From e417e1dacc015ecc320c80146c738b5d9d1a72bc Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 3 Mar 2015 11:43:32 -0800 Subject: [PATCH 001/101] Emit 'for...of' loop when LHS is a var --- src/compiler/emitter.ts | 95 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index b1dcbfbcd95..f3d1338d959 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3444,6 +3444,10 @@ module ts { } function emitForInOrForOfStatement(node: ForInStatement | ForOfStatement) { + if (languageVersion < ScriptTarget.ES6 && node.kind === SyntaxKind.ForOfStatement) { + return emitDownLevelForOfStatement(node); + } + var endPos = emitToken(SyntaxKind.ForKeyword, node.pos); write(" "); endPos = emitToken(SyntaxKind.OpenParenToken, endPos); @@ -3470,6 +3474,97 @@ module ts { emitToken(SyntaxKind.CloseParenToken, node.expression.end); emitEmbeddedStatement(node.statement); } + + function emitDownLevelForOfStatement(node: ForOfStatement) { + // The following ES6 code: + // + // for (var v of expr) { } + // + // should be emitted as + // + // for (var v, _i = 0, _a = expr; _i < _a.length; _i++) { + // v = _a[_i]; + // } + // + // where _a and _i are temps emitted to capture the RHS and the counter, + // respectively. + // When the left hand side is an expression instead of a var declaration, + // the "var v" is not emitted. + // When the left hand side is a let/const, the v is renamed if there is + // another v in scope. + // Note that all assignments to the LHS are emitted in the body, including + // all destructuring. + // Note also that because an extra statement is needed to assign to the LHS, + // for-of bodies are always emitted as blocks. + + var endPos = emitToken(SyntaxKind.ForKeyword, node.pos); + write(" "); + endPos = emitToken(SyntaxKind.OpenParenToken, endPos); + if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length >= 1) { + write("var "); + var decl = variableDeclarationList.declarations[0]; + // TODO handle binding patterns + emit(decl.name); + write(", "); + } + } + + // Do not call create recordTempDeclaration because we are declaring the temps + // right here. Recording means they will be declared later. + var counter = createTempVariable(node, /*forLoopVariable*/ true); + var rhsReference = createTempVariable(node, /*forLoopVariable*/ false); + + // _i = 0, + emit(counter); + write(" = 0, "); + + // _a = expr; + emit(rhsReference); + write(" = "); + emit(node.expression); + write("; "); + + // _i < _a.length; + emit(counter); + write(" < "); + emit(rhsReference); + write(".length; "); + + // _i++) + emit(counter); + write("++"); + emitToken(SyntaxKind.CloseParenToken, node.expression.end); + + // Body + write(" {"); + writeLine(); + increaseIndent(); + + // Initialize LHS + // v = _a[_i]; + if (decl) { + emit(decl.name); + write(" = "); + emit(rhsReference) + write("["); + emit(counter); + write("];"); + writeLine(); + } + + if (node.statement.kind === SyntaxKind.Block) { + emitLines((node.statement).statements); + } + else { + emit(node.statement); + } + + writeLine(); + decreaseIndent(); + write("}"); + } function emitBreakOrContinueStatement(node: BreakOrContinueStatement) { emitToken(node.kind === SyntaxKind.BreakStatement ? SyntaxKind.BreakKeyword : SyntaxKind.ContinueKeyword, node.pos); From 76e9b6ab0e0423a85e6b1f79d1122e6994f38f0b Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 3 Mar 2015 14:01:11 -0800 Subject: [PATCH 002/101] Make createTempVariable call into generateUniqueNameForLocation --- src/compiler/emitter.ts | 10 +- tests/baselines/reference/callWithSpread.js | 6 +- .../collisionRestParameterArrowFunctions.js | 8 +- .../collisionRestParameterClassConstructor.js | 16 ++-- .../collisionRestParameterClassMethod.js | 12 +-- .../collisionRestParameterFunction.js | 12 +-- ...llisionRestParameterFunctionExpressions.js | 12 +-- .../collisionRestParameterUnderscoreIUsage.js | 4 +- .../reference/computedPropertyNames48_ES5.js | 14 +-- .../reference/declarationWithNoInitializer.js | 2 +- .../reference/declarationsAndAssignments.js | 92 +++++++++---------- .../destructuringParameterProperties1.js | 2 +- .../destructuringParameterProperties2.js | 4 +- .../destructuringParameterProperties3.js | 6 +- .../destructuringParameterProperties5.js | 2 +- .../reference/restElementMustBeLast.js | 4 +- .../restElementWithNullInitializer.js | 8 +- ...gedTemplateStringsTypeArgumentInference.js | 56 +++++------ ...emplateStringsWithIncompatibleTypedTags.js | 18 ++-- ...dTemplateStringsWithOverloadResolution1.js | 12 +-- ...dTemplateStringsWithOverloadResolution2.js | 4 +- ...dTemplateStringsWithOverloadResolution3.js | 44 ++++----- ...taggedTemplateStringsWithTagsTypedAsAny.js | 20 ++-- .../taggedTemplateStringsWithTypedTags.js | 16 ++-- .../reference/templateStringInModuleName.js | 4 +- 25 files changed, 190 insertions(+), 198 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index f3d1338d959..9ecc936e3c2 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2090,15 +2090,7 @@ module ts { // Create a temporary variable with a unique unused name. The forLoopVariable parameter signals that the // name should be one that is appropriate for a for loop variable. function createTempVariable(location: Node, forLoopVariable?: boolean): Identifier { - var name = forLoopVariable ? "_i" : undefined; - while (true) { - if (name && !isExistingName(location, name)) { - break; - } - // _a .. _h, _j ... _z, _0, _1, ... - name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + CharacterCodes.a) : tempCount - 25); - tempCount++; - } + var name = generateUniqueNameForLocation(location, /*baseName*/ forLoopVariable ? "_i" : "_a"); var result = createSynthesizedNode(SyntaxKind.Identifier); result.text = name; return result; diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index d676c0f2a33..02b6b9b8ff6 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -81,8 +81,8 @@ obj.foo.apply(obj, [1, 2].concat(a)); obj.foo.apply(obj, [1, 2].concat(a, ["abc"])); xa[1].foo(1, 2, "abc"); (_a = xa[1]).foo.apply(_a, [1, 2].concat(a)); -(_b = xa[1]).foo.apply(_b, [1, 2].concat(a, ["abc"])); -(_c = xa[1]).foo.apply(_c, [1, 2, "abc"]); +(_a_1 = xa[1]).foo.apply(_a_1, [1, 2].concat(a, ["abc"])); +(_a_2 = xa[1]).foo.apply(_a_2, [1, 2, "abc"]); var C = (function () { function C(x, y) { var z = []; @@ -114,4 +114,4 @@ var D = (function (_super) { })(C); // Only supported in when target is ES6 var c = new C(1, 2, ...a); -var _a, _b, _c; +var _a, _a_1, _a_2; diff --git a/tests/baselines/reference/collisionRestParameterArrowFunctions.js b/tests/baselines/reference/collisionRestParameterArrowFunctions.js index 39d449555db..b70bb6c2113 100644 --- a/tests/baselines/reference/collisionRestParameterArrowFunctions.js +++ b/tests/baselines/reference/collisionRestParameterArrowFunctions.js @@ -16,8 +16,8 @@ var f2NoError = () => { //// [collisionRestParameterArrowFunctions.js] var f1 = function (_i) { var restParameters = []; - for (var _a = 1; _a < arguments.length; _a++) { - restParameters[_a - 1] = arguments[_a]; + for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { + restParameters[_i_1 - 1] = arguments[_i_1]; } var _i = 10; // no error }; @@ -26,8 +26,8 @@ var f1NoError = function (_i) { }; var f2 = function () { var restParameters = []; - for (var _a = 0; _a < arguments.length; _a++) { - restParameters[_a - 0] = arguments[_a]; + for (var _i_1 = 0; _i_1 < arguments.length; _i_1++) { + restParameters[_i_1 - 0] = arguments[_i_1]; } var _i = 10; // No Error }; diff --git a/tests/baselines/reference/collisionRestParameterClassConstructor.js b/tests/baselines/reference/collisionRestParameterClassConstructor.js index fc6e400668c..de3fd3c671b 100644 --- a/tests/baselines/reference/collisionRestParameterClassConstructor.js +++ b/tests/baselines/reference/collisionRestParameterClassConstructor.js @@ -71,8 +71,8 @@ declare class c6NoError { var c1 = (function () { function c1(_i) { var restParameters = []; - for (var _a = 1; _a < arguments.length; _a++) { - restParameters[_a - 1] = arguments[_a]; + for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { + restParameters[_i_1 - 1] = arguments[_i_1]; } var _i = 10; // no error } @@ -87,8 +87,8 @@ var c1NoError = (function () { var c2 = (function () { function c2() { var restParameters = []; - for (var _a = 0; _a < arguments.length; _a++) { - restParameters[_a - 0] = arguments[_a]; + for (var _i_1 = 0; _i_1 < arguments.length; _i_1++) { + restParameters[_i_1 - 0] = arguments[_i_1]; } var _i = 10; // no error } @@ -103,8 +103,8 @@ var c2NoError = (function () { var c3 = (function () { function c3(_i) { var restParameters = []; - for (var _a = 1; _a < arguments.length; _a++) { - restParameters[_a - 1] = arguments[_a]; + for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { + restParameters[_i_1 - 1] = arguments[_i_1]; } this._i = _i; var _i = 10; // no error @@ -121,8 +121,8 @@ var c3NoError = (function () { var c5 = (function () { function c5(_i) { var rest = []; - for (var _a = 1; _a < arguments.length; _a++) { - rest[_a - 1] = arguments[_a]; + for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { + rest[_i_1 - 1] = arguments[_i_1]; } var _i; // no error } diff --git a/tests/baselines/reference/collisionRestParameterClassMethod.js b/tests/baselines/reference/collisionRestParameterClassMethod.js index e3471c85f1c..3478dda615f 100644 --- a/tests/baselines/reference/collisionRestParameterClassMethod.js +++ b/tests/baselines/reference/collisionRestParameterClassMethod.js @@ -44,8 +44,8 @@ var c1 = (function () { } c1.prototype.foo = function (_i) { var restParameters = []; - for (var _a = 1; _a < arguments.length; _a++) { - restParameters[_a - 1] = arguments[_a]; + for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { + restParameters[_i_1 - 1] = arguments[_i_1]; } var _i = 10; // no error }; @@ -54,8 +54,8 @@ var c1 = (function () { }; c1.prototype.f4 = function (_i) { var rest = []; - for (var _a = 1; _a < arguments.length; _a++) { - rest[_a - 1] = arguments[_a]; + for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { + rest[_i_1 - 1] = arguments[_i_1]; } var _i; // no error }; @@ -69,8 +69,8 @@ var c3 = (function () { } c3.prototype.foo = function () { var restParameters = []; - for (var _a = 0; _a < arguments.length; _a++) { - restParameters[_a - 0] = arguments[_a]; + for (var _i_1 = 0; _i_1 < arguments.length; _i_1++) { + restParameters[_i_1 - 0] = arguments[_i_1]; } var _i = 10; // no error }; diff --git a/tests/baselines/reference/collisionRestParameterFunction.js b/tests/baselines/reference/collisionRestParameterFunction.js index 8660e8f5db0..98c2b2296ee 100644 --- a/tests/baselines/reference/collisionRestParameterFunction.js +++ b/tests/baselines/reference/collisionRestParameterFunction.js @@ -37,8 +37,8 @@ declare function f6(_i: string); // no codegen no error // Functions function f1(_i) { var restParameters = []; - for (var _a = 1; _a < arguments.length; _a++) { - restParameters[_a - 1] = arguments[_a]; + for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { + restParameters[_i_1 - 1] = arguments[_i_1]; } var _i = 10; // no error } @@ -47,8 +47,8 @@ function f1NoError(_i) { } function f3() { var restParameters = []; - for (var _a = 0; _a < arguments.length; _a++) { - restParameters[_a - 0] = arguments[_a]; + for (var _i_1 = 0; _i_1 < arguments.length; _i_1++) { + restParameters[_i_1 - 0] = arguments[_i_1]; } var _i = 10; // no error } @@ -57,8 +57,8 @@ function f3NoError() { } function f4(_i) { var rest = []; - for (var _a = 1; _a < arguments.length; _a++) { - rest[_a - 1] = arguments[_a]; + for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { + rest[_i_1 - 1] = arguments[_i_1]; } } function f4NoError(_i) { diff --git a/tests/baselines/reference/collisionRestParameterFunctionExpressions.js b/tests/baselines/reference/collisionRestParameterFunctionExpressions.js index 22709b087eb..478446bd5e0 100644 --- a/tests/baselines/reference/collisionRestParameterFunctionExpressions.js +++ b/tests/baselines/reference/collisionRestParameterFunctionExpressions.js @@ -28,8 +28,8 @@ function foo() { function foo() { function f1(_i) { var restParameters = []; - for (var _a = 1; _a < arguments.length; _a++) { - restParameters[_a - 1] = arguments[_a]; + for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { + restParameters[_i_1 - 1] = arguments[_i_1]; } var _i = 10; // no error } @@ -38,8 +38,8 @@ function foo() { } function f3() { var restParameters = []; - for (var _a = 0; _a < arguments.length; _a++) { - restParameters[_a - 0] = arguments[_a]; + for (var _i_1 = 0; _i_1 < arguments.length; _i_1++) { + restParameters[_i_1 - 0] = arguments[_i_1]; } var _i = 10; // no error } @@ -48,8 +48,8 @@ function foo() { } function f4(_i) { var rest = []; - for (var _a = 1; _a < arguments.length; _a++) { - rest[_a - 1] = arguments[_a]; + for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { + rest[_i_1 - 1] = arguments[_i_1]; } } function f4NoError(_i) { diff --git a/tests/baselines/reference/collisionRestParameterUnderscoreIUsage.js b/tests/baselines/reference/collisionRestParameterUnderscoreIUsage.js index adc9c09de27..9316dba316f 100644 --- a/tests/baselines/reference/collisionRestParameterUnderscoreIUsage.js +++ b/tests/baselines/reference/collisionRestParameterUnderscoreIUsage.js @@ -13,8 +13,8 @@ var _i = "This is what I'd expect to see"; var Foo = (function () { function Foo() { var args = []; - for (var _a = 0; _a < arguments.length; _a++) { - args[_a - 0] = arguments[_a]; + for (var _i_1 = 0; _i_1 < arguments.length; _i_1++) { + args[_i_1 - 0] = arguments[_i_1]; } console.log(_i); // This should result in error } diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.js b/tests/baselines/reference/computedPropertyNames48_ES5.js index c5ca0d5b241..d14faab73eb 100644 --- a/tests/baselines/reference/computedPropertyNames48_ES5.js +++ b/tests/baselines/reference/computedPropertyNames48_ES5.js @@ -26,10 +26,10 @@ var a; extractIndexer((_a = {}, _a[a] = "", _a)); // Should return string -extractIndexer((_b = {}, - _b[0 /* x */] = "", - _b)); // Should return string -extractIndexer((_c = {}, - _c["" || 0] = "", - _c)); // Should return any (widened form of undefined) -var _a, _b, _c; +extractIndexer((_a_1 = {}, + _a_1[0 /* x */] = "", + _a_1)); // Should return string +extractIndexer((_a_2 = {}, + _a_2["" || 0] = "", + _a_2)); // Should return any (widened form of undefined) +var _a, _a_1, _a_2; diff --git a/tests/baselines/reference/declarationWithNoInitializer.js b/tests/baselines/reference/declarationWithNoInitializer.js index 54d89368fb1..ebe8f8b3b38 100644 --- a/tests/baselines/reference/declarationWithNoInitializer.js +++ b/tests/baselines/reference/declarationWithNoInitializer.js @@ -5,4 +5,4 @@ var {c, d}; // Error, no initializer //// [declarationWithNoInitializer.js] var _a = void 0, a = _a[0], b = _a[1]; // Error, no initializer -var _b = void 0, c = _b.c, d = _b.d; // Error, no initializer +var _a_1 = void 0, c = _a_1.c, d = _a_1.d; // Error, no initializer diff --git a/tests/baselines/reference/declarationsAndAssignments.js b/tests/baselines/reference/declarationsAndAssignments.js index 032f4cb0e63..3e67309663c 100644 --- a/tests/baselines/reference/declarationsAndAssignments.js +++ b/tests/baselines/reference/declarationsAndAssignments.js @@ -184,9 +184,9 @@ function f21() { function f0() { var _a = [1, "hello"]; var x = ([1, "hello"])[0]; - var _b = [1, "hello"], x = _b[0], y = _b[1]; - var _c = [1, "hello"], x = _c[0], y = _c[1], z = _c[2]; // Error - var _d = [0, 1, 2], z = _d[2]; + var _a_1 = [1, "hello"], x = _a_1[0], y = _a_1[1]; + var _a_2 = [1, "hello"], x = _a_2[0], y = _a_2[1], z = _a_2[2]; // Error + var _a_3 = [0, 1, 2], z = _a_3[2]; var x; var y; } @@ -203,60 +203,60 @@ function f2() { var _a = { x: 5, y: "hello" }; var x = ({ x: 5, y: "hello" }).x; var y = ({ x: 5, y: "hello" }).y; - var _b = { x: 5, y: "hello" }, x = _b.x, y = _b.y; + var _a_1 = { x: 5, y: "hello" }, x = _a_1.x, y = _a_1.y; var x; var y; var a = ({ x: 5, y: "hello" }).x; var b = ({ x: 5, y: "hello" }).y; - var _c = { x: 5, y: "hello" }, a = _c.x, b = _c.y; + var _a_2 = { x: 5, y: "hello" }, a = _a_2.x, b = _a_2.y; var a; var b; } function f3() { - var _a = [1, ["hello", [true]]], x = _a[0], _b = _a[1], y = _b[0], z = _b[1][0]; + var _a = [1, ["hello", [true]]], x = _a[0], _a_1 = _a[1], y = _a_1[0], z = _a_1[1][0]; var x; var y; var z; } function f4() { - var _a = { a: 1, b: { a: "hello", b: { a: true } } }, x = _a.a, _b = _a.b, y = _b.a, z = _b.b.a; + var _a = { a: 1, b: { a: "hello", b: { a: true } } }, x = _a.a, _a_1 = _a.b, y = _a_1.a, z = _a_1.b.a; var x; var y; var z; } function f6() { - var _a = [1, "hello"], _b = _a[0], x = _b === void 0 ? 0 : _b, _c = _a[1], y = _c === void 0 ? "" : _c; + var _a = [1, "hello"], _a_1 = _a[0], x = _a_1 === void 0 ? 0 : _a_1, _a_2 = _a[1], y = _a_2 === void 0 ? "" : _a_2; var x; var y; } function f7() { - var _a = [1, "hello"], _b = _a[0], x = _b === void 0 ? 0 : _b, _c = _a[1], y = _c === void 0 ? 1 : _c; // Error, initializer for y must be string + var _a = [1, "hello"], _a_1 = _a[0], x = _a_1 === void 0 ? 0 : _a_1, _a_2 = _a[1], y = _a_2 === void 0 ? 1 : _a_2; // Error, initializer for y must be string var x; var y; } function f8() { var _a = [], a = _a[0], b = _a[1], c = _a[2]; // Ok, [] is an array - var _b = [1], d = _b[0], e = _b[1], f = _b[2]; // Error, [1] is a tuple + var _a_1 = [1], d = _a_1[0], e = _a_1[1], f = _a_1[2]; // Error, [1] is a tuple } function f9() { var _a = {}, a = _a[0], b = _a[1]; // Error, not array type - var _b = { 0: 10, 1: 20 }, c = _b[0], d = _b[1]; // Error, not array type - var _c = [10, 20], e = _c[0], f = _c[1]; + var _a_1 = { 0: 10, 1: 20 }, c = _a_1[0], d = _a_1[1]; // Error, not array type + var _a_2 = [10, 20], e = _a_2[0], f = _a_2[1]; } function f10() { var _a = {}, a = _a.a, b = _a.b; // Error - var _b = [], a = _b.a, b = _b.b; // Error + var _a_1 = [], a = _a_1.a, b = _a_1.b; // Error } function f11() { var _a = { x: 10, y: "hello" }, a = _a.x, b = _a.y; - var _b = { 0: 10, 1: "hello" }, a = _b[0], b = _b[1]; - var _c = { "<": 10, ">": "hello" }, a = _c["<"], b = _c[">"]; - var _d = [10, "hello"], a = _d[0], b = _d[1]; + var _a_1 = { 0: 10, 1: "hello" }, a = _a_1[0], b = _a_1[1]; + var _a_2 = { "<": 10, ">": "hello" }, a = _a_2["<"], b = _a_2[">"]; + var _a_3 = [10, "hello"], a = _a_3[0], b = _a_3[1]; var a; var b; } function f12() { - var _a = [1, ["hello", { x: 5, y: true }]], a = _a[0], _b = _a[1], _c = _b === void 0 ? ["abc", { x: 10, y: false }] : _b, b = _c[0], _d = _c[1], x = _d.x, c = _d.y; + var _a = [1, ["hello", { x: 5, y: true }]], a = _a[0], _a_1 = _a[1], _a_2 = _a_1 === void 0 ? ["abc", { x: 10, y: false }] : _a_1, b = _a_2[0], _a_3 = _a_2[1], x = _a_3.x, c = _a_3.y; var a; var b; var x; @@ -264,10 +264,10 @@ function f12() { } function f13() { var _a = [1, "hello"], x = _a[0], y = _a[1]; - var _b = [[x, y], { x: x, y: y }], a = _b[0], b = _b[1]; + var _a_1 = [[x, y], { x: x, y: y }], a = _a_1[0], b = _a_1[1]; } function f14(_a) { - var _b = _a[0], a = _b === void 0 ? 1 : _b, _c = _a[1], _d = _c[0], b = _d === void 0 ? "hello" : _d, _e = _c[1], x = _e.x, _f = _e.y, c = _f === void 0 ? false : _f; + var _a_1 = _a[0], a = _a_1 === void 0 ? 1 : _a_1, _a_2 = _a[1], _a_3 = _a_2[0], b = _a_3 === void 0 ? "hello" : _a_3, _a_4 = _a_2[1], x = _a_4.x, _a_5 = _a_4.y, c = _a_5 === void 0 ? false : _a_5; var a; var b; var c; @@ -290,7 +290,7 @@ function f16() { var _a = f15(), a = _a.a, b = _a.b, c = _a.c; } function f17(_a) { - var _b = _a.a, a = _b === void 0 ? "" : _b, _c = _a.b, b = _c === void 0 ? 0 : _c, _d = _a.c, c = _d === void 0 ? false : _d; + var _a_1 = _a.a, a = _a_1 === void 0 ? "" : _a_1, _a_2 = _a.b, b = _a_2 === void 0 ? 0 : _a_2, _a_3 = _a.c, c = _a_3 === void 0 ? false : _a_3; } f17({}); f17({ a: "hello" }); @@ -301,20 +301,20 @@ function f18() { var b; var aa; (_a = { a: a, b: b }, a = _a.a, b = _a.b, _a); - (_b = { b: b, a: a }, a = _b.a, b = _b.b, _b); - _c = [a, b], aa[0] = _c[0], b = _c[1]; - _d = [b, a], a = _d[0], b = _d[1]; // Error - _e = [2, "def"], _f = _e[0], a = _f === void 0 ? 1 : _f, _g = _e[1], b = _g === void 0 ? "abc" : _g; - var _a, _b, _c, _d, _e, _f, _g; + (_a_1 = { b: b, a: a }, a = _a_1.a, b = _a_1.b, _a_1); + _a_2 = [a, b], aa[0] = _a_2[0], b = _a_2[1]; + _a_3 = [b, a], a = _a_3[0], b = _a_3[1]; // Error + _a_4 = [2, "def"], _a_5 = _a_4[0], a = _a_5 === void 0 ? 1 : _a_5, _a_6 = _a_4[1], b = _a_6 === void 0 ? "abc" : _a_6; + var _a, _a_1, _a_2, _a_3, _a_4, _a_5, _a_6; } function f19() { var a, b; _a = [1, 2], a = _a[0], b = _a[1]; - _b = [b, a], a = _b[0], b = _b[1]; - (_c = { b: b, a: a }, a = _c.a, b = _c.b, _c); - _d = ([[2, 3]])[0], _e = _d === void 0 ? [1, 2] : _d, a = _e[0], b = _e[1]; - var x = (_f = [1, 2], a = _f[0], b = _f[1], _f); - var _a, _b, _c, _d, _e, _f; + _a_1 = [b, a], a = _a_1[0], b = _a_1[1]; + (_a_2 = { b: b, a: a }, a = _a_2.a, b = _a_2.b, _a_2); + _a_3 = ([[2, 3]])[0], _a_4 = _a_3 === void 0 ? [1, 2] : _a_3, a = _a_4[0], b = _a_4[1]; + var x = (_a_5 = [1, 2], a = _a_5[0], b = _a_5[1], _a_5); + var _a, _a_1, _a_2, _a_3, _a_4, _a_5; } function f20() { var a; @@ -322,14 +322,14 @@ function f20() { var y; var z; var _a = [1, 2, 3], a = _a.slice(0); - var _b = [1, 2, 3], x = _b[0], a = _b.slice(1); - var _c = [1, 2, 3], x = _c[0], y = _c[1], a = _c.slice(2); - var _d = [1, 2, 3], x = _d[0], y = _d[1], z = _d[2], a = _d.slice(3); - _e = [1, 2, 3], a = _e.slice(0); - _f = [1, 2, 3], x = _f[0], a = _f.slice(1); - _g = [1, 2, 3], x = _g[0], y = _g[1], a = _g.slice(2); - _h = [1, 2, 3], x = _h[0], y = _h[1], z = _h[2], a = _h.slice(3); - var _e, _f, _g, _h; + var _a_1 = [1, 2, 3], x = _a_1[0], a = _a_1.slice(1); + var _a_2 = [1, 2, 3], x = _a_2[0], y = _a_2[1], a = _a_2.slice(2); + var _a_3 = [1, 2, 3], x = _a_3[0], y = _a_3[1], z = _a_3[2], a = _a_3.slice(3); + _a_4 = [1, 2, 3], a = _a_4.slice(0); + _a_5 = [1, 2, 3], x = _a_5[0], a = _a_5.slice(1); + _a_6 = [1, 2, 3], x = _a_6[0], y = _a_6[1], a = _a_6.slice(2); + _a_7 = [1, 2, 3], x = _a_7[0], y = _a_7[1], z = _a_7[2], a = _a_7.slice(3); + var _a_4, _a_5, _a_6, _a_7; } function f21() { var a; @@ -337,12 +337,12 @@ function f21() { var y; var z; var _a = [1, "hello", true], a = _a.slice(0); - var _b = [1, "hello", true], x = _b[0], a = _b.slice(1); - var _c = [1, "hello", true], x = _c[0], y = _c[1], a = _c.slice(2); - var _d = [1, "hello", true], x = _d[0], y = _d[1], z = _d[2], a = _d.slice(3); - _e = [1, "hello", true], a = _e.slice(0); - _f = [1, "hello", true], x = _f[0], a = _f.slice(1); - _g = [1, "hello", true], x = _g[0], y = _g[1], a = _g.slice(2); - _h = [1, "hello", true], x = _h[0], y = _h[1], z = _h[2], a = _h.slice(3); - var _e, _f, _g, _h; + var _a_1 = [1, "hello", true], x = _a_1[0], a = _a_1.slice(1); + var _a_2 = [1, "hello", true], x = _a_2[0], y = _a_2[1], a = _a_2.slice(2); + var _a_3 = [1, "hello", true], x = _a_3[0], y = _a_3[1], z = _a_3[2], a = _a_3.slice(3); + _a_4 = [1, "hello", true], a = _a_4.slice(0); + _a_5 = [1, "hello", true], x = _a_5[0], a = _a_5.slice(1); + _a_6 = [1, "hello", true], x = _a_6[0], y = _a_6[1], a = _a_6.slice(2); + _a_7 = [1, "hello", true], x = _a_7[0], y = _a_7[1], z = _a_7[2], a = _a_7.slice(3); + var _a_4, _a_5, _a_6, _a_7; } diff --git a/tests/baselines/reference/destructuringParameterProperties1.js b/tests/baselines/reference/destructuringParameterProperties1.js index cc16cc78de5..5842d68b605 100644 --- a/tests/baselines/reference/destructuringParameterProperties1.js +++ b/tests/baselines/reference/destructuringParameterProperties1.js @@ -58,4 +58,4 @@ var c2 = new C2(["10", 10, !!10]); var _a = [c2.x, c2.y, c2.z], c2_x = _a[0], c2_y = _a[1], c2_z = _a[2]; var c3 = new C3({ x: 0, y: "", z: false }); c3 = new C3({ x: 0, "y": "y", z: true }); -var _b = [c3.x, c3.y, c3.z], c3_x = _b[0], c3_y = _b[1], c3_z = _b[2]; +var _a_1 = [c3.x, c3.y, c3.z], c3_x = _a_1[0], c3_y = _a_1[1], c3_z = _a_1[2]; diff --git a/tests/baselines/reference/destructuringParameterProperties2.js b/tests/baselines/reference/destructuringParameterProperties2.js index 27e190af62f..75b00d2ddfd 100644 --- a/tests/baselines/reference/destructuringParameterProperties2.js +++ b/tests/baselines/reference/destructuringParameterProperties2.js @@ -53,6 +53,6 @@ var C1 = (function () { var x = new C1(undefined, [0, undefined, ""]); var _a = [x.getA(), x.getB(), x.getC()], x_a = _a[0], x_b = _a[1], x_c = _a[2]; var y = new C1(10, [0, "", true]); -var _b = [y.getA(), y.getB(), y.getC()], y_a = _b[0], y_b = _b[1], y_c = _b[2]; +var _a_1 = [y.getA(), y.getB(), y.getC()], y_a = _a_1[0], y_b = _a_1[1], y_c = _a_1[2]; var z = new C1(10, [undefined, "", null]); -var _c = [z.getA(), z.getB(), z.getC()], z_a = _c[0], z_b = _c[1], z_c = _c[2]; +var _a_2 = [z.getA(), z.getB(), z.getC()], z_a = _a_2[0], z_b = _a_2[1], z_c = _a_2[2]; diff --git a/tests/baselines/reference/destructuringParameterProperties3.js b/tests/baselines/reference/destructuringParameterProperties3.js index fe9e69d7e5b..be835bdfe22 100644 --- a/tests/baselines/reference/destructuringParameterProperties3.js +++ b/tests/baselines/reference/destructuringParameterProperties3.js @@ -56,8 +56,8 @@ var C1 = (function () { var x = new C1(undefined, [0, true, ""]); var _a = [x.getA(), x.getB(), x.getC()], x_a = _a[0], x_b = _a[1], x_c = _a[2]; var y = new C1(10, [0, true, true]); -var _b = [y.getA(), y.getB(), y.getC()], y_a = _b[0], y_b = _b[1], y_c = _b[2]; +var _a_1 = [y.getA(), y.getB(), y.getC()], y_a = _a_1[0], y_b = _a_1[1], y_c = _a_1[2]; var z = new C1(10, [undefined, "", ""]); -var _c = [z.getA(), z.getB(), z.getC()], z_a = _c[0], z_b = _c[1], z_c = _c[2]; +var _a_2 = [z.getA(), z.getB(), z.getC()], z_a = _a_2[0], z_b = _a_2[1], z_c = _a_2[2]; var w = new C1(10, [undefined, undefined, undefined]); -var _d = [z.getA(), z.getB(), z.getC()], z_a = _d[0], z_b = _d[1], z_c = _d[2]; +var _a_3 = [z.getA(), z.getB(), z.getC()], z_a = _a_3[0], z_b = _a_3[1], z_c = _a_3[2]; diff --git a/tests/baselines/reference/destructuringParameterProperties5.js b/tests/baselines/reference/destructuringParameterProperties5.js index d9b1710ae89..5046d41472d 100644 --- a/tests/baselines/reference/destructuringParameterProperties5.js +++ b/tests/baselines/reference/destructuringParameterProperties5.js @@ -15,7 +15,7 @@ var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z]; //// [destructuringParameterProperties5.js] var C1 = (function () { function C1(_a) { - var _b = _a[0], x1 = _b.x1, x2 = _b.x2, x3 = _b.x3, y = _a[1], z = _a[2]; + var _a_1 = _a[0], x1 = _a_1.x1, x2 = _a_1.x2, x3 = _a_1.x3, y = _a[1], z = _a[2]; this.[{ x1, x2, x3 }, y, z] = [{ x1, x2, x3 }, y, z]; var foo = x1 || x2 || x3 || y || z; var bar = this.x1 || this.x2 || this.x3 || this.y || this.z; diff --git a/tests/baselines/reference/restElementMustBeLast.js b/tests/baselines/reference/restElementMustBeLast.js index 337cb6de6f6..9cb96b7e1e6 100644 --- a/tests/baselines/reference/restElementMustBeLast.js +++ b/tests/baselines/reference/restElementMustBeLast.js @@ -5,5 +5,5 @@ var [...a, x] = [1, 2, 3]; // Error, rest must be last element //// [restElementMustBeLast.js] var _a = [1, 2, 3], x = _a[1]; // Error, rest must be last element -_b = [1, 2, 3], x = _b[1]; // Error, rest must be last element -var _b; +_a_1 = [1, 2, 3], x = _a_1[1]; // Error, rest must be last element +var _a_1; diff --git a/tests/baselines/reference/restElementWithNullInitializer.js b/tests/baselines/reference/restElementWithNullInitializer.js index 9f326602fb8..9b314a5ed19 100644 --- a/tests/baselines/reference/restElementWithNullInitializer.js +++ b/tests/baselines/reference/restElementWithNullInitializer.js @@ -14,14 +14,14 @@ function foo4([...r] = []) { //// [restElementWithNullInitializer.js] function foo1(_a) { - var _b = _a === void 0 ? null : _a, r = _b.slice(0); + var _a_1 = _a === void 0 ? null : _a, r = _a_1.slice(0); } function foo2(_a) { - var _b = _a === void 0 ? undefined : _a, r = _b.slice(0); + var _a_1 = _a === void 0 ? undefined : _a, r = _a_1.slice(0); } function foo3(_a) { - var _b = _a === void 0 ? {} : _a, r = _b.slice(0); + var _a_1 = _a === void 0 ? {} : _a, r = _a_1.slice(0); } function foo4(_a) { - var _b = _a === void 0 ? [] : _a, r = _b.slice(0); + var _a_1 = _a === void 0 ? [] : _a, r = _a_1.slice(0); } diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js index 9d3531c2667..fad2c81f0eb 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js @@ -99,62 +99,62 @@ function noParams(n) { } (_a = [""], _a.raw = [""], noParams(_a)); // Generic tag with parameter which does not use type parameter function noGenericParams(n) { } -(_b = [""], _b.raw = [""], noGenericParams(_b)); +(_a_1 = [""], _a_1.raw = [""], noGenericParams(_a_1)); // Generic tag with multiple type parameters and only one used in parameter type annotation function someGenerics1a(n, m) { } -(_c = ["", ""], _c.raw = ["", ""], someGenerics1a(_c, 3)); +(_a_2 = ["", ""], _a_2.raw = ["", ""], someGenerics1a(_a_2, 3)); function someGenerics1b(n, m) { } -(_d = ["", ""], _d.raw = ["", ""], someGenerics1b(_d, 3)); +(_a_3 = ["", ""], _a_3.raw = ["", ""], someGenerics1b(_a_3, 3)); // Generic tag with argument of function type whose parameter is of type parameter type function someGenerics2a(strs, n) { } -(_e = ["", ""], _e.raw = ["", ""], someGenerics2a(_e, function (n) { return n; })); +(_a_4 = ["", ""], _a_4.raw = ["", ""], someGenerics2a(_a_4, function (n) { return n; })); function someGenerics2b(strs, n) { } -(_f = ["", ""], _f.raw = ["", ""], someGenerics2b(_f, function (n, x) { return n; })); +(_a_5 = ["", ""], _a_5.raw = ["", ""], someGenerics2b(_a_5, function (n, x) { return n; })); // Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter function someGenerics3(strs, producer) { } -(_g = ["", ""], _g.raw = ["", ""], someGenerics3(_g, function () { return ''; })); -(_h = ["", ""], _h.raw = ["", ""], someGenerics3(_h, function () { return undefined; })); -(_j = ["", ""], _j.raw = ["", ""], someGenerics3(_j, function () { return 3; })); +(_a_6 = ["", ""], _a_6.raw = ["", ""], someGenerics3(_a_6, function () { return ''; })); +(_a_7 = ["", ""], _a_7.raw = ["", ""], someGenerics3(_a_7, function () { return undefined; })); +(_a_8 = ["", ""], _a_8.raw = ["", ""], someGenerics3(_a_8, function () { return 3; })); // 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type function someGenerics4(strs, n, f) { } -(_k = ["", "", ""], _k.raw = ["", "", ""], someGenerics4(_k, 4, function () { return null; })); -(_l = ["", "", ""], _l.raw = ["", "", ""], someGenerics4(_l, '', function () { return 3; })); -(_m = ["", "", ""], _m.raw = ["", "", ""], someGenerics4(_m, null, null)); +(_a_9 = ["", "", ""], _a_9.raw = ["", "", ""], someGenerics4(_a_9, 4, function () { return null; })); +(_a_10 = ["", "", ""], _a_10.raw = ["", "", ""], someGenerics4(_a_10, '', function () { return 3; })); +(_a_11 = ["", "", ""], _a_11.raw = ["", "", ""], someGenerics4(_a_11, null, null)); // 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type function someGenerics5(strs, n, f) { } -(_n = ["", " ", ""], _n.raw = ["", " ", ""], someGenerics5(_n, 4, function () { return null; })); -(_o = ["", "", ""], _o.raw = ["", "", ""], someGenerics5(_o, '', function () { return 3; })); -(_p = ["", "", ""], _p.raw = ["", "", ""], someGenerics5(_p, null, null)); +(_a_12 = ["", " ", ""], _a_12.raw = ["", " ", ""], someGenerics5(_a_12, 4, function () { return null; })); +(_a_13 = ["", "", ""], _a_13.raw = ["", "", ""], someGenerics5(_a_13, '', function () { return 3; })); +(_a_14 = ["", "", ""], _a_14.raw = ["", "", ""], someGenerics5(_a_14, null, null)); // Generic tag with multiple arguments of function types that each have parameters of the same generic type function someGenerics6(strs, a, b, c) { } -(_q = ["", "", "", ""], _q.raw = ["", "", "", ""], someGenerics6(_q, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); -(_r = ["", "", "", ""], _r.raw = ["", "", "", ""], someGenerics6(_r, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); -(_s = ["", "", "", ""], _s.raw = ["", "", "", ""], someGenerics6(_s, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_a_15 = ["", "", "", ""], _a_15.raw = ["", "", "", ""], someGenerics6(_a_15, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_a_16 = ["", "", "", ""], _a_16.raw = ["", "", "", ""], someGenerics6(_a_16, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_a_17 = ["", "", "", ""], _a_17.raw = ["", "", "", ""], someGenerics6(_a_17, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); // Generic tag with multiple arguments of function types that each have parameters of different generic type function someGenerics7(strs, a, b, c) { } -(_t = ["", "", "", ""], _t.raw = ["", "", "", ""], someGenerics7(_t, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); -(_u = ["", "", "", ""], _u.raw = ["", "", "", ""], someGenerics7(_u, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); -(_v = ["", "", "", ""], _v.raw = ["", "", "", ""], someGenerics7(_v, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_a_18 = ["", "", "", ""], _a_18.raw = ["", "", "", ""], someGenerics7(_a_18, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_a_19 = ["", "", "", ""], _a_19.raw = ["", "", "", ""], someGenerics7(_a_19, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_a_20 = ["", "", "", ""], _a_20.raw = ["", "", "", ""], someGenerics7(_a_20, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); // Generic tag with argument of generic function type function someGenerics8(strs, n) { return n; } -var x = (_w = ["", ""], _w.raw = ["", ""], someGenerics8(_w, someGenerics7)); -(_x = ["", "", "", ""], _x.raw = ["", "", "", ""], x(_x, null, null, null)); +var x = (_a_21 = ["", ""], _a_21.raw = ["", ""], someGenerics8(_a_21, someGenerics7)); +(_a_22 = ["", "", "", ""], _a_22.raw = ["", "", "", ""], x(_a_22, null, null, null)); // Generic tag with multiple parameters of generic type passed arguments with no best common type function someGenerics9(strs, a, b, c) { return null; } -var a9a = (_y = ["", "", "", ""], _y.raw = ["", "", "", ""], someGenerics9(_y, '', 0, [])); +var a9a = (_a_23 = ["", "", "", ""], _a_23.raw = ["", "", "", ""], someGenerics9(_a_23, '', 0, [])); var a9a; -var a9e = (_z = ["", "", "", ""], _z.raw = ["", "", "", ""], someGenerics9(_z, undefined, { x: 6, z: new Date() }, { x: 6, y: '' })); +var a9e = (_a_24 = ["", "", "", ""], _a_24.raw = ["", "", "", ""], someGenerics9(_a_24, undefined, { x: 6, z: new Date() }, { x: 6, y: '' })); var a9e; // Generic tag with multiple parameters of generic type passed arguments with a single best common type -var a9d = (_0 = ["", "", "", ""], _0.raw = ["", "", "", ""], someGenerics9(_0, { x: 3 }, { x: 6 }, { x: 6 })); +var a9d = (_a_25 = ["", "", "", ""], _a_25.raw = ["", "", "", ""], someGenerics9(_a_25, { x: 3 }, { x: 6 }, { x: 6 })); var a9d; // Generic tag with multiple parameters of generic type where one argument is of type 'any' var anyVar; -var a = (_1 = ["", "", "", ""], _1.raw = ["", "", "", ""], someGenerics9(_1, 7, anyVar, 4)); +var a = (_a_26 = ["", "", "", ""], _a_26.raw = ["", "", "", ""], someGenerics9(_a_26, 7, anyVar, 4)); var a; // Generic tag with multiple parameters of generic type where one argument is [] and the other is not 'any' -var arr = (_2 = ["", "", "", ""], _2.raw = ["", "", "", ""], someGenerics9(_2, [], null, undefined)); +var arr = (_a_27 = ["", "", "", ""], _a_27.raw = ["", "", "", ""], someGenerics9(_a_27, [], null, undefined)); var arr; -var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2; +var _a, _a_1, _a_2, _a_3, _a_4, _a_5, _a_6, _a_7, _a_8, _a_9, _a_10, _a_11, _a_12, _a_13, _a_14, _a_15, _a_16, _a_17, _a_18, _a_19, _a_20, _a_21, _a_22, _a_23, _a_24, _a_25, _a_26, _a_27; diff --git a/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js b/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js index 9d113793228..972e0cfcf65 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js +++ b/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js @@ -36,14 +36,14 @@ f.thisIsNotATag(`abc${1}def${2}ghi`); //// [taggedTemplateStringsWithIncompatibleTypedTags.js] var f; (_a = ["abc"], _a.raw = ["abc"], f(_a)); -(_b = ["abc", "def", "ghi"], _b.raw = ["abc", "def", "ghi"], f(_b, 1, 2)); -(_c = ["abc"], _c.raw = ["abc"], f(_c)).member; -(_d = ["abc", "def", "ghi"], _d.raw = ["abc", "def", "ghi"], f(_d, 1, 2)).member; -(_e = ["abc"], _e.raw = ["abc"], f(_e))["member"]; -(_f = ["abc", "def", "ghi"], _f.raw = ["abc", "def", "ghi"], f(_f, 1, 2))["member"]; -(_g = ["abc", "def", "ghi"], _g.raw = ["abc", "def", "ghi"], (_h = ["abc"], _h.raw = ["abc"], f(_h))[0].member(_g, 1, 2)); -(_j = ["abc", "def", "ghi"], _j.raw = ["abc", "def", "ghi"], (_k = ["abc", "def", "ghi"], _k.raw = ["abc", "def", "ghi"], f(_k, 1, 2))["member"].member(_j, 1, 2)); -(_l = ["abc", "def", "ghi"], _l.raw = ["abc", "def", "ghi"], (_m = ["abc", "def", "ghi"], _m.raw = ["abc", "def", "ghi"], f(_m, true, true))["member"].member(_l, 1, 2)); +(_a_1 = ["abc", "def", "ghi"], _a_1.raw = ["abc", "def", "ghi"], f(_a_1, 1, 2)); +(_a_2 = ["abc"], _a_2.raw = ["abc"], f(_a_2)).member; +(_a_3 = ["abc", "def", "ghi"], _a_3.raw = ["abc", "def", "ghi"], f(_a_3, 1, 2)).member; +(_a_4 = ["abc"], _a_4.raw = ["abc"], f(_a_4))["member"]; +(_a_5 = ["abc", "def", "ghi"], _a_5.raw = ["abc", "def", "ghi"], f(_a_5, 1, 2))["member"]; +(_a_6 = ["abc", "def", "ghi"], _a_6.raw = ["abc", "def", "ghi"], (_a_7 = ["abc"], _a_7.raw = ["abc"], f(_a_7))[0].member(_a_6, 1, 2)); +(_a_8 = ["abc", "def", "ghi"], _a_8.raw = ["abc", "def", "ghi"], (_a_9 = ["abc", "def", "ghi"], _a_9.raw = ["abc", "def", "ghi"], f(_a_9, 1, 2))["member"].member(_a_8, 1, 2)); +(_a_10 = ["abc", "def", "ghi"], _a_10.raw = ["abc", "def", "ghi"], (_a_11 = ["abc", "def", "ghi"], _a_11.raw = ["abc", "def", "ghi"], f(_a_11, true, true))["member"].member(_a_10, 1, 2)); f.thisIsNotATag("abc"); f.thisIsNotATag("abc" + 1 + "def" + 2 + "ghi"); -var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; +var _a, _a_1, _a_2, _a_3, _a_4, _a_5, _a_6, _a_7, _a_8, _a_9, _a_10, _a_11; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js index 431447df22e..cb5df24cb77 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js @@ -37,9 +37,9 @@ var d = foo([], 1, true); // boolean (with error) var e = foo([], 1, "2"); // {} var f = foo([], 1, 2, 3); // any (with error) var u = (_a = [""], _a.raw = [""], foo(_a)); // number -var v = (_b = ["", ""], _b.raw = ["", ""], foo(_b, 1)); // string -var w = (_c = ["", "", ""], _c.raw = ["", "", ""], foo(_c, 1, 2)); // boolean -var x = (_d = ["", "", ""], _d.raw = ["", "", ""], foo(_d, 1, true)); // boolean (with error) -var y = (_e = ["", "", ""], _e.raw = ["", "", ""], foo(_e, 1, "2")); // {} -var z = (_f = ["", "", "", ""], _f.raw = ["", "", "", ""], foo(_f, 1, 2, 3)); // any (with error) -var _a, _b, _c, _d, _e, _f; +var v = (_a_1 = ["", ""], _a_1.raw = ["", ""], foo(_a_1, 1)); // string +var w = (_a_2 = ["", "", ""], _a_2.raw = ["", "", ""], foo(_a_2, 1, 2)); // boolean +var x = (_a_3 = ["", "", ""], _a_3.raw = ["", "", ""], foo(_a_3, 1, true)); // boolean (with error) +var y = (_a_4 = ["", "", ""], _a_4.raw = ["", "", ""], foo(_a_4, 1, "2")); // {} +var z = (_a_5 = ["", "", "", ""], _a_5.raw = ["", "", "", ""], foo(_a_5, 1, 2, 3)); // any (with error) +var _a, _a_1, _a_2, _a_3, _a_4, _a_5; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js index f12008f9581..f17e1bbd2ee 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js @@ -35,6 +35,6 @@ function foo2() { } return undefined; } -var c = (_b = ["", ""], _b.raw = ["", ""], foo2(_b, 1)); // number +var c = (_a_1 = ["", ""], _a_1.raw = ["", ""], foo2(_a_1, 1)); // number var d = foo2([], 1); // number -var _a, _b; +var _a, _a_1; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js index 4b9df44d3f7..2176c433042 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js @@ -77,39 +77,39 @@ fn5 `${ (n) => n.substr(0) }`; function fn1() { return null; } var s = (_a = ["", ""], _a.raw = ["", ""], fn1(_a, undefined)); // No candidate overloads found -(_b = ["", ""], _b.raw = ["", ""], fn1(_b, {})); // Error +(_a_1 = ["", ""], _a_1.raw = ["", ""], fn1(_a_1, {})); // Error function fn2() { return undefined; } -var d1 = (_c = ["", "", ""], _c.raw = ["", "", ""], fn2(_c, 0, undefined)); // contextually typed -var d2 = (_d = ["", "", ""], _d.raw = ["", "", ""], fn2(_d, 0, undefined)); // any +var d1 = (_a_2 = ["", "", ""], _a_2.raw = ["", "", ""], fn2(_a_2, 0, undefined)); // contextually typed +var d2 = (_a_3 = ["", "", ""], _a_3.raw = ["", "", ""], fn2(_a_3, 0, undefined)); // any d1.foo(); // error d2(); // no error (typed as any) // Generic and non-generic overload where generic overload is the only candidate -(_e = ["", "", ""], _e.raw = ["", "", ""], fn2(_e, 0, '')); // OK +(_a_4 = ["", "", ""], _a_4.raw = ["", "", ""], fn2(_a_4, 0, '')); // OK // Generic and non-generic overload where non-generic overload is the only candidate -(_f = ["", "", ""], _f.raw = ["", "", ""], fn2(_f, '', 0)); // OK +(_a_5 = ["", "", ""], _a_5.raw = ["", "", ""], fn2(_a_5, '', 0)); // OK function fn3() { return null; } -var s = (_g = ["", ""], _g.raw = ["", ""], fn3(_g, 3)); -var s = (_h = ["", "", "", ""], _h.raw = ["", "", "", ""], fn3(_h, '', 3, '')); -var n = (_j = ["", "", "", ""], _j.raw = ["", "", "", ""], fn3(_j, 5, 5, 5)); +var s = (_a_6 = ["", ""], _a_6.raw = ["", ""], fn3(_a_6, 3)); +var s = (_a_7 = ["", "", "", ""], _a_7.raw = ["", "", "", ""], fn3(_a_7, '', 3, '')); +var n = (_a_8 = ["", "", "", ""], _a_8.raw = ["", "", "", ""], fn3(_a_8, 5, 5, 5)); var n; // Generic overloads with differing arity tagging with arguments matching each overload type parameter count -var s = (_k = ["", ""], _k.raw = ["", ""], fn3(_k, 4)); -var s = (_l = ["", "", "", ""], _l.raw = ["", "", "", ""], fn3(_l, '', '', '')); -var n = (_m = ["", "", "", ""], _m.raw = ["", "", "", ""], fn3(_m, '', '', 3)); +var s = (_a_9 = ["", ""], _a_9.raw = ["", ""], fn3(_a_9, 4)); +var s = (_a_10 = ["", "", "", ""], _a_10.raw = ["", "", "", ""], fn3(_a_10, '', '', '')); +var n = (_a_11 = ["", "", "", ""], _a_11.raw = ["", "", "", ""], fn3(_a_11, '', '', 3)); // Generic overloads with differing arity tagging with argument count that doesn't match any overload -(_n = [""], _n.raw = [""], fn3(_n)); // Error +(_a_12 = [""], _a_12.raw = [""], fn3(_a_12)); // Error function fn4() { } // Generic overloads with constraints tagged with types that satisfy the constraints -(_o = ["", "", ""], _o.raw = ["", "", ""], fn4(_o, '', 3)); -(_p = ["", "", ""], _p.raw = ["", "", ""], fn4(_p, 3, '')); -(_q = ["", "", ""], _q.raw = ["", "", ""], fn4(_q, 3, undefined)); -(_r = ["", "", ""], _r.raw = ["", "", ""], fn4(_r, '', null)); +(_a_13 = ["", "", ""], _a_13.raw = ["", "", ""], fn4(_a_13, '', 3)); +(_a_14 = ["", "", ""], _a_14.raw = ["", "", ""], fn4(_a_14, 3, '')); +(_a_15 = ["", "", ""], _a_15.raw = ["", "", ""], fn4(_a_15, 3, undefined)); +(_a_16 = ["", "", ""], _a_16.raw = ["", "", ""], fn4(_a_16, '', null)); // Generic overloads with constraints called with type arguments that do not satisfy the constraints -(_s = ["", "", ""], _s.raw = ["", "", ""], fn4(_s, null, null)); // Error +(_a_17 = ["", "", ""], _a_17.raw = ["", "", ""], fn4(_a_17, null, null)); // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints -(_t = ["", "", ""], _t.raw = ["", "", ""], fn4(_t, true, null)); -(_u = ["", "", ""], _u.raw = ["", "", ""], fn4(_u, null, true)); +(_a_18 = ["", "", ""], _a_18.raw = ["", "", ""], fn4(_a_18, true, null)); +(_a_19 = ["", "", ""], _a_19.raw = ["", "", ""], fn4(_a_19, null, true)); function fn5() { return undefined; } -(_v = ["", ""], _v.raw = ["", ""], fn5(_v, function (n) { return n.toFixed(); })); // will error; 'n' should have type 'string'. -(_w = ["", ""], _w.raw = ["", ""], fn5(_w, function (n) { return n.substr(0); })); -var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w; +(_a_20 = ["", ""], _a_20.raw = ["", ""], fn5(_a_20, function (n) { return n.toFixed(); })); // will error; 'n' should have type 'string'. +(_a_21 = ["", ""], _a_21.raw = ["", ""], fn5(_a_21, function (n) { return n.substr(0); })); +var _a, _a_1, _a_2, _a_3, _a_4, _a_5, _a_6, _a_7, _a_8, _a_9, _a_10, _a_11, _a_12, _a_13, _a_14, _a_15, _a_16, _a_17, _a_18, _a_19, _a_20, _a_21; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js index fd83d9d0ba0..2bcbc173ab2 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js @@ -28,15 +28,15 @@ f.thisIsNotATag(`abc${1}def${2}ghi`); //// [taggedTemplateStringsWithTagsTypedAsAny.js] var f; (_a = ["abc"], _a.raw = ["abc"], f(_a)); -(_b = ["abc", "def", "ghi"], _b.raw = ["abc", "def", "ghi"], f(_b, 1, 2)); -(_c = ["abc"], _c.raw = ["abc"], f.g.h(_c)); -(_d = ["abc", "def", "ghi"], _d.raw = ["abc", "def", "ghi"], f.g.h(_d, 1, 2)); -(_e = ["abc"], _e.raw = ["abc"], f(_e)).member; -(_f = ["abc", "def", "ghi"], _f.raw = ["abc", "def", "ghi"], f(_f, 1, 2)).member; -(_g = ["abc"], _g.raw = ["abc"], f(_g))["member"]; -(_h = ["abc", "def", "ghi"], _h.raw = ["abc", "def", "ghi"], f(_h, 1, 2))["member"]; -(_j = ["abc", "def", "ghi"], _j.raw = ["abc", "def", "ghi"], (_k = ["abc"], _k.raw = ["abc"], f(_k))["member"].someOtherTag(_j, 1, 2)); -(_l = ["abc", "def", "ghi"], _l.raw = ["abc", "def", "ghi"], (_m = ["abc", "def", "ghi"], _m.raw = ["abc", "def", "ghi"], f(_m, 1, 2))["member"].someOtherTag(_l, 1, 2)); +(_a_1 = ["abc", "def", "ghi"], _a_1.raw = ["abc", "def", "ghi"], f(_a_1, 1, 2)); +(_a_2 = ["abc"], _a_2.raw = ["abc"], f.g.h(_a_2)); +(_a_3 = ["abc", "def", "ghi"], _a_3.raw = ["abc", "def", "ghi"], f.g.h(_a_3, 1, 2)); +(_a_4 = ["abc"], _a_4.raw = ["abc"], f(_a_4)).member; +(_a_5 = ["abc", "def", "ghi"], _a_5.raw = ["abc", "def", "ghi"], f(_a_5, 1, 2)).member; +(_a_6 = ["abc"], _a_6.raw = ["abc"], f(_a_6))["member"]; +(_a_7 = ["abc", "def", "ghi"], _a_7.raw = ["abc", "def", "ghi"], f(_a_7, 1, 2))["member"]; +(_a_8 = ["abc", "def", "ghi"], _a_8.raw = ["abc", "def", "ghi"], (_a_9 = ["abc"], _a_9.raw = ["abc"], f(_a_9))["member"].someOtherTag(_a_8, 1, 2)); +(_a_10 = ["abc", "def", "ghi"], _a_10.raw = ["abc", "def", "ghi"], (_a_11 = ["abc", "def", "ghi"], _a_11.raw = ["abc", "def", "ghi"], f(_a_11, 1, 2))["member"].someOtherTag(_a_10, 1, 2)); f.thisIsNotATag("abc"); f.thisIsNotATag("abc" + 1 + "def" + 2 + "ghi"); -var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; +var _a, _a_1, _a_2, _a_3, _a_4, _a_5, _a_6, _a_7, _a_8, _a_9, _a_10, _a_11; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js index fcc2cda86dc..16b14d32d93 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js @@ -34,13 +34,13 @@ f.thisIsNotATag(`abc${1}def${2}ghi`); //// [taggedTemplateStringsWithTypedTags.js] var f; (_a = ["abc"], _a.raw = ["abc"], f(_a)); -(_b = ["abc", "def", "ghi"], _b.raw = ["abc", "def", "ghi"], f(_b, 1, 2)); -(_c = ["abc"], _c.raw = ["abc"], f(_c)).member; -(_d = ["abc", "def", "ghi"], _d.raw = ["abc", "def", "ghi"], f(_d, 1, 2)).member; -(_e = ["abc"], _e.raw = ["abc"], f(_e))["member"]; -(_f = ["abc", "def", "ghi"], _f.raw = ["abc", "def", "ghi"], f(_f, 1, 2))["member"]; -(_g = ["abc", "def", "ghi"], _g.raw = ["abc", "def", "ghi"], (_h = ["abc"], _h.raw = ["abc"], f(_h))[0].member(_g, 1, 2)); -(_j = ["abc", "def", "ghi"], _j.raw = ["abc", "def", "ghi"], (_k = ["abc", "def", "ghi"], _k.raw = ["abc", "def", "ghi"], f(_k, 1, 2))["member"].member(_j, 1, 2)); +(_a_1 = ["abc", "def", "ghi"], _a_1.raw = ["abc", "def", "ghi"], f(_a_1, 1, 2)); +(_a_2 = ["abc"], _a_2.raw = ["abc"], f(_a_2)).member; +(_a_3 = ["abc", "def", "ghi"], _a_3.raw = ["abc", "def", "ghi"], f(_a_3, 1, 2)).member; +(_a_4 = ["abc"], _a_4.raw = ["abc"], f(_a_4))["member"]; +(_a_5 = ["abc", "def", "ghi"], _a_5.raw = ["abc", "def", "ghi"], f(_a_5, 1, 2))["member"]; +(_a_6 = ["abc", "def", "ghi"], _a_6.raw = ["abc", "def", "ghi"], (_a_7 = ["abc"], _a_7.raw = ["abc"], f(_a_7))[0].member(_a_6, 1, 2)); +(_a_8 = ["abc", "def", "ghi"], _a_8.raw = ["abc", "def", "ghi"], (_a_9 = ["abc", "def", "ghi"], _a_9.raw = ["abc", "def", "ghi"], f(_a_9, 1, 2))["member"].member(_a_8, 1, 2)); f.thisIsNotATag("abc"); f.thisIsNotATag("abc" + 1 + "def" + 2 + "ghi"); -var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; +var _a, _a_1, _a_2, _a_3, _a_4, _a_5, _a_6, _a_7, _a_8, _a_9; diff --git a/tests/baselines/reference/templateStringInModuleName.js b/tests/baselines/reference/templateStringInModuleName.js index 36f619176e4..9ebb92a3801 100644 --- a/tests/baselines/reference/templateStringInModuleName.js +++ b/tests/baselines/reference/templateStringInModuleName.js @@ -11,7 +11,7 @@ declare; { } declare; -(_b = ["M", ""], _b.raw = ["M", ""], module(_b, 2)); +(_a_1 = ["M", ""], _a_1.raw = ["M", ""], module(_a_1, 2)); { } -var _a, _b; +var _a, _a_1; From 61224e92a048063acb5ed74fde30c043695fd197 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 3 Mar 2015 14:02:15 -0800 Subject: [PATCH 003/101] Add tests for 'for...of' emit when LHS is a var --- .../conformance/statements/for-ofStatements/ES5For-of1.ts | 1 + .../conformance/statements/for-ofStatements/ES5For-of2.ts | 3 +++ .../conformance/statements/for-ofStatements/ES5For-of3.ts | 2 ++ .../conformance/statements/for-ofStatements/ES5For-of4.ts | 3 +++ .../conformance/statements/for-ofStatements/ES5For-of5.ts | 3 +++ .../conformance/statements/for-ofStatements/ES5For-of6.ts | 5 +++++ .../conformance/statements/for-ofStatements/ES5For-of7.ts | 7 +++++++ 7 files changed, 24 insertions(+) create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of2.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of4.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of5.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of6.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts new file mode 100644 index 00000000000..24bb2f9759f --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts @@ -0,0 +1 @@ +for (var v of []) { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of2.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of2.ts new file mode 100644 index 00000000000..5015082a4a9 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of2.ts @@ -0,0 +1,3 @@ +for (var v of []) { + var x = v; +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts new file mode 100644 index 00000000000..4543b6f74ec --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts @@ -0,0 +1,2 @@ +for (var v of []) + var x = v; \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of4.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of4.ts new file mode 100644 index 00000000000..42fb4c01bdc --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of4.ts @@ -0,0 +1,3 @@ +for (var v of []) + var x = v; +var y = v; \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of5.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of5.ts new file mode 100644 index 00000000000..ee968515d65 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of5.ts @@ -0,0 +1,3 @@ +for (var _a of []) { + var x = _a; +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of6.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of6.ts new file mode 100644 index 00000000000..a04ee2d6177 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of6.ts @@ -0,0 +1,5 @@ +for (var w of []) { + for (var v of []) { + var x = [w, v]; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts new file mode 100644 index 00000000000..6acb7646779 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts @@ -0,0 +1,7 @@ +for (var w of []) { + var x = w; +} + +for (var v of []) { + var x = [w, v]; +} \ No newline at end of file From 5a878646acbf9d7ecdb0eab187e6136568d0d148 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 3 Mar 2015 14:03:01 -0800 Subject: [PATCH 004/101] Accept baselines --- tests/baselines/reference/ES5For-of1.js | 7 +++++++ tests/baselines/reference/ES5For-of2.js | 10 ++++++++++ tests/baselines/reference/ES5For-of3.js | 9 +++++++++ tests/baselines/reference/ES5For-of4.js | 11 +++++++++++ tests/baselines/reference/ES5For-of5.js | 10 ++++++++++ tests/baselines/reference/ES5For-of6.js | 15 +++++++++++++++ tests/baselines/reference/ES5For-of7.js | 18 ++++++++++++++++++ .../reference/parserES5ForOfStatement10.js | 3 ++- .../reference/parserES5ForOfStatement18.js | 4 +++- .../reference/parserES5ForOfStatement2.js | 2 +- .../reference/parserES5ForOfStatement21.js | 3 ++- .../reference/parserES5ForOfStatement3.js | 3 ++- .../reference/parserES5ForOfStatement4.js | 3 ++- .../reference/parserES5ForOfStatement5.js | 3 ++- .../reference/parserES5ForOfStatement6.js | 3 ++- .../reference/parserES5ForOfStatement7.js | 3 ++- .../reference/parserES5ForOfStatement8.js | 3 ++- .../reference/parserES5ForOfStatement9.js | 3 ++- 18 files changed, 102 insertions(+), 11 deletions(-) create mode 100644 tests/baselines/reference/ES5For-of1.js create mode 100644 tests/baselines/reference/ES5For-of2.js create mode 100644 tests/baselines/reference/ES5For-of3.js create mode 100644 tests/baselines/reference/ES5For-of4.js create mode 100644 tests/baselines/reference/ES5For-of5.js create mode 100644 tests/baselines/reference/ES5For-of6.js create mode 100644 tests/baselines/reference/ES5For-of7.js diff --git a/tests/baselines/reference/ES5For-of1.js b/tests/baselines/reference/ES5For-of1.js new file mode 100644 index 00000000000..8c4bc1038c3 --- /dev/null +++ b/tests/baselines/reference/ES5For-of1.js @@ -0,0 +1,7 @@ +//// [ES5For-of1.ts] +for (var v of []) { } + +//// [ES5For-of1.js] +for (var v, _i = 0, _a = []; _i < _a.length; _i++) { + v = _a[_i]; +} diff --git a/tests/baselines/reference/ES5For-of2.js b/tests/baselines/reference/ES5For-of2.js new file mode 100644 index 00000000000..e057ccbbf3e --- /dev/null +++ b/tests/baselines/reference/ES5For-of2.js @@ -0,0 +1,10 @@ +//// [ES5For-of2.ts] +for (var v of []) { + var x = v; +} + +//// [ES5For-of2.js] +for (var v, _i = 0, _a = []; _i < _a.length; _i++) { + v = _a[_i]; + var x = v; +} diff --git a/tests/baselines/reference/ES5For-of3.js b/tests/baselines/reference/ES5For-of3.js new file mode 100644 index 00000000000..3bb7cf63885 --- /dev/null +++ b/tests/baselines/reference/ES5For-of3.js @@ -0,0 +1,9 @@ +//// [ES5For-of3.ts] +for (var v of []) + var x = v; + +//// [ES5For-of3.js] +for (var v, _i = 0, _a = []; _i < _a.length; _i++) { + v = _a[_i]; + var x = v; +} diff --git a/tests/baselines/reference/ES5For-of4.js b/tests/baselines/reference/ES5For-of4.js new file mode 100644 index 00000000000..ee36de0a3af --- /dev/null +++ b/tests/baselines/reference/ES5For-of4.js @@ -0,0 +1,11 @@ +//// [ES5For-of4.ts] +for (var v of []) + var x = v; +var y = v; + +//// [ES5For-of4.js] +for (var v, _i = 0, _a = []; _i < _a.length; _i++) { + v = _a[_i]; + var x = v; +} +var y = v; diff --git a/tests/baselines/reference/ES5For-of5.js b/tests/baselines/reference/ES5For-of5.js new file mode 100644 index 00000000000..0dfb430ca44 --- /dev/null +++ b/tests/baselines/reference/ES5For-of5.js @@ -0,0 +1,10 @@ +//// [ES5For-of5.ts] +for (var _a of []) { + var x = _a; +} + +//// [ES5For-of5.js] +for (var _a, _i = 0, _a_1 = []; _i < _a_1.length; _i++) { + _a = _a_1[_i]; + var x = _a; +} diff --git a/tests/baselines/reference/ES5For-of6.js b/tests/baselines/reference/ES5For-of6.js new file mode 100644 index 00000000000..e7c81743509 --- /dev/null +++ b/tests/baselines/reference/ES5For-of6.js @@ -0,0 +1,15 @@ +//// [ES5For-of6.ts] +for (var w of []) { + for (var v of []) { + var x = [w, v]; + } +} + +//// [ES5For-of6.js] +for (var w, _i = 0, _a = []; _i < _a.length; _i++) { + w = _a[_i]; + for (var v, _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { + v = _a_1[_i_1]; + var x = [w, v]; + } +} diff --git a/tests/baselines/reference/ES5For-of7.js b/tests/baselines/reference/ES5For-of7.js new file mode 100644 index 00000000000..8b2355d9ad6 --- /dev/null +++ b/tests/baselines/reference/ES5For-of7.js @@ -0,0 +1,18 @@ +//// [ES5For-of7.ts] +for (var w of []) { + var x = w; +} + +for (var v of []) { + var x = [w, v]; +} + +//// [ES5For-of7.js] +for (var w, _i = 0, _a = []; _i < _a.length; _i++) { + w = _a[_i]; + var x = w; +} +for (var v, _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { + v = _a_1[_i_1]; + var x = [w, v]; +} diff --git a/tests/baselines/reference/parserES5ForOfStatement10.js b/tests/baselines/reference/parserES5ForOfStatement10.js index 2b9dc843887..13a5defecb6 100644 --- a/tests/baselines/reference/parserES5ForOfStatement10.js +++ b/tests/baselines/reference/parserES5ForOfStatement10.js @@ -3,5 +3,6 @@ for (const v of X) { } //// [parserES5ForOfStatement10.js] -for (var v of X) { +for (var v, _i = 0, _a = X; _i < _a.length; _i++) { + v = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement18.js b/tests/baselines/reference/parserES5ForOfStatement18.js index 1df3e0bed7b..76a4610d74b 100644 --- a/tests/baselines/reference/parserES5ForOfStatement18.js +++ b/tests/baselines/reference/parserES5ForOfStatement18.js @@ -2,4 +2,6 @@ for (var of of of) { } //// [parserES5ForOfStatement18.js] -for (var of of of) { } +for (var of, _i = 0, _a = of; _i < _a.length; _i++) { + of = _a[_i]; +} diff --git a/tests/baselines/reference/parserES5ForOfStatement2.js b/tests/baselines/reference/parserES5ForOfStatement2.js index dfcfb476172..5b622e7b7b9 100644 --- a/tests/baselines/reference/parserES5ForOfStatement2.js +++ b/tests/baselines/reference/parserES5ForOfStatement2.js @@ -3,5 +3,5 @@ for (var of X) { } //// [parserES5ForOfStatement2.js] -for ( of X) { +for (_i = 0, _a = X; _i < _a.length; _i++) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement21.js b/tests/baselines/reference/parserES5ForOfStatement21.js index e02ed853cb5..08e2e173701 100644 --- a/tests/baselines/reference/parserES5ForOfStatement21.js +++ b/tests/baselines/reference/parserES5ForOfStatement21.js @@ -2,4 +2,5 @@ for (var of of) { } //// [parserES5ForOfStatement21.js] -for ( of of) { } +for (_i = 0, _a = of; _i < _a.length; _i++) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement3.js b/tests/baselines/reference/parserES5ForOfStatement3.js index 64892eb5094..fd021d578d5 100644 --- a/tests/baselines/reference/parserES5ForOfStatement3.js +++ b/tests/baselines/reference/parserES5ForOfStatement3.js @@ -3,5 +3,6 @@ for (var a, b of X) { } //// [parserES5ForOfStatement3.js] -for (var a of X) { +for (var a, _i = 0, _a = X; _i < _a.length; _i++) { + a = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement4.js b/tests/baselines/reference/parserES5ForOfStatement4.js index e17699a8662..bd64f807597 100644 --- a/tests/baselines/reference/parserES5ForOfStatement4.js +++ b/tests/baselines/reference/parserES5ForOfStatement4.js @@ -3,5 +3,6 @@ for (var a = 1 of X) { } //// [parserES5ForOfStatement4.js] -for (var a = 1 of X) { +for (var a, _i = 0, _a = X; _i < _a.length; _i++) { + a = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement5.js b/tests/baselines/reference/parserES5ForOfStatement5.js index 2eeb504365e..2c4a997a393 100644 --- a/tests/baselines/reference/parserES5ForOfStatement5.js +++ b/tests/baselines/reference/parserES5ForOfStatement5.js @@ -3,5 +3,6 @@ for (var a: number of X) { } //// [parserES5ForOfStatement5.js] -for (var a of X) { +for (var a, _i = 0, _a = X; _i < _a.length; _i++) { + a = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement6.js b/tests/baselines/reference/parserES5ForOfStatement6.js index 575368fcd20..0865d27fcb8 100644 --- a/tests/baselines/reference/parserES5ForOfStatement6.js +++ b/tests/baselines/reference/parserES5ForOfStatement6.js @@ -3,5 +3,6 @@ for (var a = 1, b = 2 of X) { } //// [parserES5ForOfStatement6.js] -for (var a = 1 of X) { +for (var a, _i = 0, _a = X; _i < _a.length; _i++) { + a = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement7.js b/tests/baselines/reference/parserES5ForOfStatement7.js index ac240494c18..42408cba235 100644 --- a/tests/baselines/reference/parserES5ForOfStatement7.js +++ b/tests/baselines/reference/parserES5ForOfStatement7.js @@ -3,5 +3,6 @@ for (var a: number = 1, b: string = "" of X) { } //// [parserES5ForOfStatement7.js] -for (var a = 1 of X) { +for (var a, _i = 0, _a = X; _i < _a.length; _i++) { + a = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement8.js b/tests/baselines/reference/parserES5ForOfStatement8.js index c926784adfe..fa42d260fa5 100644 --- a/tests/baselines/reference/parserES5ForOfStatement8.js +++ b/tests/baselines/reference/parserES5ForOfStatement8.js @@ -3,5 +3,6 @@ for (var v of X) { } //// [parserES5ForOfStatement8.js] -for (var v of X) { +for (var v, _i = 0, _a = X; _i < _a.length; _i++) { + v = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement9.js b/tests/baselines/reference/parserES5ForOfStatement9.js index 856dd5982af..612a5ec63a9 100644 --- a/tests/baselines/reference/parserES5ForOfStatement9.js +++ b/tests/baselines/reference/parserES5ForOfStatement9.js @@ -3,5 +3,6 @@ for (let v of X) { } //// [parserES5ForOfStatement9.js] -for (var v of X) { +for (var v, _i = 0, _a = X; _i < _a.length; _i++) { + v = _a[_i]; } From 9b76a0298bd12185afe08382622bf57c3f6ebbe0 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 3 Mar 2015 14:16:43 -0800 Subject: [PATCH 005/101] Remove tempCount --- src/compiler/emitter.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 9ecc936e3c2..f80696b9836 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1580,7 +1580,6 @@ module ts { var generatedBlockScopeNames: string[]; var extendsEmitted = false; - var tempCount = 0; var tempVariables: Identifier[]; var tempParameters: Identifier[]; var externalImports: ExternalImportInfo[]; @@ -4219,10 +4218,8 @@ module ts { } function emitSignatureAndBody(node: FunctionLikeDeclaration) { - var saveTempCount = tempCount; var saveTempVariables = tempVariables; var saveTempParameters = tempParameters; - tempCount = 0; tempVariables = undefined; tempParameters = undefined; @@ -4261,7 +4258,6 @@ module ts { exitNameScope(popFrame); - tempCount = saveTempCount; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } @@ -4576,10 +4572,8 @@ module ts { } function emitConstructorOfClass() { - var saveTempCount = tempCount; var saveTempVariables = tempVariables; var saveTempParameters = tempParameters; - tempCount = 0; tempVariables = undefined; tempParameters = undefined; @@ -4648,7 +4642,6 @@ module ts { exitNameScope(popFrame); - tempCount = saveTempCount; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } @@ -4776,16 +4769,13 @@ module ts { emitEnd(node.name); write(") "); if (node.body.kind === SyntaxKind.ModuleBlock) { - var saveTempCount = tempCount; var saveTempVariables = tempVariables; - tempCount = 0; tempVariables = undefined; var popFrame = enterNameScope(); emit(node.body); exitNameScope(popFrame); - tempCount = saveTempCount; tempVariables = saveTempVariables; } else { From f915efa6d7108a91ce4763b9685a50aca126ca3c Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 3 Mar 2015 14:45:16 -0800 Subject: [PATCH 006/101] Emit for...of when LHS is expression --- src/compiler/emitter.ts | 26 ++++++++++++++----- tests/baselines/reference/ES5For-of10.js | 20 ++++++++++++++ tests/baselines/reference/ES5For-of11.js | 9 +++++++ tests/baselines/reference/ES5For-of12.js | 7 +++++ tests/baselines/reference/ES5For-of8.js | 16 ++++++++++++ tests/baselines/reference/ES5For-of9.js | 21 +++++++++++++++ .../reference/parserES5ForOfStatement2.js | 3 ++- .../reference/parserES5ForOfStatement21.js | 3 ++- .../for-ofStatements/ES5For-of10.ts | 7 +++++ .../for-ofStatements/ES5For-of11.ts | 2 ++ .../for-ofStatements/ES5For-of12.ts | 1 + .../statements/for-ofStatements/ES5For-of8.ts | 6 +++++ .../statements/for-ofStatements/ES5For-of9.ts | 8 ++++++ 13 files changed, 120 insertions(+), 9 deletions(-) create mode 100644 tests/baselines/reference/ES5For-of10.js create mode 100644 tests/baselines/reference/ES5For-of11.js create mode 100644 tests/baselines/reference/ES5For-of12.js create mode 100644 tests/baselines/reference/ES5For-of8.js create mode 100644 tests/baselines/reference/ES5For-of9.js create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of10.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of11.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of9.ts diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index f80696b9836..995df97e971 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3491,10 +3491,10 @@ module ts { var endPos = emitToken(SyntaxKind.ForKeyword, node.pos); write(" "); endPos = emitToken(SyntaxKind.OpenParenToken, endPos); + write("var "); if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { - write("var "); var decl = variableDeclarationList.declarations[0]; // TODO handle binding patterns emit(decl.name); @@ -3537,13 +3537,25 @@ module ts { // v = _a[_i]; if (decl) { emit(decl.name); - write(" = "); - emit(rhsReference) - write("["); - emit(counter); - write("];"); - writeLine(); } + else if (variableDeclarationList) { + // It's an empty declaration list. This can only happen in an error case, if the user wrote + // for (var of []) {} + var emptyDeclarationListTemp = createTempVariable(node, /*forLoopVariable*/ false); + write("var "); + emit(emptyDeclarationListTemp); + } + else { + // Initializer is an expression. Emit the expression in the body, so that it's + // evaluated on every iteration. + emit(node.initializer); + } + write(" = "); + emit(rhsReference) + write("["); + emit(counter); + write("];"); + writeLine(); if (node.statement.kind === SyntaxKind.Block) { emitLines((node.statement).statements); diff --git a/tests/baselines/reference/ES5For-of10.js b/tests/baselines/reference/ES5For-of10.js new file mode 100644 index 00000000000..ea081ed8ab0 --- /dev/null +++ b/tests/baselines/reference/ES5For-of10.js @@ -0,0 +1,20 @@ +//// [ES5For-of10.ts] +function foo() { + return { x: 0 }; +} +for (foo().x of []) { + for (foo().x of []) + var p = foo().x; +} + +//// [ES5For-of10.js] +function foo() { + return { x: 0 }; +} +for (var _i = 0, _a = []; _i < _a.length; _i++) { + foo().x = _a[_i]; + for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { + foo().x = _a_1[_i_1]; + var p = foo().x; + } +} diff --git a/tests/baselines/reference/ES5For-of11.js b/tests/baselines/reference/ES5For-of11.js new file mode 100644 index 00000000000..dc1268524f1 --- /dev/null +++ b/tests/baselines/reference/ES5For-of11.js @@ -0,0 +1,9 @@ +//// [ES5For-of11.ts] +var v; +for (v of []) { } + +//// [ES5For-of11.js] +var v; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + v = _a[_i]; +} diff --git a/tests/baselines/reference/ES5For-of12.js b/tests/baselines/reference/ES5For-of12.js new file mode 100644 index 00000000000..3dbdd30251c --- /dev/null +++ b/tests/baselines/reference/ES5For-of12.js @@ -0,0 +1,7 @@ +//// [ES5For-of12.ts] +for ([""] of []) { } + +//// [ES5For-of12.js] +for (var _i = 0, _a = []; _i < _a.length; _i++) { + [""] = _a[_i]; +} diff --git a/tests/baselines/reference/ES5For-of8.js b/tests/baselines/reference/ES5For-of8.js new file mode 100644 index 00000000000..a3d20b92056 --- /dev/null +++ b/tests/baselines/reference/ES5For-of8.js @@ -0,0 +1,16 @@ +//// [ES5For-of8.ts] +function foo() { + return { x: 0 }; +} +for (foo().x of []) { + var p = foo().x; +} + +//// [ES5For-of8.js] +function foo() { + return { x: 0 }; +} +for (var _i = 0, _a = []; _i < _a.length; _i++) { + foo().x = _a[_i]; + var p = foo().x; +} diff --git a/tests/baselines/reference/ES5For-of9.js b/tests/baselines/reference/ES5For-of9.js new file mode 100644 index 00000000000..f0c5142d4eb --- /dev/null +++ b/tests/baselines/reference/ES5For-of9.js @@ -0,0 +1,21 @@ +//// [ES5For-of9.ts] +function foo() { + return { x: 0 }; +} +for (foo().x of []) { + for (foo().x of []) { + var p = foo().x; + } +} + +//// [ES5For-of9.js] +function foo() { + return { x: 0 }; +} +for (var _i = 0, _a = []; _i < _a.length; _i++) { + foo().x = _a[_i]; + for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { + foo().x = _a_1[_i_1]; + var p = foo().x; + } +} diff --git a/tests/baselines/reference/parserES5ForOfStatement2.js b/tests/baselines/reference/parserES5ForOfStatement2.js index 5b622e7b7b9..0acc5abb671 100644 --- a/tests/baselines/reference/parserES5ForOfStatement2.js +++ b/tests/baselines/reference/parserES5ForOfStatement2.js @@ -3,5 +3,6 @@ for (var of X) { } //// [parserES5ForOfStatement2.js] -for (_i = 0, _a = X; _i < _a.length; _i++) { +for (var _i = 0, _a = X; _i < _a.length; _i++) { + var _a_1 = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement21.js b/tests/baselines/reference/parserES5ForOfStatement21.js index 08e2e173701..2a8734b90af 100644 --- a/tests/baselines/reference/parserES5ForOfStatement21.js +++ b/tests/baselines/reference/parserES5ForOfStatement21.js @@ -2,5 +2,6 @@ for (var of of) { } //// [parserES5ForOfStatement21.js] -for (_i = 0, _a = of; _i < _a.length; _i++) { +for (var _i = 0, _a = of; _i < _a.length; _i++) { + var _a_1 = _a[_i]; } diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of10.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of10.ts new file mode 100644 index 00000000000..78cb7668dae --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of10.ts @@ -0,0 +1,7 @@ +function foo() { + return { x: 0 }; +} +for (foo().x of []) { + for (foo().x of []) + var p = foo().x; +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of11.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of11.ts new file mode 100644 index 00000000000..9a83efa5135 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of11.ts @@ -0,0 +1,2 @@ +var v; +for (v of []) { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts new file mode 100644 index 00000000000..5fbfa31df5f --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts @@ -0,0 +1 @@ +for ([""] of []) { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts new file mode 100644 index 00000000000..5ad1fb7d58f --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts @@ -0,0 +1,6 @@ +function foo() { + return { x: 0 }; +} +for (foo().x of []) { + var p = foo().x; +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of9.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of9.ts new file mode 100644 index 00000000000..5e234df7319 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of9.ts @@ -0,0 +1,8 @@ +function foo() { + return { x: 0 }; +} +for (foo().x of []) { + for (foo().x of []) { + var p = foo().x; + } +} \ No newline at end of file From a0f108c4fb4a2aa6367ed2e7ad042dfa2cd01139 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 3 Mar 2015 16:14:03 -0800 Subject: [PATCH 007/101] Emit 'for...of' statements with let/const initializers --- src/compiler/emitter.ts | 4 ++-- tests/baselines/reference/ES5For-of13.js | 10 +++++++++ tests/baselines/reference/ES5For-of14.js | 10 +++++++++ tests/baselines/reference/ES5For-of15.js | 17 ++++++++++++++ tests/baselines/reference/ES5For-of16.js | 19 ++++++++++++++++ tests/baselines/reference/ES5For-of17.js | 19 ++++++++++++++++ tests/baselines/reference/ES5For-of18.js | 18 +++++++++++++++ tests/baselines/reference/ES5For-of19.js | 22 +++++++++++++++++++ tests/baselines/reference/ES5For-of20.js | 17 ++++++++++++++ tests/baselines/reference/ES5For-of21.js | 12 ++++++++++ .../reference/downlevelLetConst16.js | 6 +++-- .../reference/downlevelLetConst17.js | 3 ++- .../reference/parserES5ForOfStatement4.js | 2 +- .../reference/parserES5ForOfStatement6.js | 2 +- .../reference/parserES5ForOfStatement7.js | 2 +- tests/cases/compiler/downlevelLetConst17.ts | 1 - .../for-ofStatements/ES5For-of13.ts | 3 +++ .../for-ofStatements/ES5For-of14.ts | 3 +++ .../for-ofStatements/ES5For-of15.ts | 6 +++++ .../for-ofStatements/ES5For-of16.ts | 7 ++++++ .../for-ofStatements/ES5For-of17.ts | 7 ++++++ .../for-ofStatements/ES5For-of18.ts | 6 +++++ .../for-ofStatements/ES5For-of19.ts | 8 +++++++ .../for-ofStatements/ES5For-of20.ts | 6 +++++ .../for-ofStatements/ES5For-of21.ts | 3 +++ 25 files changed, 204 insertions(+), 9 deletions(-) create mode 100644 tests/baselines/reference/ES5For-of13.js create mode 100644 tests/baselines/reference/ES5For-of14.js create mode 100644 tests/baselines/reference/ES5For-of15.js create mode 100644 tests/baselines/reference/ES5For-of16.js create mode 100644 tests/baselines/reference/ES5For-of17.js create mode 100644 tests/baselines/reference/ES5For-of18.js create mode 100644 tests/baselines/reference/ES5For-of19.js create mode 100644 tests/baselines/reference/ES5For-of20.js create mode 100644 tests/baselines/reference/ES5For-of21.js create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of19.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of21.ts diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 995df97e971..d5c92bdbdb6 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3497,7 +3497,7 @@ module ts { if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; // TODO handle binding patterns - emit(decl.name); + emit(decl); write(", "); } } @@ -3944,7 +3944,7 @@ module ts { } } else { - var isLet = renameNonTopLevelLetAndConst(node.name); + renameNonTopLevelLetAndConst(node.name); emitModuleMemberName(node); var initializer = node.initializer; diff --git a/tests/baselines/reference/ES5For-of13.js b/tests/baselines/reference/ES5For-of13.js new file mode 100644 index 00000000000..8c8318e27fd --- /dev/null +++ b/tests/baselines/reference/ES5For-of13.js @@ -0,0 +1,10 @@ +//// [ES5For-of13.ts] +for (let v of []) { + var x = v; +} + +//// [ES5For-of13.js] +for (var v, _i = 0, _a = []; _i < _a.length; _i++) { + v = _a[_i]; + var x = v; +} diff --git a/tests/baselines/reference/ES5For-of14.js b/tests/baselines/reference/ES5For-of14.js new file mode 100644 index 00000000000..d7a35913ef1 --- /dev/null +++ b/tests/baselines/reference/ES5For-of14.js @@ -0,0 +1,10 @@ +//// [ES5For-of14.ts] +for (const v of []) { + var x = v; +} + +//// [ES5For-of14.js] +for (var v, _i = 0, _a = []; _i < _a.length; _i++) { + v = _a[_i]; + var x = v; +} diff --git a/tests/baselines/reference/ES5For-of15.js b/tests/baselines/reference/ES5For-of15.js new file mode 100644 index 00000000000..30b896165e5 --- /dev/null +++ b/tests/baselines/reference/ES5For-of15.js @@ -0,0 +1,17 @@ +//// [ES5For-of15.ts] +for (let v of []) { + v; + for (const v of []) { + var x = v; + } +} + +//// [ES5For-of15.js] +for (var v, _i = 0, _a = []; _i < _a.length; _i++) { + v = _a[_i]; + v; + for (var _v, _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { + _v = _a_1[_i_1]; + var x = _v; + } +} diff --git a/tests/baselines/reference/ES5For-of16.js b/tests/baselines/reference/ES5For-of16.js new file mode 100644 index 00000000000..5e15af3f9c3 --- /dev/null +++ b/tests/baselines/reference/ES5For-of16.js @@ -0,0 +1,19 @@ +//// [ES5For-of16.ts] +for (let v of []) { + v; + for (let v of []) { + var x = v; + v++; + } +} + +//// [ES5For-of16.js] +for (var v, _i = 0, _a = []; _i < _a.length; _i++) { + v = _a[_i]; + v; + for (var _v, _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { + _v = _a_1[_i_1]; + var x = _v; + _v++; + } +} diff --git a/tests/baselines/reference/ES5For-of17.js b/tests/baselines/reference/ES5For-of17.js new file mode 100644 index 00000000000..5a6cddcb605 --- /dev/null +++ b/tests/baselines/reference/ES5For-of17.js @@ -0,0 +1,19 @@ +//// [ES5For-of17.ts] +for (let v of []) { + v; + for (let v of [v]) { + var x = v; + v++; + } +} + +//// [ES5For-of17.js] +for (var v, _i = 0, _a = []; _i < _a.length; _i++) { + v = _a[_i]; + v; + for (var _v, _i_1 = 0, _a_1 = [_v]; _i_1 < _a_1.length; _i_1++) { + _v = _a_1[_i_1]; + var x = _v; + _v++; + } +} diff --git a/tests/baselines/reference/ES5For-of18.js b/tests/baselines/reference/ES5For-of18.js new file mode 100644 index 00000000000..6bb7a37b579 --- /dev/null +++ b/tests/baselines/reference/ES5For-of18.js @@ -0,0 +1,18 @@ +//// [ES5For-of18.ts] +for (let v of []) { + v; +} +for (let v of []) { + v; +} + + +//// [ES5For-of18.js] +for (var v, _i = 0, _a = []; _i < _a.length; _i++) { + v = _a[_i]; + v; +} +for (var _v, _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { + _v = _a_1[_i_1]; + _v; +} diff --git a/tests/baselines/reference/ES5For-of19.js b/tests/baselines/reference/ES5For-of19.js new file mode 100644 index 00000000000..97718ab0337 --- /dev/null +++ b/tests/baselines/reference/ES5For-of19.js @@ -0,0 +1,22 @@ +//// [ES5For-of19.ts] +for (let v of []) { + v; + function foo() { + for (const v of []) { + v; + } + } +} + + +//// [ES5For-of19.js] +for (var v, _i = 0, _a = []; _i < _a.length; _i++) { + v = _a[_i]; + v; + function foo() { + for (var _v, _i = 0, _a = []; _i < _a.length; _i++) { + _v = _a[_i]; + _v; + } + } +} diff --git a/tests/baselines/reference/ES5For-of20.js b/tests/baselines/reference/ES5For-of20.js new file mode 100644 index 00000000000..65fb4bfd39e --- /dev/null +++ b/tests/baselines/reference/ES5For-of20.js @@ -0,0 +1,17 @@ +//// [ES5For-of20.ts] +for (let v of []) { + let v; + for (let v of [v]) { + const v; + } +} + +//// [ES5For-of20.js] +for (var v, _i = 0, _a = []; _i < _a.length; _i++) { + v = _a[_i]; + var _v; + for (var _v_1, _i_1 = 0, _a_1 = [_v_1]; _i_1 < _a_1.length; _i_1++) { + _v_1 = _a_1[_i_1]; + var _v_2; + } +} diff --git a/tests/baselines/reference/ES5For-of21.js b/tests/baselines/reference/ES5For-of21.js new file mode 100644 index 00000000000..f616c328ca0 --- /dev/null +++ b/tests/baselines/reference/ES5For-of21.js @@ -0,0 +1,12 @@ +//// [ES5For-of21.ts] +for (let v of []) { + for (let _i of []) { } +} + +//// [ES5For-of21.js] +for (var v, _i = 0, _a = []; _i < _a.length; _i++) { + v = _a[_i]; + for (var _i_1, _i_2 = 0, _a_1 = []; _i_2 < _a_1.length; _i_2++) { + _i_1 = _a_1[_i_2]; + } +} diff --git a/tests/baselines/reference/downlevelLetConst16.js b/tests/baselines/reference/downlevelLetConst16.js index 36da8ac36fe..8998ad23540 100644 --- a/tests/baselines/reference/downlevelLetConst16.js +++ b/tests/baselines/reference/downlevelLetConst16.js @@ -404,7 +404,8 @@ function foo6() { } // TODO: once for-of is supported downlevel function foo7() { - for (var _x of []) { + for (var _x, _i = 0, _a = []; _i < _a.length; _i++) { + _x = _a[_i]; use(_x); } use(x); @@ -422,7 +423,8 @@ function foo9() { use(x); } function foo10() { - for (var _x of []) { + for (var _x, _i = 0, _a = []; _i < _a.length; _i++) { + _x = _a[_i]; use(_x); } use(x); diff --git a/tests/baselines/reference/downlevelLetConst17.js b/tests/baselines/reference/downlevelLetConst17.js index 1fe9c1a01ed..d0ad931bd8f 100644 --- a/tests/baselines/reference/downlevelLetConst17.js +++ b/tests/baselines/reference/downlevelLetConst17.js @@ -119,6 +119,7 @@ for (var _x_11 in []) { use(_x_11); } // TODO: update once for-of statements are supported downlevel -for (var _x_12 of []) { +for (var _x_12, _i = 0, _a = []; _i < _a.length; _i++) { + _x_12 = _a[_i]; use(_x_12); } diff --git a/tests/baselines/reference/parserES5ForOfStatement4.js b/tests/baselines/reference/parserES5ForOfStatement4.js index bd64f807597..81184fc7225 100644 --- a/tests/baselines/reference/parserES5ForOfStatement4.js +++ b/tests/baselines/reference/parserES5ForOfStatement4.js @@ -3,6 +3,6 @@ for (var a = 1 of X) { } //// [parserES5ForOfStatement4.js] -for (var a, _i = 0, _a = X; _i < _a.length; _i++) { +for (var a = 1, _i = 0, _a = X; _i < _a.length; _i++) { a = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement6.js b/tests/baselines/reference/parserES5ForOfStatement6.js index 0865d27fcb8..be7054234ff 100644 --- a/tests/baselines/reference/parserES5ForOfStatement6.js +++ b/tests/baselines/reference/parserES5ForOfStatement6.js @@ -3,6 +3,6 @@ for (var a = 1, b = 2 of X) { } //// [parserES5ForOfStatement6.js] -for (var a, _i = 0, _a = X; _i < _a.length; _i++) { +for (var a = 1, _i = 0, _a = X; _i < _a.length; _i++) { a = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement7.js b/tests/baselines/reference/parserES5ForOfStatement7.js index 42408cba235..fea53d7ec2f 100644 --- a/tests/baselines/reference/parserES5ForOfStatement7.js +++ b/tests/baselines/reference/parserES5ForOfStatement7.js @@ -3,6 +3,6 @@ for (var a: number = 1, b: string = "" of X) { } //// [parserES5ForOfStatement7.js] -for (var a, _i = 0, _a = X; _i < _a.length; _i++) { +for (var a = 1, _i = 0, _a = X; _i < _a.length; _i++) { a = _a[_i]; } diff --git a/tests/cases/compiler/downlevelLetConst17.ts b/tests/cases/compiler/downlevelLetConst17.ts index 5cbb7b605fe..b581281f679 100644 --- a/tests/cases/compiler/downlevelLetConst17.ts +++ b/tests/cases/compiler/downlevelLetConst17.ts @@ -63,7 +63,6 @@ for (const x in []) { use(x); } -// TODO: update once for-of statements are supported downlevel for (const x of []) { use(x); } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts new file mode 100644 index 00000000000..743cdf919f6 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts @@ -0,0 +1,3 @@ +for (let v of []) { + var x = v; +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts new file mode 100644 index 00000000000..26dcea71a0e --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts @@ -0,0 +1,3 @@ +for (const v of []) { + var x = v; +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts new file mode 100644 index 00000000000..2124870d7e3 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts @@ -0,0 +1,6 @@ +for (let v of []) { + v; + for (const v of []) { + var x = v; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts new file mode 100644 index 00000000000..d1354999340 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts @@ -0,0 +1,7 @@ +for (let v of []) { + v; + for (let v of []) { + var x = v; + v++; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts new file mode 100644 index 00000000000..6a782dba2a4 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts @@ -0,0 +1,7 @@ +for (let v of []) { + v; + for (let v of [v]) { + var x = v; + v++; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts new file mode 100644 index 00000000000..e7de82d2785 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts @@ -0,0 +1,6 @@ +for (let v of []) { + v; +} +for (let v of []) { + v; +} diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of19.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of19.ts new file mode 100644 index 00000000000..447048c374b --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of19.ts @@ -0,0 +1,8 @@ +for (let v of []) { + v; + function foo() { + for (const v of []) { + v; + } + } +} diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts new file mode 100644 index 00000000000..6a1a77d82ae --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts @@ -0,0 +1,6 @@ +for (let v of []) { + let v; + for (let v of [v]) { + const v; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of21.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of21.ts new file mode 100644 index 00000000000..cb0c3cf2329 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of21.ts @@ -0,0 +1,3 @@ +for (let v of []) { + for (let _i of []) { } +} \ No newline at end of file From a99449a1ef59b3b01d34fff2235ef60736d0fa12 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 4 Mar 2015 12:10:20 -0800 Subject: [PATCH 008/101] Support destructuring in 'for...of' loops --- src/compiler/emitter.ts | 103 +++++++++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 37 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index d5c92bdbdb6..d2ec35bb494 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2873,6 +2873,12 @@ module ts { return result; } + + function createExpressionStatement(expression: Expression): ExpressionStatement { + var result = createSynthesizedNode(SyntaxKind.ExpressionStatement); + result.expression = expression; + return result; + } function createMemberAccessForPropertyName(expression: LeftHandSideExpression, memberName: DeclarationName): PropertyAccessExpression | ElementAccessExpression { if (memberName.kind === SyntaxKind.Identifier) { @@ -3473,8 +3479,8 @@ module ts { // // should be emitted as // - // for (var v, _i = 0, _a = expr; _i < _a.length; _i++) { - // v = _a[_i]; + // for (var _i = 0, _a = expr; _i < _a.length; _i++) { + // var v = _a[_i]; // } // // where _a and _i are temps emitted to capture the RHS and the counter, @@ -3491,16 +3497,11 @@ module ts { var endPos = emitToken(SyntaxKind.ForKeyword, node.pos); write(" "); endPos = emitToken(SyntaxKind.OpenParenToken, endPos); + // This is the var keyword for the counter and rhsReference. The var keyword for + // the LHS will be emitted inside the body. write("var "); - if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { - var variableDeclarationList = node.initializer; - if (variableDeclarationList.declarations.length >= 1) { - var decl = variableDeclarationList.declarations[0]; - // TODO handle binding patterns - emit(decl); - write(", "); - } - } + + // Do not emit the LHS var declaration yet, because it might contain destructuring. // Do not call create recordTempDeclaration because we are declaring the temps // right here. Recording means they will be declared later. @@ -3534,33 +3535,56 @@ module ts { increaseIndent(); // Initialize LHS - // v = _a[_i]; - if (decl) { - emit(decl.name); - } - else if (variableDeclarationList) { - // It's an empty declaration list. This can only happen in an error case, if the user wrote - // for (var of []) {} - var emptyDeclarationListTemp = createTempVariable(node, /*forLoopVariable*/ false); + // var v = _a[_i]; + var rhsIterationValue = createElementAccessExpression(rhsReference, counter); + if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { write("var "); - emit(emptyDeclarationListTemp); + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length >= 1) { + var declaration = variableDeclarationList.declarations[0]; + if (isBindingPattern(declaration.name)) { + // This works whether the declaration is a var, let, or const. + // It will use rhsIterationValue _a[_i] as the initializer. + emitDestructuring(declaration, rhsIterationValue); + } + else { + // The following call does not include the initializer, so we have + // to emit it separately. + emit(declaration); + write(" = "); + emit(rhsIterationValue); + } + } + else { + // It's an empty declaration list. This can only happen in an error case, if the user wrote + // for (var of []) {} + var emptyDeclarationListTemp = createTempVariable(node, /*forLoopVariable*/ false); + emit(emptyDeclarationListTemp); + write(" = "); + emit(rhsIterationValue); + } } else { // Initializer is an expression. Emit the expression in the body, so that it's // evaluated on every iteration. - emit(node.initializer); + var assignmentExpression = createBinaryExpression(node.initializer, SyntaxKind.EqualsToken, rhsIterationValue, /*startsOnNewLine*/ false); + var assignmentExpressionStatement = createExpressionStatement(assignmentExpression); + if (node.initializer.kind === SyntaxKind.ArrayLiteralExpression || node.initializer.kind === SyntaxKind.ObjectLiteralExpression) { + // This is a destructuring pattern, so call emitDestructuring instead of emit. Calling emit will not work, because it will cause + // the BinaryExpression to be passed in instead of the expression statement, which will cause emitDestructuring to crash. + emitDestructuring(assignmentExpressionStatement); + } + else { + emit(assignmentExpression); + } } - write(" = "); - emit(rhsReference) - write("["); - emit(counter); - write("];"); - writeLine(); + write(";"); if (node.statement.kind === SyntaxKind.Block) { emitLines((node.statement).statements); } else { + writeLine(); emit(node.statement); } @@ -3723,13 +3747,14 @@ module ts { } } - function emitDestructuring(root: BinaryExpression | VariableDeclaration | ParameterDeclaration, value?: Expression) { + // Note that a destructuring assignment can be either an ExpressionStatement or a BinaryExpression. + function emitDestructuring(root: ExpressionStatement | BinaryExpression | VariableDeclaration | ParameterDeclaration, value?: Expression) { var emitCount = 0; // An exported declaration is actually emitted as an assignment (to a property on the module object), so // temporary variables in an exported declaration need to have real declarations elsewhere var isDeclaration = (root.kind === SyntaxKind.VariableDeclaration && !(getCombinedNodeFlags(root) & NodeFlags.Export)) || root.kind === SyntaxKind.Parameter; - if (root.kind === SyntaxKind.BinaryExpression) { - emitAssignmentExpression(root); + if (root.kind === SyntaxKind.ExpressionStatement || root.kind === SyntaxKind.BinaryExpression) { + emitAssignmentExpression(root); } else { emitBindingElement(root, value); @@ -3868,13 +3893,14 @@ module ts { } } - function emitAssignmentExpression(root: BinaryExpression) { - var target = root.left; - var value = root.right; - if (root.parent.kind === SyntaxKind.ExpressionStatement) { - emitDestructuringAssignment(target, value); - } - else { + function emitAssignmentExpression(root: ExpressionStatement | BinaryExpression) { + // Synthesized nodes will not have parents, so the ExpressionStatements will have to be passed + // in directly. Otherwise, it will crash when we access the parent of a synthesized binary expression. + var emitParenthesized = root.kind !== SyntaxKind.ExpressionStatement && root.parent.kind !== SyntaxKind.ExpressionStatement; + var expression = (root.kind === SyntaxKind.ExpressionStatement ? (root).expression : root); + var target = expression.left; + var value = expression.right; + if (emitParenthesized) { if (root.parent.kind !== SyntaxKind.ParenthesizedExpression) { write("("); } @@ -3886,6 +3912,9 @@ module ts { write(")"); } } + else { + emitDestructuringAssignment(target, value); + } } function emitBindingElement(target: BindingElement, value: Expression) { From 9288424fb3787a52f3288967c288762c08261052 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 4 Mar 2015 13:32:11 -0800 Subject: [PATCH 009/101] Accept baselines --- tests/baselines/reference/ES5For-of1.js | 4 ++-- tests/baselines/reference/ES5For-of12.js | 2 +- tests/baselines/reference/ES5For-of13.js | 4 ++-- tests/baselines/reference/ES5For-of14.js | 4 ++-- tests/baselines/reference/ES5For-of15.js | 8 +++---- tests/baselines/reference/ES5For-of16.js | 8 +++---- tests/baselines/reference/ES5For-of17.js | 8 +++---- tests/baselines/reference/ES5For-of18.js | 8 +++---- tests/baselines/reference/ES5For-of19.js | 8 +++---- tests/baselines/reference/ES5For-of2.js | 4 ++-- tests/baselines/reference/ES5For-of20.js | 8 +++---- tests/baselines/reference/ES5For-of21.js | 8 +++---- tests/baselines/reference/ES5For-of3.js | 4 ++-- tests/baselines/reference/ES5For-of4.js | 4 ++-- tests/baselines/reference/ES5For-of5.js | 4 ++-- tests/baselines/reference/ES5For-of6.js | 8 +++---- tests/baselines/reference/ES5For-of7.js | 8 +++---- .../reference/downlevelLetConst16.js | 22 ++++++++++--------- .../reference/downlevelLetConst17.errors.txt | 3 +-- .../reference/downlevelLetConst17.js | 6 ++--- .../reference/parserES5ForOfStatement10.js | 4 ++-- .../reference/parserES5ForOfStatement11.js | 3 ++- .../reference/parserES5ForOfStatement12.js | 3 ++- .../reference/parserES5ForOfStatement13.js | 3 ++- .../reference/parserES5ForOfStatement14.js | 3 ++- .../reference/parserES5ForOfStatement15.js | 3 ++- .../reference/parserES5ForOfStatement16.js | 3 ++- .../reference/parserES5ForOfStatement18.js | 4 ++-- .../reference/parserES5ForOfStatement3.js | 4 ++-- .../reference/parserES5ForOfStatement4.js | 4 ++-- .../reference/parserES5ForOfStatement5.js | 4 ++-- .../reference/parserES5ForOfStatement6.js | 4 ++-- .../reference/parserES5ForOfStatement7.js | 4 ++-- .../reference/parserES5ForOfStatement8.js | 4 ++-- .../reference/parserES5ForOfStatement9.js | 4 ++-- tests/cases/compiler/downlevelLetConst16.ts | 1 - 36 files changed, 96 insertions(+), 92 deletions(-) diff --git a/tests/baselines/reference/ES5For-of1.js b/tests/baselines/reference/ES5For-of1.js index 8c4bc1038c3..8001d5b537f 100644 --- a/tests/baselines/reference/ES5For-of1.js +++ b/tests/baselines/reference/ES5For-of1.js @@ -2,6 +2,6 @@ for (var v of []) { } //// [ES5For-of1.js] -for (var v, _i = 0, _a = []; _i < _a.length; _i++) { - v = _a[_i]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var v = _a[_i]; } diff --git a/tests/baselines/reference/ES5For-of12.js b/tests/baselines/reference/ES5For-of12.js index 3dbdd30251c..c3665e8b584 100644 --- a/tests/baselines/reference/ES5For-of12.js +++ b/tests/baselines/reference/ES5For-of12.js @@ -3,5 +3,5 @@ for ([""] of []) { } //// [ES5For-of12.js] for (var _i = 0, _a = []; _i < _a.length; _i++) { - [""] = _a[_i]; + "" = _a[_i][0]; } diff --git a/tests/baselines/reference/ES5For-of13.js b/tests/baselines/reference/ES5For-of13.js index 8c8318e27fd..93aa8dec765 100644 --- a/tests/baselines/reference/ES5For-of13.js +++ b/tests/baselines/reference/ES5For-of13.js @@ -4,7 +4,7 @@ for (let v of []) { } //// [ES5For-of13.js] -for (var v, _i = 0, _a = []; _i < _a.length; _i++) { - v = _a[_i]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var v = _a[_i]; var x = v; } diff --git a/tests/baselines/reference/ES5For-of14.js b/tests/baselines/reference/ES5For-of14.js index d7a35913ef1..1011bc3558c 100644 --- a/tests/baselines/reference/ES5For-of14.js +++ b/tests/baselines/reference/ES5For-of14.js @@ -4,7 +4,7 @@ for (const v of []) { } //// [ES5For-of14.js] -for (var v, _i = 0, _a = []; _i < _a.length; _i++) { - v = _a[_i]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var v = _a[_i]; var x = v; } diff --git a/tests/baselines/reference/ES5For-of15.js b/tests/baselines/reference/ES5For-of15.js index 30b896165e5..90ed376b805 100644 --- a/tests/baselines/reference/ES5For-of15.js +++ b/tests/baselines/reference/ES5For-of15.js @@ -7,11 +7,11 @@ for (let v of []) { } //// [ES5For-of15.js] -for (var v, _i = 0, _a = []; _i < _a.length; _i++) { - v = _a[_i]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var v = _a[_i]; v; - for (var _v, _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { - _v = _a_1[_i_1]; + for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { + var _v = _a_1[_i_1]; var x = _v; } } diff --git a/tests/baselines/reference/ES5For-of16.js b/tests/baselines/reference/ES5For-of16.js index 5e15af3f9c3..da1f0e8b337 100644 --- a/tests/baselines/reference/ES5For-of16.js +++ b/tests/baselines/reference/ES5For-of16.js @@ -8,11 +8,11 @@ for (let v of []) { } //// [ES5For-of16.js] -for (var v, _i = 0, _a = []; _i < _a.length; _i++) { - v = _a[_i]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var v = _a[_i]; v; - for (var _v, _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { - _v = _a_1[_i_1]; + for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { + var _v = _a_1[_i_1]; var x = _v; _v++; } diff --git a/tests/baselines/reference/ES5For-of17.js b/tests/baselines/reference/ES5For-of17.js index 5a6cddcb605..e7f059477b5 100644 --- a/tests/baselines/reference/ES5For-of17.js +++ b/tests/baselines/reference/ES5For-of17.js @@ -8,11 +8,11 @@ for (let v of []) { } //// [ES5For-of17.js] -for (var v, _i = 0, _a = []; _i < _a.length; _i++) { - v = _a[_i]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var v = _a[_i]; v; - for (var _v, _i_1 = 0, _a_1 = [_v]; _i_1 < _a_1.length; _i_1++) { - _v = _a_1[_i_1]; + for (var _i_1 = 0, _a_1 = [v]; _i_1 < _a_1.length; _i_1++) { + var _v = _a_1[_i_1]; var x = _v; _v++; } diff --git a/tests/baselines/reference/ES5For-of18.js b/tests/baselines/reference/ES5For-of18.js index 6bb7a37b579..d55dc1fc5f0 100644 --- a/tests/baselines/reference/ES5For-of18.js +++ b/tests/baselines/reference/ES5For-of18.js @@ -8,11 +8,11 @@ for (let v of []) { //// [ES5For-of18.js] -for (var v, _i = 0, _a = []; _i < _a.length; _i++) { - v = _a[_i]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var v = _a[_i]; v; } -for (var _v, _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { - _v = _a_1[_i_1]; +for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { + var _v = _a_1[_i_1]; _v; } diff --git a/tests/baselines/reference/ES5For-of19.js b/tests/baselines/reference/ES5For-of19.js index 97718ab0337..48d89d29b4c 100644 --- a/tests/baselines/reference/ES5For-of19.js +++ b/tests/baselines/reference/ES5For-of19.js @@ -10,12 +10,12 @@ for (let v of []) { //// [ES5For-of19.js] -for (var v, _i = 0, _a = []; _i < _a.length; _i++) { - v = _a[_i]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var v = _a[_i]; v; function foo() { - for (var _v, _i = 0, _a = []; _i < _a.length; _i++) { - _v = _a[_i]; + for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { + var _v = _a_1[_i_1]; _v; } } diff --git a/tests/baselines/reference/ES5For-of2.js b/tests/baselines/reference/ES5For-of2.js index e057ccbbf3e..3d83df36c76 100644 --- a/tests/baselines/reference/ES5For-of2.js +++ b/tests/baselines/reference/ES5For-of2.js @@ -4,7 +4,7 @@ for (var v of []) { } //// [ES5For-of2.js] -for (var v, _i = 0, _a = []; _i < _a.length; _i++) { - v = _a[_i]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var v = _a[_i]; var x = v; } diff --git a/tests/baselines/reference/ES5For-of20.js b/tests/baselines/reference/ES5For-of20.js index 65fb4bfd39e..04b7cca5cc4 100644 --- a/tests/baselines/reference/ES5For-of20.js +++ b/tests/baselines/reference/ES5For-of20.js @@ -7,11 +7,11 @@ for (let v of []) { } //// [ES5For-of20.js] -for (var v, _i = 0, _a = []; _i < _a.length; _i++) { - v = _a[_i]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var v = _a[_i]; var _v; - for (var _v_1, _i_1 = 0, _a_1 = [_v_1]; _i_1 < _a_1.length; _i_1++) { - _v_1 = _a_1[_i_1]; + for (var _i_1 = 0, _a_1 = [v]; _i_1 < _a_1.length; _i_1++) { + var _v_1 = _a_1[_i_1]; var _v_2; } } diff --git a/tests/baselines/reference/ES5For-of21.js b/tests/baselines/reference/ES5For-of21.js index f616c328ca0..c6eac5d0e5e 100644 --- a/tests/baselines/reference/ES5For-of21.js +++ b/tests/baselines/reference/ES5For-of21.js @@ -4,9 +4,9 @@ for (let v of []) { } //// [ES5For-of21.js] -for (var v, _i = 0, _a = []; _i < _a.length; _i++) { - v = _a[_i]; - for (var _i_1, _i_2 = 0, _a_1 = []; _i_2 < _a_1.length; _i_2++) { - _i_1 = _a_1[_i_2]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var v = _a[_i]; + for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { + var _i_2 = _a_1[_i_1]; } } diff --git a/tests/baselines/reference/ES5For-of3.js b/tests/baselines/reference/ES5For-of3.js index 3bb7cf63885..c36110443b4 100644 --- a/tests/baselines/reference/ES5For-of3.js +++ b/tests/baselines/reference/ES5For-of3.js @@ -3,7 +3,7 @@ for (var v of []) var x = v; //// [ES5For-of3.js] -for (var v, _i = 0, _a = []; _i < _a.length; _i++) { - v = _a[_i]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var v = _a[_i]; var x = v; } diff --git a/tests/baselines/reference/ES5For-of4.js b/tests/baselines/reference/ES5For-of4.js index ee36de0a3af..44d486dddf0 100644 --- a/tests/baselines/reference/ES5For-of4.js +++ b/tests/baselines/reference/ES5For-of4.js @@ -4,8 +4,8 @@ for (var v of []) var y = v; //// [ES5For-of4.js] -for (var v, _i = 0, _a = []; _i < _a.length; _i++) { - v = _a[_i]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var v = _a[_i]; var x = v; } var y = v; diff --git a/tests/baselines/reference/ES5For-of5.js b/tests/baselines/reference/ES5For-of5.js index 0dfb430ca44..31229635c35 100644 --- a/tests/baselines/reference/ES5For-of5.js +++ b/tests/baselines/reference/ES5For-of5.js @@ -4,7 +4,7 @@ for (var _a of []) { } //// [ES5For-of5.js] -for (var _a, _i = 0, _a_1 = []; _i < _a_1.length; _i++) { - _a = _a_1[_i]; +for (var _i = 0, _a_1 = []; _i < _a_1.length; _i++) { + var _a = _a_1[_i]; var x = _a; } diff --git a/tests/baselines/reference/ES5For-of6.js b/tests/baselines/reference/ES5For-of6.js index e7c81743509..e0b134407c0 100644 --- a/tests/baselines/reference/ES5For-of6.js +++ b/tests/baselines/reference/ES5For-of6.js @@ -6,10 +6,10 @@ for (var w of []) { } //// [ES5For-of6.js] -for (var w, _i = 0, _a = []; _i < _a.length; _i++) { - w = _a[_i]; - for (var v, _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { - v = _a_1[_i_1]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var w = _a[_i]; + for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { + var v = _a_1[_i_1]; var x = [w, v]; } } diff --git a/tests/baselines/reference/ES5For-of7.js b/tests/baselines/reference/ES5For-of7.js index 8b2355d9ad6..d149001509c 100644 --- a/tests/baselines/reference/ES5For-of7.js +++ b/tests/baselines/reference/ES5For-of7.js @@ -8,11 +8,11 @@ for (var v of []) { } //// [ES5For-of7.js] -for (var w, _i = 0, _a = []; _i < _a.length; _i++) { - w = _a[_i]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var w = _a[_i]; var x = w; } -for (var v, _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { - v = _a_1[_i_1]; +for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { + var v = _a_1[_i_1]; var x = [w, v]; } diff --git a/tests/baselines/reference/downlevelLetConst16.js b/tests/baselines/reference/downlevelLetConst16.js index 8998ad23540..7bd860fc197 100644 --- a/tests/baselines/reference/downlevelLetConst16.js +++ b/tests/baselines/reference/downlevelLetConst16.js @@ -185,7 +185,6 @@ function foo6() { use(x); } -// TODO: once for-of is supported downlevel function foo7() { for (let x of []) { use(x); @@ -402,41 +401,44 @@ function foo6() { } use(x); } -// TODO: once for-of is supported downlevel function foo7() { - for (var _x, _i = 0, _a = []; _i < _a.length; _i++) { - _x = _a[_i]; + for (var _i = 0, _a = []; _i < _a.length; _i++) { + var _x = _a[_i]; use(_x); } use(x); } function foo8() { - for (var _x = (void 0)[0] of []) { + for (var _i = 0, _a = []; _i < _a.length; _i++) { + var _x = _a[_i][0]; use(_x); } use(x); } function foo9() { - for (var _x = (void 0).a of []) { + for (var _i = 0, _a = []; _i < _a.length; _i++) { + var _x = _a[_i].a; use(_x); } use(x); } function foo10() { - for (var _x, _i = 0, _a = []; _i < _a.length; _i++) { - _x = _a[_i]; + for (var _i = 0, _a = []; _i < _a.length; _i++) { + var _x = _a[_i]; use(_x); } use(x); } function foo11() { - for (var _x = (void 0)[0] of []) { + for (var _i = 0, _a = []; _i < _a.length; _i++) { + var _x = _a[_i][0]; use(_x); } use(x); } function foo12() { - for (var _x = (void 0).a of []) { + for (var _i = 0, _a = []; _i < _a.length; _i++) { + var _x = _a[_i].a; use(_x); } use(x); diff --git a/tests/baselines/reference/downlevelLetConst17.errors.txt b/tests/baselines/reference/downlevelLetConst17.errors.txt index ef8f2b89085..6183bab9430 100644 --- a/tests/baselines/reference/downlevelLetConst17.errors.txt +++ b/tests/baselines/reference/downlevelLetConst17.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/downlevelLetConst17.ts(66,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst17.ts(65,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/compiler/downlevelLetConst17.ts (1 errors) ==== @@ -66,7 +66,6 @@ tests/cases/compiler/downlevelLetConst17.ts(66,1): error TS2482: 'for...of' stat use(x); } - // TODO: update once for-of statements are supported downlevel for (const x of []) { ~~~ !!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. diff --git a/tests/baselines/reference/downlevelLetConst17.js b/tests/baselines/reference/downlevelLetConst17.js index d0ad931bd8f..d38ec3fde08 100644 --- a/tests/baselines/reference/downlevelLetConst17.js +++ b/tests/baselines/reference/downlevelLetConst17.js @@ -63,7 +63,6 @@ for (const x in []) { use(x); } -// TODO: update once for-of statements are supported downlevel for (const x of []) { use(x); } @@ -118,8 +117,7 @@ for (var _x_10 in []) { for (var _x_11 in []) { use(_x_11); } -// TODO: update once for-of statements are supported downlevel -for (var _x_12, _i = 0, _a = []; _i < _a.length; _i++) { - _x_12 = _a[_i]; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + var _x_12 = _a[_i]; use(_x_12); } diff --git a/tests/baselines/reference/parserES5ForOfStatement10.js b/tests/baselines/reference/parserES5ForOfStatement10.js index 13a5defecb6..e3e339b0972 100644 --- a/tests/baselines/reference/parserES5ForOfStatement10.js +++ b/tests/baselines/reference/parserES5ForOfStatement10.js @@ -3,6 +3,6 @@ for (const v of X) { } //// [parserES5ForOfStatement10.js] -for (var v, _i = 0, _a = X; _i < _a.length; _i++) { - v = _a[_i]; +for (var _i = 0, _a = X; _i < _a.length; _i++) { + var v = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement11.js b/tests/baselines/reference/parserES5ForOfStatement11.js index 45a24b109c0..318909b3728 100644 --- a/tests/baselines/reference/parserES5ForOfStatement11.js +++ b/tests/baselines/reference/parserES5ForOfStatement11.js @@ -3,5 +3,6 @@ for (const [a, b] of X) { } //// [parserES5ForOfStatement11.js] -for (var _a = void 0, a = _a[0], b = _a[1] of X) { +for (var _i = 0, _a = X; _i < _a.length; _i++) { + var _a_1 = _a[_i], a = _a_1[0], b = _a_1[1]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement12.js b/tests/baselines/reference/parserES5ForOfStatement12.js index 30beac5118c..5e1e3b50032 100644 --- a/tests/baselines/reference/parserES5ForOfStatement12.js +++ b/tests/baselines/reference/parserES5ForOfStatement12.js @@ -3,5 +3,6 @@ for (const {a, b} of X) { } //// [parserES5ForOfStatement12.js] -for (var _a = void 0, a = _a.a, b = _a.b of X) { +for (var _i = 0, _a = X; _i < _a.length; _i++) { + var _a_1 = _a[_i], a = _a_1.a, b = _a_1.b; } diff --git a/tests/baselines/reference/parserES5ForOfStatement13.js b/tests/baselines/reference/parserES5ForOfStatement13.js index 3fac359c675..aa3bd712a3b 100644 --- a/tests/baselines/reference/parserES5ForOfStatement13.js +++ b/tests/baselines/reference/parserES5ForOfStatement13.js @@ -3,5 +3,6 @@ for (let {a, b} of X) { } //// [parserES5ForOfStatement13.js] -for (var _a = void 0, a = _a.a, b = _a.b of X) { +for (var _i = 0, _a = X; _i < _a.length; _i++) { + var _a_1 = _a[_i], a = _a_1.a, b = _a_1.b; } diff --git a/tests/baselines/reference/parserES5ForOfStatement14.js b/tests/baselines/reference/parserES5ForOfStatement14.js index 6d1fbbddd67..4e31742d94c 100644 --- a/tests/baselines/reference/parserES5ForOfStatement14.js +++ b/tests/baselines/reference/parserES5ForOfStatement14.js @@ -3,5 +3,6 @@ for (let [a, b] of X) { } //// [parserES5ForOfStatement14.js] -for (var _a = void 0, a = _a[0], b = _a[1] of X) { +for (var _i = 0, _a = X; _i < _a.length; _i++) { + var _a_1 = _a[_i], a = _a_1[0], b = _a_1[1]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement15.js b/tests/baselines/reference/parserES5ForOfStatement15.js index efca0b289f6..4df81205333 100644 --- a/tests/baselines/reference/parserES5ForOfStatement15.js +++ b/tests/baselines/reference/parserES5ForOfStatement15.js @@ -3,5 +3,6 @@ for (var [a, b] of X) { } //// [parserES5ForOfStatement15.js] -for (var _a = void 0, a = _a[0], b = _a[1] of X) { +for (var _i = 0, _a = X; _i < _a.length; _i++) { + var _a_1 = _a[_i], a = _a_1[0], b = _a_1[1]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement16.js b/tests/baselines/reference/parserES5ForOfStatement16.js index 102e91685c3..a944fdb5a5f 100644 --- a/tests/baselines/reference/parserES5ForOfStatement16.js +++ b/tests/baselines/reference/parserES5ForOfStatement16.js @@ -3,5 +3,6 @@ for (var {a, b} of X) { } //// [parserES5ForOfStatement16.js] -for (var _a = void 0, a = _a.a, b = _a.b of X) { +for (var _i = 0, _a = X; _i < _a.length; _i++) { + var _a_1 = _a[_i], a = _a_1.a, b = _a_1.b; } diff --git a/tests/baselines/reference/parserES5ForOfStatement18.js b/tests/baselines/reference/parserES5ForOfStatement18.js index 76a4610d74b..02aa0b59422 100644 --- a/tests/baselines/reference/parserES5ForOfStatement18.js +++ b/tests/baselines/reference/parserES5ForOfStatement18.js @@ -2,6 +2,6 @@ for (var of of of) { } //// [parserES5ForOfStatement18.js] -for (var of, _i = 0, _a = of; _i < _a.length; _i++) { - of = _a[_i]; +for (var _i = 0, _a = of; _i < _a.length; _i++) { + var of = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement3.js b/tests/baselines/reference/parserES5ForOfStatement3.js index fd021d578d5..8e4e5b9e426 100644 --- a/tests/baselines/reference/parserES5ForOfStatement3.js +++ b/tests/baselines/reference/parserES5ForOfStatement3.js @@ -3,6 +3,6 @@ for (var a, b of X) { } //// [parserES5ForOfStatement3.js] -for (var a, _i = 0, _a = X; _i < _a.length; _i++) { - a = _a[_i]; +for (var _i = 0, _a = X; _i < _a.length; _i++) { + var a = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement4.js b/tests/baselines/reference/parserES5ForOfStatement4.js index 81184fc7225..751753da14b 100644 --- a/tests/baselines/reference/parserES5ForOfStatement4.js +++ b/tests/baselines/reference/parserES5ForOfStatement4.js @@ -3,6 +3,6 @@ for (var a = 1 of X) { } //// [parserES5ForOfStatement4.js] -for (var a = 1, _i = 0, _a = X; _i < _a.length; _i++) { - a = _a[_i]; +for (var _i = 0, _a = X; _i < _a.length; _i++) { + var a = 1 = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement5.js b/tests/baselines/reference/parserES5ForOfStatement5.js index 2c4a997a393..fe0471f4d4f 100644 --- a/tests/baselines/reference/parserES5ForOfStatement5.js +++ b/tests/baselines/reference/parserES5ForOfStatement5.js @@ -3,6 +3,6 @@ for (var a: number of X) { } //// [parserES5ForOfStatement5.js] -for (var a, _i = 0, _a = X; _i < _a.length; _i++) { - a = _a[_i]; +for (var _i = 0, _a = X; _i < _a.length; _i++) { + var a = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement6.js b/tests/baselines/reference/parserES5ForOfStatement6.js index be7054234ff..2e01da0a0c4 100644 --- a/tests/baselines/reference/parserES5ForOfStatement6.js +++ b/tests/baselines/reference/parserES5ForOfStatement6.js @@ -3,6 +3,6 @@ for (var a = 1, b = 2 of X) { } //// [parserES5ForOfStatement6.js] -for (var a = 1, _i = 0, _a = X; _i < _a.length; _i++) { - a = _a[_i]; +for (var _i = 0, _a = X; _i < _a.length; _i++) { + var a = 1 = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement7.js b/tests/baselines/reference/parserES5ForOfStatement7.js index fea53d7ec2f..845bec0e2cc 100644 --- a/tests/baselines/reference/parserES5ForOfStatement7.js +++ b/tests/baselines/reference/parserES5ForOfStatement7.js @@ -3,6 +3,6 @@ for (var a: number = 1, b: string = "" of X) { } //// [parserES5ForOfStatement7.js] -for (var a = 1, _i = 0, _a = X; _i < _a.length; _i++) { - a = _a[_i]; +for (var _i = 0, _a = X; _i < _a.length; _i++) { + var a = 1 = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement8.js b/tests/baselines/reference/parserES5ForOfStatement8.js index fa42d260fa5..bd20d375502 100644 --- a/tests/baselines/reference/parserES5ForOfStatement8.js +++ b/tests/baselines/reference/parserES5ForOfStatement8.js @@ -3,6 +3,6 @@ for (var v of X) { } //// [parserES5ForOfStatement8.js] -for (var v, _i = 0, _a = X; _i < _a.length; _i++) { - v = _a[_i]; +for (var _i = 0, _a = X; _i < _a.length; _i++) { + var v = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement9.js b/tests/baselines/reference/parserES5ForOfStatement9.js index 612a5ec63a9..3da36ecdd5b 100644 --- a/tests/baselines/reference/parserES5ForOfStatement9.js +++ b/tests/baselines/reference/parserES5ForOfStatement9.js @@ -3,6 +3,6 @@ for (let v of X) { } //// [parserES5ForOfStatement9.js] -for (var v, _i = 0, _a = X; _i < _a.length; _i++) { - v = _a[_i]; +for (var _i = 0, _a = X; _i < _a.length; _i++) { + var v = _a[_i]; } diff --git a/tests/cases/compiler/downlevelLetConst16.ts b/tests/cases/compiler/downlevelLetConst16.ts index 2d592d253c9..30a27ba61f4 100644 --- a/tests/cases/compiler/downlevelLetConst16.ts +++ b/tests/cases/compiler/downlevelLetConst16.ts @@ -185,7 +185,6 @@ function foo6() { use(x); } -// TODO: once for-of is supported downlevel function foo7() { for (let x of []) { use(x); From 4d3265088b183dcbcbcd08eac5cabf3280716fb7 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 4 Mar 2015 14:38:22 -0800 Subject: [PATCH 010/101] Revert change to createTempVariable --- src/compiler/emitter.ts | 20 +++- tests/baselines/reference/ES5For-of18.js | 4 +- tests/baselines/reference/ES5For-of19.js | 4 +- tests/baselines/reference/ES5For-of21.js | 4 +- tests/baselines/reference/ES5For-of5.js | 4 +- tests/baselines/reference/ES5For-of7.js | 4 +- tests/baselines/reference/callWithSpread.js | 6 +- .../collisionRestParameterArrowFunctions.js | 8 +- .../collisionRestParameterClassConstructor.js | 16 ++-- .../collisionRestParameterClassMethod.js | 12 +-- .../collisionRestParameterFunction.js | 12 +-- ...llisionRestParameterFunctionExpressions.js | 12 +-- .../collisionRestParameterUnderscoreIUsage.js | 4 +- .../reference/computedPropertyNames48_ES5.js | 14 +-- .../reference/declarationWithNoInitializer.js | 2 +- .../reference/declarationsAndAssignments.js | 92 +++++++++---------- .../destructuringParameterProperties1.js | 2 +- .../destructuringParameterProperties2.js | 4 +- .../destructuringParameterProperties3.js | 6 +- .../destructuringParameterProperties5.js | 2 +- .../reference/parserES5ForOfStatement11.js | 2 +- .../reference/parserES5ForOfStatement12.js | 2 +- .../reference/parserES5ForOfStatement13.js | 2 +- .../reference/parserES5ForOfStatement14.js | 2 +- .../reference/parserES5ForOfStatement15.js | 2 +- .../reference/parserES5ForOfStatement16.js | 2 +- .../reference/parserES5ForOfStatement2.js | 2 +- .../reference/parserES5ForOfStatement21.js | 2 +- .../reference/restElementMustBeLast.js | 4 +- .../restElementWithNullInitializer.js | 8 +- ...gedTemplateStringsTypeArgumentInference.js | 56 +++++------ ...emplateStringsWithIncompatibleTypedTags.js | 18 ++-- ...dTemplateStringsWithOverloadResolution1.js | 12 +-- ...dTemplateStringsWithOverloadResolution2.js | 4 +- ...dTemplateStringsWithOverloadResolution3.js | 44 ++++----- ...taggedTemplateStringsWithTagsTypedAsAny.js | 20 ++-- .../taggedTemplateStringsWithTypedTags.js | 16 ++-- .../reference/templateStringInModuleName.js | 4 +- 38 files changed, 226 insertions(+), 208 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index d2ec35bb494..4eb2b3a8842 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1580,6 +1580,7 @@ module ts { var generatedBlockScopeNames: string[]; var extendsEmitted = false; + var tempCount = 0; var tempVariables: Identifier[]; var tempParameters: Identifier[]; var externalImports: ExternalImportInfo[]; @@ -2089,7 +2090,15 @@ module ts { // Create a temporary variable with a unique unused name. The forLoopVariable parameter signals that the // name should be one that is appropriate for a for loop variable. function createTempVariable(location: Node, forLoopVariable?: boolean): Identifier { - var name = generateUniqueNameForLocation(location, /*baseName*/ forLoopVariable ? "_i" : "_a"); + var name = forLoopVariable ? "_i" : undefined; + while (true) { + if (name && !isExistingName(location, name)) { + break; + } + // _a .. _h, _j ... _z, _0, _1, ... + name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + CharacterCodes.a) : tempCount - 25); + tempCount++; + } var result = createSynthesizedNode(SyntaxKind.Identifier); result.text = name; return result; @@ -4259,8 +4268,10 @@ module ts { } function emitSignatureAndBody(node: FunctionLikeDeclaration) { + var saveTempCount = tempCount; var saveTempVariables = tempVariables; var saveTempParameters = tempParameters; + tempCount = 0; tempVariables = undefined; tempParameters = undefined; @@ -4299,6 +4310,7 @@ module ts { exitNameScope(popFrame); + tempCount = saveTempCount; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } @@ -4613,8 +4625,10 @@ module ts { } function emitConstructorOfClass() { + var saveTempCount = tempCount; var saveTempVariables = tempVariables; var saveTempParameters = tempParameters; + tempCount = 0; tempVariables = undefined; tempParameters = undefined; @@ -4683,6 +4697,7 @@ module ts { exitNameScope(popFrame); + tempCount = saveTempCount; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } @@ -4810,13 +4825,16 @@ module ts { emitEnd(node.name); write(") "); if (node.body.kind === SyntaxKind.ModuleBlock) { + var saveTempCount = tempCount; var saveTempVariables = tempVariables; + tempCount = 0; tempVariables = undefined; var popFrame = enterNameScope(); emit(node.body); exitNameScope(popFrame); + tempCount = saveTempCount; tempVariables = saveTempVariables; } else { diff --git a/tests/baselines/reference/ES5For-of18.js b/tests/baselines/reference/ES5For-of18.js index d55dc1fc5f0..656d4f57233 100644 --- a/tests/baselines/reference/ES5For-of18.js +++ b/tests/baselines/reference/ES5For-of18.js @@ -12,7 +12,7 @@ for (var _i = 0, _a = []; _i < _a.length; _i++) { var v = _a[_i]; v; } -for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { - var _v = _a_1[_i_1]; +for (var _i = 0, _b = []; _i < _b.length; _i++) { + var _v = _b[_i]; _v; } diff --git a/tests/baselines/reference/ES5For-of19.js b/tests/baselines/reference/ES5For-of19.js index 48d89d29b4c..9ff3f9aca2a 100644 --- a/tests/baselines/reference/ES5For-of19.js +++ b/tests/baselines/reference/ES5For-of19.js @@ -14,8 +14,8 @@ for (var _i = 0, _a = []; _i < _a.length; _i++) { var v = _a[_i]; v; function foo() { - for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { - var _v = _a_1[_i_1]; + for (var _i = 0, _a = []; _i < _a.length; _i++) { + var _v = _a[_i]; _v; } } diff --git a/tests/baselines/reference/ES5For-of21.js b/tests/baselines/reference/ES5For-of21.js index c6eac5d0e5e..e23ea282998 100644 --- a/tests/baselines/reference/ES5For-of21.js +++ b/tests/baselines/reference/ES5For-of21.js @@ -6,7 +6,7 @@ for (let v of []) { //// [ES5For-of21.js] for (var _i = 0, _a = []; _i < _a.length; _i++) { var v = _a[_i]; - for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { - var _i_2 = _a_1[_i_1]; + for (var _b = 0, _c = []; _b < _c.length; _b++) { + var _i = _c[_b]; } } diff --git a/tests/baselines/reference/ES5For-of5.js b/tests/baselines/reference/ES5For-of5.js index 31229635c35..8e1a37db061 100644 --- a/tests/baselines/reference/ES5For-of5.js +++ b/tests/baselines/reference/ES5For-of5.js @@ -4,7 +4,7 @@ for (var _a of []) { } //// [ES5For-of5.js] -for (var _i = 0, _a_1 = []; _i < _a_1.length; _i++) { - var _a = _a_1[_i]; +for (var _i = 0, _b = []; _i < _b.length; _i++) { + var _a = _b[_i]; var x = _a; } diff --git a/tests/baselines/reference/ES5For-of7.js b/tests/baselines/reference/ES5For-of7.js index d149001509c..474cb2749ad 100644 --- a/tests/baselines/reference/ES5For-of7.js +++ b/tests/baselines/reference/ES5For-of7.js @@ -12,7 +12,7 @@ for (var _i = 0, _a = []; _i < _a.length; _i++) { var w = _a[_i]; var x = w; } -for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { - var v = _a_1[_i_1]; +for (var _i = 0, _b = []; _i < _b.length; _i++) { + var v = _b[_i]; var x = [w, v]; } diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index 02b6b9b8ff6..d676c0f2a33 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -81,8 +81,8 @@ obj.foo.apply(obj, [1, 2].concat(a)); obj.foo.apply(obj, [1, 2].concat(a, ["abc"])); xa[1].foo(1, 2, "abc"); (_a = xa[1]).foo.apply(_a, [1, 2].concat(a)); -(_a_1 = xa[1]).foo.apply(_a_1, [1, 2].concat(a, ["abc"])); -(_a_2 = xa[1]).foo.apply(_a_2, [1, 2, "abc"]); +(_b = xa[1]).foo.apply(_b, [1, 2].concat(a, ["abc"])); +(_c = xa[1]).foo.apply(_c, [1, 2, "abc"]); var C = (function () { function C(x, y) { var z = []; @@ -114,4 +114,4 @@ var D = (function (_super) { })(C); // Only supported in when target is ES6 var c = new C(1, 2, ...a); -var _a, _a_1, _a_2; +var _a, _b, _c; diff --git a/tests/baselines/reference/collisionRestParameterArrowFunctions.js b/tests/baselines/reference/collisionRestParameterArrowFunctions.js index b70bb6c2113..39d449555db 100644 --- a/tests/baselines/reference/collisionRestParameterArrowFunctions.js +++ b/tests/baselines/reference/collisionRestParameterArrowFunctions.js @@ -16,8 +16,8 @@ var f2NoError = () => { //// [collisionRestParameterArrowFunctions.js] var f1 = function (_i) { var restParameters = []; - for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { - restParameters[_i_1 - 1] = arguments[_i_1]; + for (var _a = 1; _a < arguments.length; _a++) { + restParameters[_a - 1] = arguments[_a]; } var _i = 10; // no error }; @@ -26,8 +26,8 @@ var f1NoError = function (_i) { }; var f2 = function () { var restParameters = []; - for (var _i_1 = 0; _i_1 < arguments.length; _i_1++) { - restParameters[_i_1 - 0] = arguments[_i_1]; + for (var _a = 0; _a < arguments.length; _a++) { + restParameters[_a - 0] = arguments[_a]; } var _i = 10; // No Error }; diff --git a/tests/baselines/reference/collisionRestParameterClassConstructor.js b/tests/baselines/reference/collisionRestParameterClassConstructor.js index de3fd3c671b..fc6e400668c 100644 --- a/tests/baselines/reference/collisionRestParameterClassConstructor.js +++ b/tests/baselines/reference/collisionRestParameterClassConstructor.js @@ -71,8 +71,8 @@ declare class c6NoError { var c1 = (function () { function c1(_i) { var restParameters = []; - for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { - restParameters[_i_1 - 1] = arguments[_i_1]; + for (var _a = 1; _a < arguments.length; _a++) { + restParameters[_a - 1] = arguments[_a]; } var _i = 10; // no error } @@ -87,8 +87,8 @@ var c1NoError = (function () { var c2 = (function () { function c2() { var restParameters = []; - for (var _i_1 = 0; _i_1 < arguments.length; _i_1++) { - restParameters[_i_1 - 0] = arguments[_i_1]; + for (var _a = 0; _a < arguments.length; _a++) { + restParameters[_a - 0] = arguments[_a]; } var _i = 10; // no error } @@ -103,8 +103,8 @@ var c2NoError = (function () { var c3 = (function () { function c3(_i) { var restParameters = []; - for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { - restParameters[_i_1 - 1] = arguments[_i_1]; + for (var _a = 1; _a < arguments.length; _a++) { + restParameters[_a - 1] = arguments[_a]; } this._i = _i; var _i = 10; // no error @@ -121,8 +121,8 @@ var c3NoError = (function () { var c5 = (function () { function c5(_i) { var rest = []; - for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { - rest[_i_1 - 1] = arguments[_i_1]; + for (var _a = 1; _a < arguments.length; _a++) { + rest[_a - 1] = arguments[_a]; } var _i; // no error } diff --git a/tests/baselines/reference/collisionRestParameterClassMethod.js b/tests/baselines/reference/collisionRestParameterClassMethod.js index 3478dda615f..e3471c85f1c 100644 --- a/tests/baselines/reference/collisionRestParameterClassMethod.js +++ b/tests/baselines/reference/collisionRestParameterClassMethod.js @@ -44,8 +44,8 @@ var c1 = (function () { } c1.prototype.foo = function (_i) { var restParameters = []; - for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { - restParameters[_i_1 - 1] = arguments[_i_1]; + for (var _a = 1; _a < arguments.length; _a++) { + restParameters[_a - 1] = arguments[_a]; } var _i = 10; // no error }; @@ -54,8 +54,8 @@ var c1 = (function () { }; c1.prototype.f4 = function (_i) { var rest = []; - for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { - rest[_i_1 - 1] = arguments[_i_1]; + for (var _a = 1; _a < arguments.length; _a++) { + rest[_a - 1] = arguments[_a]; } var _i; // no error }; @@ -69,8 +69,8 @@ var c3 = (function () { } c3.prototype.foo = function () { var restParameters = []; - for (var _i_1 = 0; _i_1 < arguments.length; _i_1++) { - restParameters[_i_1 - 0] = arguments[_i_1]; + for (var _a = 0; _a < arguments.length; _a++) { + restParameters[_a - 0] = arguments[_a]; } var _i = 10; // no error }; diff --git a/tests/baselines/reference/collisionRestParameterFunction.js b/tests/baselines/reference/collisionRestParameterFunction.js index 98c2b2296ee..8660e8f5db0 100644 --- a/tests/baselines/reference/collisionRestParameterFunction.js +++ b/tests/baselines/reference/collisionRestParameterFunction.js @@ -37,8 +37,8 @@ declare function f6(_i: string); // no codegen no error // Functions function f1(_i) { var restParameters = []; - for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { - restParameters[_i_1 - 1] = arguments[_i_1]; + for (var _a = 1; _a < arguments.length; _a++) { + restParameters[_a - 1] = arguments[_a]; } var _i = 10; // no error } @@ -47,8 +47,8 @@ function f1NoError(_i) { } function f3() { var restParameters = []; - for (var _i_1 = 0; _i_1 < arguments.length; _i_1++) { - restParameters[_i_1 - 0] = arguments[_i_1]; + for (var _a = 0; _a < arguments.length; _a++) { + restParameters[_a - 0] = arguments[_a]; } var _i = 10; // no error } @@ -57,8 +57,8 @@ function f3NoError() { } function f4(_i) { var rest = []; - for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { - rest[_i_1 - 1] = arguments[_i_1]; + for (var _a = 1; _a < arguments.length; _a++) { + rest[_a - 1] = arguments[_a]; } } function f4NoError(_i) { diff --git a/tests/baselines/reference/collisionRestParameterFunctionExpressions.js b/tests/baselines/reference/collisionRestParameterFunctionExpressions.js index 478446bd5e0..22709b087eb 100644 --- a/tests/baselines/reference/collisionRestParameterFunctionExpressions.js +++ b/tests/baselines/reference/collisionRestParameterFunctionExpressions.js @@ -28,8 +28,8 @@ function foo() { function foo() { function f1(_i) { var restParameters = []; - for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { - restParameters[_i_1 - 1] = arguments[_i_1]; + for (var _a = 1; _a < arguments.length; _a++) { + restParameters[_a - 1] = arguments[_a]; } var _i = 10; // no error } @@ -38,8 +38,8 @@ function foo() { } function f3() { var restParameters = []; - for (var _i_1 = 0; _i_1 < arguments.length; _i_1++) { - restParameters[_i_1 - 0] = arguments[_i_1]; + for (var _a = 0; _a < arguments.length; _a++) { + restParameters[_a - 0] = arguments[_a]; } var _i = 10; // no error } @@ -48,8 +48,8 @@ function foo() { } function f4(_i) { var rest = []; - for (var _i_1 = 1; _i_1 < arguments.length; _i_1++) { - rest[_i_1 - 1] = arguments[_i_1]; + for (var _a = 1; _a < arguments.length; _a++) { + rest[_a - 1] = arguments[_a]; } } function f4NoError(_i) { diff --git a/tests/baselines/reference/collisionRestParameterUnderscoreIUsage.js b/tests/baselines/reference/collisionRestParameterUnderscoreIUsage.js index 9316dba316f..adc9c09de27 100644 --- a/tests/baselines/reference/collisionRestParameterUnderscoreIUsage.js +++ b/tests/baselines/reference/collisionRestParameterUnderscoreIUsage.js @@ -13,8 +13,8 @@ var _i = "This is what I'd expect to see"; var Foo = (function () { function Foo() { var args = []; - for (var _i_1 = 0; _i_1 < arguments.length; _i_1++) { - args[_i_1 - 0] = arguments[_i_1]; + for (var _a = 0; _a < arguments.length; _a++) { + args[_a - 0] = arguments[_a]; } console.log(_i); // This should result in error } diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.js b/tests/baselines/reference/computedPropertyNames48_ES5.js index d14faab73eb..c5ca0d5b241 100644 --- a/tests/baselines/reference/computedPropertyNames48_ES5.js +++ b/tests/baselines/reference/computedPropertyNames48_ES5.js @@ -26,10 +26,10 @@ var a; extractIndexer((_a = {}, _a[a] = "", _a)); // Should return string -extractIndexer((_a_1 = {}, - _a_1[0 /* x */] = "", - _a_1)); // Should return string -extractIndexer((_a_2 = {}, - _a_2["" || 0] = "", - _a_2)); // Should return any (widened form of undefined) -var _a, _a_1, _a_2; +extractIndexer((_b = {}, + _b[0 /* x */] = "", + _b)); // Should return string +extractIndexer((_c = {}, + _c["" || 0] = "", + _c)); // Should return any (widened form of undefined) +var _a, _b, _c; diff --git a/tests/baselines/reference/declarationWithNoInitializer.js b/tests/baselines/reference/declarationWithNoInitializer.js index ebe8f8b3b38..54d89368fb1 100644 --- a/tests/baselines/reference/declarationWithNoInitializer.js +++ b/tests/baselines/reference/declarationWithNoInitializer.js @@ -5,4 +5,4 @@ var {c, d}; // Error, no initializer //// [declarationWithNoInitializer.js] var _a = void 0, a = _a[0], b = _a[1]; // Error, no initializer -var _a_1 = void 0, c = _a_1.c, d = _a_1.d; // Error, no initializer +var _b = void 0, c = _b.c, d = _b.d; // Error, no initializer diff --git a/tests/baselines/reference/declarationsAndAssignments.js b/tests/baselines/reference/declarationsAndAssignments.js index 3e67309663c..032f4cb0e63 100644 --- a/tests/baselines/reference/declarationsAndAssignments.js +++ b/tests/baselines/reference/declarationsAndAssignments.js @@ -184,9 +184,9 @@ function f21() { function f0() { var _a = [1, "hello"]; var x = ([1, "hello"])[0]; - var _a_1 = [1, "hello"], x = _a_1[0], y = _a_1[1]; - var _a_2 = [1, "hello"], x = _a_2[0], y = _a_2[1], z = _a_2[2]; // Error - var _a_3 = [0, 1, 2], z = _a_3[2]; + var _b = [1, "hello"], x = _b[0], y = _b[1]; + var _c = [1, "hello"], x = _c[0], y = _c[1], z = _c[2]; // Error + var _d = [0, 1, 2], z = _d[2]; var x; var y; } @@ -203,60 +203,60 @@ function f2() { var _a = { x: 5, y: "hello" }; var x = ({ x: 5, y: "hello" }).x; var y = ({ x: 5, y: "hello" }).y; - var _a_1 = { x: 5, y: "hello" }, x = _a_1.x, y = _a_1.y; + var _b = { x: 5, y: "hello" }, x = _b.x, y = _b.y; var x; var y; var a = ({ x: 5, y: "hello" }).x; var b = ({ x: 5, y: "hello" }).y; - var _a_2 = { x: 5, y: "hello" }, a = _a_2.x, b = _a_2.y; + var _c = { x: 5, y: "hello" }, a = _c.x, b = _c.y; var a; var b; } function f3() { - var _a = [1, ["hello", [true]]], x = _a[0], _a_1 = _a[1], y = _a_1[0], z = _a_1[1][0]; + var _a = [1, ["hello", [true]]], x = _a[0], _b = _a[1], y = _b[0], z = _b[1][0]; var x; var y; var z; } function f4() { - var _a = { a: 1, b: { a: "hello", b: { a: true } } }, x = _a.a, _a_1 = _a.b, y = _a_1.a, z = _a_1.b.a; + var _a = { a: 1, b: { a: "hello", b: { a: true } } }, x = _a.a, _b = _a.b, y = _b.a, z = _b.b.a; var x; var y; var z; } function f6() { - var _a = [1, "hello"], _a_1 = _a[0], x = _a_1 === void 0 ? 0 : _a_1, _a_2 = _a[1], y = _a_2 === void 0 ? "" : _a_2; + var _a = [1, "hello"], _b = _a[0], x = _b === void 0 ? 0 : _b, _c = _a[1], y = _c === void 0 ? "" : _c; var x; var y; } function f7() { - var _a = [1, "hello"], _a_1 = _a[0], x = _a_1 === void 0 ? 0 : _a_1, _a_2 = _a[1], y = _a_2 === void 0 ? 1 : _a_2; // Error, initializer for y must be string + var _a = [1, "hello"], _b = _a[0], x = _b === void 0 ? 0 : _b, _c = _a[1], y = _c === void 0 ? 1 : _c; // Error, initializer for y must be string var x; var y; } function f8() { var _a = [], a = _a[0], b = _a[1], c = _a[2]; // Ok, [] is an array - var _a_1 = [1], d = _a_1[0], e = _a_1[1], f = _a_1[2]; // Error, [1] is a tuple + var _b = [1], d = _b[0], e = _b[1], f = _b[2]; // Error, [1] is a tuple } function f9() { var _a = {}, a = _a[0], b = _a[1]; // Error, not array type - var _a_1 = { 0: 10, 1: 20 }, c = _a_1[0], d = _a_1[1]; // Error, not array type - var _a_2 = [10, 20], e = _a_2[0], f = _a_2[1]; + var _b = { 0: 10, 1: 20 }, c = _b[0], d = _b[1]; // Error, not array type + var _c = [10, 20], e = _c[0], f = _c[1]; } function f10() { var _a = {}, a = _a.a, b = _a.b; // Error - var _a_1 = [], a = _a_1.a, b = _a_1.b; // Error + var _b = [], a = _b.a, b = _b.b; // Error } function f11() { var _a = { x: 10, y: "hello" }, a = _a.x, b = _a.y; - var _a_1 = { 0: 10, 1: "hello" }, a = _a_1[0], b = _a_1[1]; - var _a_2 = { "<": 10, ">": "hello" }, a = _a_2["<"], b = _a_2[">"]; - var _a_3 = [10, "hello"], a = _a_3[0], b = _a_3[1]; + var _b = { 0: 10, 1: "hello" }, a = _b[0], b = _b[1]; + var _c = { "<": 10, ">": "hello" }, a = _c["<"], b = _c[">"]; + var _d = [10, "hello"], a = _d[0], b = _d[1]; var a; var b; } function f12() { - var _a = [1, ["hello", { x: 5, y: true }]], a = _a[0], _a_1 = _a[1], _a_2 = _a_1 === void 0 ? ["abc", { x: 10, y: false }] : _a_1, b = _a_2[0], _a_3 = _a_2[1], x = _a_3.x, c = _a_3.y; + var _a = [1, ["hello", { x: 5, y: true }]], a = _a[0], _b = _a[1], _c = _b === void 0 ? ["abc", { x: 10, y: false }] : _b, b = _c[0], _d = _c[1], x = _d.x, c = _d.y; var a; var b; var x; @@ -264,10 +264,10 @@ function f12() { } function f13() { var _a = [1, "hello"], x = _a[0], y = _a[1]; - var _a_1 = [[x, y], { x: x, y: y }], a = _a_1[0], b = _a_1[1]; + var _b = [[x, y], { x: x, y: y }], a = _b[0], b = _b[1]; } function f14(_a) { - var _a_1 = _a[0], a = _a_1 === void 0 ? 1 : _a_1, _a_2 = _a[1], _a_3 = _a_2[0], b = _a_3 === void 0 ? "hello" : _a_3, _a_4 = _a_2[1], x = _a_4.x, _a_5 = _a_4.y, c = _a_5 === void 0 ? false : _a_5; + var _b = _a[0], a = _b === void 0 ? 1 : _b, _c = _a[1], _d = _c[0], b = _d === void 0 ? "hello" : _d, _e = _c[1], x = _e.x, _f = _e.y, c = _f === void 0 ? false : _f; var a; var b; var c; @@ -290,7 +290,7 @@ function f16() { var _a = f15(), a = _a.a, b = _a.b, c = _a.c; } function f17(_a) { - var _a_1 = _a.a, a = _a_1 === void 0 ? "" : _a_1, _a_2 = _a.b, b = _a_2 === void 0 ? 0 : _a_2, _a_3 = _a.c, c = _a_3 === void 0 ? false : _a_3; + var _b = _a.a, a = _b === void 0 ? "" : _b, _c = _a.b, b = _c === void 0 ? 0 : _c, _d = _a.c, c = _d === void 0 ? false : _d; } f17({}); f17({ a: "hello" }); @@ -301,20 +301,20 @@ function f18() { var b; var aa; (_a = { a: a, b: b }, a = _a.a, b = _a.b, _a); - (_a_1 = { b: b, a: a }, a = _a_1.a, b = _a_1.b, _a_1); - _a_2 = [a, b], aa[0] = _a_2[0], b = _a_2[1]; - _a_3 = [b, a], a = _a_3[0], b = _a_3[1]; // Error - _a_4 = [2, "def"], _a_5 = _a_4[0], a = _a_5 === void 0 ? 1 : _a_5, _a_6 = _a_4[1], b = _a_6 === void 0 ? "abc" : _a_6; - var _a, _a_1, _a_2, _a_3, _a_4, _a_5, _a_6; + (_b = { b: b, a: a }, a = _b.a, b = _b.b, _b); + _c = [a, b], aa[0] = _c[0], b = _c[1]; + _d = [b, a], a = _d[0], b = _d[1]; // Error + _e = [2, "def"], _f = _e[0], a = _f === void 0 ? 1 : _f, _g = _e[1], b = _g === void 0 ? "abc" : _g; + var _a, _b, _c, _d, _e, _f, _g; } function f19() { var a, b; _a = [1, 2], a = _a[0], b = _a[1]; - _a_1 = [b, a], a = _a_1[0], b = _a_1[1]; - (_a_2 = { b: b, a: a }, a = _a_2.a, b = _a_2.b, _a_2); - _a_3 = ([[2, 3]])[0], _a_4 = _a_3 === void 0 ? [1, 2] : _a_3, a = _a_4[0], b = _a_4[1]; - var x = (_a_5 = [1, 2], a = _a_5[0], b = _a_5[1], _a_5); - var _a, _a_1, _a_2, _a_3, _a_4, _a_5; + _b = [b, a], a = _b[0], b = _b[1]; + (_c = { b: b, a: a }, a = _c.a, b = _c.b, _c); + _d = ([[2, 3]])[0], _e = _d === void 0 ? [1, 2] : _d, a = _e[0], b = _e[1]; + var x = (_f = [1, 2], a = _f[0], b = _f[1], _f); + var _a, _b, _c, _d, _e, _f; } function f20() { var a; @@ -322,14 +322,14 @@ function f20() { var y; var z; var _a = [1, 2, 3], a = _a.slice(0); - var _a_1 = [1, 2, 3], x = _a_1[0], a = _a_1.slice(1); - var _a_2 = [1, 2, 3], x = _a_2[0], y = _a_2[1], a = _a_2.slice(2); - var _a_3 = [1, 2, 3], x = _a_3[0], y = _a_3[1], z = _a_3[2], a = _a_3.slice(3); - _a_4 = [1, 2, 3], a = _a_4.slice(0); - _a_5 = [1, 2, 3], x = _a_5[0], a = _a_5.slice(1); - _a_6 = [1, 2, 3], x = _a_6[0], y = _a_6[1], a = _a_6.slice(2); - _a_7 = [1, 2, 3], x = _a_7[0], y = _a_7[1], z = _a_7[2], a = _a_7.slice(3); - var _a_4, _a_5, _a_6, _a_7; + var _b = [1, 2, 3], x = _b[0], a = _b.slice(1); + var _c = [1, 2, 3], x = _c[0], y = _c[1], a = _c.slice(2); + var _d = [1, 2, 3], x = _d[0], y = _d[1], z = _d[2], a = _d.slice(3); + _e = [1, 2, 3], a = _e.slice(0); + _f = [1, 2, 3], x = _f[0], a = _f.slice(1); + _g = [1, 2, 3], x = _g[0], y = _g[1], a = _g.slice(2); + _h = [1, 2, 3], x = _h[0], y = _h[1], z = _h[2], a = _h.slice(3); + var _e, _f, _g, _h; } function f21() { var a; @@ -337,12 +337,12 @@ function f21() { var y; var z; var _a = [1, "hello", true], a = _a.slice(0); - var _a_1 = [1, "hello", true], x = _a_1[0], a = _a_1.slice(1); - var _a_2 = [1, "hello", true], x = _a_2[0], y = _a_2[1], a = _a_2.slice(2); - var _a_3 = [1, "hello", true], x = _a_3[0], y = _a_3[1], z = _a_3[2], a = _a_3.slice(3); - _a_4 = [1, "hello", true], a = _a_4.slice(0); - _a_5 = [1, "hello", true], x = _a_5[0], a = _a_5.slice(1); - _a_6 = [1, "hello", true], x = _a_6[0], y = _a_6[1], a = _a_6.slice(2); - _a_7 = [1, "hello", true], x = _a_7[0], y = _a_7[1], z = _a_7[2], a = _a_7.slice(3); - var _a_4, _a_5, _a_6, _a_7; + var _b = [1, "hello", true], x = _b[0], a = _b.slice(1); + var _c = [1, "hello", true], x = _c[0], y = _c[1], a = _c.slice(2); + var _d = [1, "hello", true], x = _d[0], y = _d[1], z = _d[2], a = _d.slice(3); + _e = [1, "hello", true], a = _e.slice(0); + _f = [1, "hello", true], x = _f[0], a = _f.slice(1); + _g = [1, "hello", true], x = _g[0], y = _g[1], a = _g.slice(2); + _h = [1, "hello", true], x = _h[0], y = _h[1], z = _h[2], a = _h.slice(3); + var _e, _f, _g, _h; } diff --git a/tests/baselines/reference/destructuringParameterProperties1.js b/tests/baselines/reference/destructuringParameterProperties1.js index 5842d68b605..cc16cc78de5 100644 --- a/tests/baselines/reference/destructuringParameterProperties1.js +++ b/tests/baselines/reference/destructuringParameterProperties1.js @@ -58,4 +58,4 @@ var c2 = new C2(["10", 10, !!10]); var _a = [c2.x, c2.y, c2.z], c2_x = _a[0], c2_y = _a[1], c2_z = _a[2]; var c3 = new C3({ x: 0, y: "", z: false }); c3 = new C3({ x: 0, "y": "y", z: true }); -var _a_1 = [c3.x, c3.y, c3.z], c3_x = _a_1[0], c3_y = _a_1[1], c3_z = _a_1[2]; +var _b = [c3.x, c3.y, c3.z], c3_x = _b[0], c3_y = _b[1], c3_z = _b[2]; diff --git a/tests/baselines/reference/destructuringParameterProperties2.js b/tests/baselines/reference/destructuringParameterProperties2.js index 75b00d2ddfd..27e190af62f 100644 --- a/tests/baselines/reference/destructuringParameterProperties2.js +++ b/tests/baselines/reference/destructuringParameterProperties2.js @@ -53,6 +53,6 @@ var C1 = (function () { var x = new C1(undefined, [0, undefined, ""]); var _a = [x.getA(), x.getB(), x.getC()], x_a = _a[0], x_b = _a[1], x_c = _a[2]; var y = new C1(10, [0, "", true]); -var _a_1 = [y.getA(), y.getB(), y.getC()], y_a = _a_1[0], y_b = _a_1[1], y_c = _a_1[2]; +var _b = [y.getA(), y.getB(), y.getC()], y_a = _b[0], y_b = _b[1], y_c = _b[2]; var z = new C1(10, [undefined, "", null]); -var _a_2 = [z.getA(), z.getB(), z.getC()], z_a = _a_2[0], z_b = _a_2[1], z_c = _a_2[2]; +var _c = [z.getA(), z.getB(), z.getC()], z_a = _c[0], z_b = _c[1], z_c = _c[2]; diff --git a/tests/baselines/reference/destructuringParameterProperties3.js b/tests/baselines/reference/destructuringParameterProperties3.js index be835bdfe22..fe9e69d7e5b 100644 --- a/tests/baselines/reference/destructuringParameterProperties3.js +++ b/tests/baselines/reference/destructuringParameterProperties3.js @@ -56,8 +56,8 @@ var C1 = (function () { var x = new C1(undefined, [0, true, ""]); var _a = [x.getA(), x.getB(), x.getC()], x_a = _a[0], x_b = _a[1], x_c = _a[2]; var y = new C1(10, [0, true, true]); -var _a_1 = [y.getA(), y.getB(), y.getC()], y_a = _a_1[0], y_b = _a_1[1], y_c = _a_1[2]; +var _b = [y.getA(), y.getB(), y.getC()], y_a = _b[0], y_b = _b[1], y_c = _b[2]; var z = new C1(10, [undefined, "", ""]); -var _a_2 = [z.getA(), z.getB(), z.getC()], z_a = _a_2[0], z_b = _a_2[1], z_c = _a_2[2]; +var _c = [z.getA(), z.getB(), z.getC()], z_a = _c[0], z_b = _c[1], z_c = _c[2]; var w = new C1(10, [undefined, undefined, undefined]); -var _a_3 = [z.getA(), z.getB(), z.getC()], z_a = _a_3[0], z_b = _a_3[1], z_c = _a_3[2]; +var _d = [z.getA(), z.getB(), z.getC()], z_a = _d[0], z_b = _d[1], z_c = _d[2]; diff --git a/tests/baselines/reference/destructuringParameterProperties5.js b/tests/baselines/reference/destructuringParameterProperties5.js index 5046d41472d..d9b1710ae89 100644 --- a/tests/baselines/reference/destructuringParameterProperties5.js +++ b/tests/baselines/reference/destructuringParameterProperties5.js @@ -15,7 +15,7 @@ var [a_x1, a_x2, a_x3, a_y, a_z] = [a.x1, a.x2, a.x3, a.y, a.z]; //// [destructuringParameterProperties5.js] var C1 = (function () { function C1(_a) { - var _a_1 = _a[0], x1 = _a_1.x1, x2 = _a_1.x2, x3 = _a_1.x3, y = _a[1], z = _a[2]; + var _b = _a[0], x1 = _b.x1, x2 = _b.x2, x3 = _b.x3, y = _a[1], z = _a[2]; this.[{ x1, x2, x3 }, y, z] = [{ x1, x2, x3 }, y, z]; var foo = x1 || x2 || x3 || y || z; var bar = this.x1 || this.x2 || this.x3 || this.y || this.z; diff --git a/tests/baselines/reference/parserES5ForOfStatement11.js b/tests/baselines/reference/parserES5ForOfStatement11.js index 318909b3728..0cde774a4dd 100644 --- a/tests/baselines/reference/parserES5ForOfStatement11.js +++ b/tests/baselines/reference/parserES5ForOfStatement11.js @@ -4,5 +4,5 @@ for (const [a, b] of X) { //// [parserES5ForOfStatement11.js] for (var _i = 0, _a = X; _i < _a.length; _i++) { - var _a_1 = _a[_i], a = _a_1[0], b = _a_1[1]; + var _b = _a[_i], a = _b[0], b = _b[1]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement12.js b/tests/baselines/reference/parserES5ForOfStatement12.js index 5e1e3b50032..1826005c09a 100644 --- a/tests/baselines/reference/parserES5ForOfStatement12.js +++ b/tests/baselines/reference/parserES5ForOfStatement12.js @@ -4,5 +4,5 @@ for (const {a, b} of X) { //// [parserES5ForOfStatement12.js] for (var _i = 0, _a = X; _i < _a.length; _i++) { - var _a_1 = _a[_i], a = _a_1.a, b = _a_1.b; + var _b = _a[_i], a = _b.a, b = _b.b; } diff --git a/tests/baselines/reference/parserES5ForOfStatement13.js b/tests/baselines/reference/parserES5ForOfStatement13.js index aa3bd712a3b..5d1c725ee21 100644 --- a/tests/baselines/reference/parserES5ForOfStatement13.js +++ b/tests/baselines/reference/parserES5ForOfStatement13.js @@ -4,5 +4,5 @@ for (let {a, b} of X) { //// [parserES5ForOfStatement13.js] for (var _i = 0, _a = X; _i < _a.length; _i++) { - var _a_1 = _a[_i], a = _a_1.a, b = _a_1.b; + var _b = _a[_i], a = _b.a, b = _b.b; } diff --git a/tests/baselines/reference/parserES5ForOfStatement14.js b/tests/baselines/reference/parserES5ForOfStatement14.js index 4e31742d94c..9edbf845174 100644 --- a/tests/baselines/reference/parserES5ForOfStatement14.js +++ b/tests/baselines/reference/parserES5ForOfStatement14.js @@ -4,5 +4,5 @@ for (let [a, b] of X) { //// [parserES5ForOfStatement14.js] for (var _i = 0, _a = X; _i < _a.length; _i++) { - var _a_1 = _a[_i], a = _a_1[0], b = _a_1[1]; + var _b = _a[_i], a = _b[0], b = _b[1]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement15.js b/tests/baselines/reference/parserES5ForOfStatement15.js index 4df81205333..39c0ddd879b 100644 --- a/tests/baselines/reference/parserES5ForOfStatement15.js +++ b/tests/baselines/reference/parserES5ForOfStatement15.js @@ -4,5 +4,5 @@ for (var [a, b] of X) { //// [parserES5ForOfStatement15.js] for (var _i = 0, _a = X; _i < _a.length; _i++) { - var _a_1 = _a[_i], a = _a_1[0], b = _a_1[1]; + var _b = _a[_i], a = _b[0], b = _b[1]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement16.js b/tests/baselines/reference/parserES5ForOfStatement16.js index a944fdb5a5f..956ce126390 100644 --- a/tests/baselines/reference/parserES5ForOfStatement16.js +++ b/tests/baselines/reference/parserES5ForOfStatement16.js @@ -4,5 +4,5 @@ for (var {a, b} of X) { //// [parserES5ForOfStatement16.js] for (var _i = 0, _a = X; _i < _a.length; _i++) { - var _a_1 = _a[_i], a = _a_1.a, b = _a_1.b; + var _b = _a[_i], a = _b.a, b = _b.b; } diff --git a/tests/baselines/reference/parserES5ForOfStatement2.js b/tests/baselines/reference/parserES5ForOfStatement2.js index 0acc5abb671..1666cbdf7ae 100644 --- a/tests/baselines/reference/parserES5ForOfStatement2.js +++ b/tests/baselines/reference/parserES5ForOfStatement2.js @@ -4,5 +4,5 @@ for (var of X) { //// [parserES5ForOfStatement2.js] for (var _i = 0, _a = X; _i < _a.length; _i++) { - var _a_1 = _a[_i]; + var _b = _a[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement21.js b/tests/baselines/reference/parserES5ForOfStatement21.js index 2a8734b90af..26ea78e3089 100644 --- a/tests/baselines/reference/parserES5ForOfStatement21.js +++ b/tests/baselines/reference/parserES5ForOfStatement21.js @@ -3,5 +3,5 @@ for (var of of) { } //// [parserES5ForOfStatement21.js] for (var _i = 0, _a = of; _i < _a.length; _i++) { - var _a_1 = _a[_i]; + var _b = _a[_i]; } diff --git a/tests/baselines/reference/restElementMustBeLast.js b/tests/baselines/reference/restElementMustBeLast.js index 9cb96b7e1e6..337cb6de6f6 100644 --- a/tests/baselines/reference/restElementMustBeLast.js +++ b/tests/baselines/reference/restElementMustBeLast.js @@ -5,5 +5,5 @@ var [...a, x] = [1, 2, 3]; // Error, rest must be last element //// [restElementMustBeLast.js] var _a = [1, 2, 3], x = _a[1]; // Error, rest must be last element -_a_1 = [1, 2, 3], x = _a_1[1]; // Error, rest must be last element -var _a_1; +_b = [1, 2, 3], x = _b[1]; // Error, rest must be last element +var _b; diff --git a/tests/baselines/reference/restElementWithNullInitializer.js b/tests/baselines/reference/restElementWithNullInitializer.js index 9b314a5ed19..9f326602fb8 100644 --- a/tests/baselines/reference/restElementWithNullInitializer.js +++ b/tests/baselines/reference/restElementWithNullInitializer.js @@ -14,14 +14,14 @@ function foo4([...r] = []) { //// [restElementWithNullInitializer.js] function foo1(_a) { - var _a_1 = _a === void 0 ? null : _a, r = _a_1.slice(0); + var _b = _a === void 0 ? null : _a, r = _b.slice(0); } function foo2(_a) { - var _a_1 = _a === void 0 ? undefined : _a, r = _a_1.slice(0); + var _b = _a === void 0 ? undefined : _a, r = _b.slice(0); } function foo3(_a) { - var _a_1 = _a === void 0 ? {} : _a, r = _a_1.slice(0); + var _b = _a === void 0 ? {} : _a, r = _b.slice(0); } function foo4(_a) { - var _a_1 = _a === void 0 ? [] : _a, r = _a_1.slice(0); + var _b = _a === void 0 ? [] : _a, r = _b.slice(0); } diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js index fad2c81f0eb..9d3531c2667 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js @@ -99,62 +99,62 @@ function noParams(n) { } (_a = [""], _a.raw = [""], noParams(_a)); // Generic tag with parameter which does not use type parameter function noGenericParams(n) { } -(_a_1 = [""], _a_1.raw = [""], noGenericParams(_a_1)); +(_b = [""], _b.raw = [""], noGenericParams(_b)); // Generic tag with multiple type parameters and only one used in parameter type annotation function someGenerics1a(n, m) { } -(_a_2 = ["", ""], _a_2.raw = ["", ""], someGenerics1a(_a_2, 3)); +(_c = ["", ""], _c.raw = ["", ""], someGenerics1a(_c, 3)); function someGenerics1b(n, m) { } -(_a_3 = ["", ""], _a_3.raw = ["", ""], someGenerics1b(_a_3, 3)); +(_d = ["", ""], _d.raw = ["", ""], someGenerics1b(_d, 3)); // Generic tag with argument of function type whose parameter is of type parameter type function someGenerics2a(strs, n) { } -(_a_4 = ["", ""], _a_4.raw = ["", ""], someGenerics2a(_a_4, function (n) { return n; })); +(_e = ["", ""], _e.raw = ["", ""], someGenerics2a(_e, function (n) { return n; })); function someGenerics2b(strs, n) { } -(_a_5 = ["", ""], _a_5.raw = ["", ""], someGenerics2b(_a_5, function (n, x) { return n; })); +(_f = ["", ""], _f.raw = ["", ""], someGenerics2b(_f, function (n, x) { return n; })); // Generic tag with argument of function type whose parameter is not of type parameter type but body/return type uses type parameter function someGenerics3(strs, producer) { } -(_a_6 = ["", ""], _a_6.raw = ["", ""], someGenerics3(_a_6, function () { return ''; })); -(_a_7 = ["", ""], _a_7.raw = ["", ""], someGenerics3(_a_7, function () { return undefined; })); -(_a_8 = ["", ""], _a_8.raw = ["", ""], someGenerics3(_a_8, function () { return 3; })); +(_g = ["", ""], _g.raw = ["", ""], someGenerics3(_g, function () { return ''; })); +(_h = ["", ""], _h.raw = ["", ""], someGenerics3(_h, function () { return undefined; })); +(_j = ["", ""], _j.raw = ["", ""], someGenerics3(_j, function () { return 3; })); // 2 parameter generic tag with argument 1 of type parameter type and argument 2 of function type whose parameter is of type parameter type function someGenerics4(strs, n, f) { } -(_a_9 = ["", "", ""], _a_9.raw = ["", "", ""], someGenerics4(_a_9, 4, function () { return null; })); -(_a_10 = ["", "", ""], _a_10.raw = ["", "", ""], someGenerics4(_a_10, '', function () { return 3; })); -(_a_11 = ["", "", ""], _a_11.raw = ["", "", ""], someGenerics4(_a_11, null, null)); +(_k = ["", "", ""], _k.raw = ["", "", ""], someGenerics4(_k, 4, function () { return null; })); +(_l = ["", "", ""], _l.raw = ["", "", ""], someGenerics4(_l, '', function () { return 3; })); +(_m = ["", "", ""], _m.raw = ["", "", ""], someGenerics4(_m, null, null)); // 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type function someGenerics5(strs, n, f) { } -(_a_12 = ["", " ", ""], _a_12.raw = ["", " ", ""], someGenerics5(_a_12, 4, function () { return null; })); -(_a_13 = ["", "", ""], _a_13.raw = ["", "", ""], someGenerics5(_a_13, '', function () { return 3; })); -(_a_14 = ["", "", ""], _a_14.raw = ["", "", ""], someGenerics5(_a_14, null, null)); +(_n = ["", " ", ""], _n.raw = ["", " ", ""], someGenerics5(_n, 4, function () { return null; })); +(_o = ["", "", ""], _o.raw = ["", "", ""], someGenerics5(_o, '', function () { return 3; })); +(_p = ["", "", ""], _p.raw = ["", "", ""], someGenerics5(_p, null, null)); // Generic tag with multiple arguments of function types that each have parameters of the same generic type function someGenerics6(strs, a, b, c) { } -(_a_15 = ["", "", "", ""], _a_15.raw = ["", "", "", ""], someGenerics6(_a_15, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); -(_a_16 = ["", "", "", ""], _a_16.raw = ["", "", "", ""], someGenerics6(_a_16, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); -(_a_17 = ["", "", "", ""], _a_17.raw = ["", "", "", ""], someGenerics6(_a_17, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_q = ["", "", "", ""], _q.raw = ["", "", "", ""], someGenerics6(_q, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_r = ["", "", "", ""], _r.raw = ["", "", "", ""], someGenerics6(_r, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_s = ["", "", "", ""], _s.raw = ["", "", "", ""], someGenerics6(_s, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); // Generic tag with multiple arguments of function types that each have parameters of different generic type function someGenerics7(strs, a, b, c) { } -(_a_18 = ["", "", "", ""], _a_18.raw = ["", "", "", ""], someGenerics7(_a_18, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); -(_a_19 = ["", "", "", ""], _a_19.raw = ["", "", "", ""], someGenerics7(_a_19, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); -(_a_20 = ["", "", "", ""], _a_20.raw = ["", "", "", ""], someGenerics7(_a_20, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_t = ["", "", "", ""], _t.raw = ["", "", "", ""], someGenerics7(_t, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_u = ["", "", "", ""], _u.raw = ["", "", "", ""], someGenerics7(_u, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +(_v = ["", "", "", ""], _v.raw = ["", "", "", ""], someGenerics7(_v, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); // Generic tag with argument of generic function type function someGenerics8(strs, n) { return n; } -var x = (_a_21 = ["", ""], _a_21.raw = ["", ""], someGenerics8(_a_21, someGenerics7)); -(_a_22 = ["", "", "", ""], _a_22.raw = ["", "", "", ""], x(_a_22, null, null, null)); +var x = (_w = ["", ""], _w.raw = ["", ""], someGenerics8(_w, someGenerics7)); +(_x = ["", "", "", ""], _x.raw = ["", "", "", ""], x(_x, null, null, null)); // Generic tag with multiple parameters of generic type passed arguments with no best common type function someGenerics9(strs, a, b, c) { return null; } -var a9a = (_a_23 = ["", "", "", ""], _a_23.raw = ["", "", "", ""], someGenerics9(_a_23, '', 0, [])); +var a9a = (_y = ["", "", "", ""], _y.raw = ["", "", "", ""], someGenerics9(_y, '', 0, [])); var a9a; -var a9e = (_a_24 = ["", "", "", ""], _a_24.raw = ["", "", "", ""], someGenerics9(_a_24, undefined, { x: 6, z: new Date() }, { x: 6, y: '' })); +var a9e = (_z = ["", "", "", ""], _z.raw = ["", "", "", ""], someGenerics9(_z, undefined, { x: 6, z: new Date() }, { x: 6, y: '' })); var a9e; // Generic tag with multiple parameters of generic type passed arguments with a single best common type -var a9d = (_a_25 = ["", "", "", ""], _a_25.raw = ["", "", "", ""], someGenerics9(_a_25, { x: 3 }, { x: 6 }, { x: 6 })); +var a9d = (_0 = ["", "", "", ""], _0.raw = ["", "", "", ""], someGenerics9(_0, { x: 3 }, { x: 6 }, { x: 6 })); var a9d; // Generic tag with multiple parameters of generic type where one argument is of type 'any' var anyVar; -var a = (_a_26 = ["", "", "", ""], _a_26.raw = ["", "", "", ""], someGenerics9(_a_26, 7, anyVar, 4)); +var a = (_1 = ["", "", "", ""], _1.raw = ["", "", "", ""], someGenerics9(_1, 7, anyVar, 4)); var a; // Generic tag with multiple parameters of generic type where one argument is [] and the other is not 'any' -var arr = (_a_27 = ["", "", "", ""], _a_27.raw = ["", "", "", ""], someGenerics9(_a_27, [], null, undefined)); +var arr = (_2 = ["", "", "", ""], _2.raw = ["", "", "", ""], someGenerics9(_2, [], null, undefined)); var arr; -var _a, _a_1, _a_2, _a_3, _a_4, _a_5, _a_6, _a_7, _a_8, _a_9, _a_10, _a_11, _a_12, _a_13, _a_14, _a_15, _a_16, _a_17, _a_18, _a_19, _a_20, _a_21, _a_22, _a_23, _a_24, _a_25, _a_26, _a_27; +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2; diff --git a/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js b/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js index 972e0cfcf65..9d113793228 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js +++ b/tests/baselines/reference/taggedTemplateStringsWithIncompatibleTypedTags.js @@ -36,14 +36,14 @@ f.thisIsNotATag(`abc${1}def${2}ghi`); //// [taggedTemplateStringsWithIncompatibleTypedTags.js] var f; (_a = ["abc"], _a.raw = ["abc"], f(_a)); -(_a_1 = ["abc", "def", "ghi"], _a_1.raw = ["abc", "def", "ghi"], f(_a_1, 1, 2)); -(_a_2 = ["abc"], _a_2.raw = ["abc"], f(_a_2)).member; -(_a_3 = ["abc", "def", "ghi"], _a_3.raw = ["abc", "def", "ghi"], f(_a_3, 1, 2)).member; -(_a_4 = ["abc"], _a_4.raw = ["abc"], f(_a_4))["member"]; -(_a_5 = ["abc", "def", "ghi"], _a_5.raw = ["abc", "def", "ghi"], f(_a_5, 1, 2))["member"]; -(_a_6 = ["abc", "def", "ghi"], _a_6.raw = ["abc", "def", "ghi"], (_a_7 = ["abc"], _a_7.raw = ["abc"], f(_a_7))[0].member(_a_6, 1, 2)); -(_a_8 = ["abc", "def", "ghi"], _a_8.raw = ["abc", "def", "ghi"], (_a_9 = ["abc", "def", "ghi"], _a_9.raw = ["abc", "def", "ghi"], f(_a_9, 1, 2))["member"].member(_a_8, 1, 2)); -(_a_10 = ["abc", "def", "ghi"], _a_10.raw = ["abc", "def", "ghi"], (_a_11 = ["abc", "def", "ghi"], _a_11.raw = ["abc", "def", "ghi"], f(_a_11, true, true))["member"].member(_a_10, 1, 2)); +(_b = ["abc", "def", "ghi"], _b.raw = ["abc", "def", "ghi"], f(_b, 1, 2)); +(_c = ["abc"], _c.raw = ["abc"], f(_c)).member; +(_d = ["abc", "def", "ghi"], _d.raw = ["abc", "def", "ghi"], f(_d, 1, 2)).member; +(_e = ["abc"], _e.raw = ["abc"], f(_e))["member"]; +(_f = ["abc", "def", "ghi"], _f.raw = ["abc", "def", "ghi"], f(_f, 1, 2))["member"]; +(_g = ["abc", "def", "ghi"], _g.raw = ["abc", "def", "ghi"], (_h = ["abc"], _h.raw = ["abc"], f(_h))[0].member(_g, 1, 2)); +(_j = ["abc", "def", "ghi"], _j.raw = ["abc", "def", "ghi"], (_k = ["abc", "def", "ghi"], _k.raw = ["abc", "def", "ghi"], f(_k, 1, 2))["member"].member(_j, 1, 2)); +(_l = ["abc", "def", "ghi"], _l.raw = ["abc", "def", "ghi"], (_m = ["abc", "def", "ghi"], _m.raw = ["abc", "def", "ghi"], f(_m, true, true))["member"].member(_l, 1, 2)); f.thisIsNotATag("abc"); f.thisIsNotATag("abc" + 1 + "def" + 2 + "ghi"); -var _a, _a_1, _a_2, _a_3, _a_4, _a_5, _a_6, _a_7, _a_8, _a_9, _a_10, _a_11; +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js index cb5df24cb77..431447df22e 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution1.js @@ -37,9 +37,9 @@ var d = foo([], 1, true); // boolean (with error) var e = foo([], 1, "2"); // {} var f = foo([], 1, 2, 3); // any (with error) var u = (_a = [""], _a.raw = [""], foo(_a)); // number -var v = (_a_1 = ["", ""], _a_1.raw = ["", ""], foo(_a_1, 1)); // string -var w = (_a_2 = ["", "", ""], _a_2.raw = ["", "", ""], foo(_a_2, 1, 2)); // boolean -var x = (_a_3 = ["", "", ""], _a_3.raw = ["", "", ""], foo(_a_3, 1, true)); // boolean (with error) -var y = (_a_4 = ["", "", ""], _a_4.raw = ["", "", ""], foo(_a_4, 1, "2")); // {} -var z = (_a_5 = ["", "", "", ""], _a_5.raw = ["", "", "", ""], foo(_a_5, 1, 2, 3)); // any (with error) -var _a, _a_1, _a_2, _a_3, _a_4, _a_5; +var v = (_b = ["", ""], _b.raw = ["", ""], foo(_b, 1)); // string +var w = (_c = ["", "", ""], _c.raw = ["", "", ""], foo(_c, 1, 2)); // boolean +var x = (_d = ["", "", ""], _d.raw = ["", "", ""], foo(_d, 1, true)); // boolean (with error) +var y = (_e = ["", "", ""], _e.raw = ["", "", ""], foo(_e, 1, "2")); // {} +var z = (_f = ["", "", "", ""], _f.raw = ["", "", "", ""], foo(_f, 1, 2, 3)); // any (with error) +var _a, _b, _c, _d, _e, _f; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js index f17e1bbd2ee..f12008f9581 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2.js @@ -35,6 +35,6 @@ function foo2() { } return undefined; } -var c = (_a_1 = ["", ""], _a_1.raw = ["", ""], foo2(_a_1, 1)); // number +var c = (_b = ["", ""], _b.raw = ["", ""], foo2(_b, 1)); // number var d = foo2([], 1); // number -var _a, _a_1; +var _a, _b; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js index 2176c433042..4b9df44d3f7 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js @@ -77,39 +77,39 @@ fn5 `${ (n) => n.substr(0) }`; function fn1() { return null; } var s = (_a = ["", ""], _a.raw = ["", ""], fn1(_a, undefined)); // No candidate overloads found -(_a_1 = ["", ""], _a_1.raw = ["", ""], fn1(_a_1, {})); // Error +(_b = ["", ""], _b.raw = ["", ""], fn1(_b, {})); // Error function fn2() { return undefined; } -var d1 = (_a_2 = ["", "", ""], _a_2.raw = ["", "", ""], fn2(_a_2, 0, undefined)); // contextually typed -var d2 = (_a_3 = ["", "", ""], _a_3.raw = ["", "", ""], fn2(_a_3, 0, undefined)); // any +var d1 = (_c = ["", "", ""], _c.raw = ["", "", ""], fn2(_c, 0, undefined)); // contextually typed +var d2 = (_d = ["", "", ""], _d.raw = ["", "", ""], fn2(_d, 0, undefined)); // any d1.foo(); // error d2(); // no error (typed as any) // Generic and non-generic overload where generic overload is the only candidate -(_a_4 = ["", "", ""], _a_4.raw = ["", "", ""], fn2(_a_4, 0, '')); // OK +(_e = ["", "", ""], _e.raw = ["", "", ""], fn2(_e, 0, '')); // OK // Generic and non-generic overload where non-generic overload is the only candidate -(_a_5 = ["", "", ""], _a_5.raw = ["", "", ""], fn2(_a_5, '', 0)); // OK +(_f = ["", "", ""], _f.raw = ["", "", ""], fn2(_f, '', 0)); // OK function fn3() { return null; } -var s = (_a_6 = ["", ""], _a_6.raw = ["", ""], fn3(_a_6, 3)); -var s = (_a_7 = ["", "", "", ""], _a_7.raw = ["", "", "", ""], fn3(_a_7, '', 3, '')); -var n = (_a_8 = ["", "", "", ""], _a_8.raw = ["", "", "", ""], fn3(_a_8, 5, 5, 5)); +var s = (_g = ["", ""], _g.raw = ["", ""], fn3(_g, 3)); +var s = (_h = ["", "", "", ""], _h.raw = ["", "", "", ""], fn3(_h, '', 3, '')); +var n = (_j = ["", "", "", ""], _j.raw = ["", "", "", ""], fn3(_j, 5, 5, 5)); var n; // Generic overloads with differing arity tagging with arguments matching each overload type parameter count -var s = (_a_9 = ["", ""], _a_9.raw = ["", ""], fn3(_a_9, 4)); -var s = (_a_10 = ["", "", "", ""], _a_10.raw = ["", "", "", ""], fn3(_a_10, '', '', '')); -var n = (_a_11 = ["", "", "", ""], _a_11.raw = ["", "", "", ""], fn3(_a_11, '', '', 3)); +var s = (_k = ["", ""], _k.raw = ["", ""], fn3(_k, 4)); +var s = (_l = ["", "", "", ""], _l.raw = ["", "", "", ""], fn3(_l, '', '', '')); +var n = (_m = ["", "", "", ""], _m.raw = ["", "", "", ""], fn3(_m, '', '', 3)); // Generic overloads with differing arity tagging with argument count that doesn't match any overload -(_a_12 = [""], _a_12.raw = [""], fn3(_a_12)); // Error +(_n = [""], _n.raw = [""], fn3(_n)); // Error function fn4() { } // Generic overloads with constraints tagged with types that satisfy the constraints -(_a_13 = ["", "", ""], _a_13.raw = ["", "", ""], fn4(_a_13, '', 3)); -(_a_14 = ["", "", ""], _a_14.raw = ["", "", ""], fn4(_a_14, 3, '')); -(_a_15 = ["", "", ""], _a_15.raw = ["", "", ""], fn4(_a_15, 3, undefined)); -(_a_16 = ["", "", ""], _a_16.raw = ["", "", ""], fn4(_a_16, '', null)); +(_o = ["", "", ""], _o.raw = ["", "", ""], fn4(_o, '', 3)); +(_p = ["", "", ""], _p.raw = ["", "", ""], fn4(_p, 3, '')); +(_q = ["", "", ""], _q.raw = ["", "", ""], fn4(_q, 3, undefined)); +(_r = ["", "", ""], _r.raw = ["", "", ""], fn4(_r, '', null)); // Generic overloads with constraints called with type arguments that do not satisfy the constraints -(_a_17 = ["", "", ""], _a_17.raw = ["", "", ""], fn4(_a_17, null, null)); // Error +(_s = ["", "", ""], _s.raw = ["", "", ""], fn4(_s, null, null)); // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints -(_a_18 = ["", "", ""], _a_18.raw = ["", "", ""], fn4(_a_18, true, null)); -(_a_19 = ["", "", ""], _a_19.raw = ["", "", ""], fn4(_a_19, null, true)); +(_t = ["", "", ""], _t.raw = ["", "", ""], fn4(_t, true, null)); +(_u = ["", "", ""], _u.raw = ["", "", ""], fn4(_u, null, true)); function fn5() { return undefined; } -(_a_20 = ["", ""], _a_20.raw = ["", ""], fn5(_a_20, function (n) { return n.toFixed(); })); // will error; 'n' should have type 'string'. -(_a_21 = ["", ""], _a_21.raw = ["", ""], fn5(_a_21, function (n) { return n.substr(0); })); -var _a, _a_1, _a_2, _a_3, _a_4, _a_5, _a_6, _a_7, _a_8, _a_9, _a_10, _a_11, _a_12, _a_13, _a_14, _a_15, _a_16, _a_17, _a_18, _a_19, _a_20, _a_21; +(_v = ["", ""], _v.raw = ["", ""], fn5(_v, function (n) { return n.toFixed(); })); // will error; 'n' should have type 'string'. +(_w = ["", ""], _w.raw = ["", ""], fn5(_w, function (n) { return n.substr(0); })); +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js index 2bcbc173ab2..fd83d9d0ba0 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTagsTypedAsAny.js @@ -28,15 +28,15 @@ f.thisIsNotATag(`abc${1}def${2}ghi`); //// [taggedTemplateStringsWithTagsTypedAsAny.js] var f; (_a = ["abc"], _a.raw = ["abc"], f(_a)); -(_a_1 = ["abc", "def", "ghi"], _a_1.raw = ["abc", "def", "ghi"], f(_a_1, 1, 2)); -(_a_2 = ["abc"], _a_2.raw = ["abc"], f.g.h(_a_2)); -(_a_3 = ["abc", "def", "ghi"], _a_3.raw = ["abc", "def", "ghi"], f.g.h(_a_3, 1, 2)); -(_a_4 = ["abc"], _a_4.raw = ["abc"], f(_a_4)).member; -(_a_5 = ["abc", "def", "ghi"], _a_5.raw = ["abc", "def", "ghi"], f(_a_5, 1, 2)).member; -(_a_6 = ["abc"], _a_6.raw = ["abc"], f(_a_6))["member"]; -(_a_7 = ["abc", "def", "ghi"], _a_7.raw = ["abc", "def", "ghi"], f(_a_7, 1, 2))["member"]; -(_a_8 = ["abc", "def", "ghi"], _a_8.raw = ["abc", "def", "ghi"], (_a_9 = ["abc"], _a_9.raw = ["abc"], f(_a_9))["member"].someOtherTag(_a_8, 1, 2)); -(_a_10 = ["abc", "def", "ghi"], _a_10.raw = ["abc", "def", "ghi"], (_a_11 = ["abc", "def", "ghi"], _a_11.raw = ["abc", "def", "ghi"], f(_a_11, 1, 2))["member"].someOtherTag(_a_10, 1, 2)); +(_b = ["abc", "def", "ghi"], _b.raw = ["abc", "def", "ghi"], f(_b, 1, 2)); +(_c = ["abc"], _c.raw = ["abc"], f.g.h(_c)); +(_d = ["abc", "def", "ghi"], _d.raw = ["abc", "def", "ghi"], f.g.h(_d, 1, 2)); +(_e = ["abc"], _e.raw = ["abc"], f(_e)).member; +(_f = ["abc", "def", "ghi"], _f.raw = ["abc", "def", "ghi"], f(_f, 1, 2)).member; +(_g = ["abc"], _g.raw = ["abc"], f(_g))["member"]; +(_h = ["abc", "def", "ghi"], _h.raw = ["abc", "def", "ghi"], f(_h, 1, 2))["member"]; +(_j = ["abc", "def", "ghi"], _j.raw = ["abc", "def", "ghi"], (_k = ["abc"], _k.raw = ["abc"], f(_k))["member"].someOtherTag(_j, 1, 2)); +(_l = ["abc", "def", "ghi"], _l.raw = ["abc", "def", "ghi"], (_m = ["abc", "def", "ghi"], _m.raw = ["abc", "def", "ghi"], f(_m, 1, 2))["member"].someOtherTag(_l, 1, 2)); f.thisIsNotATag("abc"); f.thisIsNotATag("abc" + 1 + "def" + 2 + "ghi"); -var _a, _a_1, _a_2, _a_3, _a_4, _a_5, _a_6, _a_7, _a_8, _a_9, _a_10, _a_11; +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js index 16b14d32d93..fcc2cda86dc 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypedTags.js @@ -34,13 +34,13 @@ f.thisIsNotATag(`abc${1}def${2}ghi`); //// [taggedTemplateStringsWithTypedTags.js] var f; (_a = ["abc"], _a.raw = ["abc"], f(_a)); -(_a_1 = ["abc", "def", "ghi"], _a_1.raw = ["abc", "def", "ghi"], f(_a_1, 1, 2)); -(_a_2 = ["abc"], _a_2.raw = ["abc"], f(_a_2)).member; -(_a_3 = ["abc", "def", "ghi"], _a_3.raw = ["abc", "def", "ghi"], f(_a_3, 1, 2)).member; -(_a_4 = ["abc"], _a_4.raw = ["abc"], f(_a_4))["member"]; -(_a_5 = ["abc", "def", "ghi"], _a_5.raw = ["abc", "def", "ghi"], f(_a_5, 1, 2))["member"]; -(_a_6 = ["abc", "def", "ghi"], _a_6.raw = ["abc", "def", "ghi"], (_a_7 = ["abc"], _a_7.raw = ["abc"], f(_a_7))[0].member(_a_6, 1, 2)); -(_a_8 = ["abc", "def", "ghi"], _a_8.raw = ["abc", "def", "ghi"], (_a_9 = ["abc", "def", "ghi"], _a_9.raw = ["abc", "def", "ghi"], f(_a_9, 1, 2))["member"].member(_a_8, 1, 2)); +(_b = ["abc", "def", "ghi"], _b.raw = ["abc", "def", "ghi"], f(_b, 1, 2)); +(_c = ["abc"], _c.raw = ["abc"], f(_c)).member; +(_d = ["abc", "def", "ghi"], _d.raw = ["abc", "def", "ghi"], f(_d, 1, 2)).member; +(_e = ["abc"], _e.raw = ["abc"], f(_e))["member"]; +(_f = ["abc", "def", "ghi"], _f.raw = ["abc", "def", "ghi"], f(_f, 1, 2))["member"]; +(_g = ["abc", "def", "ghi"], _g.raw = ["abc", "def", "ghi"], (_h = ["abc"], _h.raw = ["abc"], f(_h))[0].member(_g, 1, 2)); +(_j = ["abc", "def", "ghi"], _j.raw = ["abc", "def", "ghi"], (_k = ["abc", "def", "ghi"], _k.raw = ["abc", "def", "ghi"], f(_k, 1, 2))["member"].member(_j, 1, 2)); f.thisIsNotATag("abc"); f.thisIsNotATag("abc" + 1 + "def" + 2 + "ghi"); -var _a, _a_1, _a_2, _a_3, _a_4, _a_5, _a_6, _a_7, _a_8, _a_9; +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; diff --git a/tests/baselines/reference/templateStringInModuleName.js b/tests/baselines/reference/templateStringInModuleName.js index 9ebb92a3801..36f619176e4 100644 --- a/tests/baselines/reference/templateStringInModuleName.js +++ b/tests/baselines/reference/templateStringInModuleName.js @@ -11,7 +11,7 @@ declare; { } declare; -(_a_1 = ["M", ""], _a_1.raw = ["M", ""], module(_a_1, 2)); +(_b = ["M", ""], _b.raw = ["M", ""], module(_b, 2)); { } -var _a, _a_1; +var _a, _b; From 4bb0587dd44d173f0bb979988df6be0d14442b3f Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 4 Mar 2015 15:50:43 -0800 Subject: [PATCH 011/101] Fix createTempVariable to always record the name in the currentScopeNames --- src/compiler/emitter.ts | 11 ++++++++++- tests/baselines/reference/ES5For-of10.js | 4 ++-- tests/baselines/reference/ES5For-of15.js | 4 ++-- tests/baselines/reference/ES5For-of16.js | 4 ++-- tests/baselines/reference/ES5For-of17.js | 4 ++-- tests/baselines/reference/ES5For-of18.js | 4 ++-- tests/baselines/reference/ES5For-of19.js | 4 ++-- tests/baselines/reference/ES5For-of20.js | 4 ++-- tests/baselines/reference/ES5For-of21.js | 2 +- tests/baselines/reference/ES5For-of22.js | 12 ++++++++++++ tests/baselines/reference/ES5For-of23.js | 12 ++++++++++++ tests/baselines/reference/ES5For-of6.js | 4 ++-- tests/baselines/reference/ES5For-of7.js | 4 ++-- tests/baselines/reference/ES5For-of9.js | 4 ++-- .../reference/overloadResolutionOverNonCTLambdas.js | 4 ++-- .../statements/for-ofStatements/ES5For-of22.ts | 4 ++++ .../statements/for-ofStatements/ES5For-of23.ts | 4 ++++ 17 files changed, 65 insertions(+), 24 deletions(-) create mode 100644 tests/baselines/reference/ES5For-of22.js create mode 100644 tests/baselines/reference/ES5For-of23.js create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of23.ts diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 4eb2b3a8842..693391a19ba 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1684,7 +1684,11 @@ module ts { else { name = generateUniqueName(baseName, n => isExistingName(location, n)); } - + + return putNameInCurrentScopeNames(name); + } + + function putNameInCurrentScopeNames(name: string): string { if (!currentScopeNames) { currentScopeNames = {}; } @@ -2099,6 +2103,11 @@ module ts { name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + CharacterCodes.a) : tempCount - 25); tempCount++; } + + // This is necessary so that a name generated via renameNonTopLevelLetAndConst will see the name + // we just generated. + putNameInCurrentScopeNames(name); + var result = createSynthesizedNode(SyntaxKind.Identifier); result.text = name; return result; diff --git a/tests/baselines/reference/ES5For-of10.js b/tests/baselines/reference/ES5For-of10.js index ea081ed8ab0..f12dc9d8acb 100644 --- a/tests/baselines/reference/ES5For-of10.js +++ b/tests/baselines/reference/ES5For-of10.js @@ -13,8 +13,8 @@ function foo() { } for (var _i = 0, _a = []; _i < _a.length; _i++) { foo().x = _a[_i]; - for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { - foo().x = _a_1[_i_1]; + for (var _b = 0, _c = []; _b < _c.length; _b++) { + foo().x = _c[_b]; var p = foo().x; } } diff --git a/tests/baselines/reference/ES5For-of15.js b/tests/baselines/reference/ES5For-of15.js index 90ed376b805..46d3dbd1d6e 100644 --- a/tests/baselines/reference/ES5For-of15.js +++ b/tests/baselines/reference/ES5For-of15.js @@ -10,8 +10,8 @@ for (let v of []) { for (var _i = 0, _a = []; _i < _a.length; _i++) { var v = _a[_i]; v; - for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { - var _v = _a_1[_i_1]; + for (var _b = 0, _c = []; _b < _c.length; _b++) { + var _v = _c[_b]; var x = _v; } } diff --git a/tests/baselines/reference/ES5For-of16.js b/tests/baselines/reference/ES5For-of16.js index da1f0e8b337..1649e4481f2 100644 --- a/tests/baselines/reference/ES5For-of16.js +++ b/tests/baselines/reference/ES5For-of16.js @@ -11,8 +11,8 @@ for (let v of []) { for (var _i = 0, _a = []; _i < _a.length; _i++) { var v = _a[_i]; v; - for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { - var _v = _a_1[_i_1]; + for (var _b = 0, _c = []; _b < _c.length; _b++) { + var _v = _c[_b]; var x = _v; _v++; } diff --git a/tests/baselines/reference/ES5For-of17.js b/tests/baselines/reference/ES5For-of17.js index e7f059477b5..688375b82bc 100644 --- a/tests/baselines/reference/ES5For-of17.js +++ b/tests/baselines/reference/ES5For-of17.js @@ -11,8 +11,8 @@ for (let v of []) { for (var _i = 0, _a = []; _i < _a.length; _i++) { var v = _a[_i]; v; - for (var _i_1 = 0, _a_1 = [v]; _i_1 < _a_1.length; _i_1++) { - var _v = _a_1[_i_1]; + for (var _b = 0, _c = [v]; _b < _c.length; _b++) { + var _v = _c[_b]; var x = _v; _v++; } diff --git a/tests/baselines/reference/ES5For-of18.js b/tests/baselines/reference/ES5For-of18.js index 656d4f57233..a135b8b0463 100644 --- a/tests/baselines/reference/ES5For-of18.js +++ b/tests/baselines/reference/ES5For-of18.js @@ -12,7 +12,7 @@ for (var _i = 0, _a = []; _i < _a.length; _i++) { var v = _a[_i]; v; } -for (var _i = 0, _b = []; _i < _b.length; _i++) { - var _v = _b[_i]; +for (var _b = 0, _c = []; _b < _c.length; _b++) { + var _v = _c[_b]; _v; } diff --git a/tests/baselines/reference/ES5For-of19.js b/tests/baselines/reference/ES5For-of19.js index 9ff3f9aca2a..7af9418f04f 100644 --- a/tests/baselines/reference/ES5For-of19.js +++ b/tests/baselines/reference/ES5For-of19.js @@ -14,8 +14,8 @@ for (var _i = 0, _a = []; _i < _a.length; _i++) { var v = _a[_i]; v; function foo() { - for (var _i = 0, _a = []; _i < _a.length; _i++) { - var _v = _a[_i]; + for (var _b = 0, _c = []; _b < _c.length; _b++) { + var _v = _c[_b]; _v; } } diff --git a/tests/baselines/reference/ES5For-of20.js b/tests/baselines/reference/ES5For-of20.js index 04b7cca5cc4..b70ac66b767 100644 --- a/tests/baselines/reference/ES5For-of20.js +++ b/tests/baselines/reference/ES5For-of20.js @@ -10,8 +10,8 @@ for (let v of []) { for (var _i = 0, _a = []; _i < _a.length; _i++) { var v = _a[_i]; var _v; - for (var _i_1 = 0, _a_1 = [v]; _i_1 < _a_1.length; _i_1++) { - var _v_1 = _a_1[_i_1]; + for (var _b = 0, _c = [v]; _b < _c.length; _b++) { + var _v_1 = _c[_b]; var _v_2; } } diff --git a/tests/baselines/reference/ES5For-of21.js b/tests/baselines/reference/ES5For-of21.js index e23ea282998..9356514ea6b 100644 --- a/tests/baselines/reference/ES5For-of21.js +++ b/tests/baselines/reference/ES5For-of21.js @@ -7,6 +7,6 @@ for (let v of []) { for (var _i = 0, _a = []; _i < _a.length; _i++) { var v = _a[_i]; for (var _b = 0, _c = []; _b < _c.length; _b++) { - var _i = _c[_b]; + var _i_1 = _c[_b]; } } diff --git a/tests/baselines/reference/ES5For-of22.js b/tests/baselines/reference/ES5For-of22.js new file mode 100644 index 00000000000..d5ebc55e04a --- /dev/null +++ b/tests/baselines/reference/ES5For-of22.js @@ -0,0 +1,12 @@ +//// [ES5For-of22.ts] +for (var x of [1, 2, 3]) { + let _a = 0; + console.log(x); +} + +//// [ES5For-of22.js] +for (var _i = 0, _a = [1, 2, 3]; _i < _a.length; _i++) { + var x = _a[_i]; + var _a_1 = 0; + console.log(x); +} diff --git a/tests/baselines/reference/ES5For-of23.js b/tests/baselines/reference/ES5For-of23.js new file mode 100644 index 00000000000..3842591820f --- /dev/null +++ b/tests/baselines/reference/ES5For-of23.js @@ -0,0 +1,12 @@ +//// [ES5For-of23.ts] +for (var x of [1, 2, 3]) { + var _a = 0; + console.log(x); +} + +//// [ES5For-of23.js] +for (var _i = 0, _b = [1, 2, 3]; _i < _b.length; _i++) { + var x = _b[_i]; + var _a = 0; + console.log(x); +} diff --git a/tests/baselines/reference/ES5For-of6.js b/tests/baselines/reference/ES5For-of6.js index e0b134407c0..bf966a0a5ae 100644 --- a/tests/baselines/reference/ES5For-of6.js +++ b/tests/baselines/reference/ES5For-of6.js @@ -8,8 +8,8 @@ for (var w of []) { //// [ES5For-of6.js] for (var _i = 0, _a = []; _i < _a.length; _i++) { var w = _a[_i]; - for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { - var v = _a_1[_i_1]; + for (var _b = 0, _c = []; _b < _c.length; _b++) { + var v = _c[_b]; var x = [w, v]; } } diff --git a/tests/baselines/reference/ES5For-of7.js b/tests/baselines/reference/ES5For-of7.js index 474cb2749ad..ad2302cdc5c 100644 --- a/tests/baselines/reference/ES5For-of7.js +++ b/tests/baselines/reference/ES5For-of7.js @@ -12,7 +12,7 @@ for (var _i = 0, _a = []; _i < _a.length; _i++) { var w = _a[_i]; var x = w; } -for (var _i = 0, _b = []; _i < _b.length; _i++) { - var v = _b[_i]; +for (var _b = 0, _c = []; _b < _c.length; _b++) { + var v = _c[_b]; var x = [w, v]; } diff --git a/tests/baselines/reference/ES5For-of9.js b/tests/baselines/reference/ES5For-of9.js index f0c5142d4eb..3a2cd2b1f74 100644 --- a/tests/baselines/reference/ES5For-of9.js +++ b/tests/baselines/reference/ES5For-of9.js @@ -14,8 +14,8 @@ function foo() { } for (var _i = 0, _a = []; _i < _a.length; _i++) { foo().x = _a[_i]; - for (var _i_1 = 0, _a_1 = []; _i_1 < _a_1.length; _i_1++) { - foo().x = _a_1[_i_1]; + for (var _b = 0, _c = []; _b < _c.length; _b++) { + foo().x = _c[_b]; var p = foo().x; } } diff --git a/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js index e77e8d3371f..b29941393d1 100644 --- a/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js +++ b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js @@ -39,8 +39,8 @@ var Bugs; } var result = message.replace(/\{(\d+)\}/g, function (match) { var rest = []; - for (var _i = 1; _i < arguments.length; _i++) { - rest[_i - 1] = arguments[_i]; + for (var _a = 1; _a < arguments.length; _a++) { + rest[_a - 1] = arguments[_a]; } var index = rest[0]; return typeof args[index] !== 'undefined' ? args[index] : match; diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts new file mode 100644 index 00000000000..ef35b6efd9c --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts @@ -0,0 +1,4 @@ +for (var x of [1, 2, 3]) { + let _a = 0; + console.log(x); +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of23.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of23.ts new file mode 100644 index 00000000000..7d93246f2bb --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of23.ts @@ -0,0 +1,4 @@ +for (var x of [1, 2, 3]) { + var _a = 0; + console.log(x); +} \ No newline at end of file From 905f35091f7bb442a90ea0f7edb530bfef1cf54e Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 4 Mar 2015 16:06:37 -0800 Subject: [PATCH 012/101] Do not create a temp for RHS if it's an identifier --- src/compiler/emitter.ts | 23 +++++++++++++------ tests/baselines/reference/ES5For-of24.js | 12 ++++++++++ tests/baselines/reference/ES5For-of25.js | 14 +++++++++++ .../reference/parserES5ForOfStatement10.js | 4 ++-- .../reference/parserES5ForOfStatement11.js | 4 ++-- .../reference/parserES5ForOfStatement12.js | 4 ++-- .../reference/parserES5ForOfStatement13.js | 4 ++-- .../reference/parserES5ForOfStatement14.js | 4 ++-- .../reference/parserES5ForOfStatement15.js | 4 ++-- .../reference/parserES5ForOfStatement16.js | 4 ++-- .../reference/parserES5ForOfStatement18.js | 4 ++-- .../reference/parserES5ForOfStatement2.js | 4 ++-- .../reference/parserES5ForOfStatement21.js | 4 ++-- .../reference/parserES5ForOfStatement3.js | 4 ++-- .../reference/parserES5ForOfStatement4.js | 4 ++-- .../reference/parserES5ForOfStatement5.js | 4 ++-- .../reference/parserES5ForOfStatement6.js | 4 ++-- .../reference/parserES5ForOfStatement7.js | 4 ++-- .../reference/parserES5ForOfStatement8.js | 4 ++-- .../reference/parserES5ForOfStatement9.js | 4 ++-- .../for-ofStatements/ES5For-of24.ts | 4 ++++ .../for-ofStatements/ES5For-of25.ts | 5 ++++ 22 files changed, 85 insertions(+), 41 deletions(-) create mode 100644 tests/baselines/reference/ES5For-of24.js create mode 100644 tests/baselines/reference/ES5For-of25.js create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of24.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 693391a19ba..98a04a1d6d6 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3523,17 +3523,26 @@ module ts { // Do not call create recordTempDeclaration because we are declaring the temps // right here. Recording means they will be declared later. + // In the case where the user wrote an identifier as the RHS, like this: + // + // for (var v of arr) { } + // + // we don't want to emit a temporary variable for the RHS, just use it directly. + var rhsIsIdentifier = node.expression.kind === SyntaxKind.Identifier; var counter = createTempVariable(node, /*forLoopVariable*/ true); - var rhsReference = createTempVariable(node, /*forLoopVariable*/ false); + var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, /*forLoopVariable*/ false); - // _i = 0, + // _i = 0 emit(counter); - write(" = 0, "); + write(" = 0"); - // _a = expr; - emit(rhsReference); - write(" = "); - emit(node.expression); + if (!rhsIsIdentifier) { + // , _a = expr + write(", "); + emit(rhsReference); + write(" = "); + emit(node.expression); + } write("; "); // _i < _a.length; diff --git a/tests/baselines/reference/ES5For-of24.js b/tests/baselines/reference/ES5For-of24.js new file mode 100644 index 00000000000..d5489016523 --- /dev/null +++ b/tests/baselines/reference/ES5For-of24.js @@ -0,0 +1,12 @@ +//// [ES5For-of24.ts] +var a = [1, 2, 3]; +for (var v of a) { + let a = 0; +} + +//// [ES5For-of24.js] +var a = [1, 2, 3]; +for (var _i = 0; _i < a.length; _i++) { + var v = a[_i]; + var _a = 0; +} diff --git a/tests/baselines/reference/ES5For-of25.js b/tests/baselines/reference/ES5For-of25.js new file mode 100644 index 00000000000..5e52f7cad5d --- /dev/null +++ b/tests/baselines/reference/ES5For-of25.js @@ -0,0 +1,14 @@ +//// [ES5For-of25.ts] +var a = [1, 2, 3]; +for (var v of a) { + v; + a; +} + +//// [ES5For-of25.js] +var a = [1, 2, 3]; +for (var _i = 0; _i < a.length; _i++) { + var v = a[_i]; + v; + a; +} diff --git a/tests/baselines/reference/parserES5ForOfStatement10.js b/tests/baselines/reference/parserES5ForOfStatement10.js index e3e339b0972..cac70523022 100644 --- a/tests/baselines/reference/parserES5ForOfStatement10.js +++ b/tests/baselines/reference/parserES5ForOfStatement10.js @@ -3,6 +3,6 @@ for (const v of X) { } //// [parserES5ForOfStatement10.js] -for (var _i = 0, _a = X; _i < _a.length; _i++) { - var v = _a[_i]; +for (var _i = 0; _i < X.length; _i++) { + var v = X[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement11.js b/tests/baselines/reference/parserES5ForOfStatement11.js index 0cde774a4dd..40e4ca68d6b 100644 --- a/tests/baselines/reference/parserES5ForOfStatement11.js +++ b/tests/baselines/reference/parserES5ForOfStatement11.js @@ -3,6 +3,6 @@ for (const [a, b] of X) { } //// [parserES5ForOfStatement11.js] -for (var _i = 0, _a = X; _i < _a.length; _i++) { - var _b = _a[_i], a = _b[0], b = _b[1]; +for (var _i = 0; _i < X.length; _i++) { + var _a = X[_i], a = _a[0], b = _a[1]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement12.js b/tests/baselines/reference/parserES5ForOfStatement12.js index 1826005c09a..f877ebdb757 100644 --- a/tests/baselines/reference/parserES5ForOfStatement12.js +++ b/tests/baselines/reference/parserES5ForOfStatement12.js @@ -3,6 +3,6 @@ for (const {a, b} of X) { } //// [parserES5ForOfStatement12.js] -for (var _i = 0, _a = X; _i < _a.length; _i++) { - var _b = _a[_i], a = _b.a, b = _b.b; +for (var _i = 0; _i < X.length; _i++) { + var _a = X[_i], a = _a.a, b = _a.b; } diff --git a/tests/baselines/reference/parserES5ForOfStatement13.js b/tests/baselines/reference/parserES5ForOfStatement13.js index 5d1c725ee21..45199480518 100644 --- a/tests/baselines/reference/parserES5ForOfStatement13.js +++ b/tests/baselines/reference/parserES5ForOfStatement13.js @@ -3,6 +3,6 @@ for (let {a, b} of X) { } //// [parserES5ForOfStatement13.js] -for (var _i = 0, _a = X; _i < _a.length; _i++) { - var _b = _a[_i], a = _b.a, b = _b.b; +for (var _i = 0; _i < X.length; _i++) { + var _a = X[_i], a = _a.a, b = _a.b; } diff --git a/tests/baselines/reference/parserES5ForOfStatement14.js b/tests/baselines/reference/parserES5ForOfStatement14.js index 9edbf845174..d05fdb96e57 100644 --- a/tests/baselines/reference/parserES5ForOfStatement14.js +++ b/tests/baselines/reference/parserES5ForOfStatement14.js @@ -3,6 +3,6 @@ for (let [a, b] of X) { } //// [parserES5ForOfStatement14.js] -for (var _i = 0, _a = X; _i < _a.length; _i++) { - var _b = _a[_i], a = _b[0], b = _b[1]; +for (var _i = 0; _i < X.length; _i++) { + var _a = X[_i], a = _a[0], b = _a[1]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement15.js b/tests/baselines/reference/parserES5ForOfStatement15.js index 39c0ddd879b..0af74961145 100644 --- a/tests/baselines/reference/parserES5ForOfStatement15.js +++ b/tests/baselines/reference/parserES5ForOfStatement15.js @@ -3,6 +3,6 @@ for (var [a, b] of X) { } //// [parserES5ForOfStatement15.js] -for (var _i = 0, _a = X; _i < _a.length; _i++) { - var _b = _a[_i], a = _b[0], b = _b[1]; +for (var _i = 0; _i < X.length; _i++) { + var _a = X[_i], a = _a[0], b = _a[1]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement16.js b/tests/baselines/reference/parserES5ForOfStatement16.js index 956ce126390..1e7c6e005a8 100644 --- a/tests/baselines/reference/parserES5ForOfStatement16.js +++ b/tests/baselines/reference/parserES5ForOfStatement16.js @@ -3,6 +3,6 @@ for (var {a, b} of X) { } //// [parserES5ForOfStatement16.js] -for (var _i = 0, _a = X; _i < _a.length; _i++) { - var _b = _a[_i], a = _b.a, b = _b.b; +for (var _i = 0; _i < X.length; _i++) { + var _a = X[_i], a = _a.a, b = _a.b; } diff --git a/tests/baselines/reference/parserES5ForOfStatement18.js b/tests/baselines/reference/parserES5ForOfStatement18.js index 02aa0b59422..905ba9c1d1e 100644 --- a/tests/baselines/reference/parserES5ForOfStatement18.js +++ b/tests/baselines/reference/parserES5ForOfStatement18.js @@ -2,6 +2,6 @@ for (var of of of) { } //// [parserES5ForOfStatement18.js] -for (var _i = 0, _a = of; _i < _a.length; _i++) { - var of = _a[_i]; +for (var _i = 0; _i < of.length; _i++) { + var of = of[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement2.js b/tests/baselines/reference/parserES5ForOfStatement2.js index 1666cbdf7ae..287602dfb9c 100644 --- a/tests/baselines/reference/parserES5ForOfStatement2.js +++ b/tests/baselines/reference/parserES5ForOfStatement2.js @@ -3,6 +3,6 @@ for (var of X) { } //// [parserES5ForOfStatement2.js] -for (var _i = 0, _a = X; _i < _a.length; _i++) { - var _b = _a[_i]; +for (var _i = 0; _i < X.length; _i++) { + var _a = X[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement21.js b/tests/baselines/reference/parserES5ForOfStatement21.js index 26ea78e3089..dcdffbc3cf0 100644 --- a/tests/baselines/reference/parserES5ForOfStatement21.js +++ b/tests/baselines/reference/parserES5ForOfStatement21.js @@ -2,6 +2,6 @@ for (var of of) { } //// [parserES5ForOfStatement21.js] -for (var _i = 0, _a = of; _i < _a.length; _i++) { - var _b = _a[_i]; +for (var _i = 0; _i < of.length; _i++) { + var _a = of[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement3.js b/tests/baselines/reference/parserES5ForOfStatement3.js index 8e4e5b9e426..a99e96a23b8 100644 --- a/tests/baselines/reference/parserES5ForOfStatement3.js +++ b/tests/baselines/reference/parserES5ForOfStatement3.js @@ -3,6 +3,6 @@ for (var a, b of X) { } //// [parserES5ForOfStatement3.js] -for (var _i = 0, _a = X; _i < _a.length; _i++) { - var a = _a[_i]; +for (var _i = 0; _i < X.length; _i++) { + var a = X[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement4.js b/tests/baselines/reference/parserES5ForOfStatement4.js index 751753da14b..f1558005f20 100644 --- a/tests/baselines/reference/parserES5ForOfStatement4.js +++ b/tests/baselines/reference/parserES5ForOfStatement4.js @@ -3,6 +3,6 @@ for (var a = 1 of X) { } //// [parserES5ForOfStatement4.js] -for (var _i = 0, _a = X; _i < _a.length; _i++) { - var a = 1 = _a[_i]; +for (var _i = 0; _i < X.length; _i++) { + var a = 1 = X[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement5.js b/tests/baselines/reference/parserES5ForOfStatement5.js index fe0471f4d4f..328b2fba0a7 100644 --- a/tests/baselines/reference/parserES5ForOfStatement5.js +++ b/tests/baselines/reference/parserES5ForOfStatement5.js @@ -3,6 +3,6 @@ for (var a: number of X) { } //// [parserES5ForOfStatement5.js] -for (var _i = 0, _a = X; _i < _a.length; _i++) { - var a = _a[_i]; +for (var _i = 0; _i < X.length; _i++) { + var a = X[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement6.js b/tests/baselines/reference/parserES5ForOfStatement6.js index 2e01da0a0c4..15747b93ba9 100644 --- a/tests/baselines/reference/parserES5ForOfStatement6.js +++ b/tests/baselines/reference/parserES5ForOfStatement6.js @@ -3,6 +3,6 @@ for (var a = 1, b = 2 of X) { } //// [parserES5ForOfStatement6.js] -for (var _i = 0, _a = X; _i < _a.length; _i++) { - var a = 1 = _a[_i]; +for (var _i = 0; _i < X.length; _i++) { + var a = 1 = X[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement7.js b/tests/baselines/reference/parserES5ForOfStatement7.js index 845bec0e2cc..29e4de8787f 100644 --- a/tests/baselines/reference/parserES5ForOfStatement7.js +++ b/tests/baselines/reference/parserES5ForOfStatement7.js @@ -3,6 +3,6 @@ for (var a: number = 1, b: string = "" of X) { } //// [parserES5ForOfStatement7.js] -for (var _i = 0, _a = X; _i < _a.length; _i++) { - var a = 1 = _a[_i]; +for (var _i = 0; _i < X.length; _i++) { + var a = 1 = X[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement8.js b/tests/baselines/reference/parserES5ForOfStatement8.js index bd20d375502..5c449fc6433 100644 --- a/tests/baselines/reference/parserES5ForOfStatement8.js +++ b/tests/baselines/reference/parserES5ForOfStatement8.js @@ -3,6 +3,6 @@ for (var v of X) { } //// [parserES5ForOfStatement8.js] -for (var _i = 0, _a = X; _i < _a.length; _i++) { - var v = _a[_i]; +for (var _i = 0; _i < X.length; _i++) { + var v = X[_i]; } diff --git a/tests/baselines/reference/parserES5ForOfStatement9.js b/tests/baselines/reference/parserES5ForOfStatement9.js index 3da36ecdd5b..6b63d58a88a 100644 --- a/tests/baselines/reference/parserES5ForOfStatement9.js +++ b/tests/baselines/reference/parserES5ForOfStatement9.js @@ -3,6 +3,6 @@ for (let v of X) { } //// [parserES5ForOfStatement9.js] -for (var _i = 0, _a = X; _i < _a.length; _i++) { - var v = _a[_i]; +for (var _i = 0; _i < X.length; _i++) { + var v = X[_i]; } diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of24.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of24.ts new file mode 100644 index 00000000000..7e025183f5f --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of24.ts @@ -0,0 +1,4 @@ +var a = [1, 2, 3]; +for (var v of a) { + let a = 0; +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts new file mode 100644 index 00000000000..5cf7efe8d65 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts @@ -0,0 +1,5 @@ +var a = [1, 2, 3]; +for (var v of a) { + v; + a; +} \ No newline at end of file From ed3ab96eed1c177095c6119b704f5e0982a00917 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 4 Mar 2015 18:39:49 -0800 Subject: [PATCH 013/101] Add tests for destructuring 'for...of' --- src/compiler/checker.ts | 4 ++-- src/compiler/emitter.ts | 5 +++-- src/compiler/types.ts | 2 +- tests/baselines/reference/ES5For-of26.js | 12 ++++++++++++ tests/baselines/reference/ES5For-of27.js | 12 ++++++++++++ tests/baselines/reference/ES5For-of28.js | 12 ++++++++++++ tests/baselines/reference/ES5For-of29.js | 12 ++++++++++++ tests/baselines/reference/ES5For-of30.js | 17 +++++++++++++++++ tests/baselines/reference/ES5For-of31.js | 16 ++++++++++++++++ .../statements/for-ofStatements/ES5For-of26.ts | 4 ++++ .../statements/for-ofStatements/ES5For-of27.ts | 4 ++++ .../statements/for-ofStatements/ES5For-of28.ts | 4 ++++ .../statements/for-ofStatements/ES5For-of29.ts | 4 ++++ .../statements/for-ofStatements/ES5For-of30.ts | 6 ++++++ .../statements/for-ofStatements/ES5For-of31.ts | 6 ++++++ 15 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 tests/baselines/reference/ES5For-of26.js create mode 100644 tests/baselines/reference/ES5For-of27.js create mode 100644 tests/baselines/reference/ES5For-of28.js create mode 100644 tests/baselines/reference/ES5For-of29.js create mode 100644 tests/baselines/reference/ES5For-of30.js create mode 100644 tests/baselines/reference/ES5For-of31.js create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of27.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of29.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of31.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7220182bfe9..949fc922c21 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10891,9 +10891,9 @@ module ts { getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } - function isUnknownIdentifier(location: Node, name: string): boolean { + function isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean { return !resolveName(location, name, SymbolFlags.Value, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined) && - !hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); + !hasProperty(getGeneratedNamesForSourceFile(sourceFile), name); } function getBlockScopedVariableId(n: Identifier): number { diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 98a04a1d6d6..8f01232ef77 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1639,10 +1639,12 @@ module ts { } if (root) { + currentSourceFile = root; emit(root); } else { forEach(host.getSourceFiles(), sourceFile => { + currentSourceFile = sourceFile; if (!isExternalModuleOrDeclarationFile(sourceFile)) { emit(sourceFile); } @@ -1698,7 +1700,7 @@ module ts { function isExistingName(location: Node, name: string) { // check if resolver is aware of this name (if name was seen during the typecheck) - if (!resolver.isUnknownIdentifier(location, name)) { + if (!resolver.isUnknownIdentifier(location, name, currentSourceFile)) { return true; } @@ -5191,7 +5193,6 @@ module ts { } function emitSourceFile(node: SourceFile) { - currentSourceFile = node; // Start new file on new line writeLine(); emitDetachedComments(node); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index c7339bcd60d..40a44ab9705 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1204,7 +1204,7 @@ module ts { isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; // Returns the constant value this property access resolves to, or 'undefined' for a non-constant getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; - isUnknownIdentifier(location: Node, name: string): boolean; + isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; getBlockScopedVariableId(node: Identifier): number; } diff --git a/tests/baselines/reference/ES5For-of26.js b/tests/baselines/reference/ES5For-of26.js new file mode 100644 index 00000000000..02d462b6025 --- /dev/null +++ b/tests/baselines/reference/ES5For-of26.js @@ -0,0 +1,12 @@ +//// [ES5For-of26.ts] +for (var [a = 0, b = 1] of [2, 3]) { + a; + b; +} + +//// [ES5For-of26.js] +for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) { + var _b = _a[_i], _c = _b[0], a = _c === void 0 ? 0 : _c, _d = _b[1], b = _d === void 0 ? 1 : _d; + a; + b; +} diff --git a/tests/baselines/reference/ES5For-of27.js b/tests/baselines/reference/ES5For-of27.js new file mode 100644 index 00000000000..c8e5a03b114 --- /dev/null +++ b/tests/baselines/reference/ES5For-of27.js @@ -0,0 +1,12 @@ +//// [ES5For-of27.ts] +for (var {x: a = 0, y: b = 1} of [2, 3]) { + a; + b; +} + +//// [ES5For-of27.js] +for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) { + var _b = _a[_i], _c = _b.x, a = _c === void 0 ? 0 : _c, _d = _b.y, b = _d === void 0 ? 1 : _d; + a; + b; +} diff --git a/tests/baselines/reference/ES5For-of28.js b/tests/baselines/reference/ES5For-of28.js new file mode 100644 index 00000000000..362b8835212 --- /dev/null +++ b/tests/baselines/reference/ES5For-of28.js @@ -0,0 +1,12 @@ +//// [ES5For-of28.ts] +for (let [a = 0, b = 1] of [2, 3]) { + a; + b; +} + +//// [ES5For-of28.js] +for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) { + var _b = _a[_i], _c = _b[0], a = _c === void 0 ? 0 : _c, _d = _b[1], b = _d === void 0 ? 1 : _d; + a; + b; +} diff --git a/tests/baselines/reference/ES5For-of29.js b/tests/baselines/reference/ES5For-of29.js new file mode 100644 index 00000000000..338ff311dba --- /dev/null +++ b/tests/baselines/reference/ES5For-of29.js @@ -0,0 +1,12 @@ +//// [ES5For-of29.ts] +for (const {x: a = 0, y: b = 1} of [2, 3]) { + a; + b; +} + +//// [ES5For-of29.js] +for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) { + var _b = _a[_i], _c = _b.x, a = _c === void 0 ? 0 : _c, _d = _b.y, b = _d === void 0 ? 1 : _d; + a; + b; +} diff --git a/tests/baselines/reference/ES5For-of30.js b/tests/baselines/reference/ES5For-of30.js new file mode 100644 index 00000000000..2a1dc5a3399 --- /dev/null +++ b/tests/baselines/reference/ES5For-of30.js @@ -0,0 +1,17 @@ +//// [ES5For-of30.ts] +var a: string, b: number; +var tuple: [number, string] = [2, "3"]; +for ([a = 1, b = ""] of tuple) { + a; + b; +} + +//// [ES5For-of30.js] +var a, b; +var tuple = [2, "3"]; +for (var _i = 0; _i < tuple.length; _i++) { + _a = tuple[_i], _b = _a[0], a = _b === void 0 ? 1 : _b, _c = _a[1], b = _c === void 0 ? "" : _c; + a; + b; +} +var _a, _b, _c; diff --git a/tests/baselines/reference/ES5For-of31.js b/tests/baselines/reference/ES5For-of31.js new file mode 100644 index 00000000000..6b038e377cb --- /dev/null +++ b/tests/baselines/reference/ES5For-of31.js @@ -0,0 +1,16 @@ +//// [ES5For-of31.ts] +var a: string, b: number; + +for ({ a: b = 1, b: a = ""} of []) { + a; + b; +} + +//// [ES5For-of31.js] +var a, b; +for (var _i = 0, _a = []; _i < _a.length; _i++) { + _b = _a[_i], _c = _b.a, b = _c === void 0 ? 1 : _c, _d = _b.b, a = _d === void 0 ? "" : _d; + a; + b; +} +var _b, _c, _d; diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts new file mode 100644 index 00000000000..d0b944dcec7 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts @@ -0,0 +1,4 @@ +for (var [a = 0, b = 1] of [2, 3]) { + a; + b; +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of27.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of27.ts new file mode 100644 index 00000000000..4a56779b68d --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of27.ts @@ -0,0 +1,4 @@ +for (var {x: a = 0, y: b = 1} of [2, 3]) { + a; + b; +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts new file mode 100644 index 00000000000..00f36f7d5d2 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts @@ -0,0 +1,4 @@ +for (let [a = 0, b = 1] of [2, 3]) { + a; + b; +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of29.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of29.ts new file mode 100644 index 00000000000..5b5e52e75c5 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of29.ts @@ -0,0 +1,4 @@ +for (const {x: a = 0, y: b = 1} of [2, 3]) { + a; + b; +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts new file mode 100644 index 00000000000..c25b7b98b5f --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts @@ -0,0 +1,6 @@ +var a: string, b: number; +var tuple: [number, string] = [2, "3"]; +for ([a = 1, b = ""] of tuple) { + a; + b; +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of31.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of31.ts new file mode 100644 index 00000000000..a00f4516541 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of31.ts @@ -0,0 +1,6 @@ +var a: string, b: number; + +for ({ a: b = 1, b: a = ""} of []) { + a; + b; +} \ No newline at end of file From 946dc0e0bcad5c2f105d4b506e7b2336387988d3 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 4 Mar 2015 19:33:49 -0800 Subject: [PATCH 014/101] Accept error baselines and API breaks --- tests/baselines/reference/APISample_compile.js | 2 +- .../baselines/reference/APISample_compile.types | 6 ++++-- tests/baselines/reference/APISample_linter.js | 2 +- tests/baselines/reference/APISample_linter.types | 6 ++++-- tests/baselines/reference/APISample_transform.js | 2 +- .../reference/APISample_transform.types | 6 ++++-- tests/baselines/reference/APISample_watcher.js | 2 +- .../baselines/reference/APISample_watcher.types | 6 ++++-- tests/baselines/reference/ES5For-of1.errors.txt | 7 +++++++ tests/baselines/reference/ES5For-of10.errors.txt | 13 +++++++++++++ tests/baselines/reference/ES5For-of11.errors.txt | 8 ++++++++ tests/baselines/reference/ES5For-of12.errors.txt | 7 +++++++ tests/baselines/reference/ES5For-of13.errors.txt | 9 +++++++++ tests/baselines/reference/ES5For-of14.errors.txt | 9 +++++++++ tests/baselines/reference/ES5For-of15.errors.txt | 12 ++++++++++++ tests/baselines/reference/ES5For-of16.errors.txt | 13 +++++++++++++ tests/baselines/reference/ES5For-of17.errors.txt | 13 +++++++++++++ tests/baselines/reference/ES5For-of18.errors.txt | 16 ++++++++++++++++ tests/baselines/reference/ES5For-of19.errors.txt | 15 +++++++++++++++ tests/baselines/reference/ES5For-of2.errors.txt | 9 +++++++++ tests/baselines/reference/ES5For-of20.errors.txt | 12 ++++++++++++ tests/baselines/reference/ES5For-of21.errors.txt | 9 +++++++++ tests/baselines/reference/ES5For-of22.errors.txt | 10 ++++++++++ tests/baselines/reference/ES5For-of23.errors.txt | 10 ++++++++++ tests/baselines/reference/ES5For-of24.errors.txt | 10 ++++++++++ tests/baselines/reference/ES5For-of25.errors.txt | 11 +++++++++++ tests/baselines/reference/ES5For-of26.errors.txt | 10 ++++++++++ tests/baselines/reference/ES5For-of27.errors.txt | 10 ++++++++++ tests/baselines/reference/ES5For-of28.errors.txt | 10 ++++++++++ tests/baselines/reference/ES5For-of29.errors.txt | 10 ++++++++++ tests/baselines/reference/ES5For-of3.errors.txt | 8 ++++++++ tests/baselines/reference/ES5For-of30.errors.txt | 12 ++++++++++++ tests/baselines/reference/ES5For-of31.errors.txt | 12 ++++++++++++ tests/baselines/reference/ES5For-of4.errors.txt | 9 +++++++++ tests/baselines/reference/ES5For-of5.errors.txt | 9 +++++++++ tests/baselines/reference/ES5For-of6.errors.txt | 11 +++++++++++ tests/baselines/reference/ES5For-of7.errors.txt | 16 ++++++++++++++++ tests/baselines/reference/ES5For-of8.errors.txt | 12 ++++++++++++ tests/baselines/reference/ES5For-of9.errors.txt | 14 ++++++++++++++ .../reference/downlevelLetConst16.errors.txt | 13 ++++++------- .../statements/for-ofStatements/ES5For-of32.ts | 4 ++++ 41 files changed, 366 insertions(+), 19 deletions(-) create mode 100644 tests/baselines/reference/ES5For-of1.errors.txt create mode 100644 tests/baselines/reference/ES5For-of10.errors.txt create mode 100644 tests/baselines/reference/ES5For-of11.errors.txt create mode 100644 tests/baselines/reference/ES5For-of12.errors.txt create mode 100644 tests/baselines/reference/ES5For-of13.errors.txt create mode 100644 tests/baselines/reference/ES5For-of14.errors.txt create mode 100644 tests/baselines/reference/ES5For-of15.errors.txt create mode 100644 tests/baselines/reference/ES5For-of16.errors.txt create mode 100644 tests/baselines/reference/ES5For-of17.errors.txt create mode 100644 tests/baselines/reference/ES5For-of18.errors.txt create mode 100644 tests/baselines/reference/ES5For-of19.errors.txt create mode 100644 tests/baselines/reference/ES5For-of2.errors.txt create mode 100644 tests/baselines/reference/ES5For-of20.errors.txt create mode 100644 tests/baselines/reference/ES5For-of21.errors.txt create mode 100644 tests/baselines/reference/ES5For-of22.errors.txt create mode 100644 tests/baselines/reference/ES5For-of23.errors.txt create mode 100644 tests/baselines/reference/ES5For-of24.errors.txt create mode 100644 tests/baselines/reference/ES5For-of25.errors.txt create mode 100644 tests/baselines/reference/ES5For-of26.errors.txt create mode 100644 tests/baselines/reference/ES5For-of27.errors.txt create mode 100644 tests/baselines/reference/ES5For-of28.errors.txt create mode 100644 tests/baselines/reference/ES5For-of29.errors.txt create mode 100644 tests/baselines/reference/ES5For-of3.errors.txt create mode 100644 tests/baselines/reference/ES5For-of30.errors.txt create mode 100644 tests/baselines/reference/ES5For-of31.errors.txt create mode 100644 tests/baselines/reference/ES5For-of4.errors.txt create mode 100644 tests/baselines/reference/ES5For-of5.errors.txt create mode 100644 tests/baselines/reference/ES5For-of6.errors.txt create mode 100644 tests/baselines/reference/ES5For-of7.errors.txt create mode 100644 tests/baselines/reference/ES5For-of8.errors.txt create mode 100644 tests/baselines/reference/ES5For-of9.errors.txt create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of32.ts diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 30fe1d09060..158d75df1cb 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -940,7 +940,7 @@ declare module "typescript" { isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; - isUnknownIdentifier(location: Node, name: string): boolean; + isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; getBlockScopedVariableId(node: Identifier): number; } const enum SymbolFlags { diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 81b98949c7b..a56ba7c43a5 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -3057,11 +3057,13 @@ declare module "typescript" { >PropertyAccessExpression : PropertyAccessExpression >ElementAccessExpression : ElementAccessExpression - isUnknownIdentifier(location: Node, name: string): boolean; ->isUnknownIdentifier : (location: Node, name: string) => boolean + isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; +>isUnknownIdentifier : (location: Node, name: string, sourceFile: SourceFile) => boolean >location : Node >Node : Node >name : string +>sourceFile : SourceFile +>SourceFile : SourceFile getBlockScopedVariableId(node: Identifier): number; >getBlockScopedVariableId : (node: Identifier) => number diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index b7a67081440..db0442017b2 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -971,7 +971,7 @@ declare module "typescript" { isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; - isUnknownIdentifier(location: Node, name: string): boolean; + isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; getBlockScopedVariableId(node: Identifier): number; } const enum SymbolFlags { diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 6da030e8617..fdbb17625bc 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -3203,11 +3203,13 @@ declare module "typescript" { >PropertyAccessExpression : PropertyAccessExpression >ElementAccessExpression : ElementAccessExpression - isUnknownIdentifier(location: Node, name: string): boolean; ->isUnknownIdentifier : (location: Node, name: string) => boolean + isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; +>isUnknownIdentifier : (location: Node, name: string, sourceFile: SourceFile) => boolean >location : Node >Node : Node >name : string +>sourceFile : SourceFile +>SourceFile : SourceFile getBlockScopedVariableId(node: Identifier): number; >getBlockScopedVariableId : (node: Identifier) => number diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index c30d4f03456..798b158539c 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -972,7 +972,7 @@ declare module "typescript" { isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; - isUnknownIdentifier(location: Node, name: string): boolean; + isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; getBlockScopedVariableId(node: Identifier): number; } const enum SymbolFlags { diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 42862def15f..557409b9457 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -3153,11 +3153,13 @@ declare module "typescript" { >PropertyAccessExpression : PropertyAccessExpression >ElementAccessExpression : ElementAccessExpression - isUnknownIdentifier(location: Node, name: string): boolean; ->isUnknownIdentifier : (location: Node, name: string) => boolean + isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; +>isUnknownIdentifier : (location: Node, name: string, sourceFile: SourceFile) => boolean >location : Node >Node : Node >name : string +>sourceFile : SourceFile +>SourceFile : SourceFile getBlockScopedVariableId(node: Identifier): number; >getBlockScopedVariableId : (node: Identifier) => number diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index a9ed17e924d..648dd0fcdeb 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1009,7 +1009,7 @@ declare module "typescript" { isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; - isUnknownIdentifier(location: Node, name: string): boolean; + isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; getBlockScopedVariableId(node: Identifier): number; } const enum SymbolFlags { diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 3dd324c421e..eb444c4141d 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -3326,11 +3326,13 @@ declare module "typescript" { >PropertyAccessExpression : PropertyAccessExpression >ElementAccessExpression : ElementAccessExpression - isUnknownIdentifier(location: Node, name: string): boolean; ->isUnknownIdentifier : (location: Node, name: string) => boolean + isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; +>isUnknownIdentifier : (location: Node, name: string, sourceFile: SourceFile) => boolean >location : Node >Node : Node >name : string +>sourceFile : SourceFile +>SourceFile : SourceFile getBlockScopedVariableId(node: Identifier): number; >getBlockScopedVariableId : (node: Identifier) => number diff --git a/tests/baselines/reference/ES5For-of1.errors.txt b/tests/baselines/reference/ES5For-of1.errors.txt new file mode 100644 index 00000000000..845e6f63ba9 --- /dev/null +++ b/tests/baselines/reference/ES5For-of1.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts (1 errors) ==== + for (var v of []) { } + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of10.errors.txt b/tests/baselines/reference/ES5For-of10.errors.txt new file mode 100644 index 00000000000..70f69ed204f --- /dev/null +++ b/tests/baselines/reference/ES5For-of10.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of10.ts(4,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of10.ts (1 errors) ==== + function foo() { + return { x: 0 }; + } + for (foo().x of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + for (foo().x of []) + var p = foo().x; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of11.errors.txt b/tests/baselines/reference/ES5For-of11.errors.txt new file mode 100644 index 00000000000..bfb494f83a5 --- /dev/null +++ b/tests/baselines/reference/ES5For-of11.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of11.ts(2,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of11.ts (1 errors) ==== + var v; + for (v of []) { } + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of12.errors.txt b/tests/baselines/reference/ES5For-of12.errors.txt new file mode 100644 index 00000000000..ca7c2b190a2 --- /dev/null +++ b/tests/baselines/reference/ES5For-of12.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts (1 errors) ==== + for ([""] of []) { } + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of13.errors.txt b/tests/baselines/reference/ES5For-of13.errors.txt new file mode 100644 index 00000000000..107170c556e --- /dev/null +++ b/tests/baselines/reference/ES5For-of13.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts (1 errors) ==== + for (let v of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + var x = v; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of14.errors.txt b/tests/baselines/reference/ES5For-of14.errors.txt new file mode 100644 index 00000000000..073c3869028 --- /dev/null +++ b/tests/baselines/reference/ES5For-of14.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts (1 errors) ==== + for (const v of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + var x = v; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of15.errors.txt b/tests/baselines/reference/ES5For-of15.errors.txt new file mode 100644 index 00000000000..a63e1202cec --- /dev/null +++ b/tests/baselines/reference/ES5For-of15.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts (1 errors) ==== + for (let v of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + v; + for (const v of []) { + var x = v; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of16.errors.txt b/tests/baselines/reference/ES5For-of16.errors.txt new file mode 100644 index 00000000000..969d83b8058 --- /dev/null +++ b/tests/baselines/reference/ES5For-of16.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts (1 errors) ==== + for (let v of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + v; + for (let v of []) { + var x = v; + v++; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of17.errors.txt b/tests/baselines/reference/ES5For-of17.errors.txt new file mode 100644 index 00000000000..05c89874fcf --- /dev/null +++ b/tests/baselines/reference/ES5For-of17.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts (1 errors) ==== + for (let v of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + v; + for (let v of [v]) { + var x = v; + v++; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of18.errors.txt b/tests/baselines/reference/ES5For-of18.errors.txt new file mode 100644 index 00000000000..77872e93b97 --- /dev/null +++ b/tests/baselines/reference/ES5For-of18.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts(4,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts (2 errors) ==== + for (let v of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + v; + } + for (let v of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + v; + } + \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of19.errors.txt b/tests/baselines/reference/ES5For-of19.errors.txt new file mode 100644 index 00000000000..0e1352d988d --- /dev/null +++ b/tests/baselines/reference/ES5For-of19.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of19.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of19.ts (1 errors) ==== + for (let v of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + v; + function foo() { + for (const v of []) { + v; + } + } + } + \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of2.errors.txt b/tests/baselines/reference/ES5For-of2.errors.txt new file mode 100644 index 00000000000..2b39c276796 --- /dev/null +++ b/tests/baselines/reference/ES5For-of2.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of2.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of2.ts (1 errors) ==== + for (var v of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + var x = v; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of20.errors.txt b/tests/baselines/reference/ES5For-of20.errors.txt new file mode 100644 index 00000000000..35e5130b0de --- /dev/null +++ b/tests/baselines/reference/ES5For-of20.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts (1 errors) ==== + for (let v of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + let v; + for (let v of [v]) { + const v; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of21.errors.txt b/tests/baselines/reference/ES5For-of21.errors.txt new file mode 100644 index 00000000000..bd0a6ccee64 --- /dev/null +++ b/tests/baselines/reference/ES5For-of21.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of21.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of21.ts (1 errors) ==== + for (let v of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + for (let _i of []) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of22.errors.txt b/tests/baselines/reference/ES5For-of22.errors.txt new file mode 100644 index 00000000000..0acfcb6dde8 --- /dev/null +++ b/tests/baselines/reference/ES5For-of22.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts (1 errors) ==== + for (var x of [1, 2, 3]) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + let _a = 0; + console.log(x); + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of23.errors.txt b/tests/baselines/reference/ES5For-of23.errors.txt new file mode 100644 index 00000000000..a659436ad9d --- /dev/null +++ b/tests/baselines/reference/ES5For-of23.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of23.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of23.ts (1 errors) ==== + for (var x of [1, 2, 3]) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + var _a = 0; + console.log(x); + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of24.errors.txt b/tests/baselines/reference/ES5For-of24.errors.txt new file mode 100644 index 00000000000..378bc42ecd9 --- /dev/null +++ b/tests/baselines/reference/ES5For-of24.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of24.ts(2,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of24.ts (1 errors) ==== + var a = [1, 2, 3]; + for (var v of a) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + let a = 0; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of25.errors.txt b/tests/baselines/reference/ES5For-of25.errors.txt new file mode 100644 index 00000000000..d53cdbadd50 --- /dev/null +++ b/tests/baselines/reference/ES5For-of25.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts(2,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts (1 errors) ==== + var a = [1, 2, 3]; + for (var v of a) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + v; + a; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of26.errors.txt b/tests/baselines/reference/ES5For-of26.errors.txt new file mode 100644 index 00000000000..4fae8257d79 --- /dev/null +++ b/tests/baselines/reference/ES5For-of26.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts (1 errors) ==== + for (var [a = 0, b = 1] of [2, 3]) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of27.errors.txt b/tests/baselines/reference/ES5For-of27.errors.txt new file mode 100644 index 00000000000..f54c66d7eae --- /dev/null +++ b/tests/baselines/reference/ES5For-of27.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of27.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of27.ts (1 errors) ==== + for (var {x: a = 0, y: b = 1} of [2, 3]) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of28.errors.txt b/tests/baselines/reference/ES5For-of28.errors.txt new file mode 100644 index 00000000000..31080bb5648 --- /dev/null +++ b/tests/baselines/reference/ES5For-of28.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts (1 errors) ==== + for (let [a = 0, b = 1] of [2, 3]) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of29.errors.txt b/tests/baselines/reference/ES5For-of29.errors.txt new file mode 100644 index 00000000000..24a0b67aec8 --- /dev/null +++ b/tests/baselines/reference/ES5For-of29.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of29.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of29.ts (1 errors) ==== + for (const {x: a = 0, y: b = 1} of [2, 3]) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of3.errors.txt b/tests/baselines/reference/ES5For-of3.errors.txt new file mode 100644 index 00000000000..9c6bd4e8864 --- /dev/null +++ b/tests/baselines/reference/ES5For-of3.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts (1 errors) ==== + for (var v of []) + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + var x = v; \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of30.errors.txt b/tests/baselines/reference/ES5For-of30.errors.txt new file mode 100644 index 00000000000..9ab0dfca3cd --- /dev/null +++ b/tests/baselines/reference/ES5For-of30.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts (1 errors) ==== + var a: string, b: number; + var tuple: [number, string] = [2, "3"]; + for ([a = 1, b = ""] of tuple) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of31.errors.txt b/tests/baselines/reference/ES5For-of31.errors.txt new file mode 100644 index 00000000000..fa3b7617980 --- /dev/null +++ b/tests/baselines/reference/ES5For-of31.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of31.ts(3,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of31.ts (1 errors) ==== + var a: string, b: number; + + for ({ a: b = 1, b: a = ""} of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of4.errors.txt b/tests/baselines/reference/ES5For-of4.errors.txt new file mode 100644 index 00000000000..047c6f4e153 --- /dev/null +++ b/tests/baselines/reference/ES5For-of4.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of4.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of4.ts (1 errors) ==== + for (var v of []) + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + var x = v; + var y = v; \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of5.errors.txt b/tests/baselines/reference/ES5For-of5.errors.txt new file mode 100644 index 00000000000..6109498afb2 --- /dev/null +++ b/tests/baselines/reference/ES5For-of5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of5.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of5.ts (1 errors) ==== + for (var _a of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + var x = _a; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of6.errors.txt b/tests/baselines/reference/ES5For-of6.errors.txt new file mode 100644 index 00000000000..3664b51b217 --- /dev/null +++ b/tests/baselines/reference/ES5For-of6.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of6.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of6.ts (1 errors) ==== + for (var w of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + for (var v of []) { + var x = [w, v]; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of7.errors.txt b/tests/baselines/reference/ES5For-of7.errors.txt new file mode 100644 index 00000000000..21f9c4d137c --- /dev/null +++ b/tests/baselines/reference/ES5For-of7.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts(5,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts (2 errors) ==== + for (var w of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + var x = w; + } + + for (var v of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + var x = [w, v]; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of8.errors.txt b/tests/baselines/reference/ES5For-of8.errors.txt new file mode 100644 index 00000000000..03c972e5e49 --- /dev/null +++ b/tests/baselines/reference/ES5For-of8.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts(4,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts (1 errors) ==== + function foo() { + return { x: 0 }; + } + for (foo().x of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + var p = foo().x; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of9.errors.txt b/tests/baselines/reference/ES5For-of9.errors.txt new file mode 100644 index 00000000000..1b6607afb30 --- /dev/null +++ b/tests/baselines/reference/ES5For-of9.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of9.ts(4,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of9.ts (1 errors) ==== + function foo() { + return { x: 0 }; + } + for (foo().x of []) { + ~~~ +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + for (foo().x of []) { + var p = foo().x; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst16.errors.txt b/tests/baselines/reference/downlevelLetConst16.errors.txt index c488e96ca23..6156bfe4a2b 100644 --- a/tests/baselines/reference/downlevelLetConst16.errors.txt +++ b/tests/baselines/reference/downlevelLetConst16.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/downlevelLetConst16.ts(189,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. -tests/cases/compiler/downlevelLetConst16.ts(196,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. -tests/cases/compiler/downlevelLetConst16.ts(203,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. -tests/cases/compiler/downlevelLetConst16.ts(210,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. -tests/cases/compiler/downlevelLetConst16.ts(217,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. -tests/cases/compiler/downlevelLetConst16.ts(224,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst16.ts(188,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst16.ts(195,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst16.ts(202,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst16.ts(209,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst16.ts(216,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/compiler/downlevelLetConst16.ts(223,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. ==== tests/cases/compiler/downlevelLetConst16.ts (6 errors) ==== @@ -193,7 +193,6 @@ tests/cases/compiler/downlevelLetConst16.ts(224,5): error TS2482: 'for...of' sta use(x); } - // TODO: once for-of is supported downlevel function foo7() { for (let x of []) { ~~~ diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of32.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of32.ts new file mode 100644 index 00000000000..65ad9bdbdc3 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of32.ts @@ -0,0 +1,4 @@ +// @sourcemap: true +for (var a of ['a', 'b', 'c']) { + console.log(a); +} \ No newline at end of file From fecd20a3dbdc71855bfc601d99c9d95034d99766 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 5 Mar 2015 11:47:40 -0800 Subject: [PATCH 015/101] Fix sourcemaps for 'for...of' and no source maps for synthesized nodes --- src/compiler/emitter.ts | 45 +++-- tests/baselines/reference/ES5For-of1.js | 8 +- tests/baselines/reference/ES5For-of1.js.map | 2 + .../reference/ES5For-of1.sourcemap.txt | 116 ++++++++++++ tests/baselines/reference/ES5For-of13.js | 5 +- tests/baselines/reference/ES5For-of13.js.map | 2 + .../reference/ES5For-of13.sourcemap.txt | 109 +++++++++++ tests/baselines/reference/ES5For-of25.js | 1 + tests/baselines/reference/ES5For-of25.js.map | 2 + .../reference/ES5For-of25.sourcemap.txt | 135 +++++++++++++ tests/baselines/reference/ES5For-of26.js | 1 + tests/baselines/reference/ES5For-of26.js.map | 2 + .../reference/ES5For-of26.sourcemap.txt | 126 +++++++++++++ tests/baselines/reference/ES5For-of3.js | 5 +- tests/baselines/reference/ES5For-of3.js.map | 2 + .../reference/ES5For-of3.sourcemap.txt | 108 +++++++++++ tests/baselines/reference/ES5For-of8.js | 5 +- tests/baselines/reference/ES5For-of8.js.map | 2 + .../reference/ES5For-of8.sourcemap.txt | 178 ++++++++++++++++++ ...computedPropertyNamesSourceMap2_ES5.js.map | 2 +- ...dPropertyNamesSourceMap2_ES5.sourcemap.txt | 130 +++---------- .../statements/for-ofStatements/ES5For-of1.ts | 5 +- .../for-ofStatements/ES5For-of13.ts | 3 +- .../for-ofStatements/ES5For-of25.ts | 1 + .../for-ofStatements/ES5For-of26.ts | 1 + .../statements/for-ofStatements/ES5For-of3.ts | 3 +- .../for-ofStatements/ES5For-of32.ts | 4 - .../statements/for-ofStatements/ES5For-of8.ts | 3 +- 28 files changed, 865 insertions(+), 141 deletions(-) create mode 100644 tests/baselines/reference/ES5For-of1.js.map create mode 100644 tests/baselines/reference/ES5For-of1.sourcemap.txt create mode 100644 tests/baselines/reference/ES5For-of13.js.map create mode 100644 tests/baselines/reference/ES5For-of13.sourcemap.txt create mode 100644 tests/baselines/reference/ES5For-of25.js.map create mode 100644 tests/baselines/reference/ES5For-of25.sourcemap.txt create mode 100644 tests/baselines/reference/ES5For-of26.js.map create mode 100644 tests/baselines/reference/ES5For-of26.sourcemap.txt create mode 100644 tests/baselines/reference/ES5For-of3.js.map create mode 100644 tests/baselines/reference/ES5For-of3.sourcemap.txt create mode 100644 tests/baselines/reference/ES5For-of8.js.map create mode 100644 tests/baselines/reference/ES5For-of8.sourcemap.txt delete mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-of32.ts diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 8f01232ef77..3fef1735a2d 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2067,6 +2067,9 @@ module ts { function emitNodeWithMap(node: Node) { if (node) { + if (nodeIsSynthesized(node)) { + return emitNode(node); + } if (node.kind != SyntaxKind.SourceFile) { recordEmitNodeStartSpan(node); emitNode(node); @@ -3517,9 +3520,6 @@ module ts { var endPos = emitToken(SyntaxKind.ForKeyword, node.pos); write(" "); endPos = emitToken(SyntaxKind.OpenParenToken, endPos); - // This is the var keyword for the counter and rhsReference. The var keyword for - // the LHS will be emitted inside the body. - write("var "); // Do not emit the LHS var declaration yet, because it might contain destructuring. @@ -3533,29 +3533,42 @@ module ts { var rhsIsIdentifier = node.expression.kind === SyntaxKind.Identifier; var counter = createTempVariable(node, /*forLoopVariable*/ true); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, /*forLoopVariable*/ false); + + // This is the var keyword for the counter and rhsReference. The var keyword for + // the LHS will be emitted inside the body. + emitStart(node.expression); + write("var "); // _i = 0 - emit(counter); + emitNode(counter); write(" = 0"); + emitEnd(node.expression); if (!rhsIsIdentifier) { // , _a = expr write(", "); - emit(rhsReference); + emitStart(node.expression); + emitNode(rhsReference); write(" = "); - emit(node.expression); + emitNode(node.expression); + emitEnd(node.expression); } write("; "); // _i < _a.length; - emit(counter); + emitStart(node.initializer); + emitNode(counter); write(" < "); - emit(rhsReference); - write(".length; "); + emitNode(rhsReference); + write(".length"); + emitEnd(node.initializer); + write("; "); // _i++) - emit(counter); + emitStart(node.initializer); + emitNode(counter); write("++"); + emitEnd(node.initializer); emitToken(SyntaxKind.CloseParenToken, node.expression.end); // Body @@ -3566,6 +3579,7 @@ module ts { // Initialize LHS // var v = _a[_i]; var rhsIterationValue = createElementAccessExpression(rhsReference, counter); + emitStart(node.initializer); if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { write("var "); var variableDeclarationList = node.initializer; @@ -3579,18 +3593,18 @@ module ts { else { // The following call does not include the initializer, so we have // to emit it separately. - emit(declaration); + emitNode(declaration); write(" = "); - emit(rhsIterationValue); + emitNode(rhsIterationValue); } } else { // It's an empty declaration list. This can only happen in an error case, if the user wrote // for (var of []) {} var emptyDeclarationListTemp = createTempVariable(node, /*forLoopVariable*/ false); - emit(emptyDeclarationListTemp); + emitNode(emptyDeclarationListTemp); write(" = "); - emit(rhsIterationValue); + emitNode(rhsIterationValue); } } else { @@ -3604,9 +3618,10 @@ module ts { emitDestructuring(assignmentExpressionStatement); } else { - emit(assignmentExpression); + emitNode(assignmentExpression); } } + emitEnd(node.initializer); write(";"); if (node.statement.kind === SyntaxKind.Block) { diff --git a/tests/baselines/reference/ES5For-of1.js b/tests/baselines/reference/ES5For-of1.js index 8001d5b537f..dffe843399f 100644 --- a/tests/baselines/reference/ES5For-of1.js +++ b/tests/baselines/reference/ES5For-of1.js @@ -1,7 +1,11 @@ //// [ES5For-of1.ts] -for (var v of []) { } +for (var v of ['a', 'b', 'c']) { + console.log(v); +} //// [ES5For-of1.js] -for (var _i = 0, _a = []; _i < _a.length; _i++) { +for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { var v = _a[_i]; + console.log(v); } +//# sourceMappingURL=ES5For-of1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of1.js.map b/tests/baselines/reference/ES5For-of1.js.map new file mode 100644 index 00000000000..568ac1987e7 --- /dev/null +++ b/tests/baselines/reference/ES5For-of1.js.map @@ -0,0 +1,2 @@ +//// [ES5For-of1.js.map] +{"version":3,"file":"ES5For-of1.js","sourceRoot":"","sources":["ES5For-of1.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAClB"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of1.sourcemap.txt b/tests/baselines/reference/ES5For-of1.sourcemap.txt new file mode 100644 index 00000000000..7bdd7edfa13 --- /dev/null +++ b/tests/baselines/reference/ES5For-of1.sourcemap.txt @@ -0,0 +1,116 @@ +=================================================================== +JsFile: ES5For-of1.js +mapUrl: ES5For-of1.js.map +sourceRoot: +sources: ES5For-of1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of1.js +sourceFile:ES5For-of1.ts +------------------------------------------------------------------- +>>>for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { +1 > +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^ +9 > ^^ +10> ^^^ +11> ^^ +12> ^^^ +13> ^ +14> ^^ +15> ^^^^^^^^^^^^^^ +16> ^^ +17> ^^^^ +18> ^ +1 > +2 >for +3 > +4 > (var v of +5 > ['a', 'b', 'c'] +6 > +7 > [ +8 > 'a' +9 > , +10> 'b' +11> , +12> 'c' +13> ] +14> +15> var v +16> +17> var v of ['a', 'b', 'c'] +18> ) +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 6) Source(1, 15) + SourceIndex(0) +5 >Emitted(1, 16) Source(1, 30) + SourceIndex(0) +6 >Emitted(1, 18) Source(1, 15) + SourceIndex(0) +7 >Emitted(1, 24) Source(1, 16) + SourceIndex(0) +8 >Emitted(1, 27) Source(1, 19) + SourceIndex(0) +9 >Emitted(1, 29) Source(1, 21) + SourceIndex(0) +10>Emitted(1, 32) Source(1, 24) + SourceIndex(0) +11>Emitted(1, 34) Source(1, 26) + SourceIndex(0) +12>Emitted(1, 37) Source(1, 29) + SourceIndex(0) +13>Emitted(1, 38) Source(1, 30) + SourceIndex(0) +14>Emitted(1, 40) Source(1, 6) + SourceIndex(0) +15>Emitted(1, 54) Source(1, 11) + SourceIndex(0) +16>Emitted(1, 56) Source(1, 6) + SourceIndex(0) +17>Emitted(1, 60) Source(1, 30) + SourceIndex(0) +18>Emitted(1, 61) Source(1, 31) + SourceIndex(0) +--- +>>> var v = _a[_i]; +1 >^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^^^^^^^ +5 > ^^-> +1 > +2 > var +3 > v +4 > +1 >Emitted(2, 5) Source(1, 6) + SourceIndex(0) +2 >Emitted(2, 9) Source(1, 10) + SourceIndex(0) +3 >Emitted(2, 10) Source(1, 11) + SourceIndex(0) +4 >Emitted(2, 19) Source(1, 11) + SourceIndex(0) +--- +>>> console.log(v); +1->^^^^ +2 > ^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +1-> of ['a', 'b', 'c']) { + > +2 > console +3 > . +4 > log +5 > ( +6 > v +7 > ) +8 > ; +1->Emitted(3, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(3, 12) Source(2, 12) + SourceIndex(0) +3 >Emitted(3, 13) Source(2, 13) + SourceIndex(0) +4 >Emitted(3, 16) Source(2, 16) + SourceIndex(0) +5 >Emitted(3, 17) Source(2, 17) + SourceIndex(0) +6 >Emitted(3, 18) Source(2, 18) + SourceIndex(0) +7 >Emitted(3, 19) Source(2, 19) + SourceIndex(0) +8 >Emitted(3, 20) Source(2, 20) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(4, 2) Source(3, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of13.js b/tests/baselines/reference/ES5For-of13.js index 93aa8dec765..2bcf98e14f1 100644 --- a/tests/baselines/reference/ES5For-of13.js +++ b/tests/baselines/reference/ES5For-of13.js @@ -1,10 +1,11 @@ //// [ES5For-of13.ts] -for (let v of []) { +for (let v of ['a', 'b', 'c']) { var x = v; } //// [ES5For-of13.js] -for (var _i = 0, _a = []; _i < _a.length; _i++) { +for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { var v = _a[_i]; var x = v; } +//# sourceMappingURL=ES5For-of13.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of13.js.map b/tests/baselines/reference/ES5For-of13.js.map new file mode 100644 index 00000000000..5ff54bb8816 --- /dev/null +++ b/tests/baselines/reference/ES5For-of13.js.map @@ -0,0 +1,2 @@ +//// [ES5For-of13.js.map] +{"version":3,"file":"ES5For-of13.js","sourceRoot":"","sources":["ES5For-of13.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CACb"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of13.sourcemap.txt b/tests/baselines/reference/ES5For-of13.sourcemap.txt new file mode 100644 index 00000000000..c3a188e7221 --- /dev/null +++ b/tests/baselines/reference/ES5For-of13.sourcemap.txt @@ -0,0 +1,109 @@ +=================================================================== +JsFile: ES5For-of13.js +mapUrl: ES5For-of13.js.map +sourceRoot: +sources: ES5For-of13.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of13.js +sourceFile:ES5For-of13.ts +------------------------------------------------------------------- +>>>for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { +1 > +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^ +9 > ^^ +10> ^^^ +11> ^^ +12> ^^^ +13> ^ +14> ^^ +15> ^^^^^^^^^^^^^^ +16> ^^ +17> ^^^^ +18> ^ +1 > +2 >for +3 > +4 > (let v of +5 > ['a', 'b', 'c'] +6 > +7 > [ +8 > 'a' +9 > , +10> 'b' +11> , +12> 'c' +13> ] +14> +15> let v +16> +17> let v of ['a', 'b', 'c'] +18> ) +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 6) Source(1, 15) + SourceIndex(0) +5 >Emitted(1, 16) Source(1, 30) + SourceIndex(0) +6 >Emitted(1, 18) Source(1, 15) + SourceIndex(0) +7 >Emitted(1, 24) Source(1, 16) + SourceIndex(0) +8 >Emitted(1, 27) Source(1, 19) + SourceIndex(0) +9 >Emitted(1, 29) Source(1, 21) + SourceIndex(0) +10>Emitted(1, 32) Source(1, 24) + SourceIndex(0) +11>Emitted(1, 34) Source(1, 26) + SourceIndex(0) +12>Emitted(1, 37) Source(1, 29) + SourceIndex(0) +13>Emitted(1, 38) Source(1, 30) + SourceIndex(0) +14>Emitted(1, 40) Source(1, 6) + SourceIndex(0) +15>Emitted(1, 54) Source(1, 11) + SourceIndex(0) +16>Emitted(1, 56) Source(1, 6) + SourceIndex(0) +17>Emitted(1, 60) Source(1, 30) + SourceIndex(0) +18>Emitted(1, 61) Source(1, 31) + SourceIndex(0) +--- +>>> var v = _a[_i]; +1 >^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^^^^^^^ +1 > +2 > let +3 > v +4 > +1 >Emitted(2, 5) Source(1, 6) + SourceIndex(0) +2 >Emitted(2, 9) Source(1, 10) + SourceIndex(0) +3 >Emitted(2, 10) Source(1, 11) + SourceIndex(0) +4 >Emitted(2, 19) Source(1, 11) + SourceIndex(0) +--- +>>> var x = v; +1 >^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +1 > of ['a', 'b', 'c']) { + > +2 > var +3 > x +4 > = +5 > v +6 > ; +1 >Emitted(3, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(3, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(3, 10) Source(2, 10) + SourceIndex(0) +4 >Emitted(3, 13) Source(2, 13) + SourceIndex(0) +5 >Emitted(3, 14) Source(2, 14) + SourceIndex(0) +6 >Emitted(3, 15) Source(2, 15) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(4, 2) Source(3, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of13.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of25.js b/tests/baselines/reference/ES5For-of25.js index 5e52f7cad5d..756c14fbe81 100644 --- a/tests/baselines/reference/ES5For-of25.js +++ b/tests/baselines/reference/ES5For-of25.js @@ -12,3 +12,4 @@ for (var _i = 0; _i < a.length; _i++) { v; a; } +//# sourceMappingURL=ES5For-of25.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of25.js.map b/tests/baselines/reference/ES5For-of25.js.map new file mode 100644 index 00000000000..cc31767128b --- /dev/null +++ b/tests/baselines/reference/ES5For-of25.js.map @@ -0,0 +1,2 @@ +//// [ES5For-of25.js.map] +{"version":3,"file":"ES5For-of25.js","sourceRoot":"","sources":["ES5For-of25.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAClB,GAAG,CAAC,CAAU,UAAC,EAAV,aAAK,EAAL,IAAU,CAAC;IAAX,IAAI,CAAC,GAAI,CAAC,IAAL;IACN,CAAC,CAAC;IACF,CAAC,CAAC;CACL"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of25.sourcemap.txt b/tests/baselines/reference/ES5For-of25.sourcemap.txt new file mode 100644 index 00000000000..623627fde20 --- /dev/null +++ b/tests/baselines/reference/ES5For-of25.sourcemap.txt @@ -0,0 +1,135 @@ +=================================================================== +JsFile: ES5For-of25.js +mapUrl: ES5For-of25.js.map +sourceRoot: +sources: ES5For-of25.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of25.js +sourceFile:ES5For-of25.ts +------------------------------------------------------------------- +>>>var a = [1, 2, 3]; +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^ +9 > ^^ +10> ^ +11> ^ +12> ^ +13> ^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >var +3 > a +4 > = +5 > [ +6 > 1 +7 > , +8 > 2 +9 > , +10> 3 +11> ] +12> ; +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +5 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) +6 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +7 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) +8 >Emitted(1, 14) Source(1, 14) + SourceIndex(0) +9 >Emitted(1, 16) Source(1, 16) + SourceIndex(0) +10>Emitted(1, 17) Source(1, 17) + SourceIndex(0) +11>Emitted(1, 18) Source(1, 18) + SourceIndex(0) +12>Emitted(1, 19) Source(1, 19) + SourceIndex(0) +--- +>>>for (var _i = 0; _i < a.length; _i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^ +10> ^ +1-> + > +2 >for +3 > +4 > (var v of +5 > a +6 > +7 > var v +8 > +9 > var v of a +10> ) +1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 4) Source(2, 4) + SourceIndex(0) +3 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +4 >Emitted(2, 6) Source(2, 15) + SourceIndex(0) +5 >Emitted(2, 16) Source(2, 16) + SourceIndex(0) +6 >Emitted(2, 18) Source(2, 6) + SourceIndex(0) +7 >Emitted(2, 31) Source(2, 11) + SourceIndex(0) +8 >Emitted(2, 33) Source(2, 6) + SourceIndex(0) +9 >Emitted(2, 37) Source(2, 16) + SourceIndex(0) +10>Emitted(2, 38) Source(2, 17) + SourceIndex(0) +--- +>>> var v = a[_i]; +1 >^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^^^^ +1 > +2 > var +3 > v +4 > of +5 > a +6 > +1 >Emitted(3, 5) Source(2, 6) + SourceIndex(0) +2 >Emitted(3, 9) Source(2, 10) + SourceIndex(0) +3 >Emitted(3, 10) Source(2, 11) + SourceIndex(0) +4 >Emitted(3, 13) Source(2, 15) + SourceIndex(0) +5 >Emitted(3, 14) Source(2, 16) + SourceIndex(0) +6 >Emitted(3, 18) Source(2, 11) + SourceIndex(0) +--- +>>> v; +1 >^^^^ +2 > ^ +3 > ^ +4 > ^-> +1 > of a) { + > +2 > v +3 > ; +1 >Emitted(4, 5) Source(3, 5) + SourceIndex(0) +2 >Emitted(4, 6) Source(3, 6) + SourceIndex(0) +3 >Emitted(4, 7) Source(3, 7) + SourceIndex(0) +--- +>>> a; +1->^^^^ +2 > ^ +3 > ^ +1-> + > +2 > a +3 > ; +1->Emitted(5, 5) Source(4, 5) + SourceIndex(0) +2 >Emitted(5, 6) Source(4, 6) + SourceIndex(0) +3 >Emitted(5, 7) Source(4, 7) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(6, 2) Source(5, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of25.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of26.js b/tests/baselines/reference/ES5For-of26.js index 02d462b6025..4571cc660a3 100644 --- a/tests/baselines/reference/ES5For-of26.js +++ b/tests/baselines/reference/ES5For-of26.js @@ -10,3 +10,4 @@ for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) { a; b; } +//# sourceMappingURL=ES5For-of26.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of26.js.map b/tests/baselines/reference/ES5For-of26.js.map new file mode 100644 index 00000000000..704a3a24f2a --- /dev/null +++ b/tests/baselines/reference/ES5For-of26.js.map @@ -0,0 +1,2 @@ +//// [ES5For-of26.js.map] +{"version":3,"file":"ES5For-of26.js","sourceRoot":"","sources":["ES5For-of26.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAuB,UAAM,EAAN,MAAC,CAAC,EAAE,CAAC,CAAC,EAA5B,cAAkB,EAAlB,IAA4B,CAAC;IAA7B,6BAAK,CAAC,mBAAG,CAAC,mBAAE,CAAC,mBAAG,CAAC,KAAC;IACnB,CAAC,CAAC;IACF,CAAC,CAAC;CACL"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of26.sourcemap.txt b/tests/baselines/reference/ES5For-of26.sourcemap.txt new file mode 100644 index 00000000000..c9942b1e861 --- /dev/null +++ b/tests/baselines/reference/ES5For-of26.sourcemap.txt @@ -0,0 +1,126 @@ +=================================================================== +JsFile: ES5For-of26.js +mapUrl: ES5For-of26.js.map +sourceRoot: +sources: ES5For-of26.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of26.js +sourceFile:ES5For-of26.ts +------------------------------------------------------------------- +>>>for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) { +1 > +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^ +9 > ^^ +10> ^ +11> ^ +12> ^^ +13> ^^^^^^^^^^^^^^ +14> ^^ +15> ^^^^ +16> ^ +17> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >for +3 > +4 > (var [a = 0, b = 1] of +5 > [2, 3] +6 > +7 > [ +8 > 2 +9 > , +10> 3 +11> ] +12> +13> var [a = 0, b = 1] +14> +15> var [a = 0, b = 1] of [2, 3] +16> ) +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 6) Source(1, 28) + SourceIndex(0) +5 >Emitted(1, 16) Source(1, 34) + SourceIndex(0) +6 >Emitted(1, 18) Source(1, 28) + SourceIndex(0) +7 >Emitted(1, 24) Source(1, 29) + SourceIndex(0) +8 >Emitted(1, 25) Source(1, 30) + SourceIndex(0) +9 >Emitted(1, 27) Source(1, 32) + SourceIndex(0) +10>Emitted(1, 28) Source(1, 33) + SourceIndex(0) +11>Emitted(1, 29) Source(1, 34) + SourceIndex(0) +12>Emitted(1, 31) Source(1, 6) + SourceIndex(0) +13>Emitted(1, 45) Source(1, 24) + SourceIndex(0) +14>Emitted(1, 47) Source(1, 6) + SourceIndex(0) +15>Emitted(1, 51) Source(1, 34) + SourceIndex(0) +16>Emitted(1, 52) Source(1, 35) + SourceIndex(0) +--- +>>> var _b = _a[_i], _c = _b[0], a = _c === void 0 ? 0 : _c, _d = _b[1], b = _d === void 0 ? 1 : _d; +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^^^^^^^ +9 > ^ +10> ^^^^^ +1-> +2 > var [ +3 > a +4 > = +5 > 0 +6 > , +7 > b +8 > = +9 > 1 +10> ] +1->Emitted(2, 5) Source(1, 6) + SourceIndex(0) +2 >Emitted(2, 34) Source(1, 11) + SourceIndex(0) +3 >Emitted(2, 35) Source(1, 12) + SourceIndex(0) +4 >Emitted(2, 54) Source(1, 15) + SourceIndex(0) +5 >Emitted(2, 55) Source(1, 16) + SourceIndex(0) +6 >Emitted(2, 74) Source(1, 18) + SourceIndex(0) +7 >Emitted(2, 75) Source(1, 19) + SourceIndex(0) +8 >Emitted(2, 94) Source(1, 22) + SourceIndex(0) +9 >Emitted(2, 95) Source(1, 23) + SourceIndex(0) +10>Emitted(2, 100) Source(1, 24) + SourceIndex(0) +--- +>>> a; +1 >^^^^ +2 > ^ +3 > ^ +4 > ^-> +1 > of [2, 3]) { + > +2 > a +3 > ; +1 >Emitted(3, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(3, 6) Source(2, 6) + SourceIndex(0) +3 >Emitted(3, 7) Source(2, 7) + SourceIndex(0) +--- +>>> b; +1->^^^^ +2 > ^ +3 > ^ +1-> + > +2 > b +3 > ; +1->Emitted(4, 5) Source(3, 5) + SourceIndex(0) +2 >Emitted(4, 6) Source(3, 6) + SourceIndex(0) +3 >Emitted(4, 7) Source(3, 7) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(5, 2) Source(4, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of26.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of3.js b/tests/baselines/reference/ES5For-of3.js index c36110443b4..648d34a9b16 100644 --- a/tests/baselines/reference/ES5For-of3.js +++ b/tests/baselines/reference/ES5For-of3.js @@ -1,9 +1,10 @@ //// [ES5For-of3.ts] -for (var v of []) +for (var v of ['a', 'b', 'c']) var x = v; //// [ES5For-of3.js] -for (var _i = 0, _a = []; _i < _a.length; _i++) { +for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { var v = _a[_i]; var x = v; } +//# sourceMappingURL=ES5For-of3.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of3.js.map b/tests/baselines/reference/ES5For-of3.js.map new file mode 100644 index 00000000000..7454e1ca85d --- /dev/null +++ b/tests/baselines/reference/ES5For-of3.js.map @@ -0,0 +1,2 @@ +//// [ES5For-of3.js.map] +{"version":3,"file":"ES5For-of3.js","sourceRoot":"","sources":["ES5For-of3.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of3.sourcemap.txt b/tests/baselines/reference/ES5For-of3.sourcemap.txt new file mode 100644 index 00000000000..dd0bca37b68 --- /dev/null +++ b/tests/baselines/reference/ES5For-of3.sourcemap.txt @@ -0,0 +1,108 @@ +=================================================================== +JsFile: ES5For-of3.js +mapUrl: ES5For-of3.js.map +sourceRoot: +sources: ES5For-of3.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of3.js +sourceFile:ES5For-of3.ts +------------------------------------------------------------------- +>>>for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { +1 > +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^ +9 > ^^ +10> ^^^ +11> ^^ +12> ^^^ +13> ^ +14> ^^ +15> ^^^^^^^^^^^^^^ +16> ^^ +17> ^^^^ +18> ^ +1 > +2 >for +3 > +4 > (var v of +5 > ['a', 'b', 'c'] +6 > +7 > [ +8 > 'a' +9 > , +10> 'b' +11> , +12> 'c' +13> ] +14> +15> var v +16> +17> var v of ['a', 'b', 'c'] +18> ) +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 6) Source(1, 15) + SourceIndex(0) +5 >Emitted(1, 16) Source(1, 30) + SourceIndex(0) +6 >Emitted(1, 18) Source(1, 15) + SourceIndex(0) +7 >Emitted(1, 24) Source(1, 16) + SourceIndex(0) +8 >Emitted(1, 27) Source(1, 19) + SourceIndex(0) +9 >Emitted(1, 29) Source(1, 21) + SourceIndex(0) +10>Emitted(1, 32) Source(1, 24) + SourceIndex(0) +11>Emitted(1, 34) Source(1, 26) + SourceIndex(0) +12>Emitted(1, 37) Source(1, 29) + SourceIndex(0) +13>Emitted(1, 38) Source(1, 30) + SourceIndex(0) +14>Emitted(1, 40) Source(1, 6) + SourceIndex(0) +15>Emitted(1, 54) Source(1, 11) + SourceIndex(0) +16>Emitted(1, 56) Source(1, 6) + SourceIndex(0) +17>Emitted(1, 60) Source(1, 30) + SourceIndex(0) +18>Emitted(1, 61) Source(1, 31) + SourceIndex(0) +--- +>>> var v = _a[_i]; +1 >^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^^^^^^^ +1 > +2 > var +3 > v +4 > +1 >Emitted(2, 5) Source(1, 6) + SourceIndex(0) +2 >Emitted(2, 9) Source(1, 10) + SourceIndex(0) +3 >Emitted(2, 10) Source(1, 11) + SourceIndex(0) +4 >Emitted(2, 19) Source(1, 11) + SourceIndex(0) +--- +>>> var x = v; +1 >^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +1 > of ['a', 'b', 'c']) + > +2 > var +3 > x +4 > = +5 > v +6 > ; +1 >Emitted(3, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(3, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(3, 10) Source(2, 10) + SourceIndex(0) +4 >Emitted(3, 13) Source(2, 13) + SourceIndex(0) +5 >Emitted(3, 14) Source(2, 14) + SourceIndex(0) +6 >Emitted(3, 15) Source(2, 15) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +1 >Emitted(4, 2) Source(2, 15) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of3.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of8.js b/tests/baselines/reference/ES5For-of8.js index a3d20b92056..dbe747b9690 100644 --- a/tests/baselines/reference/ES5For-of8.js +++ b/tests/baselines/reference/ES5For-of8.js @@ -2,7 +2,7 @@ function foo() { return { x: 0 }; } -for (foo().x of []) { +for (foo().x of ['a', 'b', 'c']) { var p = foo().x; } @@ -10,7 +10,8 @@ for (foo().x of []) { function foo() { return { x: 0 }; } -for (var _i = 0, _a = []; _i < _a.length; _i++) { +for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { foo().x = _a[_i]; var p = foo().x; } +//# sourceMappingURL=ES5For-of8.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of8.js.map b/tests/baselines/reference/ES5For-of8.js.map new file mode 100644 index 00000000000..23dec486d8d --- /dev/null +++ b/tests/baselines/reference/ES5For-of8.js.map @@ -0,0 +1,2 @@ +//// [ES5For-of8.js.map] +{"version":3,"file":"ES5For-of8.js","sourceRoot":"","sources":["ES5For-of8.ts"],"names":["foo"],"mappings":"AAAA,SAAS,GAAG;IACRA,MAAMA,CAACA,EAAEA,CAACA,EAAEA,CAACA,EAAEA,CAACA;AACpBA,CAACA;AACD,GAAG,CAAC,CAAY,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAA1B,cAAO,EAAP,IAA0B,CAAC;IAA3B,GAAG,EAAE,CAAC,CAAC,SAAA;IACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;CACnB"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of8.sourcemap.txt b/tests/baselines/reference/ES5For-of8.sourcemap.txt new file mode 100644 index 00000000000..e1cf66513a2 --- /dev/null +++ b/tests/baselines/reference/ES5For-of8.sourcemap.txt @@ -0,0 +1,178 @@ +=================================================================== +JsFile: ES5For-of8.js +mapUrl: ES5For-of8.js.map +sourceRoot: +sources: ES5For-of8.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of8.js +sourceFile:ES5For-of8.ts +------------------------------------------------------------------- +>>>function foo() { +1 > +2 >^^^^^^^^^ +3 > ^^^ +4 > ^^^^^^^^^-> +1 > +2 >function +3 > foo +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) +3 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) +--- +>>> return { x: 0 }; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^ +5 > ^ +6 > ^^ +7 > ^ +8 > ^^ +9 > ^ +1->() { + > +2 > return +3 > +4 > { +5 > x +6 > : +7 > 0 +8 > } +9 > ; +1->Emitted(2, 5) Source(2, 5) + SourceIndex(0) name (foo) +2 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) name (foo) +3 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) name (foo) +4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) name (foo) +5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) name (foo) +6 >Emitted(2, 17) Source(2, 17) + SourceIndex(0) name (foo) +7 >Emitted(2, 18) Source(2, 18) + SourceIndex(0) name (foo) +8 >Emitted(2, 20) Source(2, 20) + SourceIndex(0) name (foo) +9 >Emitted(2, 21) Source(2, 21) + SourceIndex(0) name (foo) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) name (foo) +2 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) name (foo) +--- +>>>for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { +1-> +2 >^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^ +8 > ^^^ +9 > ^^ +10> ^^^ +11> ^^ +12> ^^^ +13> ^ +14> ^^ +15> ^^^^^^^^^^^^^^ +16> ^^ +17> ^^^^ +18> ^ +1-> + > +2 >for +3 > +4 > (foo().x of +5 > ['a', 'b', 'c'] +6 > +7 > [ +8 > 'a' +9 > , +10> 'b' +11> , +12> 'c' +13> ] +14> +15> foo().x +16> +17> foo().x of ['a', 'b', 'c'] +18> ) +1->Emitted(4, 1) Source(4, 1) + SourceIndex(0) +2 >Emitted(4, 4) Source(4, 4) + SourceIndex(0) +3 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) +4 >Emitted(4, 6) Source(4, 17) + SourceIndex(0) +5 >Emitted(4, 16) Source(4, 32) + SourceIndex(0) +6 >Emitted(4, 18) Source(4, 17) + SourceIndex(0) +7 >Emitted(4, 24) Source(4, 18) + SourceIndex(0) +8 >Emitted(4, 27) Source(4, 21) + SourceIndex(0) +9 >Emitted(4, 29) Source(4, 23) + SourceIndex(0) +10>Emitted(4, 32) Source(4, 26) + SourceIndex(0) +11>Emitted(4, 34) Source(4, 28) + SourceIndex(0) +12>Emitted(4, 37) Source(4, 31) + SourceIndex(0) +13>Emitted(4, 38) Source(4, 32) + SourceIndex(0) +14>Emitted(4, 40) Source(4, 6) + SourceIndex(0) +15>Emitted(4, 54) Source(4, 13) + SourceIndex(0) +16>Emitted(4, 56) Source(4, 6) + SourceIndex(0) +17>Emitted(4, 60) Source(4, 32) + SourceIndex(0) +18>Emitted(4, 61) Source(4, 33) + SourceIndex(0) +--- +>>> foo().x = _a[_i]; +1 >^^^^ +2 > ^^^ +3 > ^^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^ +7 > ^-> +1 > +2 > foo +3 > () +4 > . +5 > x +6 > +1 >Emitted(5, 5) Source(4, 6) + SourceIndex(0) +2 >Emitted(5, 8) Source(4, 9) + SourceIndex(0) +3 >Emitted(5, 10) Source(4, 11) + SourceIndex(0) +4 >Emitted(5, 11) Source(4, 12) + SourceIndex(0) +5 >Emitted(5, 12) Source(4, 13) + SourceIndex(0) +6 >Emitted(5, 21) Source(4, 13) + SourceIndex(0) +--- +>>> var p = foo().x; +1->^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^ +5 > ^^^ +6 > ^^ +7 > ^ +8 > ^ +9 > ^ +1-> of ['a', 'b', 'c']) { + > +2 > var +3 > p +4 > = +5 > foo +6 > () +7 > . +8 > x +9 > ; +1->Emitted(6, 5) Source(5, 5) + SourceIndex(0) +2 >Emitted(6, 9) Source(5, 9) + SourceIndex(0) +3 >Emitted(6, 10) Source(5, 10) + SourceIndex(0) +4 >Emitted(6, 13) Source(5, 13) + SourceIndex(0) +5 >Emitted(6, 16) Source(5, 16) + SourceIndex(0) +6 >Emitted(6, 18) Source(5, 18) + SourceIndex(0) +7 >Emitted(6, 19) Source(5, 19) + SourceIndex(0) +8 >Emitted(6, 20) Source(5, 20) + SourceIndex(0) +9 >Emitted(6, 21) Source(5, 21) + SourceIndex(0) +--- +>>>} +1 >^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +1 >Emitted(7, 2) Source(6, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=ES5For-of8.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map index d4df74499d0..413c98fa456 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -1,2 +1,2 @@ //// [computedPropertyNamesSourceMap2_ES5.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CAAA,EAAA,GAAA,EAAA;IAAA,EAAA,CAEA,OAAO,CAFA,GAAA;QAGA,QAAQ,CAAC;IACb,CAAC,AAJA;IAAA,EAAA,CAKA,CAAA;IALA,EAAA"} \ No newline at end of file +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;OACH,OAAO;QACJ,QAAQ,CAAC;IACb,CAAC;OACJ,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt index e1a4f764f42..03eec606718 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -13,144 +13,56 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 2 >^^^^ 3 > ^ 4 > ^^^ -5 > -6 > ^ -7 > ^^ -8 > ^^^ -9 > ^^ -10> ^^^^^^^^^^^^^^^^-> +5 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >var 3 > v 4 > = -5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 9) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -5 > -6 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 10) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -6 > -7 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 10) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 12) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -7 > -8 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 10) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 15) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -8 > -9 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -9 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 12) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 17) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -9 > 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) 3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) 4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) -5 >Emitted(1, 9) Source(0, NaN) + SourceIndex(0) -6 >Emitted(1, 10) Source(0, NaN) + SourceIndex(0) -7 >Emitted(1, 12) Source(0, NaN) + SourceIndex(0) -8 >Emitted(1, 15) Source(0, NaN) + SourceIndex(0) -9 >Emitted(1, 17) Source(0, NaN) + SourceIndex(0) --- >>> _a["hello"] = function () { -1->^^^^ -2 > ^^ -3 > ^ -4 > ^^^^^^^ -5 > ^ -6 > ^^^ -1->!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 12) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 5) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -1-> -2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 7) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -2 > -3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 8) Source(2, 6) + SourceIndex(0) nameIndex (-1) -3 > -4 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 15) Source(2, 13) + SourceIndex(0) nameIndex (-1) -4 > "hello" -5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 16) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -5 > -6 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 5) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 19) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -6 > -1->Emitted(2, 5) Source(0, NaN) + SourceIndex(0) -2 >Emitted(2, 7) Source(0, NaN) + SourceIndex(0) -3 >Emitted(2, 8) Source(2, 6) + SourceIndex(0) -4 >Emitted(2, 15) Source(2, 13) + SourceIndex(0) -5 >Emitted(2, 16) Source(0, NaN) + SourceIndex(0) -6 >Emitted(2, 19) Source(0, NaN) + SourceIndex(0) +1->^^^^^^^ +2 > ^^^^^^^ +3 > ^^^^-> +1->{ + > [ +2 > "hello" +1->Emitted(2, 8) Source(2, 6) + SourceIndex(0) +2 >Emitted(2, 15) Source(2, 13) + SourceIndex(0) --- >>> debugger; -1 >^^^^^^^^ +1->^^^^^^^^ 2 > ^^^^^^^^ 3 > ^ -1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 5) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 9) Source(3, 9) + SourceIndex(0) nameIndex (-1) -1 > -2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 7) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 17) Source(3, 17) + SourceIndex(0) nameIndex (-1) +1->]() { + > 2 > debugger -3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 7) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 18) Source(3, 18) + SourceIndex(0) nameIndex (-1) 3 > ; -1 >Emitted(3, 9) Source(3, 9) + SourceIndex(0) +1->Emitted(3, 9) Source(3, 9) + SourceIndex(0) 2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) 3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) --- >>> }, 1 >^^^^ 2 > ^ -3 > -4 > ^^^^-> -1 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 8) Source(2, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(4, 5) + SourceIndex(0) nameIndex (-1) +3 > ^^^^-> 1 > > -2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 15) Source(2, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 6) Source(4, 6) + SourceIndex(0) nameIndex (-1) 2 > } -3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 16) Source(0, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 6) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -3 > 1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) 2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) -3 >Emitted(4, 6) Source(0, NaN) + SourceIndex(0) --- >>> _a); -1->^^^^ -2 > ^^ -3 > ^ -4 > ^ -1->!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 16) Source(0, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 5) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -1-> -2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 19) Source(0, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -2 > -3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 19) Source(0, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 8) Source(5, 2) + SourceIndex(0) nameIndex (-1) -3 > -4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 9) Source(3, 16) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 9) Source(5, 2) + SourceIndex(0) nameIndex (-1) -4 > -1->Emitted(5, 5) Source(0, NaN) + SourceIndex(0) -2 >Emitted(5, 7) Source(0, NaN) + SourceIndex(0) -3 >Emitted(5, 8) Source(5, 2) + SourceIndex(0) -4 >Emitted(5, 9) Source(5, 2) + SourceIndex(0) +1->^^^^^^^ +2 > ^ +1-> + >} +2 > +1->Emitted(5, 8) Source(5, 2) + SourceIndex(0) +2 >Emitted(5, 9) Source(5, 2) + SourceIndex(0) --- >>>var _a; -1 >^^^^ -2 > ^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 17) Source(3, 24) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(6, 5) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -1 > -2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 18) Source(3, 25) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(6, 7) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -2 > -1 >Emitted(6, 5) Source(0, NaN) + SourceIndex(0) -2 >Emitted(6, 7) Source(0, NaN) + SourceIndex(0) ---- -!!!! **** There are more source map entries in the sourceMap's mapping than what was encoded -!!!! **** Remaining decoded string: ;IACb,CAAC,AAJA;IAAA,EAAA,CAKA,CAAA;IALA,EAAA >>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts index 24bb2f9759f..3dd4ec5a360 100644 --- a/tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts @@ -1 +1,4 @@ -for (var v of []) { } \ No newline at end of file +//@sourcemap: true +for (var v of ['a', 'b', 'c']) { + console.log(v); +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts index 743cdf919f6..274d8541bc6 100644 --- a/tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts @@ -1,3 +1,4 @@ -for (let v of []) { +//@sourcemap: true +for (let v of ['a', 'b', 'c']) { var x = v; } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts index 5cf7efe8d65..7017991c7f2 100644 --- a/tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts @@ -1,3 +1,4 @@ +//@sourcemap: true var a = [1, 2, 3]; for (var v of a) { v; diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts index d0b944dcec7..13a386309bb 100644 --- a/tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts @@ -1,3 +1,4 @@ +//@sourcemap: true for (var [a = 0, b = 1] of [2, 3]) { a; b; diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts index 4543b6f74ec..c2fb21f68ce 100644 --- a/tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts @@ -1,2 +1,3 @@ -for (var v of []) +//@sourcemap: true +for (var v of ['a', 'b', 'c']) var x = v; \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of32.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of32.ts deleted file mode 100644 index 65ad9bdbdc3..00000000000 --- a/tests/cases/conformance/statements/for-ofStatements/ES5For-of32.ts +++ /dev/null @@ -1,4 +0,0 @@ -// @sourcemap: true -for (var a of ['a', 'b', 'c']) { - console.log(a); -} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts index 5ad1fb7d58f..e902f50031e 100644 --- a/tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts @@ -1,6 +1,7 @@ +//@sourcemap: true function foo() { return { x: 0 }; } -for (foo().x of []) { +for (foo().x of ['a', 'b', 'c']) { var p = foo().x; } \ No newline at end of file From 835c84f834c863e66512f3d266c60482ac94fa85 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 5 Mar 2015 11:52:00 -0800 Subject: [PATCH 016/101] Minor baseline adjustment --- tests/baselines/reference/ES5For-of1.errors.txt | 6 ++++-- tests/baselines/reference/ES5For-of13.errors.txt | 2 +- tests/baselines/reference/ES5For-of3.errors.txt | 2 +- tests/baselines/reference/ES5For-of8.errors.txt | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/baselines/reference/ES5For-of1.errors.txt b/tests/baselines/reference/ES5For-of1.errors.txt index 845e6f63ba9..7579ea04528 100644 --- a/tests/baselines/reference/ES5For-of1.errors.txt +++ b/tests/baselines/reference/ES5For-of1.errors.txt @@ -2,6 +2,8 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts(1,1): error TS ==== tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts (1 errors) ==== - for (var v of []) { } + for (var v of ['a', 'b', 'c']) { ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. \ No newline at end of file +!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + console.log(v); + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of13.errors.txt b/tests/baselines/reference/ES5For-of13.errors.txt index 107170c556e..a217d590f5e 100644 --- a/tests/baselines/reference/ES5For-of13.errors.txt +++ b/tests/baselines/reference/ES5For-of13.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts(1,1): error T ==== tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts (1 errors) ==== - for (let v of []) { + for (let v of ['a', 'b', 'c']) { ~~~ !!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. var x = v; diff --git a/tests/baselines/reference/ES5For-of3.errors.txt b/tests/baselines/reference/ES5For-of3.errors.txt index 9c6bd4e8864..ecf6b73db13 100644 --- a/tests/baselines/reference/ES5For-of3.errors.txt +++ b/tests/baselines/reference/ES5For-of3.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts(1,1): error TS ==== tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts (1 errors) ==== - for (var v of []) + for (var v of ['a', 'b', 'c']) ~~~ !!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. var x = v; \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of8.errors.txt b/tests/baselines/reference/ES5For-of8.errors.txt index 03c972e5e49..d32d50a6610 100644 --- a/tests/baselines/reference/ES5For-of8.errors.txt +++ b/tests/baselines/reference/ES5For-of8.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts(4,1): error TS function foo() { return { x: 0 }; } - for (foo().x of []) { + for (foo().x of ['a', 'b', 'c']) { ~~~ !!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. var p = foo().x; From dc451b0f69ed58ecddfabd646e1520daf927defe Mon Sep 17 00:00:00 2001 From: mihailik Date: Mon, 9 Mar 2015 14:05:53 +0000 Subject: [PATCH 017/101] Fix for #2268 createDiagnosticCollection should be @internal DiagnosticsCollection interface is marked @internal in [src/compiler/types.ts](https://github.com/Microsoft/TypeScript/blob/c6cd57d18c85e59b2fbe9d316725748a0af8ac2b/src/compiler/types.ts#L1761), so this should be @internal too. Otherwise it causes compilation errors whenever the generated type definitions for LS is used. See #2268 for more details. --- src/compiler/utilities.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 28e9b114ec3..76800d77b3c 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1207,6 +1207,7 @@ module ts { } } + // @internal export function createDiagnosticCollection(): DiagnosticCollection { var nonFileDiagnostics: Diagnostic[] = []; var fileDiagnostics: Map = {}; @@ -1336,4 +1337,4 @@ module ts { s.replace(nonAsciiCharacters, c => get16BitUnicodeEscapeSequence(c.charCodeAt(0))) : s; } -} \ No newline at end of file +} From 700156211063f20c5dd07df893d7abc8351fd071 Mon Sep 17 00:00:00 2001 From: Dick van den Brink Date: Mon, 9 Mar 2015 23:48:51 +0100 Subject: [PATCH 018/101] made seal, freeze and preventExtensions generic --- src/lib/core.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/core.d.ts b/src/lib/core.d.ts index bbaddeeacc1..040eb69ae96 100644 --- a/src/lib/core.d.ts +++ b/src/lib/core.d.ts @@ -164,19 +164,19 @@ interface ObjectConstructor { * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - seal(o: any): any; + seal(o: T): T; /** * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - freeze(o: any): any; + freeze(o: T): T; /** * Prevents the addition of new properties to an object. * @param o Object to make non-extensible. */ - preventExtensions(o: any): any; + preventExtensions(o: T): T; /** * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. From b15d8aa2b5fcd00f6e0adb8d7c02a119bc8ec167 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Mon, 9 Mar 2015 13:32:02 -0700 Subject: [PATCH 019/101] Address PR feedback --- src/compiler/checker.ts | 6 +- src/compiler/emitter.ts | 83 ++++---- src/compiler/types.ts | 2 +- .../baselines/reference/APISample_compile.js | 2 +- .../reference/APISample_compile.types | 6 +- tests/baselines/reference/APISample_linter.js | 2 +- .../reference/APISample_linter.types | 6 +- .../reference/APISample_transform.js | 2 +- .../reference/APISample_transform.types | 6 +- .../baselines/reference/APISample_watcher.js | 2 +- .../reference/APISample_watcher.types | 6 +- tests/baselines/reference/ES5For-of1.js | 6 +- tests/baselines/reference/ES5For-of1.js.map | 2 +- .../reference/ES5For-of1.sourcemap.txt | 111 ++++++----- tests/baselines/reference/ES5For-of10.js | 4 +- tests/baselines/reference/ES5For-of13.js | 6 +- tests/baselines/reference/ES5For-of13.js.map | 2 +- .../reference/ES5For-of13.sourcemap.txt | 107 +++++----- tests/baselines/reference/ES5For-of17.js | 4 +- tests/baselines/reference/ES5For-of20.js | 4 +- tests/baselines/reference/ES5For-of22.js | 6 +- tests/baselines/reference/ES5For-of23.js | 6 +- tests/baselines/reference/ES5For-of24.js | 6 +- tests/baselines/reference/ES5For-of25.js | 6 +- tests/baselines/reference/ES5For-of25.js.map | 2 +- .../reference/ES5For-of25.sourcemap.txt | 108 +++++----- tests/baselines/reference/ES5For-of26.js | 5 +- tests/baselines/reference/ES5For-of26.js.map | 2 +- .../reference/ES5For-of26.sourcemap.txt | 106 +++++----- tests/baselines/reference/ES5For-of27.js | 5 +- tests/baselines/reference/ES5For-of28.js | 5 +- tests/baselines/reference/ES5For-of29.js | 5 +- tests/baselines/reference/ES5For-of3.js | 6 +- tests/baselines/reference/ES5For-of3.js.map | 2 +- .../reference/ES5For-of3.sourcemap.txt | 107 +++++----- tests/baselines/reference/ES5For-of30.js | 5 +- tests/baselines/reference/ES5For-of6.js | 5 +- tests/baselines/reference/ES5For-of7.js | 5 +- tests/baselines/reference/ES5For-of8.js | 10 +- tests/baselines/reference/ES5For-of8.js.map | 2 +- .../reference/ES5For-of8.sourcemap.txt | 188 +++++++++--------- tests/baselines/reference/ES5For-of9.js | 4 +- 42 files changed, 547 insertions(+), 418 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d3e643d32ad..13b5057e187 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10911,9 +10911,11 @@ module ts { getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } - function isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean { + function isUnknownIdentifier(location: Node, name: string): boolean { + // Do not call resolveName on a synthesized node! + Debug.assert(!nodeIsSynthesized(location), "isUnknownIdentifier called with a synthesized location"); return !resolveName(location, name, SymbolFlags.Value, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined) && - !hasProperty(getGeneratedNamesForSourceFile(sourceFile), name); + !hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); } function getBlockScopedVariableId(n: Identifier): number { diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index f5cd5b1100e..b4cdd3d9944 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1641,14 +1641,13 @@ module ts { } if (root) { - currentSourceFile = root; - emit(root); + // Do not call emit directly. It does not set the currentSourceFile. + emitSourceFile(root); } else { forEach(host.getSourceFiles(), sourceFile => { - currentSourceFile = sourceFile; if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emit(sourceFile); + emitSourceFile(sourceFile); } }); } @@ -1657,6 +1656,11 @@ module ts { writeEmittedFiles(writer.getText(), /*writeByteOrderMark*/ compilerOptions.emitBOM); return; + function emitSourceFile(sourceFile: SourceFile): void { + currentSourceFile = sourceFile; + emit(sourceFile); + } + // enters the new lexical environment // return value should be passed to matching call to exitNameScope. function enterNameScope(): boolean { @@ -1689,10 +1693,10 @@ module ts { name = generateUniqueName(baseName, n => isExistingName(location, n)); } - return putNameInCurrentScopeNames(name); + return recordNameInCurrentScope(name); } - function putNameInCurrentScopeNames(name: string): string { + function recordNameInCurrentScope(name: string): string { if (!currentScopeNames) { currentScopeNames = {}; } @@ -1702,7 +1706,7 @@ module ts { function isExistingName(location: Node, name: string) { // check if resolver is aware of this name (if name was seen during the typecheck) - if (!resolver.isUnknownIdentifier(location, name, currentSourceFile)) { + if (!resolver.isUnknownIdentifier(location, name)) { return true; } @@ -2107,13 +2111,14 @@ module ts { break; } // _a .. _h, _j ... _z, _0, _1, ... + // Note that _i is skipped name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + CharacterCodes.a) : tempCount - 25); tempCount++; } // This is necessary so that a name generated via renameNonTopLevelLetAndConst will see the name // we just generated. - putNameInCurrentScopeNames(name); + recordNameInCurrentScope(name); var result = createSynthesizedNode(SyntaxKind.Identifier); result.text = name; @@ -3315,7 +3320,7 @@ module ts { function emitBinaryExpression(node: BinaryExpression) { if (languageVersion < ScriptTarget.ES6 && node.operatorToken.kind === SyntaxKind.EqualsToken && (node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) { - emitDestructuring(node); + emitDestructuring(node, node.parent.kind === SyntaxKind.ExpressionStatement); } else { emit(node.left); @@ -3595,7 +3600,7 @@ module ts { // Do not emit the LHS var declaration yet, because it might contain destructuring. - // Do not call create recordTempDeclaration because we are declaring the temps + // Do not call recordTempDeclaration because we are declaring the temps // right here. Recording means they will be declared later. // In the case where the user wrote an identifier as the RHS, like this: // @@ -3655,12 +3660,12 @@ module ts { if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { write("var "); var variableDeclarationList = node.initializer; - if (variableDeclarationList.declarations.length >= 1) { + if (variableDeclarationList.declarations.length > 0) { var declaration = variableDeclarationList.declarations[0]; if (isBindingPattern(declaration.name)) { // This works whether the declaration is a var, let, or const. // It will use rhsIterationValue _a[_i] as the initializer. - emitDestructuring(declaration, rhsIterationValue); + emitDestructuring(declaration, /*isAssignmentExpressionStatement*/ false, rhsIterationValue); } else { // The following call does not include the initializer, so we have @@ -3673,8 +3678,7 @@ module ts { else { // It's an empty declaration list. This can only happen in an error case, if the user wrote // for (var of []) {} - var emptyDeclarationListTemp = createTempVariable(node, /*forLoopVariable*/ false); - emitNode(emptyDeclarationListTemp); + emitNode(createTempVariable(node, /*forLoopVariable*/ false)); write(" = "); emitNode(rhsIterationValue); } @@ -3683,11 +3687,10 @@ module ts { // Initializer is an expression. Emit the expression in the body, so that it's // evaluated on every iteration. var assignmentExpression = createBinaryExpression(node.initializer, SyntaxKind.EqualsToken, rhsIterationValue, /*startsOnNewLine*/ false); - var assignmentExpressionStatement = createExpressionStatement(assignmentExpression); if (node.initializer.kind === SyntaxKind.ArrayLiteralExpression || node.initializer.kind === SyntaxKind.ObjectLiteralExpression) { // This is a destructuring pattern, so call emitDestructuring instead of emit. Calling emit will not work, because it will cause // the BinaryExpression to be passed in instead of the expression statement, which will cause emitDestructuring to crash. - emitDestructuring(assignmentExpressionStatement); + emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined, /*locationForCheckingExistingName*/ node); } else { emitNode(assignmentExpression); @@ -3864,16 +3867,25 @@ module ts { } } - // Note that a destructuring assignment can be either an ExpressionStatement or a BinaryExpression. - function emitDestructuring(root: ExpressionStatement | BinaryExpression | VariableDeclaration | ParameterDeclaration, value?: Expression) { + /** + * If the root has a chance of being a synthesized node, callers should also pass a value for + * lowestNonSynthesizedAncestor. This should be an ancestor of root, it should not be synthesized, + * and there should not be a lower ancestor that introduces a scope. This node will be used as the + * location for ensuring that temporary names are unique. + */ + function emitDestructuring(root: BinaryExpression | VariableDeclaration | ParameterDeclaration, + isAssignmentExpressionStatement: boolean, + value?: Expression, + lowestNonSynthesizedAncestor?: Node) { var emitCount = 0; // An exported declaration is actually emitted as an assignment (to a property on the module object), so // temporary variables in an exported declaration need to have real declarations elsewhere var isDeclaration = (root.kind === SyntaxKind.VariableDeclaration && !(getCombinedNodeFlags(root) & NodeFlags.Export)) || root.kind === SyntaxKind.Parameter; - if (root.kind === SyntaxKind.ExpressionStatement || root.kind === SyntaxKind.BinaryExpression) { - emitAssignmentExpression(root); + if (root.kind === SyntaxKind.BinaryExpression) { + emitAssignmentExpression(root); } else { + Debug.assert(!isAssignmentExpressionStatement); emitBindingElement(root, value); } @@ -3895,7 +3907,10 @@ module ts { function ensureIdentifier(expr: Expression): Expression { if (expr.kind !== SyntaxKind.Identifier) { - var identifier = createTempVariable(root); + // In case the root is a synthesized node, we need to pass lowestNonSynthesizedAncestor + // as the location for determining uniqueness of the variable we are about to + // generate. + var identifier = createTempVariable(lowestNonSynthesizedAncestor || root); if (!isDeclaration) { recordTempDeclaration(identifier); } @@ -4013,14 +4028,13 @@ module ts { } } - function emitAssignmentExpression(root: ExpressionStatement | BinaryExpression) { - // Synthesized nodes will not have parents, so the ExpressionStatements will have to be passed - // in directly. Otherwise, it will crash when we access the parent of a synthesized binary expression. - var emitParenthesized = root.kind !== SyntaxKind.ExpressionStatement && root.parent.kind !== SyntaxKind.ExpressionStatement; - var expression = (root.kind === SyntaxKind.ExpressionStatement ? (root).expression : root); - var target = expression.left; - var value = expression.right; - if (emitParenthesized) { + function emitAssignmentExpression(root: BinaryExpression) { + var target = root.left; + var value = root.right; + if (isAssignmentExpressionStatement) { + emitDestructuringAssignment(target, value); + } + else { if (root.parent.kind !== SyntaxKind.ParenthesizedExpression) { write("("); } @@ -4032,9 +4046,6 @@ module ts { write(")"); } } - else { - emitDestructuringAssignment(target, value); - } } function emitBindingElement(target: BindingElement, value: Expression) { @@ -4085,7 +4096,7 @@ module ts { function emitVariableDeclaration(node: VariableDeclaration) { if (isBindingPattern(node.name)) { if (languageVersion < ScriptTarget.ES6) { - emitDestructuring(node); + emitDestructuring(node, /*isAssignmentExpressionStatement*/ false); } else { emit(node.name); @@ -4248,7 +4259,7 @@ module ts { if (isBindingPattern(p.name)) { writeLine(); write("var "); - emitDestructuring(p, tempParameters[tempIndex]); + emitDestructuring(p, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex]); write(";"); tempIndex++; } @@ -5310,7 +5321,7 @@ module ts { return statements.length; } - function emitSourceFile(node: SourceFile) { + function emitSourceFileNode(node: SourceFile) { // Start new file on new line writeLine(); emitDetachedComments(node); @@ -5553,7 +5564,7 @@ module ts { case SyntaxKind.ExportDeclaration: return emitExportDeclaration(node); case SyntaxKind.SourceFile: - return emitSourceFile(node); + return emitSourceFileNode(node); } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 9d44ee9c091..abace7e224e 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1205,7 +1205,7 @@ module ts { isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; // Returns the constant value this property access resolves to, or 'undefined' for a non-constant getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; - isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; + isUnknownIdentifier(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; } diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 540b0693bc3..a94858d9154 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -942,7 +942,7 @@ declare module "typescript" { isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; - isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; + isUnknownIdentifier(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; } const enum SymbolFlags { diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 9ee51fd491a..40096915869 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -3063,13 +3063,11 @@ declare module "typescript" { >PropertyAccessExpression : PropertyAccessExpression >ElementAccessExpression : ElementAccessExpression - isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; ->isUnknownIdentifier : (location: Node, name: string, sourceFile: SourceFile) => boolean + isUnknownIdentifier(location: Node, name: string): boolean; +>isUnknownIdentifier : (location: Node, name: string) => boolean >location : Node >Node : Node >name : string ->sourceFile : SourceFile ->SourceFile : SourceFile getBlockScopedVariableId(node: Identifier): number; >getBlockScopedVariableId : (node: Identifier) => number diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 72e104aa8ff..aa94796e3f1 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -973,7 +973,7 @@ declare module "typescript" { isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; - isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; + isUnknownIdentifier(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; } const enum SymbolFlags { diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 1e0e004e600..f061125220d 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -3209,13 +3209,11 @@ declare module "typescript" { >PropertyAccessExpression : PropertyAccessExpression >ElementAccessExpression : ElementAccessExpression - isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; ->isUnknownIdentifier : (location: Node, name: string, sourceFile: SourceFile) => boolean + isUnknownIdentifier(location: Node, name: string): boolean; +>isUnknownIdentifier : (location: Node, name: string) => boolean >location : Node >Node : Node >name : string ->sourceFile : SourceFile ->SourceFile : SourceFile getBlockScopedVariableId(node: Identifier): number; >getBlockScopedVariableId : (node: Identifier) => number diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 855d6a0de35..6defcf64c70 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -974,7 +974,7 @@ declare module "typescript" { isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; - isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; + isUnknownIdentifier(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; } const enum SymbolFlags { diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index a6a4c1d6fe3..9fb0771cb2d 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -3159,13 +3159,11 @@ declare module "typescript" { >PropertyAccessExpression : PropertyAccessExpression >ElementAccessExpression : ElementAccessExpression - isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; ->isUnknownIdentifier : (location: Node, name: string, sourceFile: SourceFile) => boolean + isUnknownIdentifier(location: Node, name: string): boolean; +>isUnknownIdentifier : (location: Node, name: string) => boolean >location : Node >Node : Node >name : string ->sourceFile : SourceFile ->SourceFile : SourceFile getBlockScopedVariableId(node: Identifier): number; >getBlockScopedVariableId : (node: Identifier) => number diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 896b9f59f5b..6fabb4d8b3b 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1011,7 +1011,7 @@ declare module "typescript" { isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; - isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; + isUnknownIdentifier(location: Node, name: string): boolean; getBlockScopedVariableId(node: Identifier): number; } const enum SymbolFlags { diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 2b74b73935c..e2ad04b970e 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -3332,13 +3332,11 @@ declare module "typescript" { >PropertyAccessExpression : PropertyAccessExpression >ElementAccessExpression : ElementAccessExpression - isUnknownIdentifier(location: Node, name: string, sourceFile: SourceFile): boolean; ->isUnknownIdentifier : (location: Node, name: string, sourceFile: SourceFile) => boolean + isUnknownIdentifier(location: Node, name: string): boolean; +>isUnknownIdentifier : (location: Node, name: string) => boolean >location : Node >Node : Node >name : string ->sourceFile : SourceFile ->SourceFile : SourceFile getBlockScopedVariableId(node: Identifier): number; >getBlockScopedVariableId : (node: Identifier) => number diff --git a/tests/baselines/reference/ES5For-of1.js b/tests/baselines/reference/ES5For-of1.js index dffe843399f..afdded3418c 100644 --- a/tests/baselines/reference/ES5For-of1.js +++ b/tests/baselines/reference/ES5For-of1.js @@ -4,7 +4,11 @@ for (var v of ['a', 'b', 'c']) { } //// [ES5For-of1.js] -for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { +for (var _i = 0, _a = [ + 'a', + 'b', + 'c' +]; _i < _a.length; _i++) { var v = _a[_i]; console.log(v); } diff --git a/tests/baselines/reference/ES5For-of1.js.map b/tests/baselines/reference/ES5For-of1.js.map index 568ac1987e7..4fa49b0f02b 100644 --- a/tests/baselines/reference/ES5For-of1.js.map +++ b/tests/baselines/reference/ES5For-of1.js.map @@ -1,2 +1,2 @@ //// [ES5For-of1.js.map] -{"version":3,"file":"ES5For-of1.js","sourceRoot":"","sources":["ES5For-of1.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAClB"} \ No newline at end of file +{"version":3,"file":"ES5For-of1.js","sourceRoot":"","sources":["ES5For-of1.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf;IAAC,GAAG;IAAE,GAAG;IAAE,GAAG;CAAC,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAClB"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of1.sourcemap.txt b/tests/baselines/reference/ES5For-of1.sourcemap.txt index 7bdd7edfa13..c07414d1d85 100644 --- a/tests/baselines/reference/ES5For-of1.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of1.sourcemap.txt @@ -8,61 +8,72 @@ sources: ES5For-of1.ts emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of1.js sourceFile:ES5For-of1.ts ------------------------------------------------------------------- ->>>for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { +>>>for (var _i = 0, _a = [ 1 > 2 >^^^ 3 > ^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^^ -7 > ^^^^^^ -8 > ^^^ -9 > ^^ -10> ^^^ -11> ^^ -12> ^^^ -13> ^ -14> ^^ -15> ^^^^^^^^^^^^^^ -16> ^^ -17> ^^^^ -18> ^ 1 > 2 >for 3 > 4 > (var v of 5 > ['a', 'b', 'c'] 6 > -7 > [ -8 > 'a' -9 > , -10> 'b' -11> , -12> 'c' -13> ] -14> -15> var v -16> -17> var v of ['a', 'b', 'c'] -18> ) 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) 3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) 4 >Emitted(1, 6) Source(1, 15) + SourceIndex(0) 5 >Emitted(1, 16) Source(1, 30) + SourceIndex(0) 6 >Emitted(1, 18) Source(1, 15) + SourceIndex(0) -7 >Emitted(1, 24) Source(1, 16) + SourceIndex(0) -8 >Emitted(1, 27) Source(1, 19) + SourceIndex(0) -9 >Emitted(1, 29) Source(1, 21) + SourceIndex(0) -10>Emitted(1, 32) Source(1, 24) + SourceIndex(0) -11>Emitted(1, 34) Source(1, 26) + SourceIndex(0) -12>Emitted(1, 37) Source(1, 29) + SourceIndex(0) -13>Emitted(1, 38) Source(1, 30) + SourceIndex(0) -14>Emitted(1, 40) Source(1, 6) + SourceIndex(0) -15>Emitted(1, 54) Source(1, 11) + SourceIndex(0) -16>Emitted(1, 56) Source(1, 6) + SourceIndex(0) -17>Emitted(1, 60) Source(1, 30) + SourceIndex(0) -18>Emitted(1, 61) Source(1, 31) + SourceIndex(0) +--- +>>> 'a', +1 >^^^^ +2 > ^^^ +3 > ^^-> +1 >[ +2 > 'a' +1 >Emitted(2, 5) Source(1, 16) + SourceIndex(0) +2 >Emitted(2, 8) Source(1, 19) + SourceIndex(0) +--- +>>> 'b', +1->^^^^ +2 > ^^^ +3 > ^-> +1->, +2 > 'b' +1->Emitted(3, 5) Source(1, 21) + SourceIndex(0) +2 >Emitted(3, 8) Source(1, 24) + SourceIndex(0) +--- +>>> 'c' +1->^^^^ +2 > ^^^ +3 > ^^^^^^^^^^^^^^^^^^^^-> +1->, +2 > 'c' +1->Emitted(4, 5) Source(1, 26) + SourceIndex(0) +2 >Emitted(4, 8) Source(1, 29) + SourceIndex(0) +--- +>>>]; _i < _a.length; _i++) { +1->^ +2 > ^^ +3 > ^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^ +6 > ^ +1->] +2 > +3 > var v +4 > +5 > var v of ['a', 'b', 'c'] +6 > ) +1->Emitted(5, 2) Source(1, 30) + SourceIndex(0) +2 >Emitted(5, 4) Source(1, 6) + SourceIndex(0) +3 >Emitted(5, 18) Source(1, 11) + SourceIndex(0) +4 >Emitted(5, 20) Source(1, 6) + SourceIndex(0) +5 >Emitted(5, 24) Source(1, 30) + SourceIndex(0) +6 >Emitted(5, 25) Source(1, 31) + SourceIndex(0) --- >>> var v = _a[_i]; 1 >^^^^ @@ -74,10 +85,10 @@ sourceFile:ES5For-of1.ts 2 > var 3 > v 4 > -1 >Emitted(2, 5) Source(1, 6) + SourceIndex(0) -2 >Emitted(2, 9) Source(1, 10) + SourceIndex(0) -3 >Emitted(2, 10) Source(1, 11) + SourceIndex(0) -4 >Emitted(2, 19) Source(1, 11) + SourceIndex(0) +1 >Emitted(6, 5) Source(1, 6) + SourceIndex(0) +2 >Emitted(6, 9) Source(1, 10) + SourceIndex(0) +3 >Emitted(6, 10) Source(1, 11) + SourceIndex(0) +4 >Emitted(6, 19) Source(1, 11) + SourceIndex(0) --- >>> console.log(v); 1->^^^^ @@ -97,20 +108,20 @@ sourceFile:ES5For-of1.ts 6 > v 7 > ) 8 > ; -1->Emitted(3, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(3, 12) Source(2, 12) + SourceIndex(0) -3 >Emitted(3, 13) Source(2, 13) + SourceIndex(0) -4 >Emitted(3, 16) Source(2, 16) + SourceIndex(0) -5 >Emitted(3, 17) Source(2, 17) + SourceIndex(0) -6 >Emitted(3, 18) Source(2, 18) + SourceIndex(0) -7 >Emitted(3, 19) Source(2, 19) + SourceIndex(0) -8 >Emitted(3, 20) Source(2, 20) + SourceIndex(0) +1->Emitted(7, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(7, 12) Source(2, 12) + SourceIndex(0) +3 >Emitted(7, 13) Source(2, 13) + SourceIndex(0) +4 >Emitted(7, 16) Source(2, 16) + SourceIndex(0) +5 >Emitted(7, 17) Source(2, 17) + SourceIndex(0) +6 >Emitted(7, 18) Source(2, 18) + SourceIndex(0) +7 >Emitted(7, 19) Source(2, 19) + SourceIndex(0) +8 >Emitted(7, 20) Source(2, 20) + SourceIndex(0) --- >>>} 1 >^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} -1 >Emitted(4, 2) Source(3, 2) + SourceIndex(0) +1 >Emitted(8, 2) Source(3, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=ES5For-of1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of10.js b/tests/baselines/reference/ES5For-of10.js index f12dc9d8acb..673e2ae0f77 100644 --- a/tests/baselines/reference/ES5For-of10.js +++ b/tests/baselines/reference/ES5For-of10.js @@ -9,7 +9,9 @@ for (foo().x of []) { //// [ES5For-of10.js] function foo() { - return { x: 0 }; + return { + x: 0 + }; } for (var _i = 0, _a = []; _i < _a.length; _i++) { foo().x = _a[_i]; diff --git a/tests/baselines/reference/ES5For-of13.js b/tests/baselines/reference/ES5For-of13.js index 2bcf98e14f1..ba9c24eebfe 100644 --- a/tests/baselines/reference/ES5For-of13.js +++ b/tests/baselines/reference/ES5For-of13.js @@ -4,7 +4,11 @@ for (let v of ['a', 'b', 'c']) { } //// [ES5For-of13.js] -for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { +for (var _i = 0, _a = [ + 'a', + 'b', + 'c' +]; _i < _a.length; _i++) { var v = _a[_i]; var x = v; } diff --git a/tests/baselines/reference/ES5For-of13.js.map b/tests/baselines/reference/ES5For-of13.js.map index 5ff54bb8816..3027624c54d 100644 --- a/tests/baselines/reference/ES5For-of13.js.map +++ b/tests/baselines/reference/ES5For-of13.js.map @@ -1,2 +1,2 @@ //// [ES5For-of13.js.map] -{"version":3,"file":"ES5For-of13.js","sourceRoot":"","sources":["ES5For-of13.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CACb"} \ No newline at end of file +{"version":3,"file":"ES5For-of13.js","sourceRoot":"","sources":["ES5For-of13.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf;IAAC,GAAG;IAAE,GAAG;IAAE,GAAG;CAAC,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CACb"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of13.sourcemap.txt b/tests/baselines/reference/ES5For-of13.sourcemap.txt index c3a188e7221..d2c3b6847e6 100644 --- a/tests/baselines/reference/ES5For-of13.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of13.sourcemap.txt @@ -8,61 +8,72 @@ sources: ES5For-of13.ts emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of13.js sourceFile:ES5For-of13.ts ------------------------------------------------------------------- ->>>for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { +>>>for (var _i = 0, _a = [ 1 > 2 >^^^ 3 > ^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^^ -7 > ^^^^^^ -8 > ^^^ -9 > ^^ -10> ^^^ -11> ^^ -12> ^^^ -13> ^ -14> ^^ -15> ^^^^^^^^^^^^^^ -16> ^^ -17> ^^^^ -18> ^ 1 > 2 >for 3 > 4 > (let v of 5 > ['a', 'b', 'c'] 6 > -7 > [ -8 > 'a' -9 > , -10> 'b' -11> , -12> 'c' -13> ] -14> -15> let v -16> -17> let v of ['a', 'b', 'c'] -18> ) 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) 3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) 4 >Emitted(1, 6) Source(1, 15) + SourceIndex(0) 5 >Emitted(1, 16) Source(1, 30) + SourceIndex(0) 6 >Emitted(1, 18) Source(1, 15) + SourceIndex(0) -7 >Emitted(1, 24) Source(1, 16) + SourceIndex(0) -8 >Emitted(1, 27) Source(1, 19) + SourceIndex(0) -9 >Emitted(1, 29) Source(1, 21) + SourceIndex(0) -10>Emitted(1, 32) Source(1, 24) + SourceIndex(0) -11>Emitted(1, 34) Source(1, 26) + SourceIndex(0) -12>Emitted(1, 37) Source(1, 29) + SourceIndex(0) -13>Emitted(1, 38) Source(1, 30) + SourceIndex(0) -14>Emitted(1, 40) Source(1, 6) + SourceIndex(0) -15>Emitted(1, 54) Source(1, 11) + SourceIndex(0) -16>Emitted(1, 56) Source(1, 6) + SourceIndex(0) -17>Emitted(1, 60) Source(1, 30) + SourceIndex(0) -18>Emitted(1, 61) Source(1, 31) + SourceIndex(0) +--- +>>> 'a', +1 >^^^^ +2 > ^^^ +3 > ^^-> +1 >[ +2 > 'a' +1 >Emitted(2, 5) Source(1, 16) + SourceIndex(0) +2 >Emitted(2, 8) Source(1, 19) + SourceIndex(0) +--- +>>> 'b', +1->^^^^ +2 > ^^^ +3 > ^-> +1->, +2 > 'b' +1->Emitted(3, 5) Source(1, 21) + SourceIndex(0) +2 >Emitted(3, 8) Source(1, 24) + SourceIndex(0) +--- +>>> 'c' +1->^^^^ +2 > ^^^ +3 > ^^^^^^^^^^^^^^^^^^^^-> +1->, +2 > 'c' +1->Emitted(4, 5) Source(1, 26) + SourceIndex(0) +2 >Emitted(4, 8) Source(1, 29) + SourceIndex(0) +--- +>>>]; _i < _a.length; _i++) { +1->^ +2 > ^^ +3 > ^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^ +6 > ^ +1->] +2 > +3 > let v +4 > +5 > let v of ['a', 'b', 'c'] +6 > ) +1->Emitted(5, 2) Source(1, 30) + SourceIndex(0) +2 >Emitted(5, 4) Source(1, 6) + SourceIndex(0) +3 >Emitted(5, 18) Source(1, 11) + SourceIndex(0) +4 >Emitted(5, 20) Source(1, 6) + SourceIndex(0) +5 >Emitted(5, 24) Source(1, 30) + SourceIndex(0) +6 >Emitted(5, 25) Source(1, 31) + SourceIndex(0) --- >>> var v = _a[_i]; 1 >^^^^ @@ -73,10 +84,10 @@ sourceFile:ES5For-of13.ts 2 > let 3 > v 4 > -1 >Emitted(2, 5) Source(1, 6) + SourceIndex(0) -2 >Emitted(2, 9) Source(1, 10) + SourceIndex(0) -3 >Emitted(2, 10) Source(1, 11) + SourceIndex(0) -4 >Emitted(2, 19) Source(1, 11) + SourceIndex(0) +1 >Emitted(6, 5) Source(1, 6) + SourceIndex(0) +2 >Emitted(6, 9) Source(1, 10) + SourceIndex(0) +3 >Emitted(6, 10) Source(1, 11) + SourceIndex(0) +4 >Emitted(6, 19) Source(1, 11) + SourceIndex(0) --- >>> var x = v; 1 >^^^^ @@ -92,18 +103,18 @@ sourceFile:ES5For-of13.ts 4 > = 5 > v 6 > ; -1 >Emitted(3, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(3, 9) Source(2, 9) + SourceIndex(0) -3 >Emitted(3, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(3, 13) Source(2, 13) + SourceIndex(0) -5 >Emitted(3, 14) Source(2, 14) + SourceIndex(0) -6 >Emitted(3, 15) Source(2, 15) + SourceIndex(0) +1 >Emitted(7, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(7, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(7, 10) Source(2, 10) + SourceIndex(0) +4 >Emitted(7, 13) Source(2, 13) + SourceIndex(0) +5 >Emitted(7, 14) Source(2, 14) + SourceIndex(0) +6 >Emitted(7, 15) Source(2, 15) + SourceIndex(0) --- >>>} 1 >^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} -1 >Emitted(4, 2) Source(3, 2) + SourceIndex(0) +1 >Emitted(8, 2) Source(3, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=ES5For-of13.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of17.js b/tests/baselines/reference/ES5For-of17.js index 688375b82bc..b728074ae93 100644 --- a/tests/baselines/reference/ES5For-of17.js +++ b/tests/baselines/reference/ES5For-of17.js @@ -11,7 +11,9 @@ for (let v of []) { for (var _i = 0, _a = []; _i < _a.length; _i++) { var v = _a[_i]; v; - for (var _b = 0, _c = [v]; _b < _c.length; _b++) { + for (var _b = 0, _c = [ + v + ]; _b < _c.length; _b++) { var _v = _c[_b]; var x = _v; _v++; diff --git a/tests/baselines/reference/ES5For-of20.js b/tests/baselines/reference/ES5For-of20.js index b70ac66b767..3dd707805d8 100644 --- a/tests/baselines/reference/ES5For-of20.js +++ b/tests/baselines/reference/ES5For-of20.js @@ -10,7 +10,9 @@ for (let v of []) { for (var _i = 0, _a = []; _i < _a.length; _i++) { var v = _a[_i]; var _v; - for (var _b = 0, _c = [v]; _b < _c.length; _b++) { + for (var _b = 0, _c = [ + v + ]; _b < _c.length; _b++) { var _v_1 = _c[_b]; var _v_2; } diff --git a/tests/baselines/reference/ES5For-of22.js b/tests/baselines/reference/ES5For-of22.js index d5ebc55e04a..63608f36e51 100644 --- a/tests/baselines/reference/ES5For-of22.js +++ b/tests/baselines/reference/ES5For-of22.js @@ -5,7 +5,11 @@ for (var x of [1, 2, 3]) { } //// [ES5For-of22.js] -for (var _i = 0, _a = [1, 2, 3]; _i < _a.length; _i++) { +for (var _i = 0, _a = [ + 1, + 2, + 3 +]; _i < _a.length; _i++) { var x = _a[_i]; var _a_1 = 0; console.log(x); diff --git a/tests/baselines/reference/ES5For-of23.js b/tests/baselines/reference/ES5For-of23.js index 3842591820f..dcecfac69df 100644 --- a/tests/baselines/reference/ES5For-of23.js +++ b/tests/baselines/reference/ES5For-of23.js @@ -5,7 +5,11 @@ for (var x of [1, 2, 3]) { } //// [ES5For-of23.js] -for (var _i = 0, _b = [1, 2, 3]; _i < _b.length; _i++) { +for (var _i = 0, _b = [ + 1, + 2, + 3 +]; _i < _b.length; _i++) { var x = _b[_i]; var _a = 0; console.log(x); diff --git a/tests/baselines/reference/ES5For-of24.js b/tests/baselines/reference/ES5For-of24.js index d5489016523..418ccc2005c 100644 --- a/tests/baselines/reference/ES5For-of24.js +++ b/tests/baselines/reference/ES5For-of24.js @@ -5,7 +5,11 @@ for (var v of a) { } //// [ES5For-of24.js] -var a = [1, 2, 3]; +var a = [ + 1, + 2, + 3 +]; for (var _i = 0; _i < a.length; _i++) { var v = a[_i]; var _a = 0; diff --git a/tests/baselines/reference/ES5For-of25.js b/tests/baselines/reference/ES5For-of25.js index 756c14fbe81..14e59a472fc 100644 --- a/tests/baselines/reference/ES5For-of25.js +++ b/tests/baselines/reference/ES5For-of25.js @@ -6,7 +6,11 @@ for (var v of a) { } //// [ES5For-of25.js] -var a = [1, 2, 3]; +var a = [ + 1, + 2, + 3 +]; for (var _i = 0; _i < a.length; _i++) { var v = a[_i]; v; diff --git a/tests/baselines/reference/ES5For-of25.js.map b/tests/baselines/reference/ES5For-of25.js.map index cc31767128b..90f1b9c0750 100644 --- a/tests/baselines/reference/ES5For-of25.js.map +++ b/tests/baselines/reference/ES5For-of25.js.map @@ -1,2 +1,2 @@ //// [ES5For-of25.js.map] -{"version":3,"file":"ES5For-of25.js","sourceRoot":"","sources":["ES5For-of25.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAClB,GAAG,CAAC,CAAU,UAAC,EAAV,aAAK,EAAL,IAAU,CAAC;IAAX,IAAI,CAAC,GAAI,CAAC,IAAL;IACN,CAAC,CAAC;IACF,CAAC,CAAC;CACL"} \ No newline at end of file +{"version":3,"file":"ES5For-of25.js","sourceRoot":"","sources":["ES5For-of25.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;IAAC,CAAC;IAAE,CAAC;IAAE,CAAC;CAAC,CAAC;AAClB,GAAG,CAAC,CAAU,UAAC,EAAV,aAAK,EAAL,IAAU,CAAC;IAAX,IAAI,CAAC,GAAI,CAAC,IAAL;IACN,CAAC,CAAC;IACF,CAAC,CAAC;CACL"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of25.sourcemap.txt b/tests/baselines/reference/ES5For-of25.sourcemap.txt index 623627fde20..1031764b03a 100644 --- a/tests/baselines/reference/ES5For-of25.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of25.sourcemap.txt @@ -8,44 +8,54 @@ sources: ES5For-of25.ts emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of25.js sourceFile:ES5For-of25.ts ------------------------------------------------------------------- ->>>var a = [1, 2, 3]; +>>>var a = [ 1 > 2 >^^^^ 3 > ^ 4 > ^^^ -5 > ^ -6 > ^ -7 > ^^ -8 > ^ -9 > ^^ -10> ^ -11> ^ -12> ^ -13> ^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >var 3 > a 4 > = -5 > [ -6 > 1 -7 > , -8 > 2 -9 > , -10> 3 -11> ] -12> ; 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) 3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) 4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) -5 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) -6 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) -7 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) -8 >Emitted(1, 14) Source(1, 14) + SourceIndex(0) -9 >Emitted(1, 16) Source(1, 16) + SourceIndex(0) -10>Emitted(1, 17) Source(1, 17) + SourceIndex(0) -11>Emitted(1, 18) Source(1, 18) + SourceIndex(0) -12>Emitted(1, 19) Source(1, 19) + SourceIndex(0) +--- +>>> 1, +1 >^^^^ +2 > ^ +3 > ^^-> +1 >[ +2 > 1 +1 >Emitted(2, 5) Source(1, 10) + SourceIndex(0) +2 >Emitted(2, 6) Source(1, 11) + SourceIndex(0) +--- +>>> 2, +1->^^^^ +2 > ^ +3 > ^-> +1->, +2 > 2 +1->Emitted(3, 5) Source(1, 13) + SourceIndex(0) +2 >Emitted(3, 6) Source(1, 14) + SourceIndex(0) +--- +>>> 3 +1->^^^^ +2 > ^ +1->, +2 > 3 +1->Emitted(4, 5) Source(1, 16) + SourceIndex(0) +2 >Emitted(4, 6) Source(1, 17) + SourceIndex(0) +--- +>>>]; +1 >^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 >] +2 > ; +1 >Emitted(5, 2) Source(1, 18) + SourceIndex(0) +2 >Emitted(5, 3) Source(1, 19) + SourceIndex(0) --- >>>for (var _i = 0; _i < a.length; _i++) { 1-> @@ -69,16 +79,16 @@ sourceFile:ES5For-of25.ts 8 > 9 > var v of a 10> ) -1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(2, 4) Source(2, 4) + SourceIndex(0) -3 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -4 >Emitted(2, 6) Source(2, 15) + SourceIndex(0) -5 >Emitted(2, 16) Source(2, 16) + SourceIndex(0) -6 >Emitted(2, 18) Source(2, 6) + SourceIndex(0) -7 >Emitted(2, 31) Source(2, 11) + SourceIndex(0) -8 >Emitted(2, 33) Source(2, 6) + SourceIndex(0) -9 >Emitted(2, 37) Source(2, 16) + SourceIndex(0) -10>Emitted(2, 38) Source(2, 17) + SourceIndex(0) +1->Emitted(6, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(6, 4) Source(2, 4) + SourceIndex(0) +3 >Emitted(6, 5) Source(2, 5) + SourceIndex(0) +4 >Emitted(6, 6) Source(2, 15) + SourceIndex(0) +5 >Emitted(6, 16) Source(2, 16) + SourceIndex(0) +6 >Emitted(6, 18) Source(2, 6) + SourceIndex(0) +7 >Emitted(6, 31) Source(2, 11) + SourceIndex(0) +8 >Emitted(6, 33) Source(2, 6) + SourceIndex(0) +9 >Emitted(6, 37) Source(2, 16) + SourceIndex(0) +10>Emitted(6, 38) Source(2, 17) + SourceIndex(0) --- >>> var v = a[_i]; 1 >^^^^ @@ -93,12 +103,12 @@ sourceFile:ES5For-of25.ts 4 > of 5 > a 6 > -1 >Emitted(3, 5) Source(2, 6) + SourceIndex(0) -2 >Emitted(3, 9) Source(2, 10) + SourceIndex(0) -3 >Emitted(3, 10) Source(2, 11) + SourceIndex(0) -4 >Emitted(3, 13) Source(2, 15) + SourceIndex(0) -5 >Emitted(3, 14) Source(2, 16) + SourceIndex(0) -6 >Emitted(3, 18) Source(2, 11) + SourceIndex(0) +1 >Emitted(7, 5) Source(2, 6) + SourceIndex(0) +2 >Emitted(7, 9) Source(2, 10) + SourceIndex(0) +3 >Emitted(7, 10) Source(2, 11) + SourceIndex(0) +4 >Emitted(7, 13) Source(2, 15) + SourceIndex(0) +5 >Emitted(7, 14) Source(2, 16) + SourceIndex(0) +6 >Emitted(7, 18) Source(2, 11) + SourceIndex(0) --- >>> v; 1 >^^^^ @@ -109,9 +119,9 @@ sourceFile:ES5For-of25.ts > 2 > v 3 > ; -1 >Emitted(4, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(4, 6) Source(3, 6) + SourceIndex(0) -3 >Emitted(4, 7) Source(3, 7) + SourceIndex(0) +1 >Emitted(8, 5) Source(3, 5) + SourceIndex(0) +2 >Emitted(8, 6) Source(3, 6) + SourceIndex(0) +3 >Emitted(8, 7) Source(3, 7) + SourceIndex(0) --- >>> a; 1->^^^^ @@ -121,15 +131,15 @@ sourceFile:ES5For-of25.ts > 2 > a 3 > ; -1->Emitted(5, 5) Source(4, 5) + SourceIndex(0) -2 >Emitted(5, 6) Source(4, 6) + SourceIndex(0) -3 >Emitted(5, 7) Source(4, 7) + SourceIndex(0) +1->Emitted(9, 5) Source(4, 5) + SourceIndex(0) +2 >Emitted(9, 6) Source(4, 6) + SourceIndex(0) +3 >Emitted(9, 7) Source(4, 7) + SourceIndex(0) --- >>>} 1 >^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} -1 >Emitted(6, 2) Source(5, 2) + SourceIndex(0) +1 >Emitted(10, 2) Source(5, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=ES5For-of25.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of26.js b/tests/baselines/reference/ES5For-of26.js index 4571cc660a3..2cbb65ad790 100644 --- a/tests/baselines/reference/ES5For-of26.js +++ b/tests/baselines/reference/ES5For-of26.js @@ -5,7 +5,10 @@ for (var [a = 0, b = 1] of [2, 3]) { } //// [ES5For-of26.js] -for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) { +for (var _i = 0, _a = [ + 2, + 3 +]; _i < _a.length; _i++) { var _b = _a[_i], _c = _b[0], a = _c === void 0 ? 0 : _c, _d = _b[1], b = _d === void 0 ? 1 : _d; a; b; diff --git a/tests/baselines/reference/ES5For-of26.js.map b/tests/baselines/reference/ES5For-of26.js.map index 704a3a24f2a..d80a8a75951 100644 --- a/tests/baselines/reference/ES5For-of26.js.map +++ b/tests/baselines/reference/ES5For-of26.js.map @@ -1,2 +1,2 @@ //// [ES5For-of26.js.map] -{"version":3,"file":"ES5For-of26.js","sourceRoot":"","sources":["ES5For-of26.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAuB,UAAM,EAAN,MAAC,CAAC,EAAE,CAAC,CAAC,EAA5B,cAAkB,EAAlB,IAA4B,CAAC;IAA7B,6BAAK,CAAC,mBAAG,CAAC,mBAAE,CAAC,mBAAG,CAAC,KAAC;IACnB,CAAC,CAAC;IACF,CAAC,CAAC;CACL"} \ No newline at end of file +{"version":3,"file":"ES5For-of26.js","sourceRoot":"","sources":["ES5For-of26.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAuB,UAAM,EAAN;IAAC,CAAC;IAAE,CAAC;CAAC,EAA5B,cAAkB,EAAlB,IAA4B,CAAC;IAA7B,6BAAK,CAAC,mBAAG,CAAC,mBAAE,CAAC,mBAAG,CAAC,KAAC;IACnB,CAAC,CAAC;IACF,CAAC,CAAC;CACL"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of26.sourcemap.txt b/tests/baselines/reference/ES5For-of26.sourcemap.txt index c9942b1e861..4fcc759dca8 100644 --- a/tests/baselines/reference/ES5For-of26.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of26.sourcemap.txt @@ -8,56 +8,64 @@ sources: ES5For-of26.ts emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of26.js sourceFile:ES5For-of26.ts ------------------------------------------------------------------- ->>>for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) { +>>>for (var _i = 0, _a = [ 1 > 2 >^^^ 3 > ^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^^ -7 > ^^^^^^ -8 > ^ -9 > ^^ -10> ^ -11> ^ -12> ^^ -13> ^^^^^^^^^^^^^^ -14> ^^ -15> ^^^^ -16> ^ -17> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >for 3 > 4 > (var [a = 0, b = 1] of 5 > [2, 3] 6 > -7 > [ -8 > 2 -9 > , -10> 3 -11> ] -12> -13> var [a = 0, b = 1] -14> -15> var [a = 0, b = 1] of [2, 3] -16> ) 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) 3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) 4 >Emitted(1, 6) Source(1, 28) + SourceIndex(0) 5 >Emitted(1, 16) Source(1, 34) + SourceIndex(0) 6 >Emitted(1, 18) Source(1, 28) + SourceIndex(0) -7 >Emitted(1, 24) Source(1, 29) + SourceIndex(0) -8 >Emitted(1, 25) Source(1, 30) + SourceIndex(0) -9 >Emitted(1, 27) Source(1, 32) + SourceIndex(0) -10>Emitted(1, 28) Source(1, 33) + SourceIndex(0) -11>Emitted(1, 29) Source(1, 34) + SourceIndex(0) -12>Emitted(1, 31) Source(1, 6) + SourceIndex(0) -13>Emitted(1, 45) Source(1, 24) + SourceIndex(0) -14>Emitted(1, 47) Source(1, 6) + SourceIndex(0) -15>Emitted(1, 51) Source(1, 34) + SourceIndex(0) -16>Emitted(1, 52) Source(1, 35) + SourceIndex(0) +--- +>>> 2, +1 >^^^^ +2 > ^ +3 > ^-> +1 >[ +2 > 2 +1 >Emitted(2, 5) Source(1, 29) + SourceIndex(0) +2 >Emitted(2, 6) Source(1, 30) + SourceIndex(0) +--- +>>> 3 +1->^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^-> +1->, +2 > 3 +1->Emitted(3, 5) Source(1, 32) + SourceIndex(0) +2 >Emitted(3, 6) Source(1, 33) + SourceIndex(0) +--- +>>>]; _i < _a.length; _i++) { +1->^ +2 > ^^ +3 > ^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->] +2 > +3 > var [a = 0, b = 1] +4 > +5 > var [a = 0, b = 1] of [2, 3] +6 > ) +1->Emitted(4, 2) Source(1, 34) + SourceIndex(0) +2 >Emitted(4, 4) Source(1, 6) + SourceIndex(0) +3 >Emitted(4, 18) Source(1, 24) + SourceIndex(0) +4 >Emitted(4, 20) Source(1, 6) + SourceIndex(0) +5 >Emitted(4, 24) Source(1, 34) + SourceIndex(0) +6 >Emitted(4, 25) Source(1, 35) + SourceIndex(0) --- >>> var _b = _a[_i], _c = _b[0], a = _c === void 0 ? 0 : _c, _d = _b[1], b = _d === void 0 ? 1 : _d; 1->^^^^ @@ -80,16 +88,16 @@ sourceFile:ES5For-of26.ts 8 > = 9 > 1 10> ] -1->Emitted(2, 5) Source(1, 6) + SourceIndex(0) -2 >Emitted(2, 34) Source(1, 11) + SourceIndex(0) -3 >Emitted(2, 35) Source(1, 12) + SourceIndex(0) -4 >Emitted(2, 54) Source(1, 15) + SourceIndex(0) -5 >Emitted(2, 55) Source(1, 16) + SourceIndex(0) -6 >Emitted(2, 74) Source(1, 18) + SourceIndex(0) -7 >Emitted(2, 75) Source(1, 19) + SourceIndex(0) -8 >Emitted(2, 94) Source(1, 22) + SourceIndex(0) -9 >Emitted(2, 95) Source(1, 23) + SourceIndex(0) -10>Emitted(2, 100) Source(1, 24) + SourceIndex(0) +1->Emitted(5, 5) Source(1, 6) + SourceIndex(0) +2 >Emitted(5, 34) Source(1, 11) + SourceIndex(0) +3 >Emitted(5, 35) Source(1, 12) + SourceIndex(0) +4 >Emitted(5, 54) Source(1, 15) + SourceIndex(0) +5 >Emitted(5, 55) Source(1, 16) + SourceIndex(0) +6 >Emitted(5, 74) Source(1, 18) + SourceIndex(0) +7 >Emitted(5, 75) Source(1, 19) + SourceIndex(0) +8 >Emitted(5, 94) Source(1, 22) + SourceIndex(0) +9 >Emitted(5, 95) Source(1, 23) + SourceIndex(0) +10>Emitted(5, 100) Source(1, 24) + SourceIndex(0) --- >>> a; 1 >^^^^ @@ -100,9 +108,9 @@ sourceFile:ES5For-of26.ts > 2 > a 3 > ; -1 >Emitted(3, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(3, 6) Source(2, 6) + SourceIndex(0) -3 >Emitted(3, 7) Source(2, 7) + SourceIndex(0) +1 >Emitted(6, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(6, 6) Source(2, 6) + SourceIndex(0) +3 >Emitted(6, 7) Source(2, 7) + SourceIndex(0) --- >>> b; 1->^^^^ @@ -112,15 +120,15 @@ sourceFile:ES5For-of26.ts > 2 > b 3 > ; -1->Emitted(4, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(4, 6) Source(3, 6) + SourceIndex(0) -3 >Emitted(4, 7) Source(3, 7) + SourceIndex(0) +1->Emitted(7, 5) Source(3, 5) + SourceIndex(0) +2 >Emitted(7, 6) Source(3, 6) + SourceIndex(0) +3 >Emitted(7, 7) Source(3, 7) + SourceIndex(0) --- >>>} 1 >^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} -1 >Emitted(5, 2) Source(4, 2) + SourceIndex(0) +1 >Emitted(8, 2) Source(4, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=ES5For-of26.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of27.js b/tests/baselines/reference/ES5For-of27.js index c8e5a03b114..c3993f6da52 100644 --- a/tests/baselines/reference/ES5For-of27.js +++ b/tests/baselines/reference/ES5For-of27.js @@ -5,7 +5,10 @@ for (var {x: a = 0, y: b = 1} of [2, 3]) { } //// [ES5For-of27.js] -for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) { +for (var _i = 0, _a = [ + 2, + 3 +]; _i < _a.length; _i++) { var _b = _a[_i], _c = _b.x, a = _c === void 0 ? 0 : _c, _d = _b.y, b = _d === void 0 ? 1 : _d; a; b; diff --git a/tests/baselines/reference/ES5For-of28.js b/tests/baselines/reference/ES5For-of28.js index 362b8835212..f1fa44a8453 100644 --- a/tests/baselines/reference/ES5For-of28.js +++ b/tests/baselines/reference/ES5For-of28.js @@ -5,7 +5,10 @@ for (let [a = 0, b = 1] of [2, 3]) { } //// [ES5For-of28.js] -for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) { +for (var _i = 0, _a = [ + 2, + 3 +]; _i < _a.length; _i++) { var _b = _a[_i], _c = _b[0], a = _c === void 0 ? 0 : _c, _d = _b[1], b = _d === void 0 ? 1 : _d; a; b; diff --git a/tests/baselines/reference/ES5For-of29.js b/tests/baselines/reference/ES5For-of29.js index 338ff311dba..11f847262e9 100644 --- a/tests/baselines/reference/ES5For-of29.js +++ b/tests/baselines/reference/ES5For-of29.js @@ -5,7 +5,10 @@ for (const {x: a = 0, y: b = 1} of [2, 3]) { } //// [ES5For-of29.js] -for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) { +for (var _i = 0, _a = [ + 2, + 3 +]; _i < _a.length; _i++) { var _b = _a[_i], _c = _b.x, a = _c === void 0 ? 0 : _c, _d = _b.y, b = _d === void 0 ? 1 : _d; a; b; diff --git a/tests/baselines/reference/ES5For-of3.js b/tests/baselines/reference/ES5For-of3.js index 648d34a9b16..9c2808edbba 100644 --- a/tests/baselines/reference/ES5For-of3.js +++ b/tests/baselines/reference/ES5For-of3.js @@ -3,7 +3,11 @@ for (var v of ['a', 'b', 'c']) var x = v; //// [ES5For-of3.js] -for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { +for (var _i = 0, _a = [ + 'a', + 'b', + 'c' +]; _i < _a.length; _i++) { var v = _a[_i]; var x = v; } diff --git a/tests/baselines/reference/ES5For-of3.js.map b/tests/baselines/reference/ES5For-of3.js.map index 7454e1ca85d..bfc09619d8e 100644 --- a/tests/baselines/reference/ES5For-of3.js.map +++ b/tests/baselines/reference/ES5For-of3.js.map @@ -1,2 +1,2 @@ //// [ES5For-of3.js.map] -{"version":3,"file":"ES5For-of3.js","sourceRoot":"","sources":["ES5For-of3.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CAAA"} \ No newline at end of file +{"version":3,"file":"ES5For-of3.js","sourceRoot":"","sources":["ES5For-of3.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf;IAAC,GAAG;IAAE,GAAG;IAAE,GAAG;CAAC,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of3.sourcemap.txt b/tests/baselines/reference/ES5For-of3.sourcemap.txt index dd0bca37b68..252a4a7414c 100644 --- a/tests/baselines/reference/ES5For-of3.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of3.sourcemap.txt @@ -8,61 +8,72 @@ sources: ES5For-of3.ts emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of3.js sourceFile:ES5For-of3.ts ------------------------------------------------------------------- ->>>for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { +>>>for (var _i = 0, _a = [ 1 > 2 >^^^ 3 > ^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^^ -7 > ^^^^^^ -8 > ^^^ -9 > ^^ -10> ^^^ -11> ^^ -12> ^^^ -13> ^ -14> ^^ -15> ^^^^^^^^^^^^^^ -16> ^^ -17> ^^^^ -18> ^ 1 > 2 >for 3 > 4 > (var v of 5 > ['a', 'b', 'c'] 6 > -7 > [ -8 > 'a' -9 > , -10> 'b' -11> , -12> 'c' -13> ] -14> -15> var v -16> -17> var v of ['a', 'b', 'c'] -18> ) 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) 3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) 4 >Emitted(1, 6) Source(1, 15) + SourceIndex(0) 5 >Emitted(1, 16) Source(1, 30) + SourceIndex(0) 6 >Emitted(1, 18) Source(1, 15) + SourceIndex(0) -7 >Emitted(1, 24) Source(1, 16) + SourceIndex(0) -8 >Emitted(1, 27) Source(1, 19) + SourceIndex(0) -9 >Emitted(1, 29) Source(1, 21) + SourceIndex(0) -10>Emitted(1, 32) Source(1, 24) + SourceIndex(0) -11>Emitted(1, 34) Source(1, 26) + SourceIndex(0) -12>Emitted(1, 37) Source(1, 29) + SourceIndex(0) -13>Emitted(1, 38) Source(1, 30) + SourceIndex(0) -14>Emitted(1, 40) Source(1, 6) + SourceIndex(0) -15>Emitted(1, 54) Source(1, 11) + SourceIndex(0) -16>Emitted(1, 56) Source(1, 6) + SourceIndex(0) -17>Emitted(1, 60) Source(1, 30) + SourceIndex(0) -18>Emitted(1, 61) Source(1, 31) + SourceIndex(0) +--- +>>> 'a', +1 >^^^^ +2 > ^^^ +3 > ^^-> +1 >[ +2 > 'a' +1 >Emitted(2, 5) Source(1, 16) + SourceIndex(0) +2 >Emitted(2, 8) Source(1, 19) + SourceIndex(0) +--- +>>> 'b', +1->^^^^ +2 > ^^^ +3 > ^-> +1->, +2 > 'b' +1->Emitted(3, 5) Source(1, 21) + SourceIndex(0) +2 >Emitted(3, 8) Source(1, 24) + SourceIndex(0) +--- +>>> 'c' +1->^^^^ +2 > ^^^ +3 > ^^^^^^^^^^^^^^^^^^^^-> +1->, +2 > 'c' +1->Emitted(4, 5) Source(1, 26) + SourceIndex(0) +2 >Emitted(4, 8) Source(1, 29) + SourceIndex(0) +--- +>>>]; _i < _a.length; _i++) { +1->^ +2 > ^^ +3 > ^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^ +6 > ^ +1->] +2 > +3 > var v +4 > +5 > var v of ['a', 'b', 'c'] +6 > ) +1->Emitted(5, 2) Source(1, 30) + SourceIndex(0) +2 >Emitted(5, 4) Source(1, 6) + SourceIndex(0) +3 >Emitted(5, 18) Source(1, 11) + SourceIndex(0) +4 >Emitted(5, 20) Source(1, 6) + SourceIndex(0) +5 >Emitted(5, 24) Source(1, 30) + SourceIndex(0) +6 >Emitted(5, 25) Source(1, 31) + SourceIndex(0) --- >>> var v = _a[_i]; 1 >^^^^ @@ -73,10 +84,10 @@ sourceFile:ES5For-of3.ts 2 > var 3 > v 4 > -1 >Emitted(2, 5) Source(1, 6) + SourceIndex(0) -2 >Emitted(2, 9) Source(1, 10) + SourceIndex(0) -3 >Emitted(2, 10) Source(1, 11) + SourceIndex(0) -4 >Emitted(2, 19) Source(1, 11) + SourceIndex(0) +1 >Emitted(6, 5) Source(1, 6) + SourceIndex(0) +2 >Emitted(6, 9) Source(1, 10) + SourceIndex(0) +3 >Emitted(6, 10) Source(1, 11) + SourceIndex(0) +4 >Emitted(6, 19) Source(1, 11) + SourceIndex(0) --- >>> var x = v; 1 >^^^^ @@ -92,17 +103,17 @@ sourceFile:ES5For-of3.ts 4 > = 5 > v 6 > ; -1 >Emitted(3, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(3, 9) Source(2, 9) + SourceIndex(0) -3 >Emitted(3, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(3, 13) Source(2, 13) + SourceIndex(0) -5 >Emitted(3, 14) Source(2, 14) + SourceIndex(0) -6 >Emitted(3, 15) Source(2, 15) + SourceIndex(0) +1 >Emitted(7, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(7, 9) Source(2, 9) + SourceIndex(0) +3 >Emitted(7, 10) Source(2, 10) + SourceIndex(0) +4 >Emitted(7, 13) Source(2, 13) + SourceIndex(0) +5 >Emitted(7, 14) Source(2, 14) + SourceIndex(0) +6 >Emitted(7, 15) Source(2, 15) + SourceIndex(0) --- >>>} 1 >^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(4, 2) Source(2, 15) + SourceIndex(0) +1 >Emitted(8, 2) Source(2, 15) + SourceIndex(0) --- >>>//# sourceMappingURL=ES5For-of3.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of30.js b/tests/baselines/reference/ES5For-of30.js index 2a1dc5a3399..f76a7938dcb 100644 --- a/tests/baselines/reference/ES5For-of30.js +++ b/tests/baselines/reference/ES5For-of30.js @@ -8,7 +8,10 @@ for ([a = 1, b = ""] of tuple) { //// [ES5For-of30.js] var a, b; -var tuple = [2, "3"]; +var tuple = [ + 2, + "3" +]; for (var _i = 0; _i < tuple.length; _i++) { _a = tuple[_i], _b = _a[0], a = _b === void 0 ? 1 : _b, _c = _a[1], b = _c === void 0 ? "" : _c; a; diff --git a/tests/baselines/reference/ES5For-of6.js b/tests/baselines/reference/ES5For-of6.js index bf966a0a5ae..ac740814d80 100644 --- a/tests/baselines/reference/ES5For-of6.js +++ b/tests/baselines/reference/ES5For-of6.js @@ -10,6 +10,9 @@ for (var _i = 0, _a = []; _i < _a.length; _i++) { var w = _a[_i]; for (var _b = 0, _c = []; _b < _c.length; _b++) { var v = _c[_b]; - var x = [w, v]; + var x = [ + w, + v + ]; } } diff --git a/tests/baselines/reference/ES5For-of7.js b/tests/baselines/reference/ES5For-of7.js index ad2302cdc5c..b88b6c055ac 100644 --- a/tests/baselines/reference/ES5For-of7.js +++ b/tests/baselines/reference/ES5For-of7.js @@ -14,5 +14,8 @@ for (var _i = 0, _a = []; _i < _a.length; _i++) { } for (var _b = 0, _c = []; _b < _c.length; _b++) { var v = _c[_b]; - var x = [w, v]; + var x = [ + w, + v + ]; } diff --git a/tests/baselines/reference/ES5For-of8.js b/tests/baselines/reference/ES5For-of8.js index dbe747b9690..6bf7dc37d1f 100644 --- a/tests/baselines/reference/ES5For-of8.js +++ b/tests/baselines/reference/ES5For-of8.js @@ -8,9 +8,15 @@ for (foo().x of ['a', 'b', 'c']) { //// [ES5For-of8.js] function foo() { - return { x: 0 }; + return { + x: 0 + }; } -for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { +for (var _i = 0, _a = [ + 'a', + 'b', + 'c' +]; _i < _a.length; _i++) { foo().x = _a[_i]; var p = foo().x; } diff --git a/tests/baselines/reference/ES5For-of8.js.map b/tests/baselines/reference/ES5For-of8.js.map index 23dec486d8d..eadf5e8430e 100644 --- a/tests/baselines/reference/ES5For-of8.js.map +++ b/tests/baselines/reference/ES5For-of8.js.map @@ -1,2 +1,2 @@ //// [ES5For-of8.js.map] -{"version":3,"file":"ES5For-of8.js","sourceRoot":"","sources":["ES5For-of8.ts"],"names":["foo"],"mappings":"AAAA,SAAS,GAAG;IACRA,MAAMA,CAACA,EAAEA,CAACA,EAAEA,CAACA,EAAEA,CAACA;AACpBA,CAACA;AACD,GAAG,CAAC,CAAY,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAA1B,cAAO,EAAP,IAA0B,CAAC;IAA3B,GAAG,EAAE,CAAC,CAAC,SAAA;IACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;CACnB"} \ No newline at end of file +{"version":3,"file":"ES5For-of8.js","sourceRoot":"","sources":["ES5For-of8.ts"],"names":["foo"],"mappings":"AAAA;IACIA,MAAMA,CAACA;QAAEA,CAACA,EAAEA,CAACA;KAAEA,CAACA;AACpBA,CAACA;AACD,GAAG,CAAC,CAAY,UAAe,EAAf;IAAC,GAAG;IAAE,GAAG;IAAE,GAAG;CAAC,EAA1B,cAAO,EAAP,IAA0B,CAAC;IAA3B,GAAG,EAAE,CAAC,CAAC,SAAA;IACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;CACnB"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of8.sourcemap.txt b/tests/baselines/reference/ES5For-of8.sourcemap.txt index e1cf66513a2..f4b97ebe696 100644 --- a/tests/baselines/reference/ES5For-of8.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of8.sourcemap.txt @@ -10,75 +10,62 @@ sourceFile:ES5For-of8.ts ------------------------------------------------------------------- >>>function foo() { 1 > -2 >^^^^^^^^^ -3 > ^^^ -4 > ^^^^^^^^^-> +2 >^^^^^^^^^^^^^-> 1 > -2 >function -3 > foo 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) -3 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) --- ->>> return { x: 0 }; +>>> return { 1->^^^^ 2 > ^^^^^^ 3 > ^ -4 > ^^ -5 > ^ -6 > ^^ -7 > ^ -8 > ^^ -9 > ^ -1->() { +4 > ^^-> +1->function foo() { > 2 > return 3 > -4 > { -5 > x -6 > : -7 > 0 -8 > } -9 > ; 1->Emitted(2, 5) Source(2, 5) + SourceIndex(0) name (foo) 2 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) name (foo) 3 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) name (foo) -4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) name (foo) -5 >Emitted(2, 15) Source(2, 15) + SourceIndex(0) name (foo) -6 >Emitted(2, 17) Source(2, 17) + SourceIndex(0) name (foo) -7 >Emitted(2, 18) Source(2, 18) + SourceIndex(0) name (foo) -8 >Emitted(2, 20) Source(2, 20) + SourceIndex(0) name (foo) -9 >Emitted(2, 21) Source(2, 21) + SourceIndex(0) name (foo) +--- +>>> x: 0 +1->^^^^^^^^ +2 > ^ +3 > ^^ +4 > ^ +1->{ +2 > x +3 > : +4 > 0 +1->Emitted(3, 9) Source(2, 14) + SourceIndex(0) name (foo) +2 >Emitted(3, 10) Source(2, 15) + SourceIndex(0) name (foo) +3 >Emitted(3, 12) Source(2, 17) + SourceIndex(0) name (foo) +4 >Emitted(3, 13) Source(2, 18) + SourceIndex(0) name (foo) +--- +>>> }; +1 >^^^^^ +2 > ^ +1 > } +2 > ; +1 >Emitted(4, 6) Source(2, 20) + SourceIndex(0) name (foo) +2 >Emitted(4, 7) Source(2, 21) + SourceIndex(0) name (foo) --- >>>} 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 >} -1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) name (foo) -2 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) name (foo) +1 >Emitted(5, 1) Source(3, 1) + SourceIndex(0) name (foo) +2 >Emitted(5, 2) Source(3, 2) + SourceIndex(0) name (foo) --- ->>>for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) { +>>>for (var _i = 0, _a = [ 1-> 2 >^^^ 3 > ^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^^ -7 > ^^^^^^ -8 > ^^^ -9 > ^^ -10> ^^^ -11> ^^ -12> ^^^ -13> ^ -14> ^^ -15> ^^^^^^^^^^^^^^ -16> ^^ -17> ^^^^ -18> ^ 1-> > 2 >for @@ -86,36 +73,59 @@ sourceFile:ES5For-of8.ts 4 > (foo().x of 5 > ['a', 'b', 'c'] 6 > -7 > [ -8 > 'a' -9 > , -10> 'b' -11> , -12> 'c' -13> ] -14> -15> foo().x -16> -17> foo().x of ['a', 'b', 'c'] -18> ) -1->Emitted(4, 1) Source(4, 1) + SourceIndex(0) -2 >Emitted(4, 4) Source(4, 4) + SourceIndex(0) -3 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) -4 >Emitted(4, 6) Source(4, 17) + SourceIndex(0) -5 >Emitted(4, 16) Source(4, 32) + SourceIndex(0) -6 >Emitted(4, 18) Source(4, 17) + SourceIndex(0) -7 >Emitted(4, 24) Source(4, 18) + SourceIndex(0) -8 >Emitted(4, 27) Source(4, 21) + SourceIndex(0) -9 >Emitted(4, 29) Source(4, 23) + SourceIndex(0) -10>Emitted(4, 32) Source(4, 26) + SourceIndex(0) -11>Emitted(4, 34) Source(4, 28) + SourceIndex(0) -12>Emitted(4, 37) Source(4, 31) + SourceIndex(0) -13>Emitted(4, 38) Source(4, 32) + SourceIndex(0) -14>Emitted(4, 40) Source(4, 6) + SourceIndex(0) -15>Emitted(4, 54) Source(4, 13) + SourceIndex(0) -16>Emitted(4, 56) Source(4, 6) + SourceIndex(0) -17>Emitted(4, 60) Source(4, 32) + SourceIndex(0) -18>Emitted(4, 61) Source(4, 33) + SourceIndex(0) +1->Emitted(6, 1) Source(4, 1) + SourceIndex(0) +2 >Emitted(6, 4) Source(4, 4) + SourceIndex(0) +3 >Emitted(6, 5) Source(4, 5) + SourceIndex(0) +4 >Emitted(6, 6) Source(4, 17) + SourceIndex(0) +5 >Emitted(6, 16) Source(4, 32) + SourceIndex(0) +6 >Emitted(6, 18) Source(4, 17) + SourceIndex(0) +--- +>>> 'a', +1 >^^^^ +2 > ^^^ +3 > ^^-> +1 >[ +2 > 'a' +1 >Emitted(7, 5) Source(4, 18) + SourceIndex(0) +2 >Emitted(7, 8) Source(4, 21) + SourceIndex(0) +--- +>>> 'b', +1->^^^^ +2 > ^^^ +3 > ^-> +1->, +2 > 'b' +1->Emitted(8, 5) Source(4, 23) + SourceIndex(0) +2 >Emitted(8, 8) Source(4, 26) + SourceIndex(0) +--- +>>> 'c' +1->^^^^ +2 > ^^^ +3 > ^^^^^^^^^^^^^^^^^^^^-> +1->, +2 > 'c' +1->Emitted(9, 5) Source(4, 28) + SourceIndex(0) +2 >Emitted(9, 8) Source(4, 31) + SourceIndex(0) +--- +>>>]; _i < _a.length; _i++) { +1->^ +2 > ^^ +3 > ^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^ +6 > ^ +1->] +2 > +3 > foo().x +4 > +5 > foo().x of ['a', 'b', 'c'] +6 > ) +1->Emitted(10, 2) Source(4, 32) + SourceIndex(0) +2 >Emitted(10, 4) Source(4, 6) + SourceIndex(0) +3 >Emitted(10, 18) Source(4, 13) + SourceIndex(0) +4 >Emitted(10, 20) Source(4, 6) + SourceIndex(0) +5 >Emitted(10, 24) Source(4, 32) + SourceIndex(0) +6 >Emitted(10, 25) Source(4, 33) + SourceIndex(0) --- >>> foo().x = _a[_i]; 1 >^^^^ @@ -131,12 +141,12 @@ sourceFile:ES5For-of8.ts 4 > . 5 > x 6 > -1 >Emitted(5, 5) Source(4, 6) + SourceIndex(0) -2 >Emitted(5, 8) Source(4, 9) + SourceIndex(0) -3 >Emitted(5, 10) Source(4, 11) + SourceIndex(0) -4 >Emitted(5, 11) Source(4, 12) + SourceIndex(0) -5 >Emitted(5, 12) Source(4, 13) + SourceIndex(0) -6 >Emitted(5, 21) Source(4, 13) + SourceIndex(0) +1 >Emitted(11, 5) Source(4, 6) + SourceIndex(0) +2 >Emitted(11, 8) Source(4, 9) + SourceIndex(0) +3 >Emitted(11, 10) Source(4, 11) + SourceIndex(0) +4 >Emitted(11, 11) Source(4, 12) + SourceIndex(0) +5 >Emitted(11, 12) Source(4, 13) + SourceIndex(0) +6 >Emitted(11, 21) Source(4, 13) + SourceIndex(0) --- >>> var p = foo().x; 1->^^^^ @@ -158,21 +168,21 @@ sourceFile:ES5For-of8.ts 7 > . 8 > x 9 > ; -1->Emitted(6, 5) Source(5, 5) + SourceIndex(0) -2 >Emitted(6, 9) Source(5, 9) + SourceIndex(0) -3 >Emitted(6, 10) Source(5, 10) + SourceIndex(0) -4 >Emitted(6, 13) Source(5, 13) + SourceIndex(0) -5 >Emitted(6, 16) Source(5, 16) + SourceIndex(0) -6 >Emitted(6, 18) Source(5, 18) + SourceIndex(0) -7 >Emitted(6, 19) Source(5, 19) + SourceIndex(0) -8 >Emitted(6, 20) Source(5, 20) + SourceIndex(0) -9 >Emitted(6, 21) Source(5, 21) + SourceIndex(0) +1->Emitted(12, 5) Source(5, 5) + SourceIndex(0) +2 >Emitted(12, 9) Source(5, 9) + SourceIndex(0) +3 >Emitted(12, 10) Source(5, 10) + SourceIndex(0) +4 >Emitted(12, 13) Source(5, 13) + SourceIndex(0) +5 >Emitted(12, 16) Source(5, 16) + SourceIndex(0) +6 >Emitted(12, 18) Source(5, 18) + SourceIndex(0) +7 >Emitted(12, 19) Source(5, 19) + SourceIndex(0) +8 >Emitted(12, 20) Source(5, 20) + SourceIndex(0) +9 >Emitted(12, 21) Source(5, 21) + SourceIndex(0) --- >>>} 1 >^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} -1 >Emitted(7, 2) Source(6, 2) + SourceIndex(0) +1 >Emitted(13, 2) Source(6, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=ES5For-of8.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of9.js b/tests/baselines/reference/ES5For-of9.js index 3a2cd2b1f74..bef83118864 100644 --- a/tests/baselines/reference/ES5For-of9.js +++ b/tests/baselines/reference/ES5For-of9.js @@ -10,7 +10,9 @@ for (foo().x of []) { //// [ES5For-of9.js] function foo() { - return { x: 0 }; + return { + x: 0 + }; } for (var _i = 0, _a = []; _i < _a.length; _i++) { foo().x = _a[_i]; From c222b2bb3e8b1051845bdfb65b524c20f3663f17 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Fri, 6 Mar 2015 17:51:51 -0500 Subject: [PATCH 020/101] Improve message for array destructuring error Closes #2090 --- src/compiler/checker.ts | 192 ++++++++++-------- .../diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 + .../declarationsAndAssignments.errors.txt | 12 +- 4 files changed, 114 insertions(+), 95 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8908501593c..ec45bd98254 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -338,10 +338,10 @@ module ts { case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: // TypeScript 1.0 spec (April 2014): 8.4.1 - // Initializer expressions for instance member variables are evaluated in the scope - // of the class constructor body but are not permitted to reference parameters or - // local variables of the constructor. This effectively means that entities from outer scopes - // by the same name as a constructor parameter or local variable are inaccessible + // Initializer expressions for instance member variables are evaluated in the scope + // of the class constructor body but are not permitted to reference parameters or + // local variables of the constructor. This effectively means that entities from outer scopes + // by the same name as a constructor parameter or local variable are inaccessible // in initializer expressions for instance member variables. if (location.parent.kind === SyntaxKind.ClassDeclaration && !(location.flags & NodeFlags.Static)) { var ctor = findConstructorDeclaration(location.parent); @@ -921,7 +921,7 @@ module ts { function isAccessible(symbolFromSymbolTable: Symbol, resolvedAliasSymbol?: Symbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { // if the symbolFromSymbolTable is not external module (it could be if it was determined as ambient external module and would be in globals table) - // and if symbolfrom symbolTable or alias resolution matches the symbol, + // and if symbolfrom symbolTable or alias resolution matches the symbol, // check the symbol can be qualified, it is only then this symbol is accessible return !forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); @@ -1018,14 +1018,14 @@ module ts { // } // var x: typeof m.c // In the above example when we start with checking if typeof m.c symbol is accessible, - // we are going to see if c can be accessed in scope directly. + // we are going to see if c can be accessed in scope directly. // But it can't, hence the accessible is going to be undefined, but that doesn't mean m.c is inaccessible // It is accessible if the parent m is accessible because then m.c can be accessed through qualification meaningToLook = getQualifiedLeftMeaning(meaning); symbol = getParentOfSymbol(symbol); } - // This could be a symbol that is not exported in the external module + // This could be a symbol that is not exported in the external module // or it could be a symbol from different external module that is not aliased and hence cannot be named var symbolExternalModule = forEach(initialSymbol.declarations, getExternalModuleContainer); if (symbolExternalModule) { @@ -1072,7 +1072,7 @@ module ts { function getIsDeclarationVisible(declaration: Declaration) { if (!isDeclarationVisible(declaration)) { - // Mark the unexported alias as visible if its parent is visible + // Mark the unexported alias as visible if its parent is visible // because these kind of aliases can be used to name types in declaration file if (declaration.kind === SyntaxKind.ImportEqualsDeclaration && !(declaration.flags & NodeFlags.Export) && @@ -1107,7 +1107,7 @@ module ts { else if (entityName.kind === SyntaxKind.QualifiedName || entityName.parent.kind === SyntaxKind.ImportEqualsDeclaration) { // Left identifier from type reference or TypeAlias - // Entity name of the import declaration + // Entity name of the import declaration meaning = SymbolFlags.Namespace; } else { @@ -1219,8 +1219,8 @@ module ts { appendSymbolNameOnly(symbol, writer); } - // Let the writer know we just wrote out a symbol. The declaration emitter writer uses - // this to determine if an import it has previously seen (and not written out) needs + // Let the writer know we just wrote out a symbol. The declaration emitter writer uses + // this to determine if an import it has previously seen (and not written out) needs // to be written to the file once the walk of the tree is complete. // // NOTE(cyrusn): This approach feels somewhat unfortunate. A simple pass over the tree @@ -1473,7 +1473,7 @@ module ts { writer.writeLine(); } if (resolved.stringIndexType) { - // [x: string]: + // [x: string]: writePunctuation(writer, SyntaxKind.OpenBracketToken); writer.writeParameter(getIndexerParameterName(resolved, IndexKind.String, /*fallbackName*/"x")); writePunctuation(writer, SyntaxKind.ColonToken); @@ -1487,7 +1487,7 @@ module ts { writer.writeLine(); } if (resolved.numberIndexType) { - // [x: number]: + // [x: number]: writePunctuation(writer, SyntaxKind.OpenBracketToken); writer.writeParameter(getIndexerParameterName(resolved, IndexKind.Number, /*fallbackName*/"x")); writePunctuation(writer, SyntaxKind.ColonToken); @@ -1753,7 +1753,7 @@ module ts { case SyntaxKind.UnionType: case SyntaxKind.ParenthesizedType: return isDeclarationVisible(node.parent); - + // Type parameters are always visible case SyntaxKind.TypeParameter: // Source file is always visible @@ -1784,14 +1784,14 @@ module ts { function getDeclarationContainer(node: Node): Node { node = getRootDeclaration(node); - // Parent chain: + // Parent chain: // VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container' return node.kind === SyntaxKind.VariableDeclaration ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype: Symbol): Type { // TypeScript 1.0 spec (April 2014): 8.4 - // Every class automatically contains a static property member named 'prototype', + // Every class automatically contains a static property member named 'prototype', // the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter. // It is an error to explicitly declare a static property member with the name 'prototype'. var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -1845,7 +1845,12 @@ module ts { var propName = "" + indexOf(pattern.elements, declaration); var type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, IndexKind.Number); if (!type) { - error(declaration, Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName); + if (isTupleType(parentType)) { + error(declaration, Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), (parentType).elementTypes.length, pattern.elements.length); + } + else { + error(declaration, Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName); + } return unknownType; } } @@ -3046,11 +3051,11 @@ module ts { var symbol = resolveName(typeParameter, ((n).typeName).text, SymbolFlags.Type, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); if (symbol && (symbol.flags & SymbolFlags.TypeParameter)) { // TypeScript 1.0 spec (April 2014): 3.4.1 - // Type parameters declared in a particular type parameter list + // Type parameters declared in a particular type parameter list // may not be referenced in constraints in that type parameter list - + // symbol.declaration.parent === typeParameter.parent - // -> typeParameter and symbol.declaration originate from the same type parameter list + // -> typeParameter and symbol.declaration originate from the same type parameter list // -> illegal for all declarations in symbol // forEach === exists links.isIllegalTypeReferenceInConstraint = forEach(symbol.declarations, d => d.parent == typeParameter.parent); @@ -3077,7 +3082,7 @@ module ts { var type: Type; if ((symbol.flags & SymbolFlags.TypeParameter) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { // TypeScript 1.0 spec (April 2014): 3.4.1 - // Type parameters declared in a particular type parameter list + // Type parameters declared in a particular type parameter list // may not be referenced in constraints in that type parameter list // Implementation: such type references are resolved to 'unknown' type that usually denotes error type = unknownType; @@ -3113,7 +3118,7 @@ module ts { // TypeScript 1.0 spec (April 2014): 3.6.3 // The expression is processed as an identifier expression (section 4.3) // or property access expression(section 4.10), - // the widened type(section 3.9) of which becomes the result. + // the widened type(section 3.9) of which becomes the result. links.resolvedType = getWidenedType(checkExpressionOrQualifiedName(node.exprName)); } return links.resolvedType; @@ -3478,7 +3483,7 @@ module ts { mapper = combineTypeMappers(links.mapper, mapper); } - // Keep the flags from the symbol we're instantiating. Mark that is instantiated, and + // Keep the flags from the symbol we're instantiating. Mark that is instantiated, and // also transient so that we can just store data on it directly. var result = createSymbol(SymbolFlags.Instantiated | SymbolFlags.Transient | symbol.flags, symbol.name); result.declarations = symbol.declarations; @@ -3986,7 +3991,7 @@ module ts { // S is a subtype of a type T, and T is a supertype of S if ... // S' and T are object types and, for each member M in T.. // M is a property and S' contains a property N where - // if M is a required property, N is also a required property + // if M is a required property, N is also a required property // (M - property in T) // (N - property in S) if (reportErrors) { @@ -4333,6 +4338,10 @@ module ts { return !!getPropertyOfType(type, "0"); } + function isTupleType(type: Type) : boolean { + return (type.flags & TypeFlags.Tuple) && !!(type).elementTypes; + } + function getWidenedTypeOfObjectLiteral(type: Type): Type { var properties = getPropertiesOfObjectType(type); var members: SymbolTable = {}; @@ -4823,9 +4832,9 @@ module ts { function getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type { resolveLocation(node); - // Get the narrowed type of symbol at given location instead of just getting + // Get the narrowed type of symbol at given location instead of just getting // the type of the symbol. - // eg. + // eg. // function foo(a: string | number) { // if (typeof a === "string") { // a/**/ @@ -5077,7 +5086,7 @@ module ts { // if parent is variable statement - get its parent container = container.parent; } - + var inFunction = isInsideFunction(node.parent, container); var current = container; @@ -5546,8 +5555,8 @@ module ts { // Return the contextual signature for a given expression node. A contextual type provides a // contextual signature if it has a single call signature and if that call signature is non-generic. - // If the contextual type is a union type, get the signature from each type possible and if they are - // all identical ignoring their return type, the result is same signature but with return type as + // If the contextual type is a union type, get the signature from each type possible and if they are + // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node: FunctionExpression | MethodDeclaration): Signature { Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node)); @@ -5750,9 +5759,9 @@ module ts { } else { // TypeScript 1.0 spec (April 2014) - // A get accessor declaration is processed in the same manner as + // A get accessor declaration is processed in the same manner as // an ordinary function declaration(section 6.1) with no parameters. - // A set accessor declaration is processed in the same manner + // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. Debug.assert(memberDecl.kind === SyntaxKind.GetAccessor || memberDecl.kind === SyntaxKind.SetAccessor); checkAccessorDeclaration(memberDecl); @@ -5869,11 +5878,11 @@ module ts { getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & SymbolFlags.Class) { // TS 1.0 spec (April 2014): 4.8.2 - // - In a constructor, instance member function, instance member accessor, or - // instance member variable initializer where this references a derived class instance, + // - In a constructor, instance member function, instance member accessor, or + // instance member variable initializer where this references a derived class instance, // a super property access is permitted and must specify a public instance member function of the base class. - // - In a static member function or static member accessor - // where this references the constructor function object of a derived class, + // - In a static member function or static member accessor + // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. if (left.kind === SyntaxKind.SuperKeyword && getDeclarationKindFromSymbol(prop) !== SyntaxKind.MethodDeclaration) { error(right, Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); @@ -5941,11 +5950,11 @@ module ts { } // TypeScript 1.0 spec (April 2014): 4.10 Property Access - // - If IndexExpr is a string literal or a numeric literal and ObjExpr's apparent type has a property with the name + // - If IndexExpr is a string literal or a numeric literal and ObjExpr's apparent type has a property with the name // given by that literal(converted to its string representation in the case of a numeric literal), the property access is of the type of that property. - // - Otherwise, if ObjExpr's apparent type has a numeric index signature and IndexExpr is of type Any, the Number primitive type, or an enum type, + // - Otherwise, if ObjExpr's apparent type has a numeric index signature and IndexExpr is of type Any, the Number primitive type, or an enum type, // the property access is of the type of that index signature. - // - Otherwise, if ObjExpr's apparent type has a string index signature and IndexExpr is of type Any, the String or Number primitive type, or an enum type, + // - Otherwise, if ObjExpr's apparent type has a string index signature and IndexExpr is of type Any, the String or Number primitive type, or an enum type, // the property access is of the type of that index signature. // - Otherwise, if IndexExpr is of type Any, the String or Number primitive type, or an enum type, the property access is of type Any. @@ -6182,7 +6191,7 @@ module ts { return signature.minArgumentCount === 0; } - + // For IDE scenarios we may have an incomplete call, so a trailing comma is tantamount to adding another argument. adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; @@ -6402,7 +6411,7 @@ module ts { } var args = getEffectiveCallArguments(node); - + // The following applies to any value of 'excludeArgument[i]': // - true: the argument at 'i' is susceptible to a one-time permanent contextual typing. // - undefined: the argument at 'i' is *not* susceptible to permanent contextual typing. @@ -6990,16 +6999,16 @@ module ts { function isReferenceOrErrorExpression(n: Node): boolean { // TypeScript 1.0 spec (April 2014): - // Expressions are classified as values or references. + // Expressions are classified as values or references. // References are the subset of expressions that are permitted as the target of an assignment. - // Specifically, references are combinations of identifiers(section 4.3), parentheses(section 4.7), + // Specifically, references are combinations of identifiers(section 4.3), parentheses(section 4.7), // and property accesses(section 4.10). // All other expression constructs described in this chapter are classified as values. switch (n.kind) { case SyntaxKind.Identifier: var symbol = findSymbol(n); // TypeScript 1.0 spec (April 2014): 4.3 - // An identifier expression that references a variable or parameter is classified as a reference. + // An identifier expression that references a variable or parameter is classified as a reference. // An identifier expression that references any other kind of entity is classified as a value(and therefore cannot be the target of an assignment). return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & SymbolFlags.Variable) !== 0; case SyntaxKind.PropertyAccessExpression: @@ -7172,7 +7181,7 @@ module ts { function checkInstanceOfExpression(node: BinaryExpression, leftType: Type, rightType: Type): Type { // TypeScript 1.0 spec (April 2014): 4.15.4 // The instanceof operator requires the left operand to be of type Any, an object type, or a type parameter type, - // and the right operand to be of type Any or a subtype of the 'Function' interface type. + // and the right operand to be of type Any or a subtype of the 'Function' interface type. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported if (allConstituentTypesHaveKind(leftType, TypeFlags.Primitive)) { @@ -7243,7 +7252,12 @@ module ts { checkDestructuringAssignment(e, type, contextualMapper); } else { - error(e, Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + if (isTupleType(sourceType)) { + error(e, Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), (sourceType).elementTypes.length, elements.length); + } + else { + error(e, Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + } } } else { @@ -7318,7 +7332,7 @@ module ts { case SyntaxKind.AmpersandEqualsToken: // TypeScript 1.0 spec (April 2014): 4.15.1 // These operators require their operands to be of type Any, the Number primitive type, - // or an enum type. Operands of an enum type are treated + // or an enum type. Operands of an enum type are treated // as having the primitive type Number. If one operand is the null or undefined value, // it is treated as having the type of the other operand. // The result is always of the Number primitive type. @@ -7326,7 +7340,7 @@ module ts { if (rightType.flags & (TypeFlags.Undefined | TypeFlags.Null)) rightType = leftType; var suggestedOperator: SyntaxKind; - // if a user tries to apply a bitwise operator to 2 boolean operands + // if a user tries to apply a bitwise operator to 2 boolean operands // try and return them a helpful suggestion if ((leftType.flags & TypeFlags.Boolean) && (rightType.flags & TypeFlags.Boolean) && @@ -7334,7 +7348,7 @@ module ts { error(node, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(node.operatorToken.kind), tokenToString(suggestedOperator)); } else { - // otherwise just check each operand separately and report errors as normal + // otherwise just check each operand separately and report errors as normal var leftOk = checkArithmeticOperandType(node.left, leftType, Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); var rightOk = checkArithmeticOperandType(node.right, rightType, Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); if (leftOk && rightOk) { @@ -7452,7 +7466,7 @@ module ts { // An assignment of the form // VarExpr = ValueExpr // requires VarExpr to be classified as a reference - // A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1) + // A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1) // and the type of the non - compound operation to be assignable to the type of VarExpr. var ok = checkReferenceExpression(node.left, Diagnostics.Invalid_left_hand_side_of_assignment_expression, Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); // Use default messages @@ -7580,7 +7594,7 @@ module ts { if (isConstEnumObjectType(type)) { // enum object type for const enums are only permitted in: - // - 'left' in property access + // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement var ok = @@ -7865,14 +7879,14 @@ module ts { } // TS 1.0 spec (April 2014): 8.3.2 - // Constructors of classes with no extends clause may not contain super calls, whereas + // Constructors of classes with no extends clause may not contain super calls, whereas // constructors of derived classes must contain at least one super call somewhere in their function body. if (getClassBaseTypeNode(node.parent)) { if (containsSuperCall(node.body)) { // The first statement in the body of a constructor must be a super call if both of the following are true: // - The containing class is a derived class. - // - The constructor declares parameter properties + // - The constructor declares parameter properties // or the containing class declares instance member variables with initializers. var superCallShouldBeFirst = forEach((node.parent).members, isInstancePropertyWithInitializer) || @@ -8230,8 +8244,8 @@ module ts { // checkSpecializedSignatureDeclaration if (!bodySignature.hasStringLiterals) { // TypeScript 1.0 spec (April 2014): 6.1 - // If a function declaration includes overloads, the overloads determine the call - // signatures of the type given to the function object + // If a function declaration includes overloads, the overloads determine the call + // signatures of the type given to the function object // and the function implementation signature must be assignable to that type // // TypeScript 1.0 spec (April 2014): 3.8.4 @@ -8281,7 +8295,7 @@ module ts { return; } - // we use SymbolFlags.ExportValue, SymbolFlags.ExportType and SymbolFlags.ExportNamespace + // we use SymbolFlags.ExportValue, SymbolFlags.ExportType and SymbolFlags.ExportNamespace // to denote disjoint declarationSpaces (without making new enum type). var exportedDeclarationSpaces: SymbolFlags = 0; var nonExportedDeclarationSpaces: SymbolFlags = 0; @@ -8509,11 +8523,11 @@ module ts { function checkVarDeclaredNamesNotShadowed(node: VariableDeclaration | BindingElement) { // - ScriptBody : StatementList - // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList + // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList // also occurs in the VarDeclaredNames of StatementList. // - Block : { StatementList } - // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList + // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList // also occurs in the VarDeclaredNames of StatementList. // Variable declarations are hoisted to the top of their function scope. They can shadow @@ -8522,11 +8536,11 @@ module ts { // A non-initialized declaration is a no-op as the block declaration will resolve before the var // declaration. the problem is if the declaration has an initializer. this will act as a write to the // block declared value. this is fine for let, but not const. - // Only consider declarations with initializers, uninitialized var declarations will not + // Only consider declarations with initializers, uninitialized var declarations will not // step on a let/const variable. - // Do not consider let and const declarations, as duplicate block-scoped declarations + // Do not consider let and const declarations, as duplicate block-scoped declarations // are handled by the binder. - // We are only looking for var declarations that step on let\const declarations from a + // We are only looking for var declarations that step on let\const declarations from a // different scope. e.g.: // { // const x = 0; // localDeclarationSymbol obtained after name resolution will correspond to this declaration @@ -8545,8 +8559,8 @@ module ts { var container = varDeclList.parent.kind === SyntaxKind.VariableStatement && varDeclList.parent.parent; - - // names of block-scoped and function scoped variables can collide only + + // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && @@ -8556,7 +8570,7 @@ module ts { // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error - // otherwise if variable has an initializer - show error that initialization will fail + // otherwise if variable has an initializer - show error that initialization will fail // since LHS will be block scoped name instead of function scoped if (!namesShareScope) { var name = symbolToString(localDeclarationSymbol); @@ -8584,7 +8598,7 @@ module ts { function visit(n: Node) { if (n.kind === SyntaxKind.Identifier) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; - // check FunctionLikeDeclaration.locals (stores parameters\function local variable) + // check FunctionLikeDeclaration.locals (stores parameters\function local variable) // if it contains entry with a specified name and if this entry matches the resolved symbol if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, SymbolFlags.Value) === referencedSymbol) { if (referencedSymbol.valueDeclaration.kind === SyntaxKind.Parameter) { @@ -8729,7 +8743,7 @@ module ts { } function checkWhileStatement(node: WhileStatement) { - // Grammar checking + // Grammar checking checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); @@ -8763,7 +8777,7 @@ module ts { grammarErrorOnFirstToken(node, Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); return; } - + checkGrammarForInOrForOfStatement(node) // Check the LHS and RHS @@ -8778,7 +8792,7 @@ module ts { var varExpr = node.initializer; var rightType = checkExpression(node.expression); var iteratedType = checkIteratedType(rightType, node.expression); - + // There may be a destructuring assignment on the left side if (varExpr.kind === SyntaxKind.ArrayLiteralExpression || varExpr.kind === SyntaxKind.ObjectLiteralExpression) { // iteratedType may be undefined. In this case, we still want to check the structure of @@ -8790,7 +8804,7 @@ module ts { var leftType = checkExpression(varExpr); checkReferenceExpression(varExpr, /*invalidReferenceMessage*/ Diagnostics.Invalid_left_hand_side_in_for_of_statement, /*constantVariableMessage*/ Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant); - + // iteratedType will be undefined if the rightType was missing properties/signatures // required to get its iteratedType (like [Symbol.iterator] or next). This may be // because we accessed properties from anyType, or it may have led to an error inside @@ -8805,20 +8819,20 @@ module ts { } function checkForInStatement(node: ForInStatement) { - // Grammar checking + // Grammar checking checkGrammarForInOrForOfStatement(node); // TypeScript 1.0 spec (April 2014): 5.4 // In a 'for-in' statement of the form // for (var VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, - // and Expr must be an expression of type Any, an object type, or a type parameter type. + // and Expr must be an expression of type Any, an object type, or a type parameter type. if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { var variable = (node.initializer).declarations[0]; if (variable && isBindingPattern(variable.name)) { error(variable.name, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } - + checkForInOrForOfVariableDeclaration(node); } else { @@ -8889,7 +8903,7 @@ module ts { } return iteratedType; - + function getIteratedType(iterable: Type, expressionForError: Expression) { // We want to treat type as an iterable, and get the type it is an iterable of. The iterable // must have the following structure (annotated with the names of the variables below): @@ -8916,7 +8930,7 @@ module ts { // caller requested it. Then the caller can decide what to do in the case where there is no iterated // type. This is different from returning anyType, because that would signify that we have matched the // whole pattern and that T (above) is 'any'. - + if (allConstituentTypesHaveKind(iterable, TypeFlags.Any)) { return undefined; } @@ -8964,7 +8978,7 @@ module ts { } return undefined; } - + return iteratorNextValue; } } @@ -9160,7 +9174,7 @@ module ts { if (!(member.flags & NodeFlags.Static) && hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, IndexKind.String); - checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, IndexKind.Number); + checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, IndexKind.Number); } } } @@ -9176,7 +9190,7 @@ module ts { } } - if (errorNode && !isTypeAssignableTo(numberIndexType, stringIndexType)) { + if (errorNode && !isTypeAssignableTo(numberIndexType, stringIndexType)) { error(errorNode, Diagnostics.Numeric_index_type_0_is_not_assignable_to_string_index_type_1, typeToString(numberIndexType), typeToString(stringIndexType)); } @@ -9289,7 +9303,7 @@ module ts { checkKindsOfPropertyMemberOverrides(type, baseType); } - + // Check that base type can be evaluated as expression checkExpressionOrQualifiedName(baseTypeNode.typeName); } @@ -9333,13 +9347,13 @@ module ts { // Inheritance means that a derived class implicitly contains all non - overridden members of the base class. // Both public and private property members are inherited, but only public property members can be overridden. // A property member in a derived class is said to override a property member in a base class - // when the derived class property member has the same name and kind(instance or static) + // when the derived class property member has the same name and kind(instance or static) // as the base class property member. // The type of an overriding property member must be assignable(section 3.8.4) // to the type of the overridden property member, or otherwise a compile - time error occurs. // Base class instance member functions can be overridden by derived class instance member functions, // but not by other kinds of members. - // Base class instance member variables and accessors can be overridden by + // Base class instance member variables and accessors can be overridden by // derived class instance member variables and accessors, but not by other kinds of members. // NOTE: assignability is checked in checkClassDeclaration @@ -9505,7 +9519,7 @@ module ts { function checkTypeAliasDeclaration(node: TypeAliasDeclaration) { // Grammar checking checkGrammarModifiers(node); - + checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0); checkSourceElement(node.type); } @@ -9533,7 +9547,7 @@ module ts { } else if (!ambient) { // Only here do we need to check that the initializer is assignable to the enum type. - // If it is a constant value (not undefined), it is syntactically constrained to be a number. + // If it is a constant value (not undefined), it is syntactically constrained to be a number. // Also, we do not need to check this for ambients because there is already // a syntax error if it is not a constant. checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, /*headMessage*/ undefined); @@ -9802,7 +9816,7 @@ module ts { } if (inAmbientExternalModule && isExternalModuleNameRelative((moduleName).text)) { // TypeScript 1.0 spec (April 2013): 12.1.6 - // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference + // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference // other external modules only through top - level external module names. // Relative external module names are not permitted. error(node, Diagnostics.Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); @@ -10941,7 +10955,7 @@ module ts { var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, SymbolFlags.BlockScopedVariable | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); - + var isLetOrConst = symbol && (symbol.flags & SymbolFlags.BlockScopedVariable) && @@ -11422,7 +11436,7 @@ module ts { for (var i = 0, n = node.properties.length; i < n; i++) { var prop = node.properties[i]; var name = prop.name; - if (prop.kind === SyntaxKind.OmittedExpression || + if (prop.kind === SyntaxKind.OmittedExpression || name.kind === SyntaxKind.ComputedPropertyName) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); @@ -11685,8 +11699,8 @@ module ts { return grammarErrorAtPos(getSourceFileOfNode(node), node.initializer.pos - 1, 1, Diagnostics.A_rest_element_cannot_have_an_initializer); } } - // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code - // and its Identifier is eval or arguments + // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code + // and its Identifier is eval or arguments return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } @@ -11720,8 +11734,8 @@ module ts { // 2. ForDeclaration: ForDeclaration : LetOrConst ForBinding // It is a Syntax Error if the BoundNames of ForDeclaration contains "let". - // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code - // and its Identifier is eval or arguments + // It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code + // and its Identifier is eval or arguments return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } @@ -11957,7 +11971,7 @@ module ts { if (!links.hasReportedStatementInAmbientContext && isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts) } - + // We are either parented by another statement, or some sort of block. // If we're in a block, we only want to really report an error once // to prevent noisyness. So use a bit on the block to indicate if diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 24ed8ce4e99..b06a283a876 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -338,6 +338,7 @@ module ts { The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: DiagnosticCategory.Error, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: DiagnosticCategory.Error, key: "Cannot redeclare identifier '{0}' in catch clause" }, + Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: DiagnosticCategory.Error, key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 40f7d55f9f0..b265f5b5281 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1343,6 +1343,10 @@ "category": "Error", "code": 2492 }, + "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'.": { + "category": "Error", + "code": 2493 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/tests/baselines/reference/declarationsAndAssignments.errors.txt b/tests/baselines/reference/declarationsAndAssignments.errors.txt index 4eefc2fcc23..828083e7687 100644 --- a/tests/baselines/reference/declarationsAndAssignments.errors.txt +++ b/tests/baselines/reference/declarationsAndAssignments.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(5,16): error TS2460: Type '[number, string]' has no property '2'. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(5,16): error TS2493: Tuple type '[number, string]' with length '2' cannot be assigned to tuple with length '3'. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(56,17): error TS2322: Type 'number' is not assignable to type 'string'. -tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,13): error TS2460: Type '[number]' has no property '1'. -tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,16): error TS2460: Type '[number]' has no property '2'. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,13): error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(63,16): error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(67,9): error TS2461: Type '{ [x: number]: undefined; }' is not an array type. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(68,9): error TS2461: Type '{ [x: number]: number; 0: number; 1: number; }' is not an array type. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(73,11): error TS2459: Type '{}' has no property 'a' and no string index signature. @@ -25,7 +25,7 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9): var [x, y] = [1, "hello"]; var [x, y, z] = [1, "hello"]; // Error ~ -!!! error TS2460: Type '[number, string]' has no property '2'. +!!! error TS2493: Tuple type '[number, string]' with length '2' cannot be assigned to tuple with length '3'. var [,, z] = [0, 1, 2]; var x: number; var y: string; @@ -87,9 +87,9 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9): var [a, b, c] = []; // Ok, [] is an array var [d, e, f] = [1]; // Error, [1] is a tuple ~ -!!! error TS2460: Type '[number]' has no property '1'. +!!! error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'. ~ -!!! error TS2460: Type '[number]' has no property '2'. +!!! error TS2493: Tuple type '[number]' with length '1' cannot be assigned to tuple with length '3'. } function f9() { From bd2c239161829efc2520b214b91e58158289a7f5 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Fri, 6 Mar 2015 20:54:31 -0500 Subject: [PATCH 021/101] Add tests for tuple type compatibility Tests suggested by @DanielRosenwasser --- .../arityAndOrderCompatibility01.errors.txt | 147 ++++++++++++++++++ .../reference/arityAndOrderCompatibility01.js | 61 ++++++++ .../tuple/arityAndOrderCompatibility01.ts | 33 ++++ 3 files changed, 241 insertions(+) create mode 100644 tests/baselines/reference/arityAndOrderCompatibility01.errors.txt create mode 100644 tests/baselines/reference/arityAndOrderCompatibility01.js create mode 100644 tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts diff --git a/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt b/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt new file mode 100644 index 00000000000..3925cdff747 --- /dev/null +++ b/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt @@ -0,0 +1,147 @@ +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(13,12): error TS2493: Tuple type '[string, number]' with length '2' cannot be assigned to tuple with length '3'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(14,12): error TS2460: Type 'StrNum' has no property '2'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(15,5): error TS2461: Type '{ 0: string; 1: number; }' is not an array type. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(16,5): error TS2322: Type '[string, number]' is not assignable to type '[number, number, number]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(17,5): error TS2322: Type 'StrNum' is not assignable to type '[number, number, number]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(18,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number, number, number]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(19,5): error TS2322: Type '[string, number]' is not assignable to type '[string, number, number]'. + Property '2' is missing in type '[string, number]'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(20,5): error TS2322: Type 'StrNum' is not assignable to type '[string, number, number]'. + Property '2' is missing in type 'StrNum'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(21,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string, number, number]'. + Property '2' is missing in type '{ 0: string; 1: number; }'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(22,5): error TS2322: Type '[string, number]' is not assignable to type '[number]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(23,5): error TS2322: Type 'StrNum' is not assignable to type '[number]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(24,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(25,5): error TS2322: Type '[string, number]' is not assignable to type '[string]'. + Types of property 'pop' are incompatible. + Type '() => string | number' is not assignable to type '() => string'. + Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(26,5): error TS2322: Type 'StrNum' is not assignable to type '[string]'. + Types of property 'pop' are incompatible. + Type '() => string | number' is not assignable to type '() => string'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(27,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string]'. + Property 'length' is missing in type '{ 0: string; 1: number; }'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(28,5): error TS2322: Type '[string, number]' is not assignable to type '[number, string]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(29,5): error TS2322: Type 'StrNum' is not assignable to type '[number, string]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(30,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number, string]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. + + +==== tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts (18 errors) ==== + interface StrNum extends Array { + 0: string; + 1: number; + } + + var x: [string, number]; + var y: StrNum + var z: { + 0: string; + 1: number; + } + + var [a, b, c] = x; + ~ +!!! error TS2493: Tuple type '[string, number]' with length '2' cannot be assigned to tuple with length '3'. + var [d, e, f] = y; + ~ +!!! error TS2460: Type 'StrNum' has no property '2'. + var [g, h, i] = z; + ~~~~~~~~~ +!!! error TS2461: Type '{ 0: string; 1: number; }' is not an array type. + var j1: [number, number, number] = x; + ~~ +!!! error TS2322: Type '[string, number]' is not assignable to type '[number, number, number]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var j2: [number, number, number] = y; + ~~ +!!! error TS2322: Type 'StrNum' is not assignable to type '[number, number, number]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var j3: [number, number, number] = z; + ~~ +!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number, number, number]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var k1: [string, number, number] = x; + ~~ +!!! error TS2322: Type '[string, number]' is not assignable to type '[string, number, number]'. +!!! error TS2322: Property '2' is missing in type '[string, number]'. + var k2: [string, number, number] = y; + ~~ +!!! error TS2322: Type 'StrNum' is not assignable to type '[string, number, number]'. +!!! error TS2322: Property '2' is missing in type 'StrNum'. + var k3: [string, number, number] = z; + ~~ +!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string, number, number]'. +!!! error TS2322: Property '2' is missing in type '{ 0: string; 1: number; }'. + var l1: [number] = x; + ~~ +!!! error TS2322: Type '[string, number]' is not assignable to type '[number]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var l2: [number] = y; + ~~ +!!! error TS2322: Type 'StrNum' is not assignable to type '[number]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var l3: [number] = z; + ~~ +!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var m1: [string] = x; + ~~ +!!! error TS2322: Type '[string, number]' is not assignable to type '[string]'. +!!! error TS2322: Types of property 'pop' are incompatible. +!!! error TS2322: Type '() => string | number' is not assignable to type '() => string'. +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + var m2: [string] = y; + ~~ +!!! error TS2322: Type 'StrNum' is not assignable to type '[string]'. +!!! error TS2322: Types of property 'pop' are incompatible. +!!! error TS2322: Type '() => string | number' is not assignable to type '() => string'. + var m3: [string] = z; + ~~ +!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string]'. +!!! error TS2322: Property 'length' is missing in type '{ 0: string; 1: number; }'. + var n1: [number, string] = x; + ~~ +!!! error TS2322: Type '[string, number]' is not assignable to type '[number, string]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var n2: [number, string] = y; + ~~ +!!! error TS2322: Type 'StrNum' is not assignable to type '[number, string]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var n3: [number, string] = z; + ~~ +!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number, string]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var o1: [string, number] = x; + var o2: [string, number] = y; + var o3: [string, number] = y; + \ No newline at end of file diff --git a/tests/baselines/reference/arityAndOrderCompatibility01.js b/tests/baselines/reference/arityAndOrderCompatibility01.js new file mode 100644 index 00000000000..5b88697fd4f --- /dev/null +++ b/tests/baselines/reference/arityAndOrderCompatibility01.js @@ -0,0 +1,61 @@ +//// [arityAndOrderCompatibility01.ts] +interface StrNum extends Array { + 0: string; + 1: number; +} + +var x: [string, number]; +var y: StrNum +var z: { + 0: string; + 1: number; +} + +var [a, b, c] = x; +var [d, e, f] = y; +var [g, h, i] = z; +var j1: [number, number, number] = x; +var j2: [number, number, number] = y; +var j3: [number, number, number] = z; +var k1: [string, number, number] = x; +var k2: [string, number, number] = y; +var k3: [string, number, number] = z; +var l1: [number] = x; +var l2: [number] = y; +var l3: [number] = z; +var m1: [string] = x; +var m2: [string] = y; +var m3: [string] = z; +var n1: [number, string] = x; +var n2: [number, string] = y; +var n3: [number, string] = z; +var o1: [string, number] = x; +var o2: [string, number] = y; +var o3: [string, number] = y; + + +//// [arityAndOrderCompatibility01.js] +var x; +var y; +var z; +var a = x[0], b = x[1], c = x[2]; +var d = y[0], e = y[1], f = y[2]; +var g = z[0], h = z[1], i = z[2]; +var j1 = x; +var j2 = y; +var j3 = z; +var k1 = x; +var k2 = y; +var k3 = z; +var l1 = x; +var l2 = y; +var l3 = z; +var m1 = x; +var m2 = y; +var m3 = z; +var n1 = x; +var n2 = y; +var n3 = z; +var o1 = x; +var o2 = y; +var o3 = y; diff --git a/tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts b/tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts new file mode 100644 index 00000000000..0f486d843ea --- /dev/null +++ b/tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts @@ -0,0 +1,33 @@ +interface StrNum extends Array { + 0: string; + 1: number; +} + +var x: [string, number]; +var y: StrNum +var z: { + 0: string; + 1: number; +} + +var [a, b, c] = x; +var [d, e, f] = y; +var [g, h, i] = z; +var j1: [number, number, number] = x; +var j2: [number, number, number] = y; +var j3: [number, number, number] = z; +var k1: [string, number, number] = x; +var k2: [string, number, number] = y; +var k3: [string, number, number] = z; +var l1: [number] = x; +var l2: [number] = y; +var l3: [number] = z; +var m1: [string] = x; +var m2: [string] = y; +var m3: [string] = z; +var n1: [number, string] = x; +var n2: [number, string] = y; +var n3: [number, string] = z; +var o1: [string, number] = x; +var o2: [string, number] = y; +var o3: [string, number] = y; From 7acb410251dca0e1001dc26bab2f8e360c590ba7 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Tue, 10 Mar 2015 13:37:25 -0400 Subject: [PATCH 022/101] Add note about use of isTupleType() --- src/compiler/checker.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ec45bd98254..831f2258db0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4339,6 +4339,8 @@ module ts { } function isTupleType(type: Type) : boolean { + // Check if a Type exactly implements interface TupleType. Typical typechecking code should rely on + // isTupleLikeType() instead. return (type.flags & TypeFlags.Tuple) && !!(type).elementTypes; } From f389aefc478de9d867e56ef56da6e66309c8a187 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 10 Mar 2015 10:41:26 -0700 Subject: [PATCH 023/101] Fix call to emitNode after merge with master --- src/compiler/emitter.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 3a8a513d135..54739b4080c 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2074,7 +2074,7 @@ module ts { function emitNodeWithSourceMap(node: Node) { if (node) { if (nodeIsSynthesized(node)) { - return emitNode(node); + return emitNodeWithoutSourceMap(node); } if (node.kind != SyntaxKind.SourceFile) { recordEmitNodeStartSpan(node); @@ -3587,7 +3587,7 @@ module ts { write("var "); // _i = 0 - emitNode(counter); + emitNodeWithoutSourceMap(counter); write(" = 0"); emitEnd(node.expression); @@ -3595,25 +3595,25 @@ module ts { // , _a = expr write(", "); emitStart(node.expression); - emitNode(rhsReference); + emitNodeWithoutSourceMap(rhsReference); write(" = "); - emitNode(node.expression); + emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); } write("; "); // _i < _a.length; emitStart(node.initializer); - emitNode(counter); + emitNodeWithoutSourceMap(counter); write(" < "); - emitNode(rhsReference); + emitNodeWithoutSourceMap(rhsReference); write(".length"); emitEnd(node.initializer); write("; "); // _i++) emitStart(node.initializer); - emitNode(counter); + emitNodeWithoutSourceMap(counter); write("++"); emitEnd(node.initializer); emitToken(SyntaxKind.CloseParenToken, node.expression.end); @@ -3640,17 +3640,17 @@ module ts { else { // The following call does not include the initializer, so we have // to emit it separately. - emitNode(declaration); + emitNodeWithoutSourceMap(declaration); write(" = "); - emitNode(rhsIterationValue); + emitNodeWithoutSourceMap(rhsIterationValue); } } else { // It's an empty declaration list. This can only happen in an error case, if the user wrote // for (var of []) {} - emitNode(createTempVariable(node, /*forLoopVariable*/ false)); + emitNodeWithoutSourceMap(createTempVariable(node, /*forLoopVariable*/ false)); write(" = "); - emitNode(rhsIterationValue); + emitNodeWithoutSourceMap(rhsIterationValue); } } else { @@ -3663,7 +3663,7 @@ module ts { emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined, /*locationForCheckingExistingName*/ node); } else { - emitNode(assignmentExpression); + emitNodeWithoutSourceMap(assignmentExpression); } } emitEnd(node.initializer); @@ -4567,7 +4567,7 @@ module ts { } function emitMemberAccessForPropertyName(memberName: DeclarationName) { - // TODO: (jfreeman,drosen): comment on why this is emitNode instead of emit here. + // TODO: (jfreeman,drosen): comment on why this is emitNodeWithoutSourceMap instead of emit here. if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) { write("["); emitNodeWithoutSourceMap(memberName); From 0d06729b188efd7fa2fa91b1cd04bb3dad33ee49 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Tue, 10 Mar 2015 15:58:39 -0400 Subject: [PATCH 024/101] Move comment and refer to tuple type literal syntax rather than TupleType interface --- src/compiler/checker.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 831f2258db0..2c0ae191320 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4338,9 +4338,11 @@ module ts { return !!getPropertyOfType(type, "0"); } + /** + * Check if a Type was written as a tuple type literal. + * Prefer using isTupleLikeType() unless the use of `elementTypes` is required. + */ function isTupleType(type: Type) : boolean { - // Check if a Type exactly implements interface TupleType. Typical typechecking code should rely on - // isTupleLikeType() instead. return (type.flags & TypeFlags.Tuple) && !!(type).elementTypes; } From efcf0e6f579ceba15ffe9698afa68bd39fb6e99c Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 10 Mar 2015 17:50:54 -0700 Subject: [PATCH 025/101] introduce CaseBlock as a block-scoped container for switch statements --- src/compiler/binder.ts | 2 +- src/compiler/checker.ts | 3 +- src/compiler/emitter.ts | 6 +- src/compiler/parser.ts | 8 ++- src/compiler/types.ts | 5 ++ src/compiler/utilities.ts | 1 + src/services/breakpoints.ts | 10 +-- src/services/formatting/rules.ts | 2 +- src/services/formatting/smartIndenter.ts | 4 +- src/services/outliningElementsCollector.ts | 2 +- src/services/services.ts | 6 +- .../baselines/reference/APISample_compile.js | 46 +++++++------- .../reference/APISample_compile.types | 53 +++++++++------- tests/baselines/reference/APISample_linter.js | 46 +++++++------- .../reference/APISample_linter.types | 53 +++++++++------- .../reference/APISample_transform.js | 46 +++++++------- .../reference/APISample_transform.types | 53 +++++++++------- .../baselines/reference/APISample_watcher.js | 46 +++++++------- .../reference/APISample_watcher.types | 53 +++++++++------- .../letConstInCaseClauses.errors.txt | 39 ++++++++++++ .../reference/letConstInCaseClauses.js | 61 +++++++++++++++++++ tests/cases/compiler/letConstInCaseClauses.ts | 31 ++++++++++ 22 files changed, 389 insertions(+), 187 deletions(-) create mode 100644 tests/baselines/reference/letConstInCaseClauses.errors.txt create mode 100644 tests/baselines/reference/letConstInCaseClauses.js create mode 100644 tests/cases/compiler/letConstInCaseClauses.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 2e17d8bf3a1..e325b2033e7 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -534,7 +534,7 @@ module ts { case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: case SyntaxKind.ForOfStatement: - case SyntaxKind.SwitchStatement: + case SyntaxKind.CaseBlock: bindChildren(node, 0, /*isBlockScopeContainer*/ true); break; default: diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8908501593c..94f3fc2244a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9031,7 +9031,7 @@ module ts { var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); - forEach(node.clauses, clause => { + forEach(node.caseBlock.clauses, clause => { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause if (clause.kind === SyntaxKind.DefaultClause && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { @@ -10147,6 +10147,7 @@ module ts { case SyntaxKind.BreakStatement: case SyntaxKind.ReturnStatement: case SyntaxKind.SwitchStatement: + case SyntaxKind.CaseBlock: case SyntaxKind.CaseClause: case SyntaxKind.DefaultClause: case SyntaxKind.LabeledStatement: diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 8947314a6f6..e9848af989c 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3541,10 +3541,10 @@ module ts { write(" "); emitToken(SyntaxKind.OpenBraceToken, endPos); increaseIndent(); - emitLines(node.clauses); + emitLines(node.caseBlock.clauses); decreaseIndent(); writeLine(); - emitToken(SyntaxKind.CloseBraceToken, node.clauses.end); + emitToken(SyntaxKind.CloseBraceToken, node.caseBlock.clauses.end); } function nodeStartPositionsAreOnSameLine(node1: Node, node2: Node) { @@ -3938,7 +3938,7 @@ module ts { } switch (current.kind) { case SyntaxKind.SourceFile: - case SyntaxKind.SwitchKeyword: + case SyntaxKind.CaseBlock: case SyntaxKind.CatchClause: case SyntaxKind.ModuleDeclaration: case SyntaxKind.ForStatement: diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 0d6f002a3da..6e444eb23c7 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -209,7 +209,9 @@ module ts { visitNode(cbNode, (node).statement); case SyntaxKind.SwitchStatement: return visitNode(cbNode, (node).expression) || - visitNodes(cbNodes, (node).clauses); + visitNode(cbNode, (node).caseBlock); + case SyntaxKind.CaseBlock: + return visitNodes(cbNodes, (node).clauses); case SyntaxKind.CaseClause: return visitNode(cbNode, (node).expression) || visitNodes(cbNodes, (node).statements); @@ -3954,9 +3956,11 @@ module ts { parseExpected(SyntaxKind.OpenParenToken); node.expression = allowInAnd(parseExpression); parseExpected(SyntaxKind.CloseParenToken); + var caseBlock = createNode(SyntaxKind.CaseBlock, scanner.getStartPos()); parseExpected(SyntaxKind.OpenBraceToken); - node.clauses = parseList(ParsingContext.SwitchClauses, /*checkForStrictMode*/ false, parseCaseOrDefaultClause); + caseBlock.clauses = parseList(ParsingContext.SwitchClauses, /*checkForStrictMode*/ false, parseCaseOrDefaultClause); parseExpected(SyntaxKind.CloseBraceToken); + node.caseBlock = finishNode(caseBlock); return finishNode(node); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index abace7e224e..7301e087ae1 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -233,6 +233,7 @@ module ts { EnumDeclaration, ModuleDeclaration, ModuleBlock, + CaseBlock, ImportEqualsDeclaration, ImportDeclaration, ImportClause, @@ -790,6 +791,10 @@ module ts { export interface SwitchStatement extends Statement { expression: Expression; + caseBlock: CaseBlock; + } + + export interface CaseBlock extends Node { clauses: NodeArray; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 28e9b114ec3..0278af8671b 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -376,6 +376,7 @@ module ts { switch (node.kind) { case SyntaxKind.ReturnStatement: return visitor(node); + case SyntaxKind.CaseBlock: case SyntaxKind.Block: case SyntaxKind.IfStatement: case SyntaxKind.DoStatement: diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index d59718322c9..1f87ae40745 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -416,8 +416,8 @@ module ts.BreakpointResolver { var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case SyntaxKind.SwitchStatement: - return spanInNodeIfStartsOnSameLine(node.parent, (node.parent).clauses[0]); + case SyntaxKind.CaseBlock: + return spanInNodeIfStartsOnSameLine(node.parent.parent, (node.parent).clauses[0]); } // Default to parent node @@ -447,10 +447,10 @@ module ts.BreakpointResolver { case SyntaxKind.CatchClause: return spanInNode((node.parent).statements[(node.parent).statements.length - 1]);; - case SyntaxKind.SwitchStatement: + case SyntaxKind.CaseBlock: // breakpoint in last statement of the last clause - var switchStatement = node.parent; - var lastClause = switchStatement.clauses[switchStatement.clauses.length - 1]; + var caseBlock = node.parent; + var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; if (lastClause) { return spanInNode(lastClause.statements[lastClause.statements.length - 1]); } diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index ecfc5012915..7eb5232af18 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -541,7 +541,7 @@ module ts.formatting { switch (node.kind) { case SyntaxKind.Block: - case SyntaxKind.SwitchStatement: + case SyntaxKind.CaseBlock: case SyntaxKind.ObjectLiteralExpression: case SyntaxKind.ModuleBlock: return true; diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 6974f160e10..96159d332fe 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -357,7 +357,7 @@ module ts.formatting { case SyntaxKind.ModuleBlock: case SyntaxKind.ObjectLiteralExpression: case SyntaxKind.TypeLiteral: - case SyntaxKind.SwitchStatement: + case SyntaxKind.CaseBlock: case SyntaxKind.DefaultClause: case SyntaxKind.CaseClause: case SyntaxKind.ParenthesizedExpression: @@ -431,7 +431,7 @@ module ts.formatting { case SyntaxKind.ObjectLiteralExpression: case SyntaxKind.Block: case SyntaxKind.ModuleBlock: - case SyntaxKind.SwitchStatement: + case SyntaxKind.CaseBlock: return nodeEndsWith(n, SyntaxKind.CloseBraceToken, sourceFile); case SyntaxKind.CatchClause: return isCompletedNode((n).block, sourceFile); diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 54b548336de..eee537bbebb 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -104,7 +104,7 @@ module ts { case SyntaxKind.InterfaceDeclaration: case SyntaxKind.EnumDeclaration: case SyntaxKind.ObjectLiteralExpression: - case SyntaxKind.SwitchStatement: + case SyntaxKind.CaseBlock: var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile); var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); diff --git a/src/services/services.ts b/src/services/services.ts index 6ef044ad75a..61d7a0736b0 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3619,8 +3619,8 @@ module ts { break; case SyntaxKind.CaseKeyword: case SyntaxKind.DefaultKeyword: - if (hasKind(parent(parent(node)), SyntaxKind.SwitchStatement)) { - return getSwitchCaseDefaultOccurrences(node.parent.parent); + if (hasKind(parent(parent(parent(node))), SyntaxKind.SwitchStatement)) { + return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case SyntaxKind.BreakKeyword: @@ -3887,7 +3887,7 @@ module ts { pushKeywordIf(keywords, switchStatement.getFirstToken(), SyntaxKind.SwitchKeyword); // Go through each clause in the switch statement, collecting the 'case'/'default' keywords. - forEach(switchStatement.clauses, clause => { + forEach(switchStatement.caseBlock.clauses, clause => { pushKeywordIf(keywords, clause.getFirstToken(), SyntaxKind.CaseKeyword, SyntaxKind.DefaultKeyword); var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index a94858d9154..6e6adb2cd45 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -261,27 +261,28 @@ declare module "typescript" { EnumDeclaration = 199, ModuleDeclaration = 200, ModuleBlock = 201, - ImportEqualsDeclaration = 202, - ImportDeclaration = 203, - ImportClause = 204, - NamespaceImport = 205, - NamedImports = 206, - ImportSpecifier = 207, - ExportAssignment = 208, - ExportDeclaration = 209, - NamedExports = 210, - ExportSpecifier = 211, - ExternalModuleReference = 212, - CaseClause = 213, - DefaultClause = 214, - HeritageClause = 215, - CatchClause = 216, - PropertyAssignment = 217, - ShorthandPropertyAssignment = 218, - EnumMember = 219, - SourceFile = 220, - SyntaxList = 221, - Count = 222, + CaseBlock = 202, + ImportEqualsDeclaration = 203, + ImportDeclaration = 204, + ImportClause = 205, + NamespaceImport = 206, + NamedImports = 207, + ImportSpecifier = 208, + ExportAssignment = 209, + ExportDeclaration = 210, + NamedExports = 211, + ExportSpecifier = 212, + ExternalModuleReference = 213, + CaseClause = 214, + DefaultClause = 215, + HeritageClause = 216, + CatchClause = 217, + PropertyAssignment = 218, + ShorthandPropertyAssignment = 219, + EnumMember = 220, + SourceFile = 221, + SyntaxList = 222, + Count = 223, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, @@ -656,6 +657,9 @@ declare module "typescript" { } interface SwitchStatement extends Statement { expression: Expression; + caseBlock: CaseBlock; + } + interface CaseBlock extends Node { clauses: NodeArray; } interface CaseClause extends Node { diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 40096915869..17ce175ebdf 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -801,67 +801,70 @@ declare module "typescript" { ModuleBlock = 201, >ModuleBlock : SyntaxKind - ImportEqualsDeclaration = 202, + CaseBlock = 202, +>CaseBlock : SyntaxKind + + ImportEqualsDeclaration = 203, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 203, + ImportDeclaration = 204, >ImportDeclaration : SyntaxKind - ImportClause = 204, + ImportClause = 205, >ImportClause : SyntaxKind - NamespaceImport = 205, + NamespaceImport = 206, >NamespaceImport : SyntaxKind - NamedImports = 206, + NamedImports = 207, >NamedImports : SyntaxKind - ImportSpecifier = 207, + ImportSpecifier = 208, >ImportSpecifier : SyntaxKind - ExportAssignment = 208, + ExportAssignment = 209, >ExportAssignment : SyntaxKind - ExportDeclaration = 209, + ExportDeclaration = 210, >ExportDeclaration : SyntaxKind - NamedExports = 210, + NamedExports = 211, >NamedExports : SyntaxKind - ExportSpecifier = 211, + ExportSpecifier = 212, >ExportSpecifier : SyntaxKind - ExternalModuleReference = 212, + ExternalModuleReference = 213, >ExternalModuleReference : SyntaxKind - CaseClause = 213, + CaseClause = 214, >CaseClause : SyntaxKind - DefaultClause = 214, + DefaultClause = 215, >DefaultClause : SyntaxKind - HeritageClause = 215, + HeritageClause = 216, >HeritageClause : SyntaxKind - CatchClause = 216, + CatchClause = 217, >CatchClause : SyntaxKind - PropertyAssignment = 217, + PropertyAssignment = 218, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 218, + ShorthandPropertyAssignment = 219, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 219, + EnumMember = 220, >EnumMember : SyntaxKind - SourceFile = 220, + SourceFile = 221, >SourceFile : SyntaxKind - SyntaxList = 221, + SyntaxList = 222, >SyntaxList : SyntaxKind - Count = 222, + Count = 223, >Count : SyntaxKind FirstAssignment = 52, @@ -1980,6 +1983,14 @@ declare module "typescript" { >expression : Expression >Expression : Expression + caseBlock: CaseBlock; +>caseBlock : CaseBlock +>CaseBlock : CaseBlock + } + interface CaseBlock extends Node { +>CaseBlock : CaseBlock +>Node : Node + clauses: NodeArray; >clauses : NodeArray >NodeArray : NodeArray diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index aa94796e3f1..4f1fc899a89 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -292,27 +292,28 @@ declare module "typescript" { EnumDeclaration = 199, ModuleDeclaration = 200, ModuleBlock = 201, - ImportEqualsDeclaration = 202, - ImportDeclaration = 203, - ImportClause = 204, - NamespaceImport = 205, - NamedImports = 206, - ImportSpecifier = 207, - ExportAssignment = 208, - ExportDeclaration = 209, - NamedExports = 210, - ExportSpecifier = 211, - ExternalModuleReference = 212, - CaseClause = 213, - DefaultClause = 214, - HeritageClause = 215, - CatchClause = 216, - PropertyAssignment = 217, - ShorthandPropertyAssignment = 218, - EnumMember = 219, - SourceFile = 220, - SyntaxList = 221, - Count = 222, + CaseBlock = 202, + ImportEqualsDeclaration = 203, + ImportDeclaration = 204, + ImportClause = 205, + NamespaceImport = 206, + NamedImports = 207, + ImportSpecifier = 208, + ExportAssignment = 209, + ExportDeclaration = 210, + NamedExports = 211, + ExportSpecifier = 212, + ExternalModuleReference = 213, + CaseClause = 214, + DefaultClause = 215, + HeritageClause = 216, + CatchClause = 217, + PropertyAssignment = 218, + ShorthandPropertyAssignment = 219, + EnumMember = 220, + SourceFile = 221, + SyntaxList = 222, + Count = 223, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, @@ -687,6 +688,9 @@ declare module "typescript" { } interface SwitchStatement extends Statement { expression: Expression; + caseBlock: CaseBlock; + } + interface CaseBlock extends Node { clauses: NodeArray; } interface CaseClause extends Node { diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index f061125220d..d1dcad98d85 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -947,67 +947,70 @@ declare module "typescript" { ModuleBlock = 201, >ModuleBlock : SyntaxKind - ImportEqualsDeclaration = 202, + CaseBlock = 202, +>CaseBlock : SyntaxKind + + ImportEqualsDeclaration = 203, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 203, + ImportDeclaration = 204, >ImportDeclaration : SyntaxKind - ImportClause = 204, + ImportClause = 205, >ImportClause : SyntaxKind - NamespaceImport = 205, + NamespaceImport = 206, >NamespaceImport : SyntaxKind - NamedImports = 206, + NamedImports = 207, >NamedImports : SyntaxKind - ImportSpecifier = 207, + ImportSpecifier = 208, >ImportSpecifier : SyntaxKind - ExportAssignment = 208, + ExportAssignment = 209, >ExportAssignment : SyntaxKind - ExportDeclaration = 209, + ExportDeclaration = 210, >ExportDeclaration : SyntaxKind - NamedExports = 210, + NamedExports = 211, >NamedExports : SyntaxKind - ExportSpecifier = 211, + ExportSpecifier = 212, >ExportSpecifier : SyntaxKind - ExternalModuleReference = 212, + ExternalModuleReference = 213, >ExternalModuleReference : SyntaxKind - CaseClause = 213, + CaseClause = 214, >CaseClause : SyntaxKind - DefaultClause = 214, + DefaultClause = 215, >DefaultClause : SyntaxKind - HeritageClause = 215, + HeritageClause = 216, >HeritageClause : SyntaxKind - CatchClause = 216, + CatchClause = 217, >CatchClause : SyntaxKind - PropertyAssignment = 217, + PropertyAssignment = 218, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 218, + ShorthandPropertyAssignment = 219, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 219, + EnumMember = 220, >EnumMember : SyntaxKind - SourceFile = 220, + SourceFile = 221, >SourceFile : SyntaxKind - SyntaxList = 221, + SyntaxList = 222, >SyntaxList : SyntaxKind - Count = 222, + Count = 223, >Count : SyntaxKind FirstAssignment = 52, @@ -2126,6 +2129,14 @@ declare module "typescript" { >expression : Expression >Expression : Expression + caseBlock: CaseBlock; +>caseBlock : CaseBlock +>CaseBlock : CaseBlock + } + interface CaseBlock extends Node { +>CaseBlock : CaseBlock +>Node : Node + clauses: NodeArray; >clauses : NodeArray >NodeArray : NodeArray diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 6defcf64c70..3ef3d7bc0f5 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -293,27 +293,28 @@ declare module "typescript" { EnumDeclaration = 199, ModuleDeclaration = 200, ModuleBlock = 201, - ImportEqualsDeclaration = 202, - ImportDeclaration = 203, - ImportClause = 204, - NamespaceImport = 205, - NamedImports = 206, - ImportSpecifier = 207, - ExportAssignment = 208, - ExportDeclaration = 209, - NamedExports = 210, - ExportSpecifier = 211, - ExternalModuleReference = 212, - CaseClause = 213, - DefaultClause = 214, - HeritageClause = 215, - CatchClause = 216, - PropertyAssignment = 217, - ShorthandPropertyAssignment = 218, - EnumMember = 219, - SourceFile = 220, - SyntaxList = 221, - Count = 222, + CaseBlock = 202, + ImportEqualsDeclaration = 203, + ImportDeclaration = 204, + ImportClause = 205, + NamespaceImport = 206, + NamedImports = 207, + ImportSpecifier = 208, + ExportAssignment = 209, + ExportDeclaration = 210, + NamedExports = 211, + ExportSpecifier = 212, + ExternalModuleReference = 213, + CaseClause = 214, + DefaultClause = 215, + HeritageClause = 216, + CatchClause = 217, + PropertyAssignment = 218, + ShorthandPropertyAssignment = 219, + EnumMember = 220, + SourceFile = 221, + SyntaxList = 222, + Count = 223, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, @@ -688,6 +689,9 @@ declare module "typescript" { } interface SwitchStatement extends Statement { expression: Expression; + caseBlock: CaseBlock; + } + interface CaseBlock extends Node { clauses: NodeArray; } interface CaseClause extends Node { diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 9fb0771cb2d..4bfac42f571 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -897,67 +897,70 @@ declare module "typescript" { ModuleBlock = 201, >ModuleBlock : SyntaxKind - ImportEqualsDeclaration = 202, + CaseBlock = 202, +>CaseBlock : SyntaxKind + + ImportEqualsDeclaration = 203, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 203, + ImportDeclaration = 204, >ImportDeclaration : SyntaxKind - ImportClause = 204, + ImportClause = 205, >ImportClause : SyntaxKind - NamespaceImport = 205, + NamespaceImport = 206, >NamespaceImport : SyntaxKind - NamedImports = 206, + NamedImports = 207, >NamedImports : SyntaxKind - ImportSpecifier = 207, + ImportSpecifier = 208, >ImportSpecifier : SyntaxKind - ExportAssignment = 208, + ExportAssignment = 209, >ExportAssignment : SyntaxKind - ExportDeclaration = 209, + ExportDeclaration = 210, >ExportDeclaration : SyntaxKind - NamedExports = 210, + NamedExports = 211, >NamedExports : SyntaxKind - ExportSpecifier = 211, + ExportSpecifier = 212, >ExportSpecifier : SyntaxKind - ExternalModuleReference = 212, + ExternalModuleReference = 213, >ExternalModuleReference : SyntaxKind - CaseClause = 213, + CaseClause = 214, >CaseClause : SyntaxKind - DefaultClause = 214, + DefaultClause = 215, >DefaultClause : SyntaxKind - HeritageClause = 215, + HeritageClause = 216, >HeritageClause : SyntaxKind - CatchClause = 216, + CatchClause = 217, >CatchClause : SyntaxKind - PropertyAssignment = 217, + PropertyAssignment = 218, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 218, + ShorthandPropertyAssignment = 219, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 219, + EnumMember = 220, >EnumMember : SyntaxKind - SourceFile = 220, + SourceFile = 221, >SourceFile : SyntaxKind - SyntaxList = 221, + SyntaxList = 222, >SyntaxList : SyntaxKind - Count = 222, + Count = 223, >Count : SyntaxKind FirstAssignment = 52, @@ -2076,6 +2079,14 @@ declare module "typescript" { >expression : Expression >Expression : Expression + caseBlock: CaseBlock; +>caseBlock : CaseBlock +>CaseBlock : CaseBlock + } + interface CaseBlock extends Node { +>CaseBlock : CaseBlock +>Node : Node + clauses: NodeArray; >clauses : NodeArray >NodeArray : NodeArray diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 6fabb4d8b3b..c85be654c89 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -330,27 +330,28 @@ declare module "typescript" { EnumDeclaration = 199, ModuleDeclaration = 200, ModuleBlock = 201, - ImportEqualsDeclaration = 202, - ImportDeclaration = 203, - ImportClause = 204, - NamespaceImport = 205, - NamedImports = 206, - ImportSpecifier = 207, - ExportAssignment = 208, - ExportDeclaration = 209, - NamedExports = 210, - ExportSpecifier = 211, - ExternalModuleReference = 212, - CaseClause = 213, - DefaultClause = 214, - HeritageClause = 215, - CatchClause = 216, - PropertyAssignment = 217, - ShorthandPropertyAssignment = 218, - EnumMember = 219, - SourceFile = 220, - SyntaxList = 221, - Count = 222, + CaseBlock = 202, + ImportEqualsDeclaration = 203, + ImportDeclaration = 204, + ImportClause = 205, + NamespaceImport = 206, + NamedImports = 207, + ImportSpecifier = 208, + ExportAssignment = 209, + ExportDeclaration = 210, + NamedExports = 211, + ExportSpecifier = 212, + ExternalModuleReference = 213, + CaseClause = 214, + DefaultClause = 215, + HeritageClause = 216, + CatchClause = 217, + PropertyAssignment = 218, + ShorthandPropertyAssignment = 219, + EnumMember = 220, + SourceFile = 221, + SyntaxList = 222, + Count = 223, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, @@ -725,6 +726,9 @@ declare module "typescript" { } interface SwitchStatement extends Statement { expression: Expression; + caseBlock: CaseBlock; + } + interface CaseBlock extends Node { clauses: NodeArray; } interface CaseClause extends Node { diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index e2ad04b970e..e4b53feeac0 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -1070,67 +1070,70 @@ declare module "typescript" { ModuleBlock = 201, >ModuleBlock : SyntaxKind - ImportEqualsDeclaration = 202, + CaseBlock = 202, +>CaseBlock : SyntaxKind + + ImportEqualsDeclaration = 203, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 203, + ImportDeclaration = 204, >ImportDeclaration : SyntaxKind - ImportClause = 204, + ImportClause = 205, >ImportClause : SyntaxKind - NamespaceImport = 205, + NamespaceImport = 206, >NamespaceImport : SyntaxKind - NamedImports = 206, + NamedImports = 207, >NamedImports : SyntaxKind - ImportSpecifier = 207, + ImportSpecifier = 208, >ImportSpecifier : SyntaxKind - ExportAssignment = 208, + ExportAssignment = 209, >ExportAssignment : SyntaxKind - ExportDeclaration = 209, + ExportDeclaration = 210, >ExportDeclaration : SyntaxKind - NamedExports = 210, + NamedExports = 211, >NamedExports : SyntaxKind - ExportSpecifier = 211, + ExportSpecifier = 212, >ExportSpecifier : SyntaxKind - ExternalModuleReference = 212, + ExternalModuleReference = 213, >ExternalModuleReference : SyntaxKind - CaseClause = 213, + CaseClause = 214, >CaseClause : SyntaxKind - DefaultClause = 214, + DefaultClause = 215, >DefaultClause : SyntaxKind - HeritageClause = 215, + HeritageClause = 216, >HeritageClause : SyntaxKind - CatchClause = 216, + CatchClause = 217, >CatchClause : SyntaxKind - PropertyAssignment = 217, + PropertyAssignment = 218, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 218, + ShorthandPropertyAssignment = 219, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 219, + EnumMember = 220, >EnumMember : SyntaxKind - SourceFile = 220, + SourceFile = 221, >SourceFile : SyntaxKind - SyntaxList = 221, + SyntaxList = 222, >SyntaxList : SyntaxKind - Count = 222, + Count = 223, >Count : SyntaxKind FirstAssignment = 52, @@ -2249,6 +2252,14 @@ declare module "typescript" { >expression : Expression >Expression : Expression + caseBlock: CaseBlock; +>caseBlock : CaseBlock +>CaseBlock : CaseBlock + } + interface CaseBlock extends Node { +>CaseBlock : CaseBlock +>Node : Node + clauses: NodeArray; >clauses : NodeArray >NodeArray : NodeArray diff --git a/tests/baselines/reference/letConstInCaseClauses.errors.txt b/tests/baselines/reference/letConstInCaseClauses.errors.txt new file mode 100644 index 00000000000..af0777d56a4 --- /dev/null +++ b/tests/baselines/reference/letConstInCaseClauses.errors.txt @@ -0,0 +1,39 @@ +tests/cases/compiler/letConstInCaseClauses.ts(7,5): error TS2304: Cannot find name 'console'. +tests/cases/compiler/letConstInCaseClauses.ts(21,5): error TS2304: Cannot find name 'console'. + + +==== tests/cases/compiler/letConstInCaseClauses.ts (2 errors) ==== + + var x = 10; + var y = 20; + { + let x = 1; + let y = 2; + console.log(x) + ~~~~~~~ +!!! error TS2304: Cannot find name 'console'. + switch (x) { + case 10: + let x = 20; + } + switch (y) { + case 10: + let y = 20; + } + } + + { + const x = 1; + const y = 2; + console.log(x) + ~~~~~~~ +!!! error TS2304: Cannot find name 'console'. + switch (x) { + case 10: + const x = 20; + } + switch (y) { + case 10: + const y = 20; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/letConstInCaseClauses.js b/tests/baselines/reference/letConstInCaseClauses.js new file mode 100644 index 00000000000..94840a11a2c --- /dev/null +++ b/tests/baselines/reference/letConstInCaseClauses.js @@ -0,0 +1,61 @@ +//// [letConstInCaseClauses.ts] + +var x = 10; +var y = 20; +{ + let x = 1; + let y = 2; + console.log(x) + switch (x) { + case 10: + let x = 20; + } + switch (y) { + case 10: + let y = 20; + } +} + +{ + const x = 1; + const y = 2; + console.log(x) + switch (x) { + case 10: + const x = 20; + } + switch (y) { + case 10: + const y = 20; + } +} + +//// [letConstInCaseClauses.js] +var x = 10; +var y = 20; +{ + var _x = 1; + var _y = 2; + console.log(_x); + switch (_x) { + case 10: + var _x_1 = 20; + } + switch (_y) { + case 10: + var _y_1 = 20; + } +} +{ + var _x_2 = 1; + var _y_2 = 2; + console.log(_x_2); + switch (_x_2) { + case 10: + var _x_3 = 20; + } + switch (_y_2) { + case 10: + var _y_3 = 20; + } +} diff --git a/tests/cases/compiler/letConstInCaseClauses.ts b/tests/cases/compiler/letConstInCaseClauses.ts new file mode 100644 index 00000000000..4ed1c9fa363 --- /dev/null +++ b/tests/cases/compiler/letConstInCaseClauses.ts @@ -0,0 +1,31 @@ +// @target: es5 + +var x = 10; +var y = 20; +{ + let x = 1; + let y = 2; + console.log(x) + switch (x) { + case 10: + let x = 20; + } + switch (y) { + case 10: + let y = 20; + } +} + +{ + const x = 1; + const y = 2; + console.log(x) + switch (x) { + case 10: + const x = 20; + } + switch (y) { + case 10: + const y = 20; + } +} \ No newline at end of file From 59c71acae8e6cc0dcf2bcef19a249bc143fcf20a Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 10 Mar 2015 18:17:52 -0700 Subject: [PATCH 026/101] introduce emitCaseBlock function --- src/compiler/emitter.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index e9848af989c..b96fc601bf9 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3539,12 +3539,16 @@ module ts { emit(node.expression); endPos = emitToken(SyntaxKind.CloseParenToken, node.expression.end); write(" "); - emitToken(SyntaxKind.OpenBraceToken, endPos); + emitCaseBlock(node.caseBlock, endPos) + } + + function emitCaseBlock(node: CaseBlock, startPos: number): void { + emitToken(SyntaxKind.OpenBraceToken, startPos); increaseIndent(); - emitLines(node.caseBlock.clauses); + emitLines(node.clauses); decreaseIndent(); writeLine(); - emitToken(SyntaxKind.CloseBraceToken, node.caseBlock.clauses.end); + emitToken(SyntaxKind.CloseBraceToken, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1: Node, node2: Node) { From 4b955ee91a66b8a2016e7bceffbcd3ceee084828 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Wed, 11 Mar 2015 14:03:32 -0700 Subject: [PATCH 027/101] added for* statements to isCompletedNode --- src/services/formatting/smartIndenter.ts | 6 ++++++ .../fourslash/smartIndentStatementFor.ts | 5 +++++ .../fourslash/smartIndentStatementForIn.ts | 5 +++++ .../fourslash/smartIndentStatementForOf.ts | 20 +++++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 tests/cases/fourslash/smartIndentStatementForOf.ts diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 96159d332fe..f1d0935c132 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -461,6 +461,12 @@ module ts.formatting { case SyntaxKind.DefaultClause: // there is no such thing as terminator token for CaseClause\DefaultClause so for simplicitly always consider them non-completed return false; + case SyntaxKind.ForStatement: + return isCompletedNode((n).statement, sourceFile); + case SyntaxKind.ForInStatement: + return isCompletedNode((n).statement, sourceFile); + case SyntaxKind.ForOfStatement: + return isCompletedNode((n).statement, sourceFile); case SyntaxKind.WhileStatement: return isCompletedNode((n).statement, sourceFile); case SyntaxKind.DoStatement: diff --git a/tests/cases/fourslash/smartIndentStatementFor.ts b/tests/cases/fourslash/smartIndentStatementFor.ts index a3fc2a9a0ce..777dd9ac5dc 100644 --- a/tests/cases/fourslash/smartIndentStatementFor.ts +++ b/tests/cases/fourslash/smartIndentStatementFor.ts @@ -5,6 +5,8 @@ //// /*insideStatement*/ //// } //// /*afterStatement*/ +//// for (var i = 0;;) +//// /*insideStatement2*/ ////} goTo.marker('insideStatement'); @@ -12,3 +14,6 @@ verify.indentationIs(8); goTo.marker('afterStatement'); verify.indentationIs(4); + +goTo.marker('insideStatement2'); +verify.indentationIs(8); diff --git a/tests/cases/fourslash/smartIndentStatementForIn.ts b/tests/cases/fourslash/smartIndentStatementForIn.ts index 355f175b7df..9ae65f27452 100644 --- a/tests/cases/fourslash/smartIndentStatementForIn.ts +++ b/tests/cases/fourslash/smartIndentStatementForIn.ts @@ -6,6 +6,8 @@ //// /*insideStatement*/ //// } //// /*afterStatement*/ +//// for (var i in []) +//// /*insideStatement2*/ ////} goTo.marker('insideStatement'); @@ -13,3 +15,6 @@ verify.indentationIs(8); goTo.marker('afterStatement'); verify.indentationIs(4); + +goTo.marker('insideStatement2'); +verify.indentationIs(8); diff --git a/tests/cases/fourslash/smartIndentStatementForOf.ts b/tests/cases/fourslash/smartIndentStatementForOf.ts new file mode 100644 index 00000000000..3126e63e6a5 --- /dev/null +++ b/tests/cases/fourslash/smartIndentStatementForOf.ts @@ -0,0 +1,20 @@ +/// + +////function Foo() { +//// for (var i of []) +//// { +//// /*insideStatement*/ +//// } +//// /*afterStatement*/ +//// for (var i of []) +//// /*insideStatement2*/ +////} + +goTo.marker('insideStatement'); +verify.indentationIs(8); + +goTo.marker('afterStatement'); +verify.indentationIs(4); + +goTo.marker('insideStatement2'); +verify.indentationIs(8); From 42ae38ddcc7c48867b7afee0c13032f8a243663d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 11 Mar 2015 14:44:32 -0700 Subject: [PATCH 028/101] Add failing test. --- .../fourslash/signatureHelpWithInvalidArgumentList1.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tests/cases/fourslash/signatureHelpWithInvalidArgumentList1.ts diff --git a/tests/cases/fourslash/signatureHelpWithInvalidArgumentList1.ts b/tests/cases/fourslash/signatureHelpWithInvalidArgumentList1.ts new file mode 100644 index 00000000000..f280adb1d9e --- /dev/null +++ b/tests/cases/fourslash/signatureHelpWithInvalidArgumentList1.ts @@ -0,0 +1,9 @@ +/// + +////function foo(a) { } +////foo(hello my name /**/is + +goTo.marker(); +verify.signatureHelpPresent(); +verify.signatureHelpCountIs(1); + From d9d90b2c02e21087275d545b3b9e4dabc28164c0 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 11 Mar 2015 15:05:31 -0700 Subject: [PATCH 029/101] Compute consistent argument indices and counts for signature help. --- src/services/services.ts | 4 +++ src/services/signatureHelp.ts | 61 +++++++++++++++++++++++------------ src/services/utilities.ts | 2 ++ 3 files changed, 47 insertions(+), 20 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index 6ef044ad75a..502387c948f 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -207,6 +207,10 @@ module ts { if (pos < nodes.end) { this.addSyntheticNodes(list._children, pos, nodes.end); } + + if (nodes.hasTrailingComma) { + + } return list; } diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 6f4f38aa736..80befc1bebd 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -238,7 +238,7 @@ module ts.SignatureHelp { invocation: callExpression, argumentsSpan: getApplicableSpanForArguments(list), argumentIndex: 0, - argumentCount: getCommaBasedArgCount(list) + argumentCount: getArgumentCount(list) }; } @@ -253,20 +253,11 @@ module ts.SignatureHelp { var list = listItemInfo.list; var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; - // The listItemIndex we got back includes commas. Our goal is to return the index of the proper - // item (not including commas). Here are some examples: - // 1. foo(a, b, c #) -> the listItemIndex is 4, we want to return 2 - // 2. foo(a, b, # c) -> listItemIndex is 3, we want to return 2 - // 3. foo(#a) -> listItemIndex is 0, we want to return 0 - // - // In general, we want to subtract the number of commas before the current index. - // But if we are on a comma, we also want to pretend we are on the argument *following* - // the comma. That amounts to taking the ceiling of half the index. - var argumentIndex = (listItemInfo.listItemIndex + 1) >> 1; + var argumentIndex = getArgumentIndex(list, node); + var argumentCount = getArgumentCount(list); - var argumentCount = getCommaBasedArgCount(list); - - Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, `argumentCount < argumentIndex, ${argumentCount} < ${argumentIndex}`); + Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, + `argumentCount < argumentIndex, ${argumentCount} < ${argumentIndex}`); return { kind: isTypeArgList ? ArgumentListKind.TypeArguments : ArgumentListKind.CallArguments, @@ -313,12 +304,42 @@ module ts.SignatureHelp { return undefined; } - function getCommaBasedArgCount(argumentsList: Node) { - // The number of arguments is the number of commas plus one, unless the list - // is completely empty, in which case there are 0 arguments. - return argumentsList.getChildCount() === 0 - ? 0 - : 1 + countWhere(argumentsList.getChildren(), arg => arg.kind === SyntaxKind.CommaToken); + function getArgumentIndex(argumentsList: Node, node: Node) { + // The list we got back can include commas. In the presence of errors it may + // also just have nodes without commas. For example "Foo(a b c)" will have 3 + // args without commas. We want to find what index we're at. So we count + // forward until we hit ourselves, only incrementing the index if it isn't a + // comma. + var argumentIndex = 0; + var listChildren = argumentsList.getChildren(); + for (var i = 0, n = listChildren.length; i < n; i++) { + var child = listChildren[i]; + if (child === node) { + break; + } + if (child.kind !== SyntaxKind.CommaToken) { + argumentIndex++; + } + } + + return argumentIndex; + } + + function getArgumentCount(argumentsList: Node) { + // The argument count for a list is normally the number of non-comma children it has. + // For example, if you have "Foo(a,b)" then there will be three children of the arg + // list 'a' '' 'b'. So, in this case the arg count will be 2. However, there + // is a small subtlety. If you have "Foo(a,)", then the child list will just have + // 'a' ''. So, in the case where the last child is a comma, we increase the + // arg count by one to compensate. + var listChildren = argumentsList.getChildren(); + + var argumentCount = countWhere(listChildren, arg => arg.kind !== SyntaxKind.CommaToken); + if (listChildren.length > 0 && lastOrUndefined(listChildren).kind === SyntaxKind.CommaToken) { + argumentCount++; + } + + return argumentCount; } // spanIndex is either the index for a given template span. diff --git a/src/services/utilities.ts b/src/services/utilities.ts index e0ff5293546..f2403217c24 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -95,6 +95,8 @@ module ts { } }); + // Either we didn't find an appropriate list, or the list must contain us. + Debug.assert(!syntaxList || contains(syntaxList.getChildren(), node)); return syntaxList; } From 63ba6457919c7dec29df5e727e7a99ad481123d7 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 11 Mar 2015 15:08:28 -0700 Subject: [PATCH 030/101] Remove unnecessary code. --- src/services/services.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index 502387c948f..6ef044ad75a 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -207,10 +207,6 @@ module ts { if (pos < nodes.end) { this.addSyntheticNodes(list._children, pos, nodes.end); } - - if (nodes.hasTrailingComma) { - - } return list; } From 05c2a3ef892f096633448b01f5af106a9b8df045 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 11 Mar 2015 15:30:33 -0700 Subject: [PATCH 031/101] Add explanatory comments. --- src/services/signatureHelp.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 80befc1bebd..52a7b41d8a7 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -310,6 +310,12 @@ module ts.SignatureHelp { // args without commas. We want to find what index we're at. So we count // forward until we hit ourselves, only incrementing the index if it isn't a // comma. + // + // Note: the subtlety around trailing commas (in getArgumentCount) does not apply + // here. That's because we're only walking forward until we hit the node we're + // on. In that case, even if we're after the trailing comma, we'll still see + // that trailing comma in the list, and we'll have generated the appropriate + // arg index. var argumentIndex = 0; var listChildren = argumentsList.getChildren(); for (var i = 0, n = listChildren.length; i < n; i++) { @@ -332,6 +338,11 @@ module ts.SignatureHelp { // is a small subtlety. If you have "Foo(a,)", then the child list will just have // 'a' ''. So, in the case where the last child is a comma, we increase the // arg count by one to compensate. + // + // Note: this subtlety only applies to the last comma. If you had "Foo(a,," then + // we'll have: 'a' '' '' + // That will give us 2 non-commas. We then add one for the last comma, givin us an + // arg count of 3. var listChildren = argumentsList.getChildren(); var argumentCount = countWhere(listChildren, arg => arg.kind !== SyntaxKind.CommaToken); From 5b46f5f9ae4bf47707b8bb4b676f4299523b808c Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 5 Mar 2015 15:21:00 -0800 Subject: [PATCH 032/101] Remove error for using 'for...of' in ES3/ES5 --- src/compiler/checker.ts | 5 - .../diagnosticInformationMap.generated.ts | 1 - src/compiler/diagnosticMessages.json | 4 - .../baselines/reference/ES5For-of1.errors.txt | 6 +- .../reference/ES5For-of10.errors.txt | 13 - .../reference/ES5For-of11.errors.txt | 8 - .../reference/ES5For-of13.errors.txt | 9 - .../reference/ES5For-of14.errors.txt | 9 - tests/baselines/reference/ES5For-of14.types | 9 + .../reference/ES5For-of15.errors.txt | 12 - tests/baselines/reference/ES5For-of15.types | 17 + .../reference/ES5For-of16.errors.txt | 13 - tests/baselines/reference/ES5For-of16.types | 21 + .../reference/ES5For-of18.errors.txt | 16 - tests/baselines/reference/ES5For-of18.types | 16 + .../reference/ES5For-of19.errors.txt | 15 - tests/baselines/reference/ES5For-of19.types | 21 + .../baselines/reference/ES5For-of2.errors.txt | 9 - tests/baselines/reference/ES5For-of2.types | 9 + .../reference/ES5For-of20.errors.txt | 6 +- .../reference/ES5For-of21.errors.txt | 9 - tests/baselines/reference/ES5For-of21.types | 9 + .../reference/ES5For-of22.errors.txt | 6 +- .../reference/ES5For-of23.errors.txt | 6 +- .../reference/ES5For-of24.errors.txt | 10 - .../reference/ES5For-of25.errors.txt | 11 - .../reference/ES5For-of26.errors.txt | 10 - tests/baselines/reference/ES5For-of26.types | 12 + .../reference/ES5For-of28.errors.txt | 10 - tests/baselines/reference/ES5For-of28.types | 12 + .../baselines/reference/ES5For-of3.errors.txt | 8 - .../baselines/reference/ES5For-of4.errors.txt | 9 - tests/baselines/reference/ES5For-of4.types | 13 + .../baselines/reference/ES5For-of5.errors.txt | 9 - tests/baselines/reference/ES5For-of5.types | 9 + .../baselines/reference/ES5For-of6.errors.txt | 11 - tests/baselines/reference/ES5For-of6.types | 16 + .../baselines/reference/ES5For-of7.errors.txt | 11 +- .../baselines/reference/ES5For-of9.errors.txt | 14 - .../reference/downlevelLetConst16.errors.txt | 248 ------- .../reference/downlevelLetConst16.types | 686 ++++++++++++++++++ .../reference/downlevelLetConst17.errors.txt | 73 -- .../reference/downlevelLetConst17.types | 154 ++++ .../parserES5ForOfStatement1.d.errors.txt | 4 +- .../parserES5ForOfStatement2.errors.txt | 6 +- .../parserES5ForOfStatement21.errors.txt | 6 +- .../parserES5ForOfStatement3.errors.txt | 6 +- .../parserES5ForOfStatement4.errors.txt | 6 +- .../parserES5ForOfStatement5.errors.txt | 6 +- .../parserES5ForOfStatement6.errors.txt | 6 +- .../parserES5ForOfStatement7.errors.txt | 6 +- 51 files changed, 1043 insertions(+), 578 deletions(-) delete mode 100644 tests/baselines/reference/ES5For-of10.errors.txt delete mode 100644 tests/baselines/reference/ES5For-of11.errors.txt delete mode 100644 tests/baselines/reference/ES5For-of13.errors.txt delete mode 100644 tests/baselines/reference/ES5For-of14.errors.txt create mode 100644 tests/baselines/reference/ES5For-of14.types delete mode 100644 tests/baselines/reference/ES5For-of15.errors.txt create mode 100644 tests/baselines/reference/ES5For-of15.types delete mode 100644 tests/baselines/reference/ES5For-of16.errors.txt create mode 100644 tests/baselines/reference/ES5For-of16.types delete mode 100644 tests/baselines/reference/ES5For-of18.errors.txt create mode 100644 tests/baselines/reference/ES5For-of18.types delete mode 100644 tests/baselines/reference/ES5For-of19.errors.txt create mode 100644 tests/baselines/reference/ES5For-of19.types delete mode 100644 tests/baselines/reference/ES5For-of2.errors.txt create mode 100644 tests/baselines/reference/ES5For-of2.types delete mode 100644 tests/baselines/reference/ES5For-of21.errors.txt create mode 100644 tests/baselines/reference/ES5For-of21.types delete mode 100644 tests/baselines/reference/ES5For-of24.errors.txt delete mode 100644 tests/baselines/reference/ES5For-of25.errors.txt delete mode 100644 tests/baselines/reference/ES5For-of26.errors.txt create mode 100644 tests/baselines/reference/ES5For-of26.types delete mode 100644 tests/baselines/reference/ES5For-of28.errors.txt create mode 100644 tests/baselines/reference/ES5For-of28.types delete mode 100644 tests/baselines/reference/ES5For-of3.errors.txt delete mode 100644 tests/baselines/reference/ES5For-of4.errors.txt create mode 100644 tests/baselines/reference/ES5For-of4.types delete mode 100644 tests/baselines/reference/ES5For-of5.errors.txt create mode 100644 tests/baselines/reference/ES5For-of5.types delete mode 100644 tests/baselines/reference/ES5For-of6.errors.txt create mode 100644 tests/baselines/reference/ES5For-of6.types delete mode 100644 tests/baselines/reference/ES5For-of9.errors.txt delete mode 100644 tests/baselines/reference/downlevelLetConst16.errors.txt create mode 100644 tests/baselines/reference/downlevelLetConst16.types delete mode 100644 tests/baselines/reference/downlevelLetConst17.errors.txt create mode 100644 tests/baselines/reference/downlevelLetConst17.types diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index afcf12fed1b..6682761812d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8777,11 +8777,6 @@ module ts { } function checkForOfStatement(node: ForOfStatement): void { - if (languageVersion < ScriptTarget.ES6) { - grammarErrorOnFirstToken(node, Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); - return; - } - checkGrammarForInOrForOfStatement(node) // Check the LHS and RHS diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index b06a283a876..74028d85910 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -327,7 +327,6 @@ module ts { Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, - for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: DiagnosticCategory.Error, key: "Export declaration conflicts with exported declaration of '{0}'" }, The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index b265f5b5281..f55c4391699 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1299,10 +1299,6 @@ "category": "Error", "code": 2481 }, - "'for...of' statements are only available when targeting ECMAScript 6 or higher.": { - "category": "Error", - "code": 2482 - }, "The left-hand side of a 'for...of' statement cannot use a type annotation.": { "category": "Error", "code": 2483 diff --git a/tests/baselines/reference/ES5For-of1.errors.txt b/tests/baselines/reference/ES5For-of1.errors.txt index 7579ea04528..16222725b3d 100644 --- a/tests/baselines/reference/ES5For-of1.errors.txt +++ b/tests/baselines/reference/ES5For-of1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts(2,5): error TS2304: Cannot find name 'console'. ==== tests/cases/conformance/statements/for-ofStatements/ES5For-of1.ts (1 errors) ==== for (var v of ['a', 'b', 'c']) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. console.log(v); + ~~~~~~~ +!!! error TS2304: Cannot find name 'console'. } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of10.errors.txt b/tests/baselines/reference/ES5For-of10.errors.txt deleted file mode 100644 index 70f69ed204f..00000000000 --- a/tests/baselines/reference/ES5For-of10.errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of10.ts(4,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of10.ts (1 errors) ==== - function foo() { - return { x: 0 }; - } - for (foo().x of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - for (foo().x of []) - var p = foo().x; - } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of11.errors.txt b/tests/baselines/reference/ES5For-of11.errors.txt deleted file mode 100644 index bfb494f83a5..00000000000 --- a/tests/baselines/reference/ES5For-of11.errors.txt +++ /dev/null @@ -1,8 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of11.ts(2,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of11.ts (1 errors) ==== - var v; - for (v of []) { } - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of13.errors.txt b/tests/baselines/reference/ES5For-of13.errors.txt deleted file mode 100644 index a217d590f5e..00000000000 --- a/tests/baselines/reference/ES5For-of13.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts (1 errors) ==== - for (let v of ['a', 'b', 'c']) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - var x = v; - } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of14.errors.txt b/tests/baselines/reference/ES5For-of14.errors.txt deleted file mode 100644 index 073c3869028..00000000000 --- a/tests/baselines/reference/ES5For-of14.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts (1 errors) ==== - for (const v of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - var x = v; - } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of14.types b/tests/baselines/reference/ES5For-of14.types new file mode 100644 index 00000000000..0a4f9a78453 --- /dev/null +++ b/tests/baselines/reference/ES5For-of14.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts === +for (const v of []) { +>v : any +>[] : undefined[] + + var x = v; +>x : any +>v : any +} diff --git a/tests/baselines/reference/ES5For-of15.errors.txt b/tests/baselines/reference/ES5For-of15.errors.txt deleted file mode 100644 index a63e1202cec..00000000000 --- a/tests/baselines/reference/ES5For-of15.errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts (1 errors) ==== - for (let v of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - v; - for (const v of []) { - var x = v; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of15.types b/tests/baselines/reference/ES5For-of15.types new file mode 100644 index 00000000000..90409b8b167 --- /dev/null +++ b/tests/baselines/reference/ES5For-of15.types @@ -0,0 +1,17 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts === +for (let v of []) { +>v : any +>[] : undefined[] + + v; +>v : any + + for (const v of []) { +>v : any +>[] : undefined[] + + var x = v; +>x : any +>v : any + } +} diff --git a/tests/baselines/reference/ES5For-of16.errors.txt b/tests/baselines/reference/ES5For-of16.errors.txt deleted file mode 100644 index 969d83b8058..00000000000 --- a/tests/baselines/reference/ES5For-of16.errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts (1 errors) ==== - for (let v of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - v; - for (let v of []) { - var x = v; - v++; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of16.types b/tests/baselines/reference/ES5For-of16.types new file mode 100644 index 00000000000..94f01509711 --- /dev/null +++ b/tests/baselines/reference/ES5For-of16.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts === +for (let v of []) { +>v : any +>[] : undefined[] + + v; +>v : any + + for (let v of []) { +>v : any +>[] : undefined[] + + var x = v; +>x : any +>v : any + + v++; +>v++ : number +>v : any + } +} diff --git a/tests/baselines/reference/ES5For-of18.errors.txt b/tests/baselines/reference/ES5For-of18.errors.txt deleted file mode 100644 index 77872e93b97..00000000000 --- a/tests/baselines/reference/ES5For-of18.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. -tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts(4,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts (2 errors) ==== - for (let v of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - v; - } - for (let v of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - v; - } - \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of18.types b/tests/baselines/reference/ES5For-of18.types new file mode 100644 index 00000000000..e78bc846df6 --- /dev/null +++ b/tests/baselines/reference/ES5For-of18.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts === +for (let v of []) { +>v : any +>[] : undefined[] + + v; +>v : any +} +for (let v of []) { +>v : any +>[] : undefined[] + + v; +>v : any +} + diff --git a/tests/baselines/reference/ES5For-of19.errors.txt b/tests/baselines/reference/ES5For-of19.errors.txt deleted file mode 100644 index 0e1352d988d..00000000000 --- a/tests/baselines/reference/ES5For-of19.errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of19.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of19.ts (1 errors) ==== - for (let v of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - v; - function foo() { - for (const v of []) { - v; - } - } - } - \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of19.types b/tests/baselines/reference/ES5For-of19.types new file mode 100644 index 00000000000..d95dc63d262 --- /dev/null +++ b/tests/baselines/reference/ES5For-of19.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of19.ts === +for (let v of []) { +>v : any +>[] : undefined[] + + v; +>v : any + + function foo() { +>foo : () => void + + for (const v of []) { +>v : any +>[] : undefined[] + + v; +>v : any + } + } +} + diff --git a/tests/baselines/reference/ES5For-of2.errors.txt b/tests/baselines/reference/ES5For-of2.errors.txt deleted file mode 100644 index 2b39c276796..00000000000 --- a/tests/baselines/reference/ES5For-of2.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of2.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of2.ts (1 errors) ==== - for (var v of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - var x = v; - } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of2.types b/tests/baselines/reference/ES5For-of2.types new file mode 100644 index 00000000000..3e680c44bc8 --- /dev/null +++ b/tests/baselines/reference/ES5For-of2.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of2.ts === +for (var v of []) { +>v : any +>[] : undefined[] + + var x = v; +>x : any +>v : any +} diff --git a/tests/baselines/reference/ES5For-of20.errors.txt b/tests/baselines/reference/ES5For-of20.errors.txt index 35e5130b0de..81509910996 100644 --- a/tests/baselines/reference/ES5For-of20.errors.txt +++ b/tests/baselines/reference/ES5For-of20.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts(4,15): error TS1155: 'const' declarations must be initialized ==== tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts (1 errors) ==== for (let v of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. let v; for (let v of [v]) { const v; + ~ +!!! error TS1155: 'const' declarations must be initialized } } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of21.errors.txt b/tests/baselines/reference/ES5For-of21.errors.txt deleted file mode 100644 index bd0a6ccee64..00000000000 --- a/tests/baselines/reference/ES5For-of21.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of21.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of21.ts (1 errors) ==== - for (let v of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - for (let _i of []) { } - } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of21.types b/tests/baselines/reference/ES5For-of21.types new file mode 100644 index 00000000000..a15942fd013 --- /dev/null +++ b/tests/baselines/reference/ES5For-of21.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of21.ts === +for (let v of []) { +>v : any +>[] : undefined[] + + for (let _i of []) { } +>_i : any +>[] : undefined[] +} diff --git a/tests/baselines/reference/ES5For-of22.errors.txt b/tests/baselines/reference/ES5For-of22.errors.txt index 0acfcb6dde8..914be13c63c 100644 --- a/tests/baselines/reference/ES5For-of22.errors.txt +++ b/tests/baselines/reference/ES5For-of22.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts(3,5): error TS2304: Cannot find name 'console'. ==== tests/cases/conformance/statements/for-ofStatements/ES5For-of22.ts (1 errors) ==== for (var x of [1, 2, 3]) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. let _a = 0; console.log(x); + ~~~~~~~ +!!! error TS2304: Cannot find name 'console'. } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of23.errors.txt b/tests/baselines/reference/ES5For-of23.errors.txt index a659436ad9d..cbc043e32d2 100644 --- a/tests/baselines/reference/ES5For-of23.errors.txt +++ b/tests/baselines/reference/ES5For-of23.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of23.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/statements/for-ofStatements/ES5For-of23.ts(3,5): error TS2304: Cannot find name 'console'. ==== tests/cases/conformance/statements/for-ofStatements/ES5For-of23.ts (1 errors) ==== for (var x of [1, 2, 3]) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. var _a = 0; console.log(x); + ~~~~~~~ +!!! error TS2304: Cannot find name 'console'. } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of24.errors.txt b/tests/baselines/reference/ES5For-of24.errors.txt deleted file mode 100644 index 378bc42ecd9..00000000000 --- a/tests/baselines/reference/ES5For-of24.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of24.ts(2,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of24.ts (1 errors) ==== - var a = [1, 2, 3]; - for (var v of a) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - let a = 0; - } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of25.errors.txt b/tests/baselines/reference/ES5For-of25.errors.txt deleted file mode 100644 index d53cdbadd50..00000000000 --- a/tests/baselines/reference/ES5For-of25.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts(2,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts (1 errors) ==== - var a = [1, 2, 3]; - for (var v of a) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - v; - a; - } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of26.errors.txt b/tests/baselines/reference/ES5For-of26.errors.txt deleted file mode 100644 index 4fae8257d79..00000000000 --- a/tests/baselines/reference/ES5For-of26.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts (1 errors) ==== - for (var [a = 0, b = 1] of [2, 3]) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - a; - b; - } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of26.types b/tests/baselines/reference/ES5For-of26.types new file mode 100644 index 00000000000..b59378fdb6b --- /dev/null +++ b/tests/baselines/reference/ES5For-of26.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts === +for (var [a = 0, b = 1] of [2, 3]) { +>a : number +>b : number +>[2, 3] : number[] + + a; +>a : number + + b; +>b : number +} diff --git a/tests/baselines/reference/ES5For-of28.errors.txt b/tests/baselines/reference/ES5For-of28.errors.txt deleted file mode 100644 index 31080bb5648..00000000000 --- a/tests/baselines/reference/ES5For-of28.errors.txt +++ /dev/null @@ -1,10 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts (1 errors) ==== - for (let [a = 0, b = 1] of [2, 3]) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - a; - b; - } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of28.types b/tests/baselines/reference/ES5For-of28.types new file mode 100644 index 00000000000..61a4779e80b --- /dev/null +++ b/tests/baselines/reference/ES5For-of28.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts === +for (let [a = 0, b = 1] of [2, 3]) { +>a : number +>b : number +>[2, 3] : number[] + + a; +>a : number + + b; +>b : number +} diff --git a/tests/baselines/reference/ES5For-of3.errors.txt b/tests/baselines/reference/ES5For-of3.errors.txt deleted file mode 100644 index ecf6b73db13..00000000000 --- a/tests/baselines/reference/ES5For-of3.errors.txt +++ /dev/null @@ -1,8 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts (1 errors) ==== - for (var v of ['a', 'b', 'c']) - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - var x = v; \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of4.errors.txt b/tests/baselines/reference/ES5For-of4.errors.txt deleted file mode 100644 index 047c6f4e153..00000000000 --- a/tests/baselines/reference/ES5For-of4.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of4.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of4.ts (1 errors) ==== - for (var v of []) - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - var x = v; - var y = v; \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of4.types b/tests/baselines/reference/ES5For-of4.types new file mode 100644 index 00000000000..9396096746c --- /dev/null +++ b/tests/baselines/reference/ES5For-of4.types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of4.ts === +for (var v of []) +>v : any +>[] : undefined[] + + var x = v; +>x : any +>v : any + +var y = v; +>y : any +>v : any + diff --git a/tests/baselines/reference/ES5For-of5.errors.txt b/tests/baselines/reference/ES5For-of5.errors.txt deleted file mode 100644 index 6109498afb2..00000000000 --- a/tests/baselines/reference/ES5For-of5.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of5.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of5.ts (1 errors) ==== - for (var _a of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - var x = _a; - } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of5.types b/tests/baselines/reference/ES5For-of5.types new file mode 100644 index 00000000000..dd9aa285edb --- /dev/null +++ b/tests/baselines/reference/ES5For-of5.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of5.ts === +for (var _a of []) { +>_a : any +>[] : undefined[] + + var x = _a; +>x : any +>_a : any +} diff --git a/tests/baselines/reference/ES5For-of6.errors.txt b/tests/baselines/reference/ES5For-of6.errors.txt deleted file mode 100644 index 3664b51b217..00000000000 --- a/tests/baselines/reference/ES5For-of6.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of6.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of6.ts (1 errors) ==== - for (var w of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - for (var v of []) { - var x = [w, v]; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of6.types b/tests/baselines/reference/ES5For-of6.types new file mode 100644 index 00000000000..e2d2f872809 --- /dev/null +++ b/tests/baselines/reference/ES5For-of6.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of6.ts === +for (var w of []) { +>w : any +>[] : undefined[] + + for (var v of []) { +>v : any +>[] : undefined[] + + var x = [w, v]; +>x : any[] +>[w, v] : any[] +>w : any +>v : any + } +} diff --git a/tests/baselines/reference/ES5For-of7.errors.txt b/tests/baselines/reference/ES5For-of7.errors.txt index 21f9c4d137c..a3d40f38814 100644 --- a/tests/baselines/reference/ES5For-of7.errors.txt +++ b/tests/baselines/reference/ES5For-of7.errors.txt @@ -1,16 +1,13 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. -tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts(5,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts(6,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'any[]'. -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts (2 errors) ==== +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts (1 errors) ==== for (var w of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. var x = w; } for (var v of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. var x = [w, v]; + ~ +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'any[]'. } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of9.errors.txt b/tests/baselines/reference/ES5For-of9.errors.txt deleted file mode 100644 index 1b6607afb30..00000000000 --- a/tests/baselines/reference/ES5For-of9.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of9.ts(4,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of9.ts (1 errors) ==== - function foo() { - return { x: 0 }; - } - for (foo().x of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - for (foo().x of []) { - var p = foo().x; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst16.errors.txt b/tests/baselines/reference/downlevelLetConst16.errors.txt deleted file mode 100644 index 6156bfe4a2b..00000000000 --- a/tests/baselines/reference/downlevelLetConst16.errors.txt +++ /dev/null @@ -1,248 +0,0 @@ -tests/cases/compiler/downlevelLetConst16.ts(188,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. -tests/cases/compiler/downlevelLetConst16.ts(195,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. -tests/cases/compiler/downlevelLetConst16.ts(202,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. -tests/cases/compiler/downlevelLetConst16.ts(209,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. -tests/cases/compiler/downlevelLetConst16.ts(216,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. -tests/cases/compiler/downlevelLetConst16.ts(223,5): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/compiler/downlevelLetConst16.ts (6 errors) ==== - 'use strict' - - declare function use(a: any); - - var x = 10; - var y; - var z; - use(x); - use(y); - use(z); - function foo1() { - let x = 1; - use(x); - let [y] = [1]; - use(y); - let {a: z} = {a: 1}; - use(z); - } - - function foo2() { - { - let x = 1; - use(x); - let [y] = [1]; - use(y); - let {a: z} = { a: 1 }; - use(z); - } - use(x); - } - - class A { - m1() { - let x = 1; - use(x); - let [y] = [1]; - use(y); - let {a: z} = { a: 1 }; - use(z); - } - m2() { - { - let x = 1; - use(x); - let [y] = [1]; - use(y); - let {a: z} = { a: 1 }; - use(z); - } - use(x); - } - - } - - class B { - m1() { - const x = 1; - use(x); - const [y] = [1]; - use(y); - const {a: z} = { a: 1 }; - use(z); - - } - m2() { - { - const x = 1; - use(x); - const [y] = [1]; - use(y); - const {a: z} = { a: 1 }; - use(z); - - } - use(x); - } - } - - function bar1() { - const x = 1; - use(x); - const [y] = [1]; - use(y); - const {a: z} = { a: 1 }; - use(z); - } - - function bar2() { - { - const x = 1; - use(x); - const [y] = [1]; - use(y); - const {a: z} = { a: 1 }; - use(z); - - } - use(x); - } - - module M1 { - let x = 1; - use(x); - let [y] = [1]; - use(y); - let {a: z} = { a: 1 }; - use(z); - } - - module M2 { - { - let x = 1; - use(x); - let [y] = [1]; - use(y); - let {a: z} = { a: 1 }; - use(z); - } - use(x); - } - - module M3 { - const x = 1; - use(x); - const [y] = [1]; - use(y); - const {a: z} = { a: 1 }; - use(z); - - } - - module M4 { - { - const x = 1; - use(x); - const [y] = [1]; - use(y); - const {a: z} = { a: 1 }; - use(z); - - } - use(x); - use(y); - use(z); - } - - function foo3() { - for (let x; ;) { - use(x); - } - for (let [y] = []; ;) { - use(y); - } - for (let {a: z} = {a: 1}; ;) { - use(z); - } - use(x); - } - - function foo4() { - for (const x = 1; ;) { - use(x); - } - for (const [y] = []; ;) { - use(y); - } - for (const {a: z} = { a: 1 }; ;) { - use(z); - } - use(x); - } - - function foo5() { - for (let x in []) { - use(x); - } - use(x); - } - - function foo6() { - for (const x in []) { - use(x); - } - use(x); - } - - function foo7() { - for (let x of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - use(x); - } - use(x); - } - - function foo8() { - for (let [x] of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - use(x); - } - use(x); - } - - function foo9() { - for (let {a: x} of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - use(x); - } - use(x); - } - - function foo10() { - for (const x of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - use(x); - } - use(x); - } - - function foo11() { - for (const [x] of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - use(x); - } - use(x); - } - - function foo12() { - for (const {a: x} of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - use(x); - } - use(x); - } \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst16.types b/tests/baselines/reference/downlevelLetConst16.types new file mode 100644 index 00000000000..a9a11507c30 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst16.types @@ -0,0 +1,686 @@ +=== tests/cases/compiler/downlevelLetConst16.ts === +'use strict' + +declare function use(a: any); +>use : (a: any) => any +>a : any + +var x = 10; +>x : number + +var y; +>y : any + +var z; +>z : any + +use(x); +>use(x) : any +>use : (a: any) => any +>x : number + +use(y); +>use(y) : any +>use : (a: any) => any +>y : any + +use(z); +>use(z) : any +>use : (a: any) => any +>z : any + +function foo1() { +>foo1 : () => void + + let x = 1; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + let [y] = [1]; +>y : number +>[1] : [number] + + use(y); +>use(y) : any +>use : (a: any) => any +>y : number + + let {a: z} = {a: 1}; +>a : unknown +>z : number +>{a: 1} : { a: number; } +>a : number + + use(z); +>use(z) : any +>use : (a: any) => any +>z : number +} + +function foo2() { +>foo2 : () => void + { + let x = 1; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + let [y] = [1]; +>y : number +>[1] : [number] + + use(y); +>use(y) : any +>use : (a: any) => any +>y : number + + let {a: z} = { a: 1 }; +>a : unknown +>z : number +>{ a: 1 } : { a: number; } +>a : number + + use(z); +>use(z) : any +>use : (a: any) => any +>z : number + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} + +class A { +>A : A + + m1() { +>m1 : () => void + + let x = 1; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + let [y] = [1]; +>y : number +>[1] : [number] + + use(y); +>use(y) : any +>use : (a: any) => any +>y : number + + let {a: z} = { a: 1 }; +>a : unknown +>z : number +>{ a: 1 } : { a: number; } +>a : number + + use(z); +>use(z) : any +>use : (a: any) => any +>z : number + } + m2() { +>m2 : () => void + { + let x = 1; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + let [y] = [1]; +>y : number +>[1] : [number] + + use(y); +>use(y) : any +>use : (a: any) => any +>y : number + + let {a: z} = { a: 1 }; +>a : unknown +>z : number +>{ a: 1 } : { a: number; } +>a : number + + use(z); +>use(z) : any +>use : (a: any) => any +>z : number + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + } + +} + +class B { +>B : B + + m1() { +>m1 : () => void + + const x = 1; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + const [y] = [1]; +>y : number +>[1] : [number] + + use(y); +>use(y) : any +>use : (a: any) => any +>y : number + + const {a: z} = { a: 1 }; +>a : unknown +>z : number +>{ a: 1 } : { a: number; } +>a : number + + use(z); +>use(z) : any +>use : (a: any) => any +>z : number + + } + m2() { +>m2 : () => void + { + const x = 1; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + const [y] = [1]; +>y : number +>[1] : [number] + + use(y); +>use(y) : any +>use : (a: any) => any +>y : number + + const {a: z} = { a: 1 }; +>a : unknown +>z : number +>{ a: 1 } : { a: number; } +>a : number + + use(z); +>use(z) : any +>use : (a: any) => any +>z : number + + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + } +} + +function bar1() { +>bar1 : () => void + + const x = 1; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + const [y] = [1]; +>y : number +>[1] : [number] + + use(y); +>use(y) : any +>use : (a: any) => any +>y : number + + const {a: z} = { a: 1 }; +>a : unknown +>z : number +>{ a: 1 } : { a: number; } +>a : number + + use(z); +>use(z) : any +>use : (a: any) => any +>z : number +} + +function bar2() { +>bar2 : () => void + { + const x = 1; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + const [y] = [1]; +>y : number +>[1] : [number] + + use(y); +>use(y) : any +>use : (a: any) => any +>y : number + + const {a: z} = { a: 1 }; +>a : unknown +>z : number +>{ a: 1 } : { a: number; } +>a : number + + use(z); +>use(z) : any +>use : (a: any) => any +>z : number + + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} + +module M1 { +>M1 : typeof M1 + + let x = 1; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + let [y] = [1]; +>y : number +>[1] : [number] + + use(y); +>use(y) : any +>use : (a: any) => any +>y : number + + let {a: z} = { a: 1 }; +>a : unknown +>z : number +>{ a: 1 } : { a: number; } +>a : number + + use(z); +>use(z) : any +>use : (a: any) => any +>z : number +} + +module M2 { +>M2 : typeof M2 + { + let x = 1; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + let [y] = [1]; +>y : number +>[1] : [number] + + use(y); +>use(y) : any +>use : (a: any) => any +>y : number + + let {a: z} = { a: 1 }; +>a : unknown +>z : number +>{ a: 1 } : { a: number; } +>a : number + + use(z); +>use(z) : any +>use : (a: any) => any +>z : number + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} + +module M3 { +>M3 : typeof M3 + + const x = 1; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + const [y] = [1]; +>y : number +>[1] : [number] + + use(y); +>use(y) : any +>use : (a: any) => any +>y : number + + const {a: z} = { a: 1 }; +>a : unknown +>z : number +>{ a: 1 } : { a: number; } +>a : number + + use(z); +>use(z) : any +>use : (a: any) => any +>z : number + +} + +module M4 { +>M4 : typeof M4 + { + const x = 1; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + const [y] = [1]; +>y : number +>[1] : [number] + + use(y); +>use(y) : any +>use : (a: any) => any +>y : number + + const {a: z} = { a: 1 }; +>a : unknown +>z : number +>{ a: 1 } : { a: number; } +>a : number + + use(z); +>use(z) : any +>use : (a: any) => any +>z : number + + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + use(y); +>use(y) : any +>use : (a: any) => any +>y : any + + use(z); +>use(z) : any +>use : (a: any) => any +>z : any +} + +function foo3() { +>foo3 : () => void + + for (let x; ;) { +>x : any + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any + } + for (let [y] = []; ;) { +>y : any +>[] : undefined[] + + use(y); +>use(y) : any +>use : (a: any) => any +>y : any + } + for (let {a: z} = {a: 1}; ;) { +>a : unknown +>z : number +>{a: 1} : { a: number; } +>a : number + + use(z); +>use(z) : any +>use : (a: any) => any +>z : number + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} + +function foo4() { +>foo4 : () => void + + for (const x = 1; ;) { +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + } + for (const [y] = []; ;) { +>y : any +>[] : undefined[] + + use(y); +>use(y) : any +>use : (a: any) => any +>y : any + } + for (const {a: z} = { a: 1 }; ;) { +>a : unknown +>z : number +>{ a: 1 } : { a: number; } +>a : number + + use(z); +>use(z) : any +>use : (a: any) => any +>z : number + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} + +function foo5() { +>foo5 : () => void + + for (let x in []) { +>x : any +>[] : undefined[] + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} + +function foo6() { +>foo6 : () => void + + for (const x in []) { +>x : any +>[] : undefined[] + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} + +function foo7() { +>foo7 : () => void + + for (let x of []) { +>x : any +>[] : undefined[] + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} + +function foo8() { +>foo8 : () => void + + for (let [x] of []) { +>x : any +>[] : undefined[] + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} + +function foo9() { +>foo9 : () => void + + for (let {a: x} of []) { +>a : unknown +>x : any +>[] : undefined[] + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} + +function foo10() { +>foo10 : () => void + + for (const x of []) { +>x : any +>[] : undefined[] + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} + +function foo11() { +>foo11 : () => void + + for (const [x] of []) { +>x : any +>[] : undefined[] + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} + +function foo12() { +>foo12 : () => void + + for (const {a: x} of []) { +>a : unknown +>x : any +>[] : undefined[] + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any + } + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} diff --git a/tests/baselines/reference/downlevelLetConst17.errors.txt b/tests/baselines/reference/downlevelLetConst17.errors.txt deleted file mode 100644 index 6183bab9430..00000000000 --- a/tests/baselines/reference/downlevelLetConst17.errors.txt +++ /dev/null @@ -1,73 +0,0 @@ -tests/cases/compiler/downlevelLetConst17.ts(65,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/compiler/downlevelLetConst17.ts (1 errors) ==== - 'use strict' - - declare function use(a: any); - - var x; - for (let x = 10; ;) { - use(x); - } - use(x); - - for (const x = 10; ;) { - use(x); - } - - for (; ;) { - let x = 10; - use(x); - x = 1; - } - - for (; ;) { - const x = 10; - use(x); - } - - for (let x; ;) { - use(x); - x = 1; - } - - for (; ;) { - let x; - use(x); - x = 1; - } - - while (true) { - let x; - use(x); - } - - while (true) { - const x = true; - use(x); - } - - do { - let x; - use(x); - } while (true); - - do { - let x; - use(x); - } while (true); - - for (let x in []) { - use(x); - } - - for (const x in []) { - use(x); - } - - for (const x of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - use(x); - } \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst17.types b/tests/baselines/reference/downlevelLetConst17.types new file mode 100644 index 00000000000..0c5a8eaa86b --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst17.types @@ -0,0 +1,154 @@ +=== tests/cases/compiler/downlevelLetConst17.ts === +'use strict' + +declare function use(a: any); +>use : (a: any) => any +>a : any + +var x; +>x : any + +for (let x = 10; ;) { +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} +use(x); +>use(x) : any +>use : (a: any) => any +>x : any + +for (const x = 10; ;) { +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} + +for (; ;) { + let x = 10; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number + + x = 1; +>x = 1 : number +>x : number +} + +for (; ;) { + const x = 10; +>x : number + + use(x); +>use(x) : any +>use : (a: any) => any +>x : number +} + +for (let x; ;) { +>x : any + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any + + x = 1; +>x = 1 : number +>x : any +} + +for (; ;) { + let x; +>x : any + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any + + x = 1; +>x = 1 : number +>x : any +} + +while (true) { + let x; +>x : any + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any +} + +while (true) { + const x = true; +>x : boolean + + use(x); +>use(x) : any +>use : (a: any) => any +>x : boolean +} + +do { + let x; +>x : any + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any + +} while (true); + +do { + let x; +>x : any + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any + +} while (true); + +for (let x in []) { +>x : any +>[] : undefined[] + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any +} + +for (const x in []) { +>x : any +>[] : undefined[] + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any +} + +for (const x of []) { +>x : any +>[] : undefined[] + + use(x); +>use(x) : any +>use : (a: any) => any +>x : any +} diff --git a/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt index c280b597b2c..f3034cd2c27 100644 --- a/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS1036: Statements are not allowed in ambient contexts. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts (1 errors) ==== for (var i of e) { ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +!!! error TS1036: Statements are not allowed in ambient contexts. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement2.errors.txt b/tests/baselines/reference/parserES5ForOfStatement2.errors.txt index 618e2f3f0ae..cb249e83785 100644 --- a/tests/baselines/reference/parserES5ForOfStatement2.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement2.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,9): error TS1123: Variable declaration list cannot be empty. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts (1 errors) ==== for (var of X) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + +!!! error TS1123: Variable declaration list cannot be empty. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement21.errors.txt b/tests/baselines/reference/parserES5ForOfStatement21.errors.txt index 14d97f49faf..76f87978cf1 100644 --- a/tests/baselines/reference/parserES5ForOfStatement21.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement21.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,9): error TS1123: Variable declaration list cannot be empty. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts (1 errors) ==== for (var of of) { } - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. \ No newline at end of file + +!!! error TS1123: Variable declaration list cannot be empty. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement3.errors.txt b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt index dd888a3120a..a976d9c0d54 100644 --- a/tests/baselines/reference/parserES5ForOfStatement3.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,13): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts (1 errors) ==== for (var a, b of X) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement4.errors.txt b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt index b94de56b17c..e2b38b56be5 100644 --- a/tests/baselines/reference/parserES5ForOfStatement4.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,10): error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts (1 errors) ==== for (var a = 1 of X) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement5.errors.txt b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt index 0b8dafc0b90..0e88ce6cf36 100644 --- a/tests/baselines/reference/parserES5ForOfStatement5.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,10): error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts (1 errors) ==== for (var a: number of X) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement6.errors.txt b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt index 04ac84fbd73..da76589190d 100644 --- a/tests/baselines/reference/parserES5ForOfStatement6.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,17): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts (1 errors) ==== for (var a = 1, b = 2 of X) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement7.errors.txt b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt index 1def5279f65..ced399ca103 100644 --- a/tests/baselines/reference/parserES5ForOfStatement7.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,25): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts (1 errors) ==== for (var a: number = 1, b: string = "" of X) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. } \ No newline at end of file From 61cd2a7543261c082213d314d1dc294d402bed88 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Mon, 9 Mar 2015 11:27:02 -0700 Subject: [PATCH 033/101] Introduce checkElementTypeOfArrayOrString for downlevel for..of type checking --- src/compiler/checker.ts | 67 +- .../diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 + tests/baselines/reference/ES5For-of10.types | 29 + tests/baselines/reference/ES5For-of11.types | 8 + .../reference/ES5For-of12.errors.txt | 6 +- tests/baselines/reference/ES5For-of13.types | 9 + tests/baselines/reference/ES5For-of24.types | 12 + tests/baselines/reference/ES5For-of25.types | 15 + .../reference/ES5For-of26.errors.txt | 10 + tests/baselines/reference/ES5For-of26.types | 12 - .../reference/ES5For-of27.errors.txt | 11 +- .../reference/ES5For-of28.errors.txt | 10 + tests/baselines/reference/ES5For-of28.types | 12 - .../reference/ES5For-of29.errors.txt | 11 +- tests/baselines/reference/ES5For-of3.types | 9 + .../reference/ES5For-of30.errors.txt | 6 +- .../reference/ES5For-of31.errors.txt | 11 +- .../baselines/reference/ES5For-of8.errors.txt | 6 +- tests/baselines/reference/ES5For-of9.types | 30 + .../arityAndOrderCompatibility01.errors.txt | 292 ++++---- .../reference/arityAndOrderCompatibility01.js | 56 +- .../reference/downlevelLetConst16.errors.txt | 242 ++++++ .../reference/downlevelLetConst16.types | 686 ------------------ .../parserES5ForOfStatement1.d.errors.txt | 5 +- .../parserES5ForOfStatement10.errors.txt | 6 +- .../parserES5ForOfStatement11.errors.txt | 6 +- .../parserES5ForOfStatement12.errors.txt | 6 +- .../parserES5ForOfStatement13.errors.txt | 6 +- .../parserES5ForOfStatement14.errors.txt | 6 +- .../parserES5ForOfStatement15.errors.txt | 6 +- .../parserES5ForOfStatement16.errors.txt | 6 +- .../parserES5ForOfStatement3.errors.txt | 5 +- .../parserES5ForOfStatement4.errors.txt | 5 +- .../parserES5ForOfStatement5.errors.txt | 5 +- .../parserES5ForOfStatement6.errors.txt | 5 +- .../parserES5ForOfStatement7.errors.txt | 5 +- .../parserES5ForOfStatement8.errors.txt | 6 +- .../parserES5ForOfStatement9.errors.txt | 6 +- 39 files changed, 685 insertions(+), 954 deletions(-) create mode 100644 tests/baselines/reference/ES5For-of10.types create mode 100644 tests/baselines/reference/ES5For-of11.types create mode 100644 tests/baselines/reference/ES5For-of13.types create mode 100644 tests/baselines/reference/ES5For-of24.types create mode 100644 tests/baselines/reference/ES5For-of25.types create mode 100644 tests/baselines/reference/ES5For-of26.errors.txt delete mode 100644 tests/baselines/reference/ES5For-of26.types create mode 100644 tests/baselines/reference/ES5For-of28.errors.txt delete mode 100644 tests/baselines/reference/ES5For-of28.types create mode 100644 tests/baselines/reference/ES5For-of3.types create mode 100644 tests/baselines/reference/ES5For-of9.types create mode 100644 tests/baselines/reference/downlevelLetConst16.errors.txt delete mode 100644 tests/baselines/reference/downlevelLetConst16.types diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6682761812d..414a8ce17fa 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1869,7 +1869,11 @@ module ts { return anyType; } if (declaration.parent.parent.kind === SyntaxKind.ForOfStatement) { - return getTypeForVariableDeclarationInForOfStatement(declaration.parent.parent); + // checkRightHandSideOfForOf will return undefined if the for-of expression type was + // missing properties/signatures required to get its iteratedType (like + // [Symbol.iterator] or next). This may be because we accessed properties from anyType, + // or it may have led to an error inside getIteratedType. + return checkRightHandSideOfForOf((declaration.parent.parent).expression) || anyType; } if (isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); @@ -8781,7 +8785,7 @@ module ts { // Check the LHS and RHS // If the LHS is a declaration, just check it as a variable declaration, which will in turn check the RHS - // via getTypeForVariableDeclarationInForOfStatement. + // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { @@ -8789,8 +8793,7 @@ module ts { } else { var varExpr = node.initializer; - var rightType = checkExpression(node.expression); - var iteratedType = checkIteratedType(rightType, node.expression); + var iteratedType = checkRightHandSideOfForOf(node.expression); // There may be a destructuring assignment on the left side if (varExpr.kind === SyntaxKind.ArrayLiteralExpression || varExpr.kind === SyntaxKind.ObjectLiteralExpression) { @@ -8872,18 +8875,11 @@ module ts { } } - function getTypeForVariableDeclarationInForOfStatement(forOfStatement: ForOfStatement): Type { - // Temporarily return 'any' below ES6 - if (languageVersion < ScriptTarget.ES6) { - return anyType; - } - - // iteratedType will be undefined if the for-of expression type was missing properties/signatures - // required to get its iteratedType (like [Symbol.iterator] or next). This may be - // because we accessed properties from anyType, or it may have led to an error inside - // getIteratedType. - var expressionType = getTypeOfExpression(forOfStatement.expression); - return checkIteratedType(expressionType, forOfStatement.expression) || anyType; + function checkRightHandSideOfForOf(rhsExpression: Expression): Type { + var expressionType = getTypeOfExpression(rhsExpression); + return languageVersion >= ScriptTarget.ES6 + ? checkIteratedType(expressionType, rhsExpression) + : checkElementTypeOfArrayOrString(expressionType, rhsExpression); } /** @@ -8982,6 +8978,45 @@ module ts { } } + function checkElementTypeOfArrayOrString(arrayOrStringType: Type, expressionForError: Expression): Type { + Debug.assert(languageVersion < ScriptTarget.ES6); + var isJustString = allConstituentTypesHaveKind(arrayOrStringType, TypeFlags.StringLike); + + // Check isJustString because removeTypesFromUnionType will only remove types if it doesn't result + // in an emptyObjectType. In this case, we actually do want the emptyObjectType. + var arrayType = isJustString ? emptyObjectType : removeTypesFromUnionType(arrayOrStringType, TypeFlags.StringLike, /*isTypeOfKind*/ true); + var hasStringConstituent = arrayOrStringType !== emptyObjectType && arrayOrStringType !== arrayType; + + var reportedError = false; + if (hasStringConstituent && languageVersion < ScriptTarget.ES5) { + error(expressionForError, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); + reportedError = true; + } + + if (isJustString) { + return stringType; + } + + if (!isArrayLikeType(arrayType)) { + if (!reportedError) { + error(expressionForError, Diagnostics.Type_0_is_not_an_array_type, typeToString(arrayType)); + } + return hasStringConstituent ? stringType : unknownType; + } + + var arrayElementType = getIndexTypeOfType(arrayType, IndexKind.Number) || unknownType; + if (hasStringConstituent) { + // This is just an optimization for the case where arrayOrStringType is string | string[] + if (arrayElementType.flags & TypeFlags.StringLike) { + return stringType; + } + + return getUnionType([arrayElementType, stringType]); + } + + return arrayElementType; + } + function checkBreakOrContinueStatement(node: BreakOrContinueStatement) { // Grammar checking checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 74028d85910..ef8a3936bc3 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -338,6 +338,7 @@ module ts { The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: DiagnosticCategory.Error, key: "Cannot redeclare identifier '{0}' in catch clause" }, Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: DiagnosticCategory.Error, key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: DiagnosticCategory.Error, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f55c4391699..efeb54d93fc 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1343,6 +1343,10 @@ "category": "Error", "code": 2493 }, + "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher.": { + "category": "Error", + "code": 2494 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/tests/baselines/reference/ES5For-of10.types b/tests/baselines/reference/ES5For-of10.types new file mode 100644 index 00000000000..32a2adcf3da --- /dev/null +++ b/tests/baselines/reference/ES5For-of10.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of10.ts === +function foo() { +>foo : () => { x: number; } + + return { x: 0 }; +>{ x: 0 } : { x: number; } +>x : number +} +for (foo().x of []) { +>foo().x : number +>foo() : { x: number; } +>foo : () => { x: number; } +>x : number +>[] : undefined[] + + for (foo().x of []) +>foo().x : number +>foo() : { x: number; } +>foo : () => { x: number; } +>x : number +>[] : undefined[] + + var p = foo().x; +>p : number +>foo().x : number +>foo() : { x: number; } +>foo : () => { x: number; } +>x : number +} diff --git a/tests/baselines/reference/ES5For-of11.types b/tests/baselines/reference/ES5For-of11.types new file mode 100644 index 00000000000..e51bc46f157 --- /dev/null +++ b/tests/baselines/reference/ES5For-of11.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of11.ts === +var v; +>v : any + +for (v of []) { } +>v : any +>[] : undefined[] + diff --git a/tests/baselines/reference/ES5For-of12.errors.txt b/tests/baselines/reference/ES5For-of12.errors.txt index ca7c2b190a2..55144f549a0 100644 --- a/tests/baselines/reference/ES5For-of12.errors.txt +++ b/tests/baselines/reference/ES5For-of12.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts(1,6): error TS2461: Type 'undefined' is not an array type. ==== tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts (1 errors) ==== for ([""] of []) { } - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. \ No newline at end of file + ~~~~ +!!! error TS2461: Type 'undefined' is not an array type. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of13.types b/tests/baselines/reference/ES5For-of13.types new file mode 100644 index 00000000000..64aac2ae4b2 --- /dev/null +++ b/tests/baselines/reference/ES5For-of13.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts === +for (let v of ['a', 'b', 'c']) { +>v : string +>['a', 'b', 'c'] : string[] + + var x = v; +>x : string +>v : string +} diff --git a/tests/baselines/reference/ES5For-of24.types b/tests/baselines/reference/ES5For-of24.types new file mode 100644 index 00000000000..7170073b5d9 --- /dev/null +++ b/tests/baselines/reference/ES5For-of24.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of24.ts === +var a = [1, 2, 3]; +>a : number[] +>[1, 2, 3] : number[] + +for (var v of a) { +>v : number +>a : number[] + + let a = 0; +>a : number +} diff --git a/tests/baselines/reference/ES5For-of25.types b/tests/baselines/reference/ES5For-of25.types new file mode 100644 index 00000000000..7b306ee9a26 --- /dev/null +++ b/tests/baselines/reference/ES5For-of25.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of25.ts === +var a = [1, 2, 3]; +>a : number[] +>[1, 2, 3] : number[] + +for (var v of a) { +>v : number +>a : number[] + + v; +>v : number + + a; +>a : number[] +} diff --git a/tests/baselines/reference/ES5For-of26.errors.txt b/tests/baselines/reference/ES5For-of26.errors.txt new file mode 100644 index 00000000000..324ded25b4f --- /dev/null +++ b/tests/baselines/reference/ES5For-of26.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts(1,10): error TS2461: Type 'number' is not an array type. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts (1 errors) ==== + for (var [a = 0, b = 1] of [2, 3]) { + ~~~~~~~~~~~~~~ +!!! error TS2461: Type 'number' is not an array type. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of26.types b/tests/baselines/reference/ES5For-of26.types deleted file mode 100644 index b59378fdb6b..00000000000 --- a/tests/baselines/reference/ES5For-of26.types +++ /dev/null @@ -1,12 +0,0 @@ -=== tests/cases/conformance/statements/for-ofStatements/ES5For-of26.ts === -for (var [a = 0, b = 1] of [2, 3]) { ->a : number ->b : number ->[2, 3] : number[] - - a; ->a : number - - b; ->b : number -} diff --git a/tests/baselines/reference/ES5For-of27.errors.txt b/tests/baselines/reference/ES5For-of27.errors.txt index f54c66d7eae..0c839859930 100644 --- a/tests/baselines/reference/ES5For-of27.errors.txt +++ b/tests/baselines/reference/ES5For-of27.errors.txt @@ -1,10 +1,13 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of27.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/statements/for-ofStatements/ES5For-of27.ts(1,11): error TS2459: Type 'number' has no property 'x' and no string index signature. +tests/cases/conformance/statements/for-ofStatements/ES5For-of27.ts(1,21): error TS2459: Type 'number' has no property 'y' and no string index signature. -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of27.ts (1 errors) ==== +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of27.ts (2 errors) ==== for (var {x: a = 0, y: b = 1} of [2, 3]) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS2459: Type 'number' has no property 'x' and no string index signature. + ~ +!!! error TS2459: Type 'number' has no property 'y' and no string index signature. a; b; } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of28.errors.txt b/tests/baselines/reference/ES5For-of28.errors.txt new file mode 100644 index 00000000000..81398fa5a9b --- /dev/null +++ b/tests/baselines/reference/ES5For-of28.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts(1,10): error TS2461: Type 'number' is not an array type. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts (1 errors) ==== + for (let [a = 0, b = 1] of [2, 3]) { + ~~~~~~~~~~~~~~ +!!! error TS2461: Type 'number' is not an array type. + a; + b; + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of28.types b/tests/baselines/reference/ES5For-of28.types deleted file mode 100644 index 61a4779e80b..00000000000 --- a/tests/baselines/reference/ES5For-of28.types +++ /dev/null @@ -1,12 +0,0 @@ -=== tests/cases/conformance/statements/for-ofStatements/ES5For-of28.ts === -for (let [a = 0, b = 1] of [2, 3]) { ->a : number ->b : number ->[2, 3] : number[] - - a; ->a : number - - b; ->b : number -} diff --git a/tests/baselines/reference/ES5For-of29.errors.txt b/tests/baselines/reference/ES5For-of29.errors.txt index 24a0b67aec8..e669b070222 100644 --- a/tests/baselines/reference/ES5For-of29.errors.txt +++ b/tests/baselines/reference/ES5For-of29.errors.txt @@ -1,10 +1,13 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of29.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/statements/for-ofStatements/ES5For-of29.ts(1,13): error TS2459: Type 'number' has no property 'x' and no string index signature. +tests/cases/conformance/statements/for-ofStatements/ES5For-of29.ts(1,23): error TS2459: Type 'number' has no property 'y' and no string index signature. -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of29.ts (1 errors) ==== +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of29.ts (2 errors) ==== for (const {x: a = 0, y: b = 1} of [2, 3]) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS2459: Type 'number' has no property 'x' and no string index signature. + ~ +!!! error TS2459: Type 'number' has no property 'y' and no string index signature. a; b; } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of3.types b/tests/baselines/reference/ES5For-of3.types new file mode 100644 index 00000000000..c47328816e8 --- /dev/null +++ b/tests/baselines/reference/ES5For-of3.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of3.ts === +for (var v of ['a', 'b', 'c']) +>v : string +>['a', 'b', 'c'] : string[] + + var x = v; +>x : string +>v : string + diff --git a/tests/baselines/reference/ES5For-of30.errors.txt b/tests/baselines/reference/ES5For-of30.errors.txt index 9ab0dfca3cd..0b02a55ba3f 100644 --- a/tests/baselines/reference/ES5For-of30.errors.txt +++ b/tests/baselines/reference/ES5For-of30.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts(3,6): error TS2461: Type 'string | number' is not an array type. ==== tests/cases/conformance/statements/for-ofStatements/ES5For-of30.ts (1 errors) ==== var a: string, b: number; var tuple: [number, string] = [2, "3"]; for ([a = 1, b = ""] of tuple) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~~~~~~~~~~~~~~~ +!!! error TS2461: Type 'string | number' is not an array type. a; b; } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of31.errors.txt b/tests/baselines/reference/ES5For-of31.errors.txt index fa3b7617980..4a49e1fdf92 100644 --- a/tests/baselines/reference/ES5For-of31.errors.txt +++ b/tests/baselines/reference/ES5For-of31.errors.txt @@ -1,12 +1,15 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of31.ts(3,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/statements/for-ofStatements/ES5For-of31.ts(3,8): error TS2459: Type 'undefined' has no property 'a' and no string index signature. +tests/cases/conformance/statements/for-ofStatements/ES5For-of31.ts(3,18): error TS2459: Type 'undefined' has no property 'b' and no string index signature. -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of31.ts (1 errors) ==== +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of31.ts (2 errors) ==== var a: string, b: number; for ({ a: b = 1, b: a = ""} of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS2459: Type 'undefined' has no property 'a' and no string index signature. + ~ +!!! error TS2459: Type 'undefined' has no property 'b' and no string index signature. a; b; } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of8.errors.txt b/tests/baselines/reference/ES5For-of8.errors.txt index d32d50a6610..7cc3c871277 100644 --- a/tests/baselines/reference/ES5For-of8.errors.txt +++ b/tests/baselines/reference/ES5For-of8.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts(4,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts(4,6): error TS2322: Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of8.ts(4,1): error TS return { x: 0 }; } for (foo().x of ['a', 'b', 'c']) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. var p = foo().x; } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of9.types b/tests/baselines/reference/ES5For-of9.types new file mode 100644 index 00000000000..60870c2d642 --- /dev/null +++ b/tests/baselines/reference/ES5For-of9.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of9.ts === +function foo() { +>foo : () => { x: number; } + + return { x: 0 }; +>{ x: 0 } : { x: number; } +>x : number +} +for (foo().x of []) { +>foo().x : number +>foo() : { x: number; } +>foo : () => { x: number; } +>x : number +>[] : undefined[] + + for (foo().x of []) { +>foo().x : number +>foo() : { x: number; } +>foo : () => { x: number; } +>x : number +>[] : undefined[] + + var p = foo().x; +>p : number +>foo().x : number +>foo() : { x: number; } +>foo : () => { x: number; } +>x : number + } +} diff --git a/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt b/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt index 3925cdff747..391fbf42384 100644 --- a/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt +++ b/tests/baselines/reference/arityAndOrderCompatibility01.errors.txt @@ -1,147 +1,147 @@ -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(13,12): error TS2493: Tuple type '[string, number]' with length '2' cannot be assigned to tuple with length '3'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(14,12): error TS2460: Type 'StrNum' has no property '2'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(15,5): error TS2461: Type '{ 0: string; 1: number; }' is not an array type. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(16,5): error TS2322: Type '[string, number]' is not assignable to type '[number, number, number]'. - Types of property '0' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(17,5): error TS2322: Type 'StrNum' is not assignable to type '[number, number, number]'. - Types of property '0' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(18,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number, number, number]'. - Types of property '0' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(19,5): error TS2322: Type '[string, number]' is not assignable to type '[string, number, number]'. - Property '2' is missing in type '[string, number]'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(20,5): error TS2322: Type 'StrNum' is not assignable to type '[string, number, number]'. - Property '2' is missing in type 'StrNum'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(21,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string, number, number]'. - Property '2' is missing in type '{ 0: string; 1: number; }'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(22,5): error TS2322: Type '[string, number]' is not assignable to type '[number]'. - Types of property '0' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(23,5): error TS2322: Type 'StrNum' is not assignable to type '[number]'. - Types of property '0' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(24,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number]'. - Types of property '0' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(25,5): error TS2322: Type '[string, number]' is not assignable to type '[string]'. - Types of property 'pop' are incompatible. - Type '() => string | number' is not assignable to type '() => string'. - Type 'string | number' is not assignable to type 'string'. - Type 'number' is not assignable to type 'string'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(26,5): error TS2322: Type 'StrNum' is not assignable to type '[string]'. - Types of property 'pop' are incompatible. - Type '() => string | number' is not assignable to type '() => string'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(27,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string]'. - Property 'length' is missing in type '{ 0: string; 1: number; }'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(28,5): error TS2322: Type '[string, number]' is not assignable to type '[number, string]'. - Types of property '0' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(29,5): error TS2322: Type 'StrNum' is not assignable to type '[number, string]'. - Types of property '0' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(30,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number, string]'. - Types of property '0' are incompatible. - Type 'string' is not assignable to type 'number'. - - -==== tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts (18 errors) ==== - interface StrNum extends Array { - 0: string; - 1: number; - } - - var x: [string, number]; - var y: StrNum - var z: { - 0: string; - 1: number; - } - - var [a, b, c] = x; - ~ -!!! error TS2493: Tuple type '[string, number]' with length '2' cannot be assigned to tuple with length '3'. - var [d, e, f] = y; - ~ -!!! error TS2460: Type 'StrNum' has no property '2'. - var [g, h, i] = z; - ~~~~~~~~~ -!!! error TS2461: Type '{ 0: string; 1: number; }' is not an array type. - var j1: [number, number, number] = x; - ~~ -!!! error TS2322: Type '[string, number]' is not assignable to type '[number, number, number]'. -!!! error TS2322: Types of property '0' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. - var j2: [number, number, number] = y; - ~~ -!!! error TS2322: Type 'StrNum' is not assignable to type '[number, number, number]'. -!!! error TS2322: Types of property '0' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. - var j3: [number, number, number] = z; - ~~ -!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number, number, number]'. -!!! error TS2322: Types of property '0' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. - var k1: [string, number, number] = x; - ~~ -!!! error TS2322: Type '[string, number]' is not assignable to type '[string, number, number]'. -!!! error TS2322: Property '2' is missing in type '[string, number]'. - var k2: [string, number, number] = y; - ~~ -!!! error TS2322: Type 'StrNum' is not assignable to type '[string, number, number]'. -!!! error TS2322: Property '2' is missing in type 'StrNum'. - var k3: [string, number, number] = z; - ~~ -!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string, number, number]'. -!!! error TS2322: Property '2' is missing in type '{ 0: string; 1: number; }'. - var l1: [number] = x; - ~~ -!!! error TS2322: Type '[string, number]' is not assignable to type '[number]'. -!!! error TS2322: Types of property '0' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. - var l2: [number] = y; - ~~ -!!! error TS2322: Type 'StrNum' is not assignable to type '[number]'. -!!! error TS2322: Types of property '0' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. - var l3: [number] = z; - ~~ -!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number]'. -!!! error TS2322: Types of property '0' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. - var m1: [string] = x; - ~~ -!!! error TS2322: Type '[string, number]' is not assignable to type '[string]'. -!!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => string | number' is not assignable to type '() => string'. -!!! error TS2322: Type 'string | number' is not assignable to type 'string'. -!!! error TS2322: Type 'number' is not assignable to type 'string'. - var m2: [string] = y; - ~~ -!!! error TS2322: Type 'StrNum' is not assignable to type '[string]'. -!!! error TS2322: Types of property 'pop' are incompatible. -!!! error TS2322: Type '() => string | number' is not assignable to type '() => string'. - var m3: [string] = z; - ~~ -!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string]'. -!!! error TS2322: Property 'length' is missing in type '{ 0: string; 1: number; }'. - var n1: [number, string] = x; - ~~ -!!! error TS2322: Type '[string, number]' is not assignable to type '[number, string]'. -!!! error TS2322: Types of property '0' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. - var n2: [number, string] = y; - ~~ -!!! error TS2322: Type 'StrNum' is not assignable to type '[number, string]'. -!!! error TS2322: Types of property '0' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. - var n3: [number, string] = z; - ~~ -!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number, string]'. -!!! error TS2322: Types of property '0' are incompatible. -!!! error TS2322: Type 'string' is not assignable to type 'number'. - var o1: [string, number] = x; - var o2: [string, number] = y; - var o3: [string, number] = y; +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(13,12): error TS2493: Tuple type '[string, number]' with length '2' cannot be assigned to tuple with length '3'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(14,12): error TS2460: Type 'StrNum' has no property '2'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(15,5): error TS2461: Type '{ 0: string; 1: number; }' is not an array type. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(16,5): error TS2322: Type '[string, number]' is not assignable to type '[number, number, number]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(17,5): error TS2322: Type 'StrNum' is not assignable to type '[number, number, number]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(18,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number, number, number]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(19,5): error TS2322: Type '[string, number]' is not assignable to type '[string, number, number]'. + Property '2' is missing in type '[string, number]'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(20,5): error TS2322: Type 'StrNum' is not assignable to type '[string, number, number]'. + Property '2' is missing in type 'StrNum'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(21,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string, number, number]'. + Property '2' is missing in type '{ 0: string; 1: number; }'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(22,5): error TS2322: Type '[string, number]' is not assignable to type '[number]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(23,5): error TS2322: Type 'StrNum' is not assignable to type '[number]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(24,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(25,5): error TS2322: Type '[string, number]' is not assignable to type '[string]'. + Types of property 'pop' are incompatible. + Type '() => string | number' is not assignable to type '() => string'. + Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(26,5): error TS2322: Type 'StrNum' is not assignable to type '[string]'. + Types of property 'pop' are incompatible. + Type '() => string | number' is not assignable to type '() => string'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(27,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string]'. + Property 'length' is missing in type '{ 0: string; 1: number; }'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(28,5): error TS2322: Type '[string, number]' is not assignable to type '[number, string]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(29,5): error TS2322: Type 'StrNum' is not assignable to type '[number, string]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts(30,5): error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number, string]'. + Types of property '0' are incompatible. + Type 'string' is not assignable to type 'number'. + + +==== tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts (18 errors) ==== + interface StrNum extends Array { + 0: string; + 1: number; + } + + var x: [string, number]; + var y: StrNum + var z: { + 0: string; + 1: number; + } + + var [a, b, c] = x; + ~ +!!! error TS2493: Tuple type '[string, number]' with length '2' cannot be assigned to tuple with length '3'. + var [d, e, f] = y; + ~ +!!! error TS2460: Type 'StrNum' has no property '2'. + var [g, h, i] = z; + ~~~~~~~~~ +!!! error TS2461: Type '{ 0: string; 1: number; }' is not an array type. + var j1: [number, number, number] = x; + ~~ +!!! error TS2322: Type '[string, number]' is not assignable to type '[number, number, number]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var j2: [number, number, number] = y; + ~~ +!!! error TS2322: Type 'StrNum' is not assignable to type '[number, number, number]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var j3: [number, number, number] = z; + ~~ +!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number, number, number]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var k1: [string, number, number] = x; + ~~ +!!! error TS2322: Type '[string, number]' is not assignable to type '[string, number, number]'. +!!! error TS2322: Property '2' is missing in type '[string, number]'. + var k2: [string, number, number] = y; + ~~ +!!! error TS2322: Type 'StrNum' is not assignable to type '[string, number, number]'. +!!! error TS2322: Property '2' is missing in type 'StrNum'. + var k3: [string, number, number] = z; + ~~ +!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string, number, number]'. +!!! error TS2322: Property '2' is missing in type '{ 0: string; 1: number; }'. + var l1: [number] = x; + ~~ +!!! error TS2322: Type '[string, number]' is not assignable to type '[number]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var l2: [number] = y; + ~~ +!!! error TS2322: Type 'StrNum' is not assignable to type '[number]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var l3: [number] = z; + ~~ +!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var m1: [string] = x; + ~~ +!!! error TS2322: Type '[string, number]' is not assignable to type '[string]'. +!!! error TS2322: Types of property 'pop' are incompatible. +!!! error TS2322: Type '() => string | number' is not assignable to type '() => string'. +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + var m2: [string] = y; + ~~ +!!! error TS2322: Type 'StrNum' is not assignable to type '[string]'. +!!! error TS2322: Types of property 'pop' are incompatible. +!!! error TS2322: Type '() => string | number' is not assignable to type '() => string'. + var m3: [string] = z; + ~~ +!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[string]'. +!!! error TS2322: Property 'length' is missing in type '{ 0: string; 1: number; }'. + var n1: [number, string] = x; + ~~ +!!! error TS2322: Type '[string, number]' is not assignable to type '[number, string]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var n2: [number, string] = y; + ~~ +!!! error TS2322: Type 'StrNum' is not assignable to type '[number, string]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var n3: [number, string] = z; + ~~ +!!! error TS2322: Type '{ 0: string; 1: number; }' is not assignable to type '[number, string]'. +!!! error TS2322: Types of property '0' are incompatible. +!!! error TS2322: Type 'string' is not assignable to type 'number'. + var o1: [string, number] = x; + var o2: [string, number] = y; + var o3: [string, number] = y; \ No newline at end of file diff --git a/tests/baselines/reference/arityAndOrderCompatibility01.js b/tests/baselines/reference/arityAndOrderCompatibility01.js index 5b88697fd4f..2eb1bcf8bd8 100644 --- a/tests/baselines/reference/arityAndOrderCompatibility01.js +++ b/tests/baselines/reference/arityAndOrderCompatibility01.js @@ -1,4 +1,4 @@ -//// [arityAndOrderCompatibility01.ts] +//// [arityAndOrderCompatibility01.ts] interface StrNum extends Array { 0: string; 1: number; @@ -32,30 +32,30 @@ var n3: [number, string] = z; var o1: [string, number] = x; var o2: [string, number] = y; var o3: [string, number] = y; - - -//// [arityAndOrderCompatibility01.js] -var x; -var y; -var z; -var a = x[0], b = x[1], c = x[2]; -var d = y[0], e = y[1], f = y[2]; -var g = z[0], h = z[1], i = z[2]; -var j1 = x; -var j2 = y; -var j3 = z; -var k1 = x; -var k2 = y; -var k3 = z; -var l1 = x; -var l2 = y; -var l3 = z; -var m1 = x; -var m2 = y; -var m3 = z; -var n1 = x; -var n2 = y; -var n3 = z; -var o1 = x; -var o2 = y; -var o3 = y; + + +//// [arityAndOrderCompatibility01.js] +var x; +var y; +var z; +var a = x[0], b = x[1], c = x[2]; +var d = y[0], e = y[1], f = y[2]; +var g = z[0], h = z[1], i = z[2]; +var j1 = x; +var j2 = y; +var j3 = z; +var k1 = x; +var k2 = y; +var k3 = z; +var l1 = x; +var l2 = y; +var l3 = z; +var m1 = x; +var m2 = y; +var m3 = z; +var n1 = x; +var n2 = y; +var n3 = z; +var o1 = x; +var o2 = y; +var o3 = y; diff --git a/tests/baselines/reference/downlevelLetConst16.errors.txt b/tests/baselines/reference/downlevelLetConst16.errors.txt new file mode 100644 index 00000000000..94c53360b87 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst16.errors.txt @@ -0,0 +1,242 @@ +tests/cases/compiler/downlevelLetConst16.ts(195,14): error TS2461: Type 'undefined' is not an array type. +tests/cases/compiler/downlevelLetConst16.ts(202,15): error TS2459: Type 'undefined' has no property 'a' and no string index signature. +tests/cases/compiler/downlevelLetConst16.ts(216,16): error TS2461: Type 'undefined' is not an array type. +tests/cases/compiler/downlevelLetConst16.ts(223,17): error TS2459: Type 'undefined' has no property 'a' and no string index signature. + + +==== tests/cases/compiler/downlevelLetConst16.ts (4 errors) ==== + 'use strict' + + declare function use(a: any); + + var x = 10; + var y; + var z; + use(x); + use(y); + use(z); + function foo1() { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = {a: 1}; + use(z); + } + + function foo2() { + { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + use(x); + } + + class A { + m1() { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + m2() { + { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + use(x); + } + + } + + class B { + m1() { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + m2() { + { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + use(x); + } + } + + function bar1() { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + } + + function bar2() { + { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + use(x); + } + + module M1 { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + + module M2 { + { + let x = 1; + use(x); + let [y] = [1]; + use(y); + let {a: z} = { a: 1 }; + use(z); + } + use(x); + } + + module M3 { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + + module M4 { + { + const x = 1; + use(x); + const [y] = [1]; + use(y); + const {a: z} = { a: 1 }; + use(z); + + } + use(x); + use(y); + use(z); + } + + function foo3() { + for (let x; ;) { + use(x); + } + for (let [y] = []; ;) { + use(y); + } + for (let {a: z} = {a: 1}; ;) { + use(z); + } + use(x); + } + + function foo4() { + for (const x = 1; ;) { + use(x); + } + for (const [y] = []; ;) { + use(y); + } + for (const {a: z} = { a: 1 }; ;) { + use(z); + } + use(x); + } + + function foo5() { + for (let x in []) { + use(x); + } + use(x); + } + + function foo6() { + for (const x in []) { + use(x); + } + use(x); + } + + function foo7() { + for (let x of []) { + use(x); + } + use(x); + } + + function foo8() { + for (let [x] of []) { + ~~~ +!!! error TS2461: Type 'undefined' is not an array type. + use(x); + } + use(x); + } + + function foo9() { + for (let {a: x} of []) { + ~ +!!! error TS2459: Type 'undefined' has no property 'a' and no string index signature. + use(x); + } + use(x); + } + + function foo10() { + for (const x of []) { + use(x); + } + use(x); + } + + function foo11() { + for (const [x] of []) { + ~~~ +!!! error TS2461: Type 'undefined' is not an array type. + use(x); + } + use(x); + } + + function foo12() { + for (const {a: x} of []) { + ~ +!!! error TS2459: Type 'undefined' has no property 'a' and no string index signature. + use(x); + } + use(x); + } \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst16.types b/tests/baselines/reference/downlevelLetConst16.types deleted file mode 100644 index a9a11507c30..00000000000 --- a/tests/baselines/reference/downlevelLetConst16.types +++ /dev/null @@ -1,686 +0,0 @@ -=== tests/cases/compiler/downlevelLetConst16.ts === -'use strict' - -declare function use(a: any); ->use : (a: any) => any ->a : any - -var x = 10; ->x : number - -var y; ->y : any - -var z; ->z : any - -use(x); ->use(x) : any ->use : (a: any) => any ->x : number - -use(y); ->use(y) : any ->use : (a: any) => any ->y : any - -use(z); ->use(z) : any ->use : (a: any) => any ->z : any - -function foo1() { ->foo1 : () => void - - let x = 1; ->x : number - - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - - let [y] = [1]; ->y : number ->[1] : [number] - - use(y); ->use(y) : any ->use : (a: any) => any ->y : number - - let {a: z} = {a: 1}; ->a : unknown ->z : number ->{a: 1} : { a: number; } ->a : number - - use(z); ->use(z) : any ->use : (a: any) => any ->z : number -} - -function foo2() { ->foo2 : () => void - { - let x = 1; ->x : number - - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - - let [y] = [1]; ->y : number ->[1] : [number] - - use(y); ->use(y) : any ->use : (a: any) => any ->y : number - - let {a: z} = { a: 1 }; ->a : unknown ->z : number ->{ a: 1 } : { a: number; } ->a : number - - use(z); ->use(z) : any ->use : (a: any) => any ->z : number - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number -} - -class A { ->A : A - - m1() { ->m1 : () => void - - let x = 1; ->x : number - - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - - let [y] = [1]; ->y : number ->[1] : [number] - - use(y); ->use(y) : any ->use : (a: any) => any ->y : number - - let {a: z} = { a: 1 }; ->a : unknown ->z : number ->{ a: 1 } : { a: number; } ->a : number - - use(z); ->use(z) : any ->use : (a: any) => any ->z : number - } - m2() { ->m2 : () => void - { - let x = 1; ->x : number - - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - - let [y] = [1]; ->y : number ->[1] : [number] - - use(y); ->use(y) : any ->use : (a: any) => any ->y : number - - let {a: z} = { a: 1 }; ->a : unknown ->z : number ->{ a: 1 } : { a: number; } ->a : number - - use(z); ->use(z) : any ->use : (a: any) => any ->z : number - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - } - -} - -class B { ->B : B - - m1() { ->m1 : () => void - - const x = 1; ->x : number - - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - - const [y] = [1]; ->y : number ->[1] : [number] - - use(y); ->use(y) : any ->use : (a: any) => any ->y : number - - const {a: z} = { a: 1 }; ->a : unknown ->z : number ->{ a: 1 } : { a: number; } ->a : number - - use(z); ->use(z) : any ->use : (a: any) => any ->z : number - - } - m2() { ->m2 : () => void - { - const x = 1; ->x : number - - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - - const [y] = [1]; ->y : number ->[1] : [number] - - use(y); ->use(y) : any ->use : (a: any) => any ->y : number - - const {a: z} = { a: 1 }; ->a : unknown ->z : number ->{ a: 1 } : { a: number; } ->a : number - - use(z); ->use(z) : any ->use : (a: any) => any ->z : number - - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - } -} - -function bar1() { ->bar1 : () => void - - const x = 1; ->x : number - - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - - const [y] = [1]; ->y : number ->[1] : [number] - - use(y); ->use(y) : any ->use : (a: any) => any ->y : number - - const {a: z} = { a: 1 }; ->a : unknown ->z : number ->{ a: 1 } : { a: number; } ->a : number - - use(z); ->use(z) : any ->use : (a: any) => any ->z : number -} - -function bar2() { ->bar2 : () => void - { - const x = 1; ->x : number - - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - - const [y] = [1]; ->y : number ->[1] : [number] - - use(y); ->use(y) : any ->use : (a: any) => any ->y : number - - const {a: z} = { a: 1 }; ->a : unknown ->z : number ->{ a: 1 } : { a: number; } ->a : number - - use(z); ->use(z) : any ->use : (a: any) => any ->z : number - - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number -} - -module M1 { ->M1 : typeof M1 - - let x = 1; ->x : number - - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - - let [y] = [1]; ->y : number ->[1] : [number] - - use(y); ->use(y) : any ->use : (a: any) => any ->y : number - - let {a: z} = { a: 1 }; ->a : unknown ->z : number ->{ a: 1 } : { a: number; } ->a : number - - use(z); ->use(z) : any ->use : (a: any) => any ->z : number -} - -module M2 { ->M2 : typeof M2 - { - let x = 1; ->x : number - - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - - let [y] = [1]; ->y : number ->[1] : [number] - - use(y); ->use(y) : any ->use : (a: any) => any ->y : number - - let {a: z} = { a: 1 }; ->a : unknown ->z : number ->{ a: 1 } : { a: number; } ->a : number - - use(z); ->use(z) : any ->use : (a: any) => any ->z : number - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number -} - -module M3 { ->M3 : typeof M3 - - const x = 1; ->x : number - - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - - const [y] = [1]; ->y : number ->[1] : [number] - - use(y); ->use(y) : any ->use : (a: any) => any ->y : number - - const {a: z} = { a: 1 }; ->a : unknown ->z : number ->{ a: 1 } : { a: number; } ->a : number - - use(z); ->use(z) : any ->use : (a: any) => any ->z : number - -} - -module M4 { ->M4 : typeof M4 - { - const x = 1; ->x : number - - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - - const [y] = [1]; ->y : number ->[1] : [number] - - use(y); ->use(y) : any ->use : (a: any) => any ->y : number - - const {a: z} = { a: 1 }; ->a : unknown ->z : number ->{ a: 1 } : { a: number; } ->a : number - - use(z); ->use(z) : any ->use : (a: any) => any ->z : number - - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - - use(y); ->use(y) : any ->use : (a: any) => any ->y : any - - use(z); ->use(z) : any ->use : (a: any) => any ->z : any -} - -function foo3() { ->foo3 : () => void - - for (let x; ;) { ->x : any - - use(x); ->use(x) : any ->use : (a: any) => any ->x : any - } - for (let [y] = []; ;) { ->y : any ->[] : undefined[] - - use(y); ->use(y) : any ->use : (a: any) => any ->y : any - } - for (let {a: z} = {a: 1}; ;) { ->a : unknown ->z : number ->{a: 1} : { a: number; } ->a : number - - use(z); ->use(z) : any ->use : (a: any) => any ->z : number - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number -} - -function foo4() { ->foo4 : () => void - - for (const x = 1; ;) { ->x : number - - use(x); ->use(x) : any ->use : (a: any) => any ->x : number - } - for (const [y] = []; ;) { ->y : any ->[] : undefined[] - - use(y); ->use(y) : any ->use : (a: any) => any ->y : any - } - for (const {a: z} = { a: 1 }; ;) { ->a : unknown ->z : number ->{ a: 1 } : { a: number; } ->a : number - - use(z); ->use(z) : any ->use : (a: any) => any ->z : number - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number -} - -function foo5() { ->foo5 : () => void - - for (let x in []) { ->x : any ->[] : undefined[] - - use(x); ->use(x) : any ->use : (a: any) => any ->x : any - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number -} - -function foo6() { ->foo6 : () => void - - for (const x in []) { ->x : any ->[] : undefined[] - - use(x); ->use(x) : any ->use : (a: any) => any ->x : any - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number -} - -function foo7() { ->foo7 : () => void - - for (let x of []) { ->x : any ->[] : undefined[] - - use(x); ->use(x) : any ->use : (a: any) => any ->x : any - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number -} - -function foo8() { ->foo8 : () => void - - for (let [x] of []) { ->x : any ->[] : undefined[] - - use(x); ->use(x) : any ->use : (a: any) => any ->x : any - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number -} - -function foo9() { ->foo9 : () => void - - for (let {a: x} of []) { ->a : unknown ->x : any ->[] : undefined[] - - use(x); ->use(x) : any ->use : (a: any) => any ->x : any - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number -} - -function foo10() { ->foo10 : () => void - - for (const x of []) { ->x : any ->[] : undefined[] - - use(x); ->use(x) : any ->use : (a: any) => any ->x : any - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number -} - -function foo11() { ->foo11 : () => void - - for (const [x] of []) { ->x : any ->[] : undefined[] - - use(x); ->use(x) : any ->use : (a: any) => any ->x : any - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number -} - -function foo12() { ->foo12 : () => void - - for (const {a: x} of []) { ->a : unknown ->x : any ->[] : undefined[] - - use(x); ->use(x) : any ->use : (a: any) => any ->x : any - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : number -} diff --git a/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt index f3034cd2c27..d8e186b4d57 100644 --- a/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt @@ -1,8 +1,11 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,15): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts (2 errors) ==== for (var i of e) { ~~~ !!! error TS1036: Statements are not allowed in ambient contexts. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement10.errors.txt b/tests/baselines/reference/parserES5ForOfStatement10.errors.txt index 5cee7472d24..e0ea8928be1 100644 --- a/tests/baselines/reference/parserES5ForOfStatement10.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement10.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,17): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts (1 errors) ==== for (const v of X) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement11.errors.txt b/tests/baselines/reference/parserES5ForOfStatement11.errors.txt index 79b16ed1ad6..098d895e6c3 100644 --- a/tests/baselines/reference/parserES5ForOfStatement11.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement11.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,22): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts (1 errors) ==== for (const [a, b] of X) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement12.errors.txt b/tests/baselines/reference/parserES5ForOfStatement12.errors.txt index cdb6db690cf..63916799810 100644 --- a/tests/baselines/reference/parserES5ForOfStatement12.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement12.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,22): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts (1 errors) ==== for (const {a, b} of X) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement13.errors.txt b/tests/baselines/reference/parserES5ForOfStatement13.errors.txt index 9d97fd9e249..e197c0c42ee 100644 --- a/tests/baselines/reference/parserES5ForOfStatement13.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement13.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,20): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts (1 errors) ==== for (let {a, b} of X) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement14.errors.txt b/tests/baselines/reference/parserES5ForOfStatement14.errors.txt index 303439ec447..f48a17cbc43 100644 --- a/tests/baselines/reference/parserES5ForOfStatement14.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement14.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,20): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts (1 errors) ==== for (let [a, b] of X) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement15.errors.txt b/tests/baselines/reference/parserES5ForOfStatement15.errors.txt index f0eab288fa7..dd4d61c420b 100644 --- a/tests/baselines/reference/parserES5ForOfStatement15.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement15.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts(1,20): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts (1 errors) ==== for (var [a, b] of X) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement16.errors.txt b/tests/baselines/reference/parserES5ForOfStatement16.errors.txt index b9248140f33..3879fb64e70 100644 --- a/tests/baselines/reference/parserES5ForOfStatement16.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement16.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts(1,20): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts (1 errors) ==== for (var {a, b} of X) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement3.errors.txt b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt index a976d9c0d54..7388676a703 100644 --- a/tests/baselines/reference/parserES5ForOfStatement3.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt @@ -1,8 +1,11 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,13): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,18): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts (2 errors) ==== for (var a, b of X) { ~ !!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement4.errors.txt b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt index e2b38b56be5..8a0d7abf0d0 100644 --- a/tests/baselines/reference/parserES5ForOfStatement4.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt @@ -1,8 +1,11 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,10): error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,19): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts (2 errors) ==== for (var a = 1 of X) { ~ !!! error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement5.errors.txt b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt index 0e88ce6cf36..43c9161156a 100644 --- a/tests/baselines/reference/parserES5ForOfStatement5.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt @@ -1,8 +1,11 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,10): error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,23): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts (2 errors) ==== for (var a: number of X) { ~ !!! error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement6.errors.txt b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt index da76589190d..8ddf2273ba8 100644 --- a/tests/baselines/reference/parserES5ForOfStatement6.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt @@ -1,8 +1,11 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,17): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,26): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts (2 errors) ==== for (var a = 1, b = 2 of X) { ~ !!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement7.errors.txt b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt index ced399ca103..6bf7f300183 100644 --- a/tests/baselines/reference/parserES5ForOfStatement7.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt @@ -1,8 +1,11 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,25): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,43): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts (2 errors) ==== for (var a: number = 1, b: string = "" of X) { ~ !!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement8.errors.txt b/tests/baselines/reference/parserES5ForOfStatement8.errors.txt index 829fea57e6e..53b263ad6e1 100644 --- a/tests/baselines/reference/parserES5ForOfStatement8.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement8.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts(1,15): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts (1 errors) ==== for (var v of X) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement9.errors.txt b/tests/baselines/reference/parserES5ForOfStatement9.errors.txt index 4cf082b4f15..869cdfdf647 100644 --- a/tests/baselines/reference/parserES5ForOfStatement9.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement9.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts(1,15): error TS2304: Cannot find name 'X'. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts (1 errors) ==== for (let v of X) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. + ~ +!!! error TS2304: Cannot find name 'X'. } \ No newline at end of file From 32aee67c4fa63246d1e9dad61e6d83bc15503142 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 10 Mar 2015 17:36:17 -0700 Subject: [PATCH 034/101] Change a test to be more interesting --- tests/baselines/reference/ES5For-of12.errors.txt | 8 ++++---- tests/baselines/reference/ES5For-of12.js | 8 ++++++-- .../statements/for-ofStatements/ES5For-of12.ts | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/baselines/reference/ES5For-of12.errors.txt b/tests/baselines/reference/ES5For-of12.errors.txt index 55144f549a0..02ed4c335a6 100644 --- a/tests/baselines/reference/ES5For-of12.errors.txt +++ b/tests/baselines/reference/ES5For-of12.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts(1,6): error TS2461: Type 'undefined' is not an array type. +tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts(1,7): error TS2364: Invalid left-hand side of assignment expression. ==== tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts (1 errors) ==== - for ([""] of []) { } - ~~~~ -!!! error TS2461: Type 'undefined' is not an array type. \ No newline at end of file + for ([""] of [[""]]) { } + ~~ +!!! error TS2364: Invalid left-hand side of assignment expression. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of12.js b/tests/baselines/reference/ES5For-of12.js index c3665e8b584..7a5534f4aa1 100644 --- a/tests/baselines/reference/ES5For-of12.js +++ b/tests/baselines/reference/ES5For-of12.js @@ -1,7 +1,11 @@ //// [ES5For-of12.ts] -for ([""] of []) { } +for ([""] of [[""]]) { } //// [ES5For-of12.js] -for (var _i = 0, _a = []; _i < _a.length; _i++) { +for (var _i = 0, _a = [ + [ + "" + ] +]; _i < _a.length; _i++) { "" = _a[_i][0]; } diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts index 5fbfa31df5f..eb3017296aa 100644 --- a/tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-of12.ts @@ -1 +1 @@ -for ([""] of []) { } \ No newline at end of file +for ([""] of [[""]]) { } \ No newline at end of file From 29cbe9d4bae21907ddfa3e38f92fab5f503cd319 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 11 Mar 2015 16:33:19 -0700 Subject: [PATCH 035/101] Remove unhelpful comment --- src/compiler/checker.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 414a8ce17fa..f977cdd1f16 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10961,7 +10961,6 @@ module ts { } function isUnknownIdentifier(location: Node, name: string): boolean { - // Do not call resolveName on a synthesized node! Debug.assert(!nodeIsSynthesized(location), "isUnknownIdentifier called with a synthesized location"); return !resolveName(location, name, SymbolFlags.Value, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined) && !hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); From 03176d33efda5ba6dfe7c57e62926a6324cb81df Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 11 Mar 2015 16:33:38 -0700 Subject: [PATCH 036/101] Add tests for downlevel for-of type checking --- .../reference/ES3For-ofTypeCheck1.errors.txt | 7 ++++ .../reference/ES3For-ofTypeCheck1.js | 7 ++++ .../reference/ES3For-ofTypeCheck2.js | 9 +++++ .../reference/ES3For-ofTypeCheck2.types | 5 +++ .../reference/ES3For-ofTypeCheck4.errors.txt | 8 +++++ .../reference/ES3For-ofTypeCheck4.js | 9 +++++ .../reference/ES3For-ofTypeCheck6.js | 9 +++++ .../reference/ES3For-ofTypeCheck6.types | 8 +++++ .../reference/ES5For-ofTypeCheck1.js | 7 ++++ .../reference/ES5For-ofTypeCheck1.types | 4 +++ .../reference/ES5For-ofTypeCheck10.errors.txt | 23 ++++++++++++ .../reference/ES5For-ofTypeCheck10.js | 35 +++++++++++++++++++ .../reference/ES5For-ofTypeCheck11.errors.txt | 11 ++++++ .../reference/ES5For-ofTypeCheck11.js | 11 ++++++ .../reference/ES5For-ofTypeCheck2.js | 9 +++++ .../reference/ES5For-ofTypeCheck2.types | 5 +++ .../reference/ES5For-ofTypeCheck3.js | 12 +++++++ .../reference/ES5For-ofTypeCheck3.types | 9 +++++ .../reference/ES5For-ofTypeCheck4.js | 9 +++++ .../reference/ES5For-ofTypeCheck4.types | 8 +++++ .../reference/ES5For-ofTypeCheck5.js | 9 +++++ .../reference/ES5For-ofTypeCheck5.types | 8 +++++ .../reference/ES5For-ofTypeCheck6.js | 9 +++++ .../reference/ES5For-ofTypeCheck6.types | 8 +++++ .../reference/ES5For-ofTypeCheck7.errors.txt | 8 +++++ .../reference/ES5For-ofTypeCheck7.js | 9 +++++ .../reference/ES5For-ofTypeCheck8.errors.txt | 11 ++++++ .../reference/ES5For-ofTypeCheck8.js | 11 ++++++ .../reference/ES5For-ofTypeCheck9.errors.txt | 8 +++++ .../reference/ES5For-ofTypeCheck9.js | 9 +++++ .../for-ofStatements/ES3For-ofTypeCheck1.ts | 2 ++ .../for-ofStatements/ES3For-ofTypeCheck2.ts | 2 ++ .../for-ofStatements/ES3For-ofTypeCheck4.ts | 3 ++ .../for-ofStatements/ES3For-ofTypeCheck6.ts | 3 ++ .../for-ofStatements/ES5For-ofTypeCheck1.ts | 2 ++ .../for-ofStatements/ES5For-ofTypeCheck10.ts | 15 ++++++++ .../for-ofStatements/ES5For-ofTypeCheck11.ts | 4 +++ .../for-ofStatements/ES5For-ofTypeCheck2.ts | 2 ++ .../for-ofStatements/ES5For-ofTypeCheck3.ts | 3 ++ .../for-ofStatements/ES5For-ofTypeCheck4.ts | 3 ++ .../for-ofStatements/ES5For-ofTypeCheck5.ts | 3 ++ .../for-ofStatements/ES5For-ofTypeCheck6.ts | 3 ++ .../for-ofStatements/ES5For-ofTypeCheck7.ts | 3 ++ .../for-ofStatements/ES5For-ofTypeCheck8.ts | 4 +++ .../for-ofStatements/ES5For-ofTypeCheck9.ts | 3 ++ 45 files changed, 350 insertions(+) create mode 100644 tests/baselines/reference/ES3For-ofTypeCheck1.errors.txt create mode 100644 tests/baselines/reference/ES3For-ofTypeCheck1.js create mode 100644 tests/baselines/reference/ES3For-ofTypeCheck2.js create mode 100644 tests/baselines/reference/ES3For-ofTypeCheck2.types create mode 100644 tests/baselines/reference/ES3For-ofTypeCheck4.errors.txt create mode 100644 tests/baselines/reference/ES3For-ofTypeCheck4.js create mode 100644 tests/baselines/reference/ES3For-ofTypeCheck6.js create mode 100644 tests/baselines/reference/ES3For-ofTypeCheck6.types create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck1.js create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck1.types create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck10.js create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck11.errors.txt create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck11.js create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck2.js create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck2.types create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck3.js create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck3.types create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck4.js create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck4.types create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck5.js create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck5.types create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck6.js create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck6.types create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck7.errors.txt create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck7.js create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck8.errors.txt create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck8.js create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck9.js create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck1.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck2.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck4.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck6.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck1.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck2.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck3.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck4.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck5.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck6.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck7.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck8.ts create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts diff --git a/tests/baselines/reference/ES3For-ofTypeCheck1.errors.txt b/tests/baselines/reference/ES3For-ofTypeCheck1.errors.txt new file mode 100644 index 00000000000..6437cfbc73d --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck1.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck1.ts(1,15): error TS2494: Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck1.ts (1 errors) ==== + for (var v of "") { } + ~~ +!!! error TS2494: Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/ES3For-ofTypeCheck1.js b/tests/baselines/reference/ES3For-ofTypeCheck1.js new file mode 100644 index 00000000000..19efa96808b --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck1.js @@ -0,0 +1,7 @@ +//// [ES3For-ofTypeCheck1.ts] +for (var v of "") { } + +//// [ES3For-ofTypeCheck1.js] +for (var _i = 0, _a = ""; _i < _a.length; _i++) { + var v = _a[_i]; +} diff --git a/tests/baselines/reference/ES3For-ofTypeCheck2.js b/tests/baselines/reference/ES3For-ofTypeCheck2.js new file mode 100644 index 00000000000..952eade6cfb --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck2.js @@ -0,0 +1,9 @@ +//// [ES3For-ofTypeCheck2.ts] +for (var v of [true]) { } + +//// [ES3For-ofTypeCheck2.js] +for (var _i = 0, _a = [ + true +]; _i < _a.length; _i++) { + var v = _a[_i]; +} diff --git a/tests/baselines/reference/ES3For-ofTypeCheck2.types b/tests/baselines/reference/ES3For-ofTypeCheck2.types new file mode 100644 index 00000000000..f5ca0ab17e8 --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck2.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck2.ts === +for (var v of [true]) { } +>v : boolean +>[true] : boolean[] + diff --git a/tests/baselines/reference/ES3For-ofTypeCheck4.errors.txt b/tests/baselines/reference/ES3For-ofTypeCheck4.errors.txt new file mode 100644 index 00000000000..80e60008da4 --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck4.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck4.ts(2,17): error TS2494: Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher. + + +==== tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck4.ts (1 errors) ==== + var union: string | string[]; + for (const v of union) { } + ~~~~~ +!!! error TS2494: Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/ES3For-ofTypeCheck4.js b/tests/baselines/reference/ES3For-ofTypeCheck4.js new file mode 100644 index 00000000000..7386a1967eb --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck4.js @@ -0,0 +1,9 @@ +//// [ES3For-ofTypeCheck4.ts] +var union: string | string[]; +for (const v of union) { } + +//// [ES3For-ofTypeCheck4.js] +var union; +for (var _i = 0; _i < union.length; _i++) { + var v = union[_i]; +} diff --git a/tests/baselines/reference/ES3For-ofTypeCheck6.js b/tests/baselines/reference/ES3For-ofTypeCheck6.js new file mode 100644 index 00000000000..ddc11808b18 --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck6.js @@ -0,0 +1,9 @@ +//// [ES3For-ofTypeCheck6.ts] +var union: string[] | number[]; +for (var v of union) { } + +//// [ES3For-ofTypeCheck6.js] +var union; +for (var _i = 0; _i < union.length; _i++) { + var v = union[_i]; +} diff --git a/tests/baselines/reference/ES3For-ofTypeCheck6.types b/tests/baselines/reference/ES3For-ofTypeCheck6.types new file mode 100644 index 00000000000..d7e6045b029 --- /dev/null +++ b/tests/baselines/reference/ES3For-ofTypeCheck6.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck6.ts === +var union: string[] | number[]; +>union : string[] | number[] + +for (var v of union) { } +>v : string | number +>union : string[] | number[] + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck1.js b/tests/baselines/reference/ES5For-ofTypeCheck1.js new file mode 100644 index 00000000000..f1522e512b6 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck1.js @@ -0,0 +1,7 @@ +//// [ES5For-ofTypeCheck1.ts] +for (var v of "") { } + +//// [ES5For-ofTypeCheck1.js] +for (var _i = 0, _a = ""; _i < _a.length; _i++) { + var v = _a[_i]; +} diff --git a/tests/baselines/reference/ES5For-ofTypeCheck1.types b/tests/baselines/reference/ES5For-ofTypeCheck1.types new file mode 100644 index 00000000000..4da0ecc0e36 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck1.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck1.ts === +for (var v of "") { } +>v : string + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt new file mode 100644 index 00000000000..8725fa62471 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(1,15): error TS2461: Type 'StringIterator' is not an array type. +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(11,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts (2 errors) ==== + for (var v of new StringIterator) { } + ~~~~~~~~~~~~~~~~~~ +!!! error TS2461: Type 'StringIterator' is not an array type. + + // In ES3/5, you cannot for...of over an arbitrary iterable. + class StringIterator { + next() { + return { + done: true, + value: "" + }; + } + [Symbol.iterator]() { + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + return this; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-ofTypeCheck10.js b/tests/baselines/reference/ES5For-ofTypeCheck10.js new file mode 100644 index 00000000000..ffef1fde8f8 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck10.js @@ -0,0 +1,35 @@ +//// [ES5For-ofTypeCheck10.ts] +for (var v of new StringIterator) { } + +// In ES3/5, you cannot for...of over an arbitrary iterable. +class StringIterator { + next() { + return { + done: true, + value: "" + }; + } + [Symbol.iterator]() { + return this; + } +} + +//// [ES5For-ofTypeCheck10.js] +for (var _i = 0, _a = new StringIterator; _i < _a.length; _i++) { + var v = _a[_i]; +} +// In ES3/5, you cannot for...of over an arbitrary iterable. +var StringIterator = (function () { + function StringIterator() { + } + StringIterator.prototype.next = function () { + return { + done: true, + value: "" + }; + }; + StringIterator.prototype[Symbol.iterator] = function () { + return this; + }; + return StringIterator; +})(); diff --git a/tests/baselines/reference/ES5For-ofTypeCheck11.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck11.errors.txt new file mode 100644 index 00000000000..635bb09616a --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck11.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts(3,6): error TS2322: Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts (1 errors) ==== + var union: string | number[]; + var v: string; + for (v of union) { } + ~ +!!! error TS2322: Type 'string | number' is not assignable to type 'string'. +!!! error TS2322: Type 'number' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-ofTypeCheck11.js b/tests/baselines/reference/ES5For-ofTypeCheck11.js new file mode 100644 index 00000000000..c0e46a45452 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck11.js @@ -0,0 +1,11 @@ +//// [ES5For-ofTypeCheck11.ts] +var union: string | number[]; +var v: string; +for (v of union) { } + +//// [ES5For-ofTypeCheck11.js] +var union; +var v; +for (var _i = 0; _i < union.length; _i++) { + v = union[_i]; +} diff --git a/tests/baselines/reference/ES5For-ofTypeCheck2.js b/tests/baselines/reference/ES5For-ofTypeCheck2.js new file mode 100644 index 00000000000..2c79054affc --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck2.js @@ -0,0 +1,9 @@ +//// [ES5For-ofTypeCheck2.ts] +for (var v of [true]) { } + +//// [ES5For-ofTypeCheck2.js] +for (var _i = 0, _a = [ + true +]; _i < _a.length; _i++) { + var v = _a[_i]; +} diff --git a/tests/baselines/reference/ES5For-ofTypeCheck2.types b/tests/baselines/reference/ES5For-ofTypeCheck2.types new file mode 100644 index 00000000000..e6b86ce1d81 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck2.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck2.ts === +for (var v of [true]) { } +>v : boolean +>[true] : boolean[] + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck3.js b/tests/baselines/reference/ES5For-ofTypeCheck3.js new file mode 100644 index 00000000000..b398f04e0ce --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck3.js @@ -0,0 +1,12 @@ +//// [ES5For-ofTypeCheck3.ts] +var tuple: [string, number] = ["", 0]; +for (var v of tuple) { } + +//// [ES5For-ofTypeCheck3.js] +var tuple = [ + "", + 0 +]; +for (var _i = 0; _i < tuple.length; _i++) { + var v = tuple[_i]; +} diff --git a/tests/baselines/reference/ES5For-ofTypeCheck3.types b/tests/baselines/reference/ES5For-ofTypeCheck3.types new file mode 100644 index 00000000000..5293634c6c5 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck3.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck3.ts === +var tuple: [string, number] = ["", 0]; +>tuple : [string, number] +>["", 0] : [string, number] + +for (var v of tuple) { } +>v : string | number +>tuple : [string, number] + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck4.js b/tests/baselines/reference/ES5For-ofTypeCheck4.js new file mode 100644 index 00000000000..630bc869c58 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck4.js @@ -0,0 +1,9 @@ +//// [ES5For-ofTypeCheck4.ts] +var union: string | string[]; +for (const v of union) { } + +//// [ES5For-ofTypeCheck4.js] +var union; +for (var _i = 0; _i < union.length; _i++) { + var v = union[_i]; +} diff --git a/tests/baselines/reference/ES5For-ofTypeCheck4.types b/tests/baselines/reference/ES5For-ofTypeCheck4.types new file mode 100644 index 00000000000..4f5721a0604 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck4.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck4.ts === +var union: string | string[]; +>union : string | string[] + +for (const v of union) { } +>v : string +>union : string | string[] + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck5.js b/tests/baselines/reference/ES5For-ofTypeCheck5.js new file mode 100644 index 00000000000..2e6b47f779d --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck5.js @@ -0,0 +1,9 @@ +//// [ES5For-ofTypeCheck5.ts] +var union: string | number[]; +for (var v of union) { } + +//// [ES5For-ofTypeCheck5.js] +var union; +for (var _i = 0; _i < union.length; _i++) { + var v = union[_i]; +} diff --git a/tests/baselines/reference/ES5For-ofTypeCheck5.types b/tests/baselines/reference/ES5For-ofTypeCheck5.types new file mode 100644 index 00000000000..ed3d13f3918 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck5.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck5.ts === +var union: string | number[]; +>union : string | number[] + +for (var v of union) { } +>v : string | number +>union : string | number[] + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck6.js b/tests/baselines/reference/ES5For-ofTypeCheck6.js new file mode 100644 index 00000000000..9249020b9d4 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck6.js @@ -0,0 +1,9 @@ +//// [ES5For-ofTypeCheck6.ts] +var union: string[] | number[]; +for (var v of union) { } + +//// [ES5For-ofTypeCheck6.js] +var union; +for (var _i = 0; _i < union.length; _i++) { + var v = union[_i]; +} diff --git a/tests/baselines/reference/ES5For-ofTypeCheck6.types b/tests/baselines/reference/ES5For-ofTypeCheck6.types new file mode 100644 index 00000000000..87999d9b0ca --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck6.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck6.ts === +var union: string[] | number[]; +>union : string[] | number[] + +for (var v of union) { } +>v : string | number +>union : string[] | number[] + diff --git a/tests/baselines/reference/ES5For-ofTypeCheck7.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck7.errors.txt new file mode 100644 index 00000000000..9006b5a2779 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck7.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck7.ts(2,15): error TS2461: Type 'number' is not an array type. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck7.ts (1 errors) ==== + var union: string | number; + for (var v of union) { } + ~~~~~ +!!! error TS2461: Type 'number' is not an array type. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-ofTypeCheck7.js b/tests/baselines/reference/ES5For-ofTypeCheck7.js new file mode 100644 index 00000000000..d5b74a24728 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck7.js @@ -0,0 +1,9 @@ +//// [ES5For-ofTypeCheck7.ts] +var union: string | number; +for (var v of union) { } + +//// [ES5For-ofTypeCheck7.js] +var union; +for (var _i = 0; _i < union.length; _i++) { + var v = union[_i]; +} diff --git a/tests/baselines/reference/ES5For-ofTypeCheck8.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck8.errors.txt new file mode 100644 index 00000000000..0cb52dbb21b --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck8.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck8.ts(3,6): error TS2322: Type 'string | number | symbol' is not assignable to type 'symbol'. + Type 'string' is not assignable to type 'symbol'. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck8.ts (1 errors) ==== + var union: string | string[]| number[]| symbol[]; + var v: symbol; + for (v of union) { } + ~ +!!! error TS2322: Type 'string | number | symbol' is not assignable to type 'symbol'. +!!! error TS2322: Type 'string' is not assignable to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-ofTypeCheck8.js b/tests/baselines/reference/ES5For-ofTypeCheck8.js new file mode 100644 index 00000000000..d73aea1cb7b --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck8.js @@ -0,0 +1,11 @@ +//// [ES5For-ofTypeCheck8.ts] +var union: string | string[]| number[]| symbol[]; +var v: symbol; +for (v of union) { } + +//// [ES5For-ofTypeCheck8.js] +var union; +var v; +for (var _i = 0; _i < union.length; _i++) { + v = union[_i]; +} diff --git a/tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt new file mode 100644 index 00000000000..156eb188803 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck9.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts(2,15): error TS2461: Type 'number | symbol | string[]' is not an array type. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts (1 errors) ==== + var union: string | string[] | number | symbol; + for (let v of union) { } + ~~~~~ +!!! error TS2461: Type 'number | symbol | string[]' is not an array type. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-ofTypeCheck9.js b/tests/baselines/reference/ES5For-ofTypeCheck9.js new file mode 100644 index 00000000000..6c7465d10ec --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck9.js @@ -0,0 +1,9 @@ +//// [ES5For-ofTypeCheck9.ts] +var union: string | string[] | number | symbol; +for (let v of union) { } + +//// [ES5For-ofTypeCheck9.js] +var union; +for (var _i = 0; _i < union.length; _i++) { + var v = union[_i]; +} diff --git a/tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck1.ts b/tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck1.ts new file mode 100644 index 00000000000..ec930d826f9 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck1.ts @@ -0,0 +1,2 @@ +//@target: ES3 +for (var v of "") { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck2.ts b/tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck2.ts new file mode 100644 index 00000000000..d382ef20e4c --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck2.ts @@ -0,0 +1,2 @@ +//@target: ES3 +for (var v of [true]) { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck4.ts b/tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck4.ts new file mode 100644 index 00000000000..b5547b936ae --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck4.ts @@ -0,0 +1,3 @@ +//@target: ES3 +var union: string | string[]; +for (const v of union) { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck6.ts b/tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck6.ts new file mode 100644 index 00000000000..6167d78d179 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck6.ts @@ -0,0 +1,3 @@ +//@target: ES3 +var union: string[] | number[]; +for (var v of union) { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck1.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck1.ts new file mode 100644 index 00000000000..3b27caf3fe9 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck1.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var v of "") { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts new file mode 100644 index 00000000000..185641d0804 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts @@ -0,0 +1,15 @@ +//@target: ES5 +for (var v of new StringIterator) { } + +// In ES3/5, you cannot for...of over an arbitrary iterable. +class StringIterator { + next() { + return { + done: true, + value: "" + }; + } + [Symbol.iterator]() { + return this; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts new file mode 100644 index 00000000000..a39371a4843 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck11.ts @@ -0,0 +1,4 @@ +//@target: ES5 +var union: string | number[]; +var v: string; +for (v of union) { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck2.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck2.ts new file mode 100644 index 00000000000..2e22731a78a --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck2.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var v of [true]) { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck3.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck3.ts new file mode 100644 index 00000000000..cc7f09df670 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck3.ts @@ -0,0 +1,3 @@ +//@target: ES5 +var tuple: [string, number] = ["", 0]; +for (var v of tuple) { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck4.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck4.ts new file mode 100644 index 00000000000..dc8388c0576 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck4.ts @@ -0,0 +1,3 @@ +//@target: ES5 +var union: string | string[]; +for (const v of union) { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck5.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck5.ts new file mode 100644 index 00000000000..f0218bd57f9 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck5.ts @@ -0,0 +1,3 @@ +//@target: ES5 +var union: string | number[]; +for (var v of union) { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck6.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck6.ts new file mode 100644 index 00000000000..46cc82af983 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck6.ts @@ -0,0 +1,3 @@ +//@target: ES5 +var union: string[] | number[]; +for (var v of union) { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck7.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck7.ts new file mode 100644 index 00000000000..4f7dd1c6d3f --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck7.ts @@ -0,0 +1,3 @@ +//@target: ES5 +var union: string | number; +for (var v of union) { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck8.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck8.ts new file mode 100644 index 00000000000..2c9f3b63d1d --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck8.ts @@ -0,0 +1,4 @@ +//@target: ES5 +var union: string | string[]| number[]| symbol[]; +var v: symbol; +for (v of union) { } \ No newline at end of file diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts new file mode 100644 index 00000000000..3c68f329f0e --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck9.ts @@ -0,0 +1,3 @@ +//@target: ES5 +var union: string | string[] | number | symbol; +for (let v of union) { } \ No newline at end of file From 751b1aee16135d74d9e33eb24c62a505a8de314d Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Wed, 11 Mar 2015 16:54:18 -0700 Subject: [PATCH 037/101] disallow recursive references for block-scoped bindings --- src/compiler/checker.ts | 44 ++++++++++++++++++- src/compiler/emitter.ts | 28 ------------ src/compiler/utilities.ts | 27 ++++++++++++ tests/baselines/reference/for-of55.errors.txt | 10 +++++ tests/baselines/reference/for-of55.types | 12 ----- .../reference/recursiveLetConst.errors.txt | 40 +++++++++++++++++ .../baselines/reference/recursiveLetConst.js | 28 ++++++++++++ tests/cases/compiler/recursiveLetConst.ts | 11 +++++ 8 files changed, 159 insertions(+), 41 deletions(-) create mode 100644 tests/baselines/reference/for-of55.errors.txt delete mode 100644 tests/baselines/reference/for-of55.types create mode 100644 tests/baselines/reference/recursiveLetConst.errors.txt create mode 100644 tests/baselines/reference/recursiveLetConst.js create mode 100644 tests/cases/compiler/recursiveLetConst.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index afcf12fed1b..47f4a44db92 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -439,7 +439,33 @@ module ts { var declaration = forEach(result.declarations, d => isBlockOrCatchScoped(d) ? d : undefined); Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!isDefinedBefore(declaration, errorLocation)) { + + // first check if usage is lexically located after the declaration + var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); + if (!isUsedBeforeDeclaration) { + // lexical check succedded however code still can be illegal. + // - block scoped variables cannot be used in its initializers + // let x = x; // illegal but usage is lexically after definition + // - in ForIn/ForOf statements variable cannot be contained in expression part + // for (let x in x) + // for (let x of x) + + // climb up to the variable declaration skipping binding patterns + var variableDeclaration = getAncestor(declaration, SyntaxKind.VariableDeclaration); + var container = getEnclosingBlockScopeContainer(variableDeclaration); + + if (variableDeclaration.parent.parent.kind === SyntaxKind.VariableStatement || + variableDeclaration.parent.parent.kind === SyntaxKind.ForStatement) { + // variable statement/for statement case, use site should not be inside initializer + isUsedBeforeDeclaration = isChildNode(errorLocation, variableDeclaration.initializer, container); + } + else if (variableDeclaration.parent.parent.kind === SyntaxKind.ForOfStatement || + variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement) { + // ForIn/ForOf case - use site should not be used in expression part + isUsedBeforeDeclaration = isChildNode(errorLocation, (variableDeclaration.parent.parent).expression, container); + } + } + if (isUsedBeforeDeclaration) { error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationNameToString(declaration.name)); } } @@ -447,6 +473,22 @@ module ts { return result; } + /* Starting from 'initial' node walk up the parent chain until 'stopAt' node is reached. + * If at any point current node is equal to 'parent' node - return true. + * Return false if 'stopAt' node is reached. + */ + function isChildNode(initial: Node, parent: Node, stopAt: Node): boolean { + if (!parent) { + return false; + } + for (var current = initial; current && current !== stopAt; current = current.parent) { + if (current === parent) { + return true; + } + } + return false; + } + // An alias symbol is created by one of the following declarations: // import = ... // import from ... diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 4b038ab1c4c..3e7d64eedc9 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -4116,34 +4116,6 @@ module ts { } } - function getEnclosingBlockScopeContainer(node: Node): Node { - var current = node; - while (current) { - if (isFunctionLike(current)) { - return current; - } - switch (current.kind) { - case SyntaxKind.SourceFile: - case SyntaxKind.CaseBlock: - case SyntaxKind.CatchClause: - case SyntaxKind.ModuleDeclaration: - case SyntaxKind.ForStatement: - case SyntaxKind.ForInStatement: - case SyntaxKind.ForOfStatement: - return current; - case SyntaxKind.Block: - // function block is not considered block-scope container - // see comment in binder.ts: bind(...), case for SyntaxKind.Block - if (!isFunctionLike(current.parent)) { - return current; - } - } - - current = current.parent; - } - } - - function getCombinedFlagsForIdentifier(node: Identifier): NodeFlags { if (!node.parent || (node.parent.kind !== SyntaxKind.VariableDeclaration && node.parent.kind !== SyntaxKind.BindingElement)) { return 0; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 02ec5eb76ad..b0e2540bdf0 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -203,6 +203,33 @@ module ts { isCatchClauseVariableDeclaration(declaration); } + export function getEnclosingBlockScopeContainer(node: Node): Node { + var current = node; + while (current) { + if (isFunctionLike(current)) { + return current; + } + switch (current.kind) { + case SyntaxKind.SourceFile: + case SyntaxKind.CaseBlock: + case SyntaxKind.CatchClause: + case SyntaxKind.ModuleDeclaration: + case SyntaxKind.ForStatement: + case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: + return current; + case SyntaxKind.Block: + // function block is not considered block-scope container + // see comment in binder.ts: bind(...), case for SyntaxKind.Block + if (!isFunctionLike(current.parent)) { + return current; + } + } + + current = current.parent; + } + } + export function isCatchClauseVariableDeclaration(declaration: Declaration) { return declaration && declaration.kind === SyntaxKind.VariableDeclaration && diff --git a/tests/baselines/reference/for-of55.errors.txt b/tests/baselines/reference/for-of55.errors.txt new file mode 100644 index 00000000000..aa1285afbd6 --- /dev/null +++ b/tests/baselines/reference/for-of55.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/es6/for-ofStatements/for-of55.ts(2,15): error TS2448: Block-scoped variable 'v' used before its declaration. + + +==== tests/cases/conformance/es6/for-ofStatements/for-of55.ts (1 errors) ==== + let v = [1]; + for (let v of v) { + ~ +!!! error TS2448: Block-scoped variable 'v' used before its declaration. + v; + } \ No newline at end of file diff --git a/tests/baselines/reference/for-of55.types b/tests/baselines/reference/for-of55.types deleted file mode 100644 index b0f5aab3fee..00000000000 --- a/tests/baselines/reference/for-of55.types +++ /dev/null @@ -1,12 +0,0 @@ -=== tests/cases/conformance/es6/for-ofStatements/for-of55.ts === -let v = [1]; ->v : number[] ->[1] : number[] - -for (let v of v) { ->v : any ->v : any - - v; ->v : any -} diff --git a/tests/baselines/reference/recursiveLetConst.errors.txt b/tests/baselines/reference/recursiveLetConst.errors.txt new file mode 100644 index 00000000000..99a904fe761 --- /dev/null +++ b/tests/baselines/reference/recursiveLetConst.errors.txt @@ -0,0 +1,40 @@ +tests/cases/compiler/recursiveLetConst.ts(2,9): error TS2448: Block-scoped variable 'x' used before its declaration. +tests/cases/compiler/recursiveLetConst.ts(3,12): error TS2448: Block-scoped variable 'x1' used before its declaration. +tests/cases/compiler/recursiveLetConst.ts(4,11): error TS2448: Block-scoped variable 'y' used before its declaration. +tests/cases/compiler/recursiveLetConst.ts(5,14): error TS2448: Block-scoped variable 'y1' used before its declaration. +tests/cases/compiler/recursiveLetConst.ts(6,14): error TS2448: Block-scoped variable 'v' used before its declaration. +tests/cases/compiler/recursiveLetConst.ts(7,16): error TS2448: Block-scoped variable 'v' used before its declaration. +tests/cases/compiler/recursiveLetConst.ts(8,15): error TS2448: Block-scoped variable 'v' used before its declaration. +tests/cases/compiler/recursiveLetConst.ts(9,15): error TS2448: Block-scoped variable 'v' used before its declaration. +tests/cases/compiler/recursiveLetConst.ts(10,17): error TS2448: Block-scoped variable 'v' used before its declaration. + + +==== tests/cases/compiler/recursiveLetConst.ts (9 errors) ==== + 'use strict' + let x = x + 1; + ~ +!!! error TS2448: Block-scoped variable 'x' used before its declaration. + let [x1] = x1 + 1; + ~~ +!!! error TS2448: Block-scoped variable 'x1' used before its declaration. + const y = y + 2; + ~ +!!! error TS2448: Block-scoped variable 'y' used before its declaration. + const [y1] = y1 + 1; + ~~ +!!! error TS2448: Block-scoped variable 'y1' used before its declaration. + for (let v = v; ; ) { } + ~ +!!! error TS2448: Block-scoped variable 'v' used before its declaration. + for (let [v] = v; ;) { } + ~ +!!! error TS2448: Block-scoped variable 'v' used before its declaration. + for (let v in v) { } + ~ +!!! error TS2448: Block-scoped variable 'v' used before its declaration. + for (let v of v) { } + ~ +!!! error TS2448: Block-scoped variable 'v' used before its declaration. + for (let [v] of v) { } + ~ +!!! error TS2448: Block-scoped variable 'v' used before its declaration. \ No newline at end of file diff --git a/tests/baselines/reference/recursiveLetConst.js b/tests/baselines/reference/recursiveLetConst.js new file mode 100644 index 00000000000..f34d85d86a9 --- /dev/null +++ b/tests/baselines/reference/recursiveLetConst.js @@ -0,0 +1,28 @@ +//// [recursiveLetConst.ts] +'use strict' +let x = x + 1; +let [x1] = x1 + 1; +const y = y + 2; +const [y1] = y1 + 1; +for (let v = v; ; ) { } +for (let [v] = v; ;) { } +for (let v in v) { } +for (let v of v) { } +for (let [v] of v) { } + +//// [recursiveLetConst.js] +'use strict'; +let x = x + 1; +let [x1] = x1 + 1; +const y = y + 2; +const [y1] = y1 + 1; +for (let v = v;;) { +} +for (let [v] = v;;) { +} +for (let v in v) { +} +for (let v of v) { +} +for (let [v] of v) { +} diff --git a/tests/cases/compiler/recursiveLetConst.ts b/tests/cases/compiler/recursiveLetConst.ts new file mode 100644 index 00000000000..c80aa6ef638 --- /dev/null +++ b/tests/cases/compiler/recursiveLetConst.ts @@ -0,0 +1,11 @@ +// @target:es6 +'use strict' +let x = x + 1; +let [x1] = x1 + 1; +const y = y + 2; +const [y1] = y1 + 1; +for (let v = v; ; ) { } +for (let [v] = v; ;) { } +for (let v in v) { } +for (let v of v) { } +for (let [v] of v) { } \ No newline at end of file From 7d2d55e44e539277a9be11b832abb7cf7abdf22b Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 11 Mar 2015 18:53:04 -0700 Subject: [PATCH 038/101] Rebaseline tests that will be affected by #2308 --- .../reference/ES5For-of17.errors.txt | 13 ----------- tests/baselines/reference/ES5For-of17.types | 22 +++++++++++++++++++ .../parserES5ForOfStatement18.errors.txt | 7 ------ .../reference/parserES5ForOfStatement18.types | 5 +++++ 4 files changed, 27 insertions(+), 20 deletions(-) delete mode 100644 tests/baselines/reference/ES5For-of17.errors.txt create mode 100644 tests/baselines/reference/ES5For-of17.types delete mode 100644 tests/baselines/reference/parserES5ForOfStatement18.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement18.types diff --git a/tests/baselines/reference/ES5For-of17.errors.txt b/tests/baselines/reference/ES5For-of17.errors.txt deleted file mode 100644 index 05c89874fcf..00000000000 --- a/tests/baselines/reference/ES5For-of17.errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts (1 errors) ==== - for (let v of []) { - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - v; - for (let v of [v]) { - var x = v; - v++; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of17.types b/tests/baselines/reference/ES5For-of17.types new file mode 100644 index 00000000000..4dafdc0599d --- /dev/null +++ b/tests/baselines/reference/ES5For-of17.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts === +for (let v of []) { +>v : any +>[] : undefined[] + + v; +>v : any + + for (let v of [v]) { +>v : any +>[v] : any[] +>v : any + + var x = v; +>x : any +>v : any + + v++; +>v++ : number +>v : any + } +} diff --git a/tests/baselines/reference/parserES5ForOfStatement18.errors.txt b/tests/baselines/reference/parserES5ForOfStatement18.errors.txt deleted file mode 100644 index e123be9c4f7..00000000000 --- a/tests/baselines/reference/parserES5ForOfStatement18.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts(1,1): error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. - - -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts (1 errors) ==== - for (var of of of) { } - ~~~ -!!! error TS2482: 'for...of' statements are only available when targeting ECMAScript 6 or higher. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement18.types b/tests/baselines/reference/parserES5ForOfStatement18.types new file mode 100644 index 00000000000..f9544e39a31 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement18.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts === +for (var of of of) { } +>of : any +>of : any + From d3246a340ab2649a64fdbe292dad1f921e2f50fa Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Wed, 11 Mar 2015 23:49:35 -0700 Subject: [PATCH 039/101] addressed PR feedback --- src/compiler/checker.ts | 79 ++++++++++--------- .../reference/recursiveLetConst.errors.txt | 11 ++- .../baselines/reference/recursiveLetConst.js | 16 +++- tests/cases/compiler/recursiveLetConst.ts | 6 +- 4 files changed, 72 insertions(+), 40 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 47f4a44db92..2541be0d79e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -435,53 +435,60 @@ module ts { return undefined; } if (result.flags & SymbolFlags.BlockScopedVariable) { - // Block-scoped variables cannot be used before their definition - var declaration = forEach(result.declarations, d => isBlockOrCatchScoped(d) ? d : undefined); - - Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - - // first check if usage is lexically located after the declaration - var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); - if (!isUsedBeforeDeclaration) { - // lexical check succedded however code still can be illegal. - // - block scoped variables cannot be used in its initializers - // let x = x; // illegal but usage is lexically after definition - // - in ForIn/ForOf statements variable cannot be contained in expression part - // for (let x in x) - // for (let x of x) - - // climb up to the variable declaration skipping binding patterns - var variableDeclaration = getAncestor(declaration, SyntaxKind.VariableDeclaration); - var container = getEnclosingBlockScopeContainer(variableDeclaration); - - if (variableDeclaration.parent.parent.kind === SyntaxKind.VariableStatement || - variableDeclaration.parent.parent.kind === SyntaxKind.ForStatement) { - // variable statement/for statement case, use site should not be inside initializer - isUsedBeforeDeclaration = isChildNode(errorLocation, variableDeclaration.initializer, container); - } - else if (variableDeclaration.parent.parent.kind === SyntaxKind.ForOfStatement || - variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement) { - // ForIn/ForOf case - use site should not be used in expression part - isUsedBeforeDeclaration = isChildNode(errorLocation, (variableDeclaration.parent.parent).expression, container); - } - } - if (isUsedBeforeDeclaration) { - error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationNameToString(declaration.name)); - } + checkResolvedBlockScopedVariable(result, errorLocation); } } return result; } + function checkResolvedBlockScopedVariable(result: Symbol, errorLocation: Node): void { + Debug.assert((result.flags & SymbolFlags.BlockScopedVariable) !== 0) + // Block-scoped variables cannot be used before their definition + var declaration = forEach(result.declarations, d => isBlockOrCatchScoped(d) ? d : undefined); + + Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); + + // first check if usage is lexically located after the declaration + var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); + if (!isUsedBeforeDeclaration) { + // lexical check succeeded however code still can be illegal. + // - block scoped variables cannot be used in its initializers + // let x = x; // illegal but usage is lexically after definition + // - in ForIn/ForOf statements variable cannot be contained in expression part + // for (let x in x) + // for (let x of x) + + // climb up to the variable declaration skipping binding patterns + var variableDeclaration = getAncestor(declaration, SyntaxKind.VariableDeclaration); + var container = getEnclosingBlockScopeContainer(variableDeclaration); + + if (variableDeclaration.parent.parent.kind === SyntaxKind.VariableStatement || + variableDeclaration.parent.parent.kind === SyntaxKind.ForStatement) { + // variable statement/for statement case, + // use site should not be inside variable declaration (initializer of declaration or binding element) + isUsedBeforeDeclaration = isDescendentOf(errorLocation, variableDeclaration, container); + } + else if (variableDeclaration.parent.parent.kind === SyntaxKind.ForOfStatement || + variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement) { + // ForIn/ForOf case - use site should not be used in expression part + var expression = (variableDeclaration.parent.parent).expression; + isUsedBeforeDeclaration = isDescendentOf(errorLocation, expression, container); + } + } + if (isUsedBeforeDeclaration) { + error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationNameToString(declaration.name)); + } + } + /* Starting from 'initial' node walk up the parent chain until 'stopAt' node is reached. * If at any point current node is equal to 'parent' node - return true. - * Return false if 'stopAt' node is reached. + * Return false if 'stopAt' node is reached or isFunctionLike(current) === true. */ - function isChildNode(initial: Node, parent: Node, stopAt: Node): boolean { + function isDescendentOf(initial: Node, parent: Node, stopAt: Node): boolean { if (!parent) { return false; } - for (var current = initial; current && current !== stopAt; current = current.parent) { + for (var current = initial; current && current !== stopAt && !isFunctionLike(current); current = current.parent) { if (current === parent) { return true; } diff --git a/tests/baselines/reference/recursiveLetConst.errors.txt b/tests/baselines/reference/recursiveLetConst.errors.txt index 99a904fe761..b02d0819a3f 100644 --- a/tests/baselines/reference/recursiveLetConst.errors.txt +++ b/tests/baselines/reference/recursiveLetConst.errors.txt @@ -7,9 +7,10 @@ tests/cases/compiler/recursiveLetConst.ts(7,16): error TS2448: Block-scoped vari tests/cases/compiler/recursiveLetConst.ts(8,15): error TS2448: Block-scoped variable 'v' used before its declaration. tests/cases/compiler/recursiveLetConst.ts(9,15): error TS2448: Block-scoped variable 'v' used before its declaration. tests/cases/compiler/recursiveLetConst.ts(10,17): error TS2448: Block-scoped variable 'v' used before its declaration. +tests/cases/compiler/recursiveLetConst.ts(11,11): error TS2448: Block-scoped variable 'x2' used before its declaration. -==== tests/cases/compiler/recursiveLetConst.ts (9 errors) ==== +==== tests/cases/compiler/recursiveLetConst.ts (10 errors) ==== 'use strict' let x = x + 1; ~ @@ -37,4 +38,10 @@ tests/cases/compiler/recursiveLetConst.ts(10,17): error TS2448: Block-scoped var !!! error TS2448: Block-scoped variable 'v' used before its declaration. for (let [v] of v) { } ~ -!!! error TS2448: Block-scoped variable 'v' used before its declaration. \ No newline at end of file +!!! error TS2448: Block-scoped variable 'v' used before its declaration. + let [x2 = x2] = [] + ~~ +!!! error TS2448: Block-scoped variable 'x2' used before its declaration. + let z0 = () => z0; + let z1 = function () { return z1; } + let z2 = { f() { return z2;}} \ No newline at end of file diff --git a/tests/baselines/reference/recursiveLetConst.js b/tests/baselines/reference/recursiveLetConst.js index f34d85d86a9..7d9aea3a754 100644 --- a/tests/baselines/reference/recursiveLetConst.js +++ b/tests/baselines/reference/recursiveLetConst.js @@ -8,7 +8,11 @@ for (let v = v; ; ) { } for (let [v] = v; ;) { } for (let v in v) { } for (let v of v) { } -for (let [v] of v) { } +for (let [v] of v) { } +let [x2 = x2] = [] +let z0 = () => z0; +let z1 = function () { return z1; } +let z2 = { f() { return z2;}} //// [recursiveLetConst.js] 'use strict'; @@ -26,3 +30,13 @@ for (let v of v) { } for (let [v] of v) { } +let [x2 = x2] = []; +let z0 = () => z0; +let z1 = function () { + return z1; +}; +let z2 = { + f() { + return z2; + } +}; diff --git a/tests/cases/compiler/recursiveLetConst.ts b/tests/cases/compiler/recursiveLetConst.ts index c80aa6ef638..9e00ae22e94 100644 --- a/tests/cases/compiler/recursiveLetConst.ts +++ b/tests/cases/compiler/recursiveLetConst.ts @@ -8,4 +8,8 @@ for (let v = v; ; ) { } for (let [v] = v; ;) { } for (let v in v) { } for (let v of v) { } -for (let [v] of v) { } \ No newline at end of file +for (let [v] of v) { } +let [x2 = x2] = [] +let z0 = () => z0; +let z1 = function () { return z1; } +let z2 = { f() { return z2;}} \ No newline at end of file From 36ac0c8f59c8488b017af132de2c71cbd911dd79 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 12 Mar 2015 10:16:28 -0700 Subject: [PATCH 040/101] Add additional asserts to ensure we don't create diagnostics with bogus positions. --- src/compiler/core.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 1fb73c90698..463473497cb 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -269,8 +269,12 @@ module ts { export function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic; export function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage): Diagnostic { + var end = start + length; + Debug.assert(start >= 0, "start must be non-negative, is " + start); Debug.assert(length >= 0, "length must be non-negative, is " + length); + Debug.assert(start <= file.text.length, `start must be within the bounds of the file. ${ start } > ${ file.text.length }`); + Debug.assert(end <= file.text.length, `end must be the bounds of the file. ${ end } > ${ file.text.length }`); var text = getLocaleSpecificMessage(message.key); From 171a5f8098831990e8829f5ced2b3cc8827cbea0 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 12 Mar 2015 10:58:16 -0700 Subject: [PATCH 041/101] correctly parse destructuring in let outside of strict mode --- src/compiler/parser.ts | 9 +++++++-- tests/baselines/reference/letInNonStrictMode.js | 11 +++++++++++ tests/baselines/reference/letInNonStrictMode.types | 11 +++++++++++ tests/cases/compiler/letInNonStrictMode.ts | 2 ++ 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 tests/baselines/reference/letInNonStrictMode.js create mode 100644 tests/baselines/reference/letInNonStrictMode.types create mode 100644 tests/cases/compiler/letInNonStrictMode.ts diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 6e444eb23c7..7656e2eb2c9 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2975,6 +2975,11 @@ module ts { return !scanner.hasPrecedingLineBreak() && isIdentifier() } + function netTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() { + nextToken(); + return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === SyntaxKind.OpenBraceToken || token === SyntaxKind.OpenBracketToken) + } + function parseYieldExpression(): YieldExpression { var node = createNode(SyntaxKind.YieldExpression); @@ -4873,9 +4878,9 @@ module ts { } function isLetDeclaration() { - // It is let declaration if in strict mode or next token is identifier on same line. + // It is let declaration if in strict mode or next token is identifier\open brace\open curly on same line. // otherwise it needs to be treated like identifier - return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOnSameLine); + return inStrictModeContext() || lookAhead(netTokenIsIdentifierOrStartOfDestructuringOnTheSameLine); } function isDeclarationStart(): boolean { diff --git a/tests/baselines/reference/letInNonStrictMode.js b/tests/baselines/reference/letInNonStrictMode.js new file mode 100644 index 00000000000..af21ce3281c --- /dev/null +++ b/tests/baselines/reference/letInNonStrictMode.js @@ -0,0 +1,11 @@ +//// [letInNonStrictMode.ts] +let [x] = [1]; +let {a: y} = {a: 1}; + +//// [letInNonStrictMode.js] +var x = ([ + 1 +])[0]; +var y = ({ + a: 1 +}).a; diff --git a/tests/baselines/reference/letInNonStrictMode.types b/tests/baselines/reference/letInNonStrictMode.types new file mode 100644 index 00000000000..4f2cbe4a703 --- /dev/null +++ b/tests/baselines/reference/letInNonStrictMode.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/letInNonStrictMode.ts === +let [x] = [1]; +>x : number +>[1] : [number] + +let {a: y} = {a: 1}; +>a : unknown +>y : number +>{a: 1} : { a: number; } +>a : number + diff --git a/tests/cases/compiler/letInNonStrictMode.ts b/tests/cases/compiler/letInNonStrictMode.ts new file mode 100644 index 00000000000..576246e76a1 --- /dev/null +++ b/tests/cases/compiler/letInNonStrictMode.ts @@ -0,0 +1,2 @@ +let [x] = [1]; +let {a: y} = {a: 1}; \ No newline at end of file From 1ce105ae4ba282e71bb3069746ca6d0088da4e25 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 12 Mar 2015 13:03:40 -0700 Subject: [PATCH 042/101] addressed PR feedback --- src/compiler/checker.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2541be0d79e..be623d3b188 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -466,13 +466,13 @@ module ts { variableDeclaration.parent.parent.kind === SyntaxKind.ForStatement) { // variable statement/for statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) - isUsedBeforeDeclaration = isDescendentOf(errorLocation, variableDeclaration, container); + isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } else if (variableDeclaration.parent.parent.kind === SyntaxKind.ForOfStatement || variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement) { // ForIn/ForOf case - use site should not be used in expression part - var expression = (variableDeclaration.parent.parent).expression; - isUsedBeforeDeclaration = isDescendentOf(errorLocation, expression, container); + var expression = (variableDeclaration.parent.parent).expression; + isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } } if (isUsedBeforeDeclaration) { @@ -484,7 +484,7 @@ module ts { * If at any point current node is equal to 'parent' node - return true. * Return false if 'stopAt' node is reached or isFunctionLike(current) === true. */ - function isDescendentOf(initial: Node, parent: Node, stopAt: Node): boolean { + function isSameScopeDescendentOf(initial: Node, parent: Node, stopAt: Node): boolean { if (!parent) { return false; } From 22f80b9582d9c0bf729fed0e936e7a2242633898 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 12 Mar 2015 13:37:08 -0700 Subject: [PATCH 043/101] Adjust baselines after merge --- .../reference/ES5For-of17.errors.txt | 13 +++++++++++ tests/baselines/reference/ES5For-of17.types | 22 ------------------- .../reference/ES5For-of20.errors.txt | 5 ++++- 3 files changed, 17 insertions(+), 23 deletions(-) create mode 100644 tests/baselines/reference/ES5For-of17.errors.txt delete mode 100644 tests/baselines/reference/ES5For-of17.types diff --git a/tests/baselines/reference/ES5For-of17.errors.txt b/tests/baselines/reference/ES5For-of17.errors.txt new file mode 100644 index 00000000000..3b9ab93a565 --- /dev/null +++ b/tests/baselines/reference/ES5For-of17.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts(3,20): error TS2448: Block-scoped variable 'v' used before its declaration. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts (1 errors) ==== + for (let v of []) { + v; + for (let v of [v]) { + ~ +!!! error TS2448: Block-scoped variable 'v' used before its declaration. + var x = v; + v++; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of17.types b/tests/baselines/reference/ES5For-of17.types deleted file mode 100644 index 4dafdc0599d..00000000000 --- a/tests/baselines/reference/ES5For-of17.types +++ /dev/null @@ -1,22 +0,0 @@ -=== tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts === -for (let v of []) { ->v : any ->[] : undefined[] - - v; ->v : any - - for (let v of [v]) { ->v : any ->[v] : any[] ->v : any - - var x = v; ->x : any ->v : any - - v++; ->v++ : number ->v : any - } -} diff --git a/tests/baselines/reference/ES5For-of20.errors.txt b/tests/baselines/reference/ES5For-of20.errors.txt index 81509910996..772d5143a04 100644 --- a/tests/baselines/reference/ES5For-of20.errors.txt +++ b/tests/baselines/reference/ES5For-of20.errors.txt @@ -1,10 +1,13 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts(3,20): error TS2448: Block-scoped variable 'v' used before its declaration. tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts(4,15): error TS1155: 'const' declarations must be initialized -==== tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts (1 errors) ==== +==== tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts (2 errors) ==== for (let v of []) { let v; for (let v of [v]) { + ~ +!!! error TS2448: Block-scoped variable 'v' used before its declaration. const v; ~ !!! error TS1155: 'const' declarations must be initialized From 6691408147bb6e773fed3ef116c3fd30ee6c64e4 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 12 Mar 2015 14:56:58 -0700 Subject: [PATCH 044/101] Address PR feedback --- src/compiler/checker.ts | 67 ++++++++++++++----- .../diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 ++ .../reference/ES5For-ofTypeCheck10.errors.txt | 4 +- .../reference/ES5For-ofTypeCheck12.errors.txt | 7 ++ .../reference/ES5For-ofTypeCheck12.js | 7 ++ .../for-ofStatements/ES5For-ofTypeCheck12.ts | 2 + 7 files changed, 73 insertions(+), 19 deletions(-) create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck12.errors.txt create mode 100644 tests/baselines/reference/ES5For-ofTypeCheck12.js create mode 100644 tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck12.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 75c85844286..1500a47f197 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4763,17 +4763,22 @@ module ts { // For a union type, remove all constituent types that are of the given type kind (when isOfTypeKind is true) // or not of the given type kind (when isOfTypeKind is false) - function removeTypesFromUnionType(type: Type, typeKind: TypeFlags, isOfTypeKind: boolean): Type { + function removeTypesFromUnionType(type: Type, typeKind: TypeFlags, isOfTypeKind: boolean, allowEmptyUnionResult: boolean): Type { if (type.flags & TypeFlags.Union) { var types = (type).types; if (forEach(types, t => !!(t.flags & typeKind) === isOfTypeKind)) { // Above we checked if we have anything to remove, now use the opposite test to do the removal var narrowedType = getUnionType(filter(types, t => !(t.flags & typeKind) === isOfTypeKind)); - if (narrowedType !== emptyObjectType) { + if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { return narrowedType; } } } + else if (allowEmptyUnionResult && !!(type.flags & typeKind) === isOfTypeKind) { + // Use getUnionType(emptyArray) instead of emptyObjectType in case the way empty union types + // are represented ever changes. + return getUnionType(emptyArray); + } return type; } @@ -4976,7 +4981,8 @@ module ts { if (assumeTrue) { // Assumed result is true. If check was not for a primitive type, remove all primitive types if (!typeInfo) { - return removeTypesFromUnionType(type, /*typeKind*/ TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.Boolean | TypeFlags.ESSymbol, /*isOfTypeKind*/ true); + return removeTypesFromUnionType(type, /*typeKind*/ TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.Boolean | TypeFlags.ESSymbol, + /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ false); } // Check was for a primitive type, return that primitive type if it is a subtype if (isTypeSubtypeOf(typeInfo.type, type)) { @@ -4984,12 +4990,12 @@ module ts { } // Otherwise, remove all types that aren't of the primitive type kind. This can happen when the type is // union of enum types and other types. - return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ false); + return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ false, /*allowEmptyUnionResult*/ false); } else { // Assumed result is false. If check was for a primitive type, remove that primitive type if (typeInfo) { - return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ true); + return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ false); } // Otherwise we don't have enough information to do anything. return type; @@ -9027,28 +9033,55 @@ module ts { } } + /** + * This function does the following steps: + * 1. Break up arrayOrStringType (possibly a union) into its string constituents and array constituents. + * 2. Take the element types of the array constituents. + * 3. Return the union of the element types, and string if there was a string constitutent. + * + * For example: + * string -> string + * number[] -> number + * string[] | number[] -> string | number + * string | number[] -> string | number + * string | string[] | number[] -> string | number + * + * It also errors if: + * 1. Some constituent is neither a string nor an array. + * 2. Some constituent is a string and target is less than ES5 (because in ES3 string is not indexable). + */ function checkElementTypeOfArrayOrString(arrayOrStringType: Type, expressionForError: Expression): Type { Debug.assert(languageVersion < ScriptTarget.ES6); - var isJustString = allConstituentTypesHaveKind(arrayOrStringType, TypeFlags.StringLike); - // Check isJustString because removeTypesFromUnionType will only remove types if it doesn't result - // in an emptyObjectType. In this case, we actually do want the emptyObjectType. - var arrayType = isJustString ? emptyObjectType : removeTypesFromUnionType(arrayOrStringType, TypeFlags.StringLike, /*isTypeOfKind*/ true); - var hasStringConstituent = arrayOrStringType !== emptyObjectType && arrayOrStringType !== arrayType; + // After we remove all types that are StringLike, we will know if there was a string constituent + // based on whether the remaining type is the same as the initial type. + var arrayType = removeTypesFromUnionType(arrayOrStringType, TypeFlags.StringLike, /*isTypeOfKind*/ true, /*allowEmptyUnionResult*/ true); + var hasStringConstituent = arrayOrStringType !== arrayType; var reportedError = false; - if (hasStringConstituent && languageVersion < ScriptTarget.ES5) { - error(expressionForError, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); - reportedError = true; - } + if (hasStringConstituent) { + if (languageVersion < ScriptTarget.ES5) { + error(expressionForError, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); + reportedError = true; + } - if (isJustString) { - return stringType; + // Now that we've removed all the StringLike types, if no constituents remain, then the entire + // arrayOrStringType was a string. + if (arrayType === emptyObjectType) { + return stringType; + } } if (!isArrayLikeType(arrayType)) { if (!reportedError) { - error(expressionForError, Diagnostics.Type_0_is_not_an_array_type, typeToString(arrayType)); + // Which error we report depends on whether there was a string constituent. For example, + // if the input type is number | string, we want to say that number is not an array type. + // But if the input was just number, we want to say that number is not an array type + // or a string type. + var diagnostic = hasStringConstituent + ? Diagnostics.Type_0_is_not_an_array_type + : Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + error(expressionForError, diagnostic, typeToString(arrayType)); } return hasStringConstituent ? stringType : unknownType; } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index ef8a3936bc3..d40fcd25ce0 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -339,6 +339,7 @@ module ts { Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: DiagnosticCategory.Error, key: "Cannot redeclare identifier '{0}' in catch clause" }, Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: DiagnosticCategory.Error, key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: DiagnosticCategory.Error, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, + Type_0_is_not_an_array_type_or_a_string_type: { code: 2461, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type or a string type." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index efeb54d93fc..c4121e92251 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1347,6 +1347,10 @@ "category": "Error", "code": 2494 }, + "Type '{0}' is not an array type or a string type.": { + "category": "Error", + "code": 2461 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt index 8725fa62471..9551d0467e9 100644 --- a/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt +++ b/tests/baselines/reference/ES5For-ofTypeCheck10.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(1,15): error TS2461: Type 'StringIterator' is not an array type. +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(1,15): error TS2461: Type 'StringIterator' is not an array type or a string type. tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts(11,6): error TS2304: Cannot find name 'Symbol'. ==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck10.ts (2 errors) ==== for (var v of new StringIterator) { } ~~~~~~~~~~~~~~~~~~ -!!! error TS2461: Type 'StringIterator' is not an array type. +!!! error TS2461: Type 'StringIterator' is not an array type or a string type. // In ES3/5, you cannot for...of over an arbitrary iterable. class StringIterator { diff --git a/tests/baselines/reference/ES5For-ofTypeCheck12.errors.txt b/tests/baselines/reference/ES5For-ofTypeCheck12.errors.txt new file mode 100644 index 00000000000..b726aaad6c7 --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck12.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck12.ts(1,17): error TS2461: Type 'number' is not an array type or a string type. + + +==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck12.ts (1 errors) ==== + for (const v of 0) { } + ~ +!!! error TS2461: Type 'number' is not an array type or a string type. \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-ofTypeCheck12.js b/tests/baselines/reference/ES5For-ofTypeCheck12.js new file mode 100644 index 00000000000..6004990f6dc --- /dev/null +++ b/tests/baselines/reference/ES5For-ofTypeCheck12.js @@ -0,0 +1,7 @@ +//// [ES5For-ofTypeCheck12.ts] +for (const v of 0) { } + +//// [ES5For-ofTypeCheck12.js] +for (var _i = 0, _a = 0; _i < _a.length; _i++) { + var v = _a[_i]; +} diff --git a/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck12.ts b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck12.ts new file mode 100644 index 00000000000..2d220dc5f26 --- /dev/null +++ b/tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck12.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (const v of 0) { } \ No newline at end of file From 3a9df5f676a0ff88e3cfc9f6e7f4029ef23c1933 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 12 Mar 2015 16:12:22 -0700 Subject: [PATCH 045/101] Update LKG --- bin/lib.core.d.ts | 12 +- bin/lib.core.es6.d.ts | 12 +- bin/lib.d.ts | 12 +- bin/lib.es6.d.ts | 12 +- bin/tsc.js | 955 ++- bin/tsserver.js | 10090 +++++++++++++++++++------ bin/typescript.d.ts | 50 +- bin/typescript.js | 9608 +++++++++++++++++------ bin/typescriptServices.d.ts | 50 +- bin/typescriptServices.js | 9608 +++++++++++++++++------ bin/typescriptServices_internal.d.ts | 2 +- bin/typescript_internal.d.ts | 2 +- 12 files changed, 22797 insertions(+), 7616 deletions(-) diff --git a/bin/lib.core.d.ts b/bin/lib.core.d.ts index a8b5fdbcf7c..132f5ffaccf 100644 --- a/bin/lib.core.d.ts +++ b/bin/lib.core.d.ts @@ -179,19 +179,19 @@ interface ObjectConstructor { * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - seal(o: any): any; + seal(o: T): T; /** * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - freeze(o: any): any; + freeze(o: T): T; /** * Prevents the addition of new properties to an object. * @param o Object to make non-extensible. */ - preventExtensions(o: any): any; + preventExtensions(o: T): T; /** * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. @@ -425,6 +425,9 @@ interface String { */ substr(from: number, length?: number): string; + /** Returns the primitive value of the specified object. */ + valueOf(): string; + [index: number]: string; } @@ -477,6 +480,9 @@ interface Number { * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. */ toPrecision(precision?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): number; } interface NumberConstructor { diff --git a/bin/lib.core.es6.d.ts b/bin/lib.core.es6.d.ts index b3c400f11a2..c6f3d1d1f97 100644 --- a/bin/lib.core.es6.d.ts +++ b/bin/lib.core.es6.d.ts @@ -179,19 +179,19 @@ interface ObjectConstructor { * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - seal(o: any): any; + seal(o: T): T; /** * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - freeze(o: any): any; + freeze(o: T): T; /** * Prevents the addition of new properties to an object. * @param o Object to make non-extensible. */ - preventExtensions(o: any): any; + preventExtensions(o: T): T; /** * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. @@ -425,6 +425,9 @@ interface String { */ substr(from: number, length?: number): string; + /** Returns the primitive value of the specified object. */ + valueOf(): string; + [index: number]: string; } @@ -477,6 +480,9 @@ interface Number { * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. */ toPrecision(precision?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): number; } interface NumberConstructor { diff --git a/bin/lib.d.ts b/bin/lib.d.ts index 02c45824aa8..e22c7351931 100644 --- a/bin/lib.d.ts +++ b/bin/lib.d.ts @@ -179,19 +179,19 @@ interface ObjectConstructor { * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - seal(o: any): any; + seal(o: T): T; /** * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - freeze(o: any): any; + freeze(o: T): T; /** * Prevents the addition of new properties to an object. * @param o Object to make non-extensible. */ - preventExtensions(o: any): any; + preventExtensions(o: T): T; /** * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. @@ -425,6 +425,9 @@ interface String { */ substr(from: number, length?: number): string; + /** Returns the primitive value of the specified object. */ + valueOf(): string; + [index: number]: string; } @@ -477,6 +480,9 @@ interface Number { * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. */ toPrecision(precision?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): number; } interface NumberConstructor { diff --git a/bin/lib.es6.d.ts b/bin/lib.es6.d.ts index 935f78f1603..cf849d5c72d 100644 --- a/bin/lib.es6.d.ts +++ b/bin/lib.es6.d.ts @@ -179,19 +179,19 @@ interface ObjectConstructor { * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - seal(o: any): any; + seal(o: T): T; /** * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - freeze(o: any): any; + freeze(o: T): T; /** * Prevents the addition of new properties to an object. * @param o Object to make non-extensible. */ - preventExtensions(o: any): any; + preventExtensions(o: T): T; /** * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. @@ -425,6 +425,9 @@ interface String { */ substr(from: number, length?: number): string; + /** Returns the primitive value of the specified object. */ + valueOf(): string; + [index: number]: string; } @@ -477,6 +480,9 @@ interface Number { * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. */ toPrecision(precision?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): number; } interface NumberConstructor { diff --git a/bin/tsc.js b/bin/tsc.js index 32d4e894340..a19101dc546 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -254,8 +254,11 @@ var ts; } ts.getLocaleSpecificMessage = getLocaleSpecificMessage; function createFileDiagnostic(file, start, length, message) { + var end = start + length; Debug.assert(start >= 0, "start must be non-negative, is " + start); Debug.assert(length >= 0, "length must be non-negative, is " + length); + Debug.assert(start <= file.text.length, "start must be within the bounds of the file. " + start + " > " + file.text.length); + Debug.assert(end <= file.text.length, "end must be the bounds of the file. " + end + " > " + file.text.length); var text = getLocaleSpecificMessage(message.key); if (arguments.length > 4) { text = formatStringFromArgs(text, arguments, 4); @@ -1188,7 +1191,6 @@ var ts; Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, - for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: 1, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: 1, key: "Export declaration conflicts with exported declaration of '{0}'" }, The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: 1, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, @@ -1199,6 +1201,9 @@ var ts; The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: 1, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: 1, key: "Cannot redeclare identifier '{0}' in catch clause" }, + Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: 1, key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: 1, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, + Type_0_is_not_an_array_type_or_a_string_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type or a string type." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1324,6 +1329,7 @@ var ts; File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: 2, key: "Do not emit declarations for code that has an '@internal' annotation." }, + Preserve_new_lines_when_emitting_code: { code: 6057, category: 2, key: "Preserve new-lines when emitting code." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1, key: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1, key: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: 1, key: "Member '{0}' implicitly has an '{1}' type." }, @@ -2608,7 +2614,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 220) { + while (node && node.kind !== 221) { node = node.parent; } return node; @@ -2683,11 +2689,35 @@ var ts; isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; + function getEnclosingBlockScopeContainer(node) { + var current = node; + while (current) { + if (isFunctionLike(current)) { + return current; + } + switch (current.kind) { + case 221: + case 202: + case 217: + case 200: + case 181: + case 182: + case 183: + return current; + case 174: + if (!isFunctionLike(current.parent)) { + return current; + } + } + current = current.parent; + } + } + ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && declaration.kind === 193 && declaration.parent && - declaration.parent.kind === 216; + declaration.parent.kind === 217; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -2730,7 +2760,7 @@ var ts; case 197: case 200: case 199: - case 219: + case 220: case 195: case 160: errorNode = node.name; @@ -2817,6 +2847,7 @@ var ts; switch (node.kind) { case 186: return visitor(node); + case 202: case 174: case 178: case 179: @@ -2826,11 +2857,11 @@ var ts; case 183: case 187: case 188: - case 213: case 214: + case 215: case 189: case 191: - case 216: + case 217: return ts.forEachChild(node, traverse); } } @@ -2840,12 +2871,12 @@ var ts; if (node) { switch (node.kind) { case 150: - case 219: + case 220: case 128: - case 217: + case 218: case 130: case 129: - case 218: + case 219: case 193: return true; } @@ -2923,7 +2954,7 @@ var ts; case 134: case 135: case 199: - case 220: + case 221: return node; } } @@ -3014,8 +3045,8 @@ var ts; case 128: case 130: case 129: - case 219: - case 217: + case 220: + case 218: case 150: return parent.initializer === node; case 177: @@ -3025,7 +3056,7 @@ var ts; case 186: case 187: case 188: - case 213: + case 214: case 190: case 188: return parent.expression === node; @@ -3061,7 +3092,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 202 && node.moduleReference.kind === 212; + return node.kind === 203 && node.moduleReference.kind === 213; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -3070,20 +3101,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 202 && node.moduleReference.kind !== 212; + return node.kind === 203 && node.moduleReference.kind !== 213; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 203) { + if (node.kind === 204) { return node.moduleSpecifier; } - if (node.kind === 202) { + if (node.kind === 203) { var reference = node.moduleReference; - if (reference.kind === 212) { + if (reference.kind === 213) { return reference.expression; } } - if (node.kind === 209) { + if (node.kind === 210) { return node.moduleSpecifier; } } @@ -3100,8 +3131,8 @@ var ts; case 132: case 131: return node.questionToken !== undefined; + case 219: case 218: - case 217: case 130: case 129: return node.questionToken !== undefined; @@ -3147,25 +3178,25 @@ var ts; case 196: case 133: case 199: - case 219: - case 211: + case 220: + case 212: case 195: case 160: case 134: - case 204: - case 202: - case 207: + case 205: + case 203: + case 208: case 197: case 132: case 131: case 200: - case 205: + case 206: case 128: - case 217: + case 218: case 130: case 129: case 135: - case 218: + case 219: case 198: case 127: case 193: @@ -3194,7 +3225,7 @@ var ts; case 175: case 180: case 187: - case 208: + case 209: return true; default: return false; @@ -3206,7 +3237,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 207 || parent.kind === 211) { + if (parent.kind === 208 || parent.kind === 212) { if (parent.propertyName) { return true; } @@ -3460,11 +3491,11 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 200 || n.kind === 220; + return isFunctionLike(n) || n.kind === 200 || n.kind === 221; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { - return node.pos === -1 && node.end === -1; + return node.pos === -1; } ts.nodeIsSynthesized = nodeIsSynthesized; function createSynthesizedNode(kind, startsOnNewLine) { @@ -3598,7 +3629,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var nodeConstructors = new Array(222); + var nodeConstructors = new Array(223); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -3645,8 +3676,8 @@ var ts; case 128: case 130: case 129: - case 217: case 218: + case 219: case 193: case 150: return visitNodes(cbNodes, node.modifiers) || @@ -3751,7 +3782,7 @@ var ts; case 174: case 201: return visitNodes(cbNodes, node.statements); - case 220: + case 221: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 175: @@ -3794,11 +3825,13 @@ var ts; visitNode(cbNode, node.statement); case 188: return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.clauses); - case 213: + visitNode(cbNode, node.caseBlock); + case 202: + return visitNodes(cbNodes, node.clauses); + case 214: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 214: + case 215: return visitNodes(cbNodes, node.statements); case 189: return visitNode(cbNode, node.label) || @@ -3809,7 +3842,7 @@ var ts; return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 216: + case 217: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 196: @@ -3832,38 +3865,38 @@ var ts; return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 219: + case 220: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 200: return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 202: + case 203: return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 203: + case 204: return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 204: + case 205: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 205: - return visitNode(cbNode, node.name); case 206: - case 210: + return visitNode(cbNode, node.name); + case 207: + case 211: return visitNodes(cbNodes, node.elements); - case 209: + case 210: return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 207: - case 211: + case 208: + case 212: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 208: + case 209: return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 169: @@ -3872,9 +3905,9 @@ var ts; return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 126: return visitNode(cbNode, node.expression); - case 215: + case 216: return visitNodes(cbNodes, node.types); - case 212: + case 213: return visitNode(cbNode, node.expression); } } @@ -4228,7 +4261,7 @@ var ts; var identifierCount = 0; var nodeCount = 0; var token; - var sourceFile = createNode(220, 0); + var sourceFile = createNode(221, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -4778,10 +4811,10 @@ var ts; function isReusableModuleElement(node) { if (node) { switch (node.kind) { + case 204: case 203: - case 202: + case 210: case 209: - case 208: case 196: case 197: case 200: @@ -4809,8 +4842,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 213: case 214: + case 215: return true; } } @@ -4845,7 +4878,7 @@ var ts; return false; } function isReusableEnumMember(node) { - return node.kind === 219; + return node.kind === 220; } function isReusableTypeMember(node) { if (node) { @@ -5967,13 +6000,13 @@ var ts; return parseMethodDeclaration(fullStart, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(218, fullStart); + var shorthandDeclaration = createNode(219, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(217, fullStart); + var propertyAssignment = createNode(218, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -6139,7 +6172,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(213); + var node = createNode(214); parseExpected(66); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -6147,7 +6180,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(214); + var node = createNode(215); parseExpected(72); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -6162,9 +6195,11 @@ var ts; parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); + var caseBlock = createNode(202, scanner.getStartPos()); parseExpected(14); - node.clauses = parseList(3, false, parseCaseOrDefaultClause); + caseBlock.clauses = parseList(3, false, parseCaseOrDefaultClause); parseExpected(15); + node.caseBlock = finishNode(caseBlock); return finishNode(node); } function parseThrowStatement() { @@ -6186,7 +6221,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(216); + var result = createNode(217); parseExpected(67); if (parseExpected(16)) { result.variableDeclaration = parseVariableDeclaration(); @@ -6616,7 +6651,7 @@ var ts; } function parseHeritageClause() { if (token === 78 || token === 102) { - var node = createNode(215); + var node = createNode(216); node.token = token; nextToken(); node.types = parseDelimitedList(8, parseTypeReference); @@ -6651,7 +6686,7 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(219, scanner.getStartPos()); + var node = createNode(220, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); @@ -6723,7 +6758,7 @@ var ts; if (isIdentifier()) { identifier = parseIdentifier(); if (token !== 23 && token !== 123) { - var importEqualsDeclaration = createNode(202, fullStart); + var importEqualsDeclaration = createNode(203, fullStart); setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; parseExpected(52); @@ -6732,7 +6767,7 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(203, fullStart); + var importDeclaration = createNode(204, fullStart); setModifiers(importDeclaration, modifiers); if (identifier || token === 35 || @@ -6745,13 +6780,13 @@ var ts; return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(204, fullStart); + var importClause = createNode(205, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(23)) { - importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(206); + importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(207); } return finishNode(importClause); } @@ -6761,7 +6796,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(212); + var node = createNode(213); parseExpected(117); parseExpected(16); node.expression = parseModuleSpecifier(); @@ -6776,7 +6811,7 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(205); + var namespaceImport = createNode(206); parseExpected(35); parseExpected(101); namespaceImport.name = parseIdentifier(); @@ -6784,14 +6819,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(20, kind === 206 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(20, kind === 207 ? parseImportSpecifier : parseExportSpecifier, 14, 15); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(211); + return parseImportOrExportSpecifier(212); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(207); + return parseImportOrExportSpecifier(208); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -6817,14 +6852,14 @@ var ts; return finishNode(node); } function parseExportDeclaration(fullStart, modifiers) { - var node = createNode(209, fullStart); + var node = createNode(210, fullStart); setModifiers(node, modifiers); if (parseOptional(35)) { parseExpected(123); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(210); + node.exportClause = parseNamedImportsOrExports(211); if (parseOptional(123)) { node.moduleSpecifier = parseModuleSpecifier(); } @@ -6833,7 +6868,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, modifiers) { - var node = createNode(208, fullStart); + var node = createNode(209, fullStart); setModifiers(node, modifiers); if (parseOptional(52)) { node.isExportEquals = true; @@ -7009,10 +7044,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 202 && node.moduleReference.kind === 212 - || node.kind === 203 - || node.kind === 208 + || node.kind === 203 && node.moduleReference.kind === 213 + || node.kind === 204 || node.kind === 209 + || node.kind === 210 ? node : undefined; }); @@ -7062,7 +7097,7 @@ var ts; else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 203 || node.kind === 202) && !(node.flags & 1)) { + else if ((node.kind === 204 || node.kind === 203) && !(node.flags & 1)) { return 0; } else if (node.kind === 201) { @@ -7155,9 +7190,9 @@ var ts; return "__new"; case 138: return "__index"; - case 209: + case 210: return "__export"; - case 208: + case 209: return "default"; case 195: case 196: @@ -7215,7 +7250,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolKind & 8388608) { - if (node.kind === 211 || (node.kind === 202 && hasExportModifier)) { + if (node.kind === 212 || (node.kind === 203 && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -7252,7 +7287,7 @@ var ts; lastContainer = container; } if (isBlockScopeContainer) { - setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 220); + setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 221); } ts.forEachChild(node, bind); container = saveContainer; @@ -7264,7 +7299,7 @@ var ts; case 200: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 220: + case 221: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -7342,7 +7377,7 @@ var ts; case 200: declareModuleMember(node, 2, 107455); break; - case 220: + case 221: if (ts.isExternalModule(container)) { declareModuleMember(node, 2, 107455); break; @@ -7383,11 +7418,11 @@ var ts; case 129: bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 217: case 218: + case 219: bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 219: + case 220: bindPropertyOrMethodOrAccessor(node, 8, 107455, false); break; case 136: @@ -7425,7 +7460,7 @@ var ts; case 161: bindAnonymousDeclaration(node, 16, "__function", true); break; - case 216: + case 217: bindCatchVariableDeclaration(node); break; case 196: @@ -7448,13 +7483,13 @@ var ts; case 200: bindModuleDeclaration(node); break; - case 202: - case 205: - case 207: - case 211: + case 203: + case 206: + case 208: + case 212: bindDeclaration(node, 8388608, 8388608, false); break; - case 204: + case 205: if (node.name) { bindDeclaration(node, 8388608, 8388608, false); } @@ -7462,13 +7497,13 @@ var ts; bindChildren(node, 0, false); } break; - case 209: + case 210: if (!node.exportClause) { declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); } bindChildren(node, 0, false); break; - case 208: + case 209: if (node.expression.kind === 64) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 8388608); } @@ -7477,7 +7512,7 @@ var ts; } bindChildren(node, 0, false); break; - case 220: + case 221: if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; @@ -7485,11 +7520,11 @@ var ts; case 174: bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 216: + case 217: case 181: case 182: case 183: - case 188: + case 202: bindChildren(node, 0, true); break; default: @@ -7777,10 +7812,10 @@ var ts; return nodeLinks[node.id] || (nodeLinks[node.id] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 220); + return ts.getAncestor(node, 221); } function isGlobalSourceFile(node) { - return node.kind === 220 && !ts.isExternalModule(node); + return node.kind === 221 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -7821,12 +7856,12 @@ var ts; } } switch (location.kind) { - case 220: + case 221: if (!ts.isExternalModule(location)) break; case 200: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { - if (!(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 211)) { + if (!(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 212)) { break loop; } result = undefined; @@ -7910,28 +7945,57 @@ var ts; return undefined; } if (result.flags & 2) { - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); - ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!isDefinedBefore(declaration, errorLocation)) { - error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); - } + checkResolvedBlockScopedVariable(result, errorLocation); } } return result; } + function checkResolvedBlockScopedVariable(result, errorLocation) { + ts.Debug.assert((result.flags & 2) !== 0); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); + ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); + var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); + if (!isUsedBeforeDeclaration) { + var variableDeclaration = ts.getAncestor(declaration, 193); + var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); + if (variableDeclaration.parent.parent.kind === 175 || + variableDeclaration.parent.parent.kind === 181) { + isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); + } + else if (variableDeclaration.parent.parent.kind === 183 || + variableDeclaration.parent.parent.kind === 182) { + var expression = variableDeclaration.parent.parent.expression; + isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); + } + } + if (isUsedBeforeDeclaration) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + } + function isSameScopeDescendentOf(initial, parent, stopAt) { + if (!parent) { + return false; + } + for (var current = initial; current && current !== stopAt && !ts.isFunctionLike(current); current = current.parent) { + if (current === parent) { + return true; + } + } + return false; + } function isAliasSymbolDeclaration(node) { - return node.kind === 202 || - node.kind === 204 && !!node.name || - node.kind === 205 || - node.kind === 207 || - node.kind === 211 || - node.kind === 208; + return node.kind === 203 || + node.kind === 205 && !!node.name || + node.kind === 206 || + node.kind === 208 || + node.kind === 212 || + node.kind === 209; } function getDeclarationOfAliasSymbol(symbol) { return ts.forEach(symbol.declarations, function (d) { return isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 212) { + if (node.moduleReference.kind === 213) { var moduleSymbol = resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)); var exportAssignmentSymbol = moduleSymbol && getResolvedExportAssignmentSymbol(moduleSymbol); return exportAssignmentSymbol || moduleSymbol; @@ -7978,17 +8042,17 @@ var ts; } function getTargetOfImportDeclaration(node) { switch (node.kind) { - case 202: + case 203: return getTargetOfImportEqualsDeclaration(node); - case 204: - return getTargetOfImportClause(node); case 205: + return getTargetOfImportClause(node); + case 206: return getTargetOfNamespaceImport(node); - case 207: - return getTargetOfImportSpecifier(node); - case 211: - return getTargetOfExportSpecifier(node); case 208: + return getTargetOfImportSpecifier(node); + case 212: + return getTargetOfExportSpecifier(node); + case 209: return getTargetOfExportAssignment(node); } } @@ -8023,10 +8087,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 208) { + if (node.kind === 209) { checkExpressionCached(node.expression); } - else if (node.kind === 211) { + else if (node.kind === 212) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -8036,7 +8100,7 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 202); + importDeclaration = ts.getAncestor(entityName, 203); ts.Debug.assert(importDeclaration !== undefined); } if (entityName.kind === 64 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { @@ -8046,7 +8110,7 @@ var ts; return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 202); + ts.Debug.assert(entityName.parent.kind === 203); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -8271,7 +8335,7 @@ var ts; } } switch (location.kind) { - case 220: + case 221: if (!ts.isExternalModule(location)) { break; } @@ -8397,7 +8461,7 @@ var ts; } function hasExternalModuleSymbol(declaration) { return (declaration.kind === 200 && declaration.name.kind === 8) || - (declaration.kind === 220 && ts.isExternalModule(declaration)); + (declaration.kind === 221 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -8407,7 +8471,7 @@ var ts; return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 202 && + if (declaration.kind === 203 && !(declaration.flags & 1) && isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; @@ -8432,7 +8496,7 @@ var ts; meaning = 107455 | 1048576; } else if (entityName.kind === 125 || - entityName.parent.kind === 202) { + entityName.parent.kind === 203) { meaning = 1536; } else { @@ -8650,7 +8714,7 @@ var ts; var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 220 || declaration.parent.kind === 201; + return declaration.parent.kind === 221 || declaration.parent.kind === 201; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -8884,7 +8948,7 @@ var ts; return node; } } - else if (node.kind === 220) { + else if (node.kind === 221) { return ts.isExternalModule(node) ? node : undefined; } } @@ -8934,10 +8998,10 @@ var ts; case 198: case 195: case 199: - case 202: + case 203: var parent = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 202 && parent.kind !== 220 && ts.isInAmbientContext(parent))) { + !(node.kind !== 203 && parent.kind !== 221 && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(parent); @@ -8966,7 +9030,7 @@ var ts; case 147: return isDeclarationVisible(node.parent); case 127: - case 220: + case 221: return true; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -9029,7 +9093,12 @@ var ts; var propName = "" + ts.indexOf(pattern.elements, declaration); var type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1); if (!type) { - error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName); + if (isTupleType(parentType)) { + error(declaration, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), parentType.elementTypes.length, pattern.elements.length); + } + else { + error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName); + } return unknownType; } } @@ -9044,7 +9113,7 @@ var ts; return anyType; } if (declaration.parent.parent.kind === 183) { - return getTypeForVariableDeclarationInForOfStatement(declaration.parent.parent); + return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); @@ -9068,7 +9137,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 218) { + if (declaration.kind === 219) { return checkIdentifier(declaration.name); } return undefined; @@ -9115,7 +9184,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 217 ? getWidenedType(type) : type; + return declaration.kind !== 218 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -9136,10 +9205,10 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 216) { + if (declaration.parent.kind === 217) { return links.type = anyType; } - if (declaration.kind === 208) { + if (declaration.kind === 209) { return links.type = checkExpression(declaration.expression); } links.type = resolvingType; @@ -10486,7 +10555,7 @@ var ts; case 167: return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 217: + case 218: return isContextSensitive(node.initializer); case 132: case 131: @@ -11176,6 +11245,9 @@ var ts; function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); } + function isTupleType(type) { + return (type.flags & 8192) && !!type.elementTypes; + } function getWidenedTypeOfObjectLiteral(type) { var properties = getPropertiesOfObjectType(type); var members = {}; @@ -11508,16 +11580,19 @@ var ts; } ts.Debug.fail("should not get here"); } - function removeTypesFromUnionType(type, typeKind, isOfTypeKind) { + function removeTypesFromUnionType(type, typeKind, isOfTypeKind, allowEmptyUnionResult) { if (type.flags & 16384) { var types = type.types; if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); - if (narrowedType !== emptyObjectType) { + if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { return narrowedType; } } } + else if (allowEmptyUnionResult && !!(type.flags & typeKind) === isOfTypeKind) { + return getUnionType(emptyArray); + } return type; } function hasInitializer(node) { @@ -11589,12 +11664,12 @@ var ts; case 186: case 187: case 188: - case 213: case 214: + case 215: case 189: case 190: case 191: - case 216: + case 217: return ts.forEachChild(node, isAssignedIn); } return false; @@ -11650,7 +11725,7 @@ var ts; } } break; - case 220: + case 221: case 200: case 195: case 132: @@ -11684,16 +11759,16 @@ var ts; } if (assumeTrue) { if (!typeInfo) { - return removeTypesFromUnionType(type, 258 | 132 | 8 | 1048576, true); + return removeTypesFromUnionType(type, 258 | 132 | 8 | 1048576, true, false); } if (isTypeSubtypeOf(typeInfo.type, type)) { return typeInfo.type; } - return removeTypesFromUnionType(type, typeInfo.flags, false); + return removeTypesFromUnionType(type, typeInfo.flags, false, false); } else { if (typeInfo) { - return removeTypesFromUnionType(type, typeInfo.flags, true); + return removeTypesFromUnionType(type, typeInfo.flags, true, false); } return type; } @@ -11795,7 +11870,7 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 || (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 216) { + symbol.valueDeclaration.parent.kind === 217) { return; } var container = symbol.valueDeclaration; @@ -12136,7 +12211,7 @@ var ts; return getTypeFromTypeNode(parent.type); case 167: return getContextualTypeForBinaryOperand(node); - case 217: + case 218: return getContextualTypeForObjectLiteralElement(parent); case 151: return getContextualTypeForElementExpression(node); @@ -12212,7 +12287,7 @@ var ts; if (parent.kind === 167 && parent.operatorToken.kind === 52 && parent.left === node) { return true; } - if (parent.kind === 217) { + if (parent.kind === 218) { return isAssignmentTarget(parent.parent); } if (parent.kind === 151) { @@ -12284,17 +12359,17 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 217 || - memberDecl.kind === 218 || + if (memberDecl.kind === 218 || + memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { - if (memberDecl.kind === 217) { + if (memberDecl.kind === 218) { var type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 132) { var type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 218); + ts.Debug.assert(memberDecl.kind === 219); var type = memberDecl.name.kind === 126 ? unknownType : checkExpression(memberDecl.name, contextualMapper); @@ -13309,7 +13384,7 @@ var ts; var properties = node.properties; for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 217 || p.kind === 218) { + if (p.kind === 218 || p.kind === 219) { var name = p.name; var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || @@ -13346,7 +13421,12 @@ var ts; checkDestructuringAssignment(e, type, contextualMapper); } else { - error(e, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + if (isTupleType(sourceType)) { + error(e, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), sourceType.elementTypes.length, elements.length); + } + else { + error(e, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + } } } else { @@ -14156,7 +14236,7 @@ var ts; case 196: case 199: return 2097152 | 1048576; - case 202: + case 203: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -14290,7 +14370,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 220 && ts.isExternalModule(parent)) { + if (parent.kind === 221 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -14309,7 +14389,7 @@ var ts; var namesShareScope = container && (container.kind === 174 && ts.isFunctionLike(container.parent) || (container.kind === 201 && container.kind === 200) || - container.kind === 220); + container.kind === 221); if (!namesShareScope) { var name = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); @@ -14468,18 +14548,13 @@ var ts; checkSourceElement(node.statement); } function checkForOfStatement(node) { - if (languageVersion < 2) { - grammarErrorOnFirstToken(node, ts.Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); - return; - } checkGrammarForInOrForOfStatement(node); if (node.initializer.kind === 194) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; - var rightType = checkExpression(node.expression); - var iteratedType = checkIteratedType(rightType, node.expression); + var iteratedType = checkRightHandSideOfForOf(node.expression); if (varExpr.kind === 151 || varExpr.kind === 152) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } @@ -14528,12 +14603,11 @@ var ts; checkVariableDeclaration(decl); } } - function getTypeForVariableDeclarationInForOfStatement(forOfStatement) { - if (languageVersion < 2) { - return anyType; - } - var expressionType = getTypeOfExpression(forOfStatement.expression); - return checkIteratedType(expressionType, forOfStatement.expression) || anyType; + function checkRightHandSideOfForOf(rhsExpression) { + var expressionType = getTypeOfExpression(rhsExpression); + return languageVersion >= 2 + ? checkIteratedType(expressionType, rhsExpression) + : checkElementTypeOfArrayOrString(expressionType, rhsExpression); } function checkIteratedType(iterable, expressionForError) { ts.Debug.assert(languageVersion >= 2); @@ -14589,6 +14663,38 @@ var ts; return iteratorNextValue; } } + function checkElementTypeOfArrayOrString(arrayOrStringType, expressionForError) { + ts.Debug.assert(languageVersion < 2); + var arrayType = removeTypesFromUnionType(arrayOrStringType, 258, true, true); + var hasStringConstituent = arrayOrStringType !== arrayType; + var reportedError = false; + if (hasStringConstituent) { + if (languageVersion < 1) { + error(expressionForError, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); + reportedError = true; + } + if (arrayType === emptyObjectType) { + return stringType; + } + } + if (!isArrayLikeType(arrayType)) { + if (!reportedError) { + var diagnostic = hasStringConstituent + ? ts.Diagnostics.Type_0_is_not_an_array_type + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + error(expressionForError, diagnostic, typeToString(arrayType)); + } + return hasStringConstituent ? stringType : unknownType; + } + var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType; + if (hasStringConstituent) { + if (arrayElementType.flags & 258) { + return stringType; + } + return getUnionType([arrayElementType, stringType]); + } + return arrayElementType; + } function checkBreakOrContinueStatement(node) { checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } @@ -14637,8 +14743,8 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); - ts.forEach(node.clauses, function (clause) { - if (clause.kind === 214 && !hasDuplicateDefaultClause) { + ts.forEach(node.caseBlock.clauses, function (clause) { + if (clause.kind === 215 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -14650,7 +14756,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 213) { + if (produceDiagnostics && clause.kind === 214) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -15236,8 +15342,8 @@ var ts; return false; } var inAmbientExternalModule = node.parent.kind === 201 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 220 && !inAmbientExternalModule) { - error(moduleName, node.kind === 209 ? + if (node.parent.kind !== 221 && !inAmbientExternalModule) { + error(moduleName, node.kind === 210 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; @@ -15256,7 +15362,7 @@ var ts; (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 211 ? + var message = node.kind === 212 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -15279,7 +15385,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 205) { + if (importClause.namedBindings.kind === 206) { checkImportBinding(importClause.namedBindings); } else { @@ -15329,7 +15435,7 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 220 ? node.parent : node.parent.parent; + var container = node.parent.kind === 221 ? node.parent : node.parent.parent; if (container.kind === 200 && container.name.kind === 64) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); return; @@ -15346,7 +15452,7 @@ var ts; checkExternalModuleExports(container); } function getModuleStatements(node) { - if (node.kind === 220) { + if (node.kind === 221) { return node.statements; } if (node.kind === 200 && node.body.kind === 201) { @@ -15360,7 +15466,7 @@ var ts; var statements = getModuleStatements(declarations[i]); for (var j = 0; j < statements.length; j++) { var node = statements[j]; - if (node.kind === 209) { + if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; @@ -15373,7 +15479,7 @@ var ts; } } } - else if (node.kind !== 208 && node.flags & 1 && !(node.flags & 256)) { + else if (node.kind !== 209 && node.flags & 1 && !(node.flags & 256)) { return true; } } @@ -15483,13 +15589,13 @@ var ts; return checkEnumDeclaration(node); case 200: return checkModuleDeclaration(node); - case 203: + case 204: return checkImportDeclaration(node); - case 202: + case 203: return checkImportEqualsDeclaration(node); - case 209: + case 210: return checkExportDeclaration(node); - case 208: + case 209: return checkExportAssignment(node); case 176: checkGrammarStatementInAmbientContext(node); @@ -15530,7 +15636,7 @@ var ts; case 150: case 151: case 152: - case 217: + case 218: case 153: case 154: case 155: @@ -15562,19 +15668,20 @@ var ts; case 185: case 186: case 188: - case 213: + case 202: case 214: + case 215: case 189: case 190: case 191: - case 216: + case 217: case 193: case 194: case 196: case 199: - case 219: - case 208: case 220: + case 209: + case 221: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -15662,7 +15769,7 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 220: + case 221: if (!ts.isExternalModule(location)) break; case 200: @@ -15774,10 +15881,10 @@ var ts; while (nodeOnRightSide.parent.kind === 125) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 202) { + if (nodeOnRightSide.parent.kind === 203) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 208) { + if (nodeOnRightSide.parent.kind === 209) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -15793,7 +15900,7 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 208) { + if (entityName.parent.kind === 209) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } if (entityName.kind !== 153) { @@ -15842,7 +15949,7 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 64 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 208 + return node.parent.kind === 209 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } @@ -15865,7 +15972,7 @@ var ts; var moduleName; if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 203 || node.parent.kind === 209) && + ((node.parent.kind === 204 || node.parent.kind === 210) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } @@ -15884,7 +15991,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 218) { + if (location && location.kind === 219) { return resolveEntityName(location.name, 107455); } return undefined; @@ -15958,7 +16065,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 220; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 221; } function isNodeDescendentOf(node, ancestor) { while (node) { @@ -15999,16 +16106,16 @@ var ts; case 199: generateNameForModuleOrEnum(node); break; - case 203: + case 204: generateNameForImportDeclaration(node); break; - case 209: + case 210: generateNameForExportDeclaration(node); break; - case 208: + case 209: generateNameForExportAssignment(node); break; - case 220: + case 221: case 201: ts.forEach(node.statements, generateNames); break; @@ -16042,7 +16149,7 @@ var ts; assignGeneratedName(node, makeUniqueName(baseName)); } function generateNameForImportDeclaration(node) { - if (node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 206) { + if (node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 207) { generateNameForImportOrExportDeclaration(node); } } @@ -16072,7 +16179,7 @@ var ts; } function getAliasNameSubstitution(symbol) { var declaration = getDeclarationOfAliasSymbol(symbol); - if (declaration && declaration.kind === 207) { + if (declaration && declaration.kind === 208) { var moduleName = getGeneratedNameForNode(declaration.parent.parent.parent); var propertyName = declaration.propertyName || declaration.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -16111,7 +16218,7 @@ var ts; return symbol && symbol !== unknownSymbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol); } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 220 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 221 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } return isAliasResolvedToValue(getSymbolOfNode(node)); @@ -16149,14 +16256,14 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 219) { + if (node.kind === 220) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; if (symbol && (symbol.flags & 8)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 219) { + if (declaration.kind === 220) { return getEnumMemberValue(declaration); } } @@ -16174,6 +16281,7 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function isUnknownIdentifier(location, name) { + ts.Debug.assert(!ts.nodeIsSynthesized(location), "isUnknownIdentifier called with a synthesized location"); return !resolveName(location, name, 107455, undefined, undefined) && !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); } @@ -16196,7 +16304,7 @@ var ts; resolveName(n, n.text, 2 | 8388608, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 216; + symbol.valueDeclaration.parent.kind !== 217; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -16273,10 +16381,10 @@ var ts; case 175: case 195: case 198: + case 204: case 203: - case 202: + case 210: case 209: - case 208: case 128: break; default: @@ -16311,7 +16419,7 @@ var ts; else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 201 || node.parent.kind === 220) { + else if (node.parent.kind === 201 || node.parent.kind === 221) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -16320,7 +16428,7 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 201 || node.parent.kind === 220) { + else if (node.parent.kind === 201 || node.parent.kind === 221) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } else if (node.kind === 128) { @@ -16373,7 +16481,7 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 203 || node.kind === 202) && flags & 2) { + else if ((node.kind === 204 || node.kind === 203) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } else if (node.kind === 197 && flags & 2) { @@ -16604,7 +16712,7 @@ var ts; continue; } var currentKind; - if (prop.kind === 217 || prop.kind === 218) { + if (prop.kind === 218 || prop.kind === 219) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 7) { checkGrammarNumbericLiteral(name); @@ -16998,10 +17106,10 @@ var ts; } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { if (node.kind === 197 || + node.kind === 204 || node.kind === 203 || - node.kind === 202 || + node.kind === 210 || node.kind === 209 || - node.kind === 208 || (node.flags & 2)) { return false; } @@ -17029,7 +17137,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 174 || node.parent.kind === 201 || node.parent.kind === 220) { + if (node.parent.kind === 174 || node.parent.kind === 201 || node.parent.kind === 221) { var links = getNodeLinks(node.parent); if (!links.hasReportedStatementInAmbientContext) { return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -17520,7 +17628,7 @@ var ts; ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 202 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 203 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -18260,17 +18368,17 @@ var ts; return emitClassDeclaration(node); case 198: return emitTypeAliasDeclaration(node); - case 219: + case 220: return emitEnumMemberDeclaration(node); case 199: return emitEnumDeclaration(node); case 200: return emitModuleDeclaration(node); - case 202: + case 203: return emitImportEqualsDeclaration(node); - case 208: + case 209: return emitExportAssignment(node); - case 220: + case 221: return emitSourceFile(node); } } @@ -18330,6 +18438,7 @@ var ts; var writeLine = writer.writeLine; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; + var preserveNewLines = compilerOptions.preserveNewLines || false; var currentSourceFile; var lastFrame; var currentScopeNames; @@ -18347,9 +18456,10 @@ var ts; var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfLocalPosition; var detachedCommentsInfo; var emitDetachedComments = compilerOptions.removeComments ? function (node) { } : emitDetachedCommentsAtPosition; - var emitPinnedOrTripleSlashComments = compilerOptions.removeComments ? function (node) { } : emitPinnedOrTripleSlashCommentsOfNode; var writeComment = writeCommentRange; - var emit = emitNode; + var emitNodeWithoutSourceMap = compilerOptions.removeComments ? emitNodeWithoutSourceMapWithoutComments : emitNodeWithoutSourceMapWithComments; + var emit = emitNodeWithoutSourceMap; + var emitWithoutComments = emitNodeWithoutSourceMapWithoutComments; var emitStart = function (node) { }; var emitEnd = function (node) { }; var emitToken = emitTokenText; @@ -18360,18 +18470,22 @@ var ts; initializeEmitterWithSourceMaps(); } if (root) { - emit(root); + emitSourceFile(root); } else { ts.forEach(host.getSourceFiles(), function (sourceFile) { if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emit(sourceFile); + emitSourceFile(sourceFile); } }); } writeLine(); writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); return; + function emitSourceFile(sourceFile) { + currentSourceFile = sourceFile; + emit(sourceFile); + } function enterNameScope() { var names = currentScopeNames; currentScopeNames = undefined; @@ -18398,6 +18512,9 @@ var ts; else { name = ts.generateUniqueName(baseName, function (n) { return isExistingName(location, n); }); } + return recordNameInCurrentScope(name); + } + function recordNameInCurrentScope(name) { if (!currentScopeNames) { currentScopeNames = {}; } @@ -18652,21 +18769,32 @@ var ts; else { sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); } - function emitNodeWithMap(node) { + function emitNodeWithSourceMap(node) { if (node) { - if (node.kind != 220) { + if (ts.nodeIsSynthesized(node)) { + return emitNodeWithoutSourceMap(node); + } + if (node.kind != 221) { recordEmitNodeStartSpan(node); - emitNode(node); + emitNodeWithoutSourceMap(node); recordEmitNodeEndSpan(node); } else { recordNewSourceFileStart(node); - emitNode(node); + emitNodeWithoutSourceMap(node); } } } + function emitNodeWithSourceMapWithoutComments(node) { + if (node) { + recordEmitNodeStartSpan(node); + emitNodeWithoutSourceMapWithoutComments(node); + recordEmitNodeEndSpan(node); + } + } writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithMap; + emit = emitNodeWithSourceMap; + emitWithoutComments = emitNodeWithSourceMapWithoutComments; emitStart = recordEmitNodeStartSpan; emitEnd = recordEmitNodeEndSpan; emitToken = writeTextWithSpanRecord; @@ -18686,6 +18814,7 @@ var ts; name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); tempCount++; } + recordNameInCurrentScope(name); var result = ts.createSynthesizedNode(64); result.text = name; return result; @@ -18747,7 +18876,7 @@ var ts; function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); - if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (preserveNewLines && nodeStartPositionsAreOnSameLine(parent, nodes[0])) { if (spacesBetweenBraces) { write(" "); } @@ -18757,7 +18886,7 @@ var ts; } for (var i = 0, n = nodes.length; i < n; i++) { if (i) { - if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + if (preserveNewLines && nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { write(", "); } else { @@ -18767,12 +18896,11 @@ var ts; } emit(nodes[i]); } - var closeTokenIsOnSameLineAsLastElement = nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes)); if (nodes.hasTrailingComma && allowTrailingComma) { write(","); } decreaseIndent(); - if (closeTokenIsOnSameLineAsLastElement) { + if (preserveNewLines && nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { if (spacesBetweenBraces) { write(" "); } @@ -19012,9 +19140,9 @@ var ts; case 150: case 130: case 129: - case 217: case 218: case 219: + case 220: case 132: case 131: case 195: @@ -19025,11 +19153,11 @@ var ts; case 197: case 199: case 200: - case 202: + case 203: return parent.name === node; case 185: case 184: - case 208: + case 209: return false; case 189: return node.parent.label === node; @@ -19217,9 +19345,9 @@ var ts; } function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { switch (property.kind) { - case 217: - return property.initializer; case 218: + return property.initializer; + case 219: return createIdentifier(resolver.getExpressionNameSubstitution(property.name)); case 132: return createFunctionExpression(property.parameters, property.body); @@ -19273,6 +19401,11 @@ var ts; result.right = right; return result; } + function createExpressionStatement(expression) { + var result = ts.createSynthesizedNode(177); + result.expression = expression; + return result; + } function createMemberAccessForPropertyName(expression, memberName) { if (memberName.kind === 64) { return createPropertyAccessExpression(expression, memberName); @@ -19288,7 +19421,7 @@ var ts; } } function createPropertyAssignment(name, initializer) { - var result = ts.createSynthesizedNode(217); + var result = ts.createSynthesizedNode(218); result.name = name; result.initializer = initializer; return result; @@ -19383,29 +19516,31 @@ var ts; } return false; } - function indentIfOnDifferentLines(parent, node1, node2) { - var isSynthesized = ts.nodeIsSynthesized(parent); - var realNodesAreOnDifferentLines = !isSynthesized && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { + var realNodesAreOnDifferentLines = preserveNewLines && !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { increaseIndent(); writeLine(); return true; } - return false; + else { + if (valueToWriteWhenNotIndenting) { + write(valueToWriteWhenNotIndenting); + } + return false; + } } function emitPropertyAccess(node) { if (tryEmitConstantValue(node)) { return; } emit(node.expression); - var indented = indentIfOnDifferentLines(node, node.expression, node.dotToken); + var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); write("."); - indented = indented || indentIfOnDifferentLines(node, node.dotToken, node.name); + var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); emit(node.name); - if (indented) { - decreaseIndent(); - } + decreaseIndentIf(indentedBeforeDot, indentedAfterDot); } function emitQualifiedName(node) { emit(node.left); @@ -19587,25 +19722,15 @@ var ts; function emitBinaryExpression(node) { if (languageVersion < 2 && node.operatorToken.kind === 52 && (node.left.kind === 152 || node.left.kind === 151)) { - emitDestructuring(node); + emitDestructuring(node, node.parent.kind === 177); } else { emit(node.left); - var indented1 = indentIfOnDifferentLines(node, node.left, node.operatorToken); - if (!indented1 && node.operatorToken.kind !== 23) { - write(" "); - } + var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 23 ? " " : undefined); write(ts.tokenToString(node.operatorToken.kind)); - if (!indented1) { - var indented2 = indentIfOnDifferentLines(node, node.operatorToken, node.right); - } - if (!indented2) { - write(" "); - } + var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); emit(node.right); - if (indented1 || indented2) { - decreaseIndent(); - } + decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); } } function synthesizedNodeStartsOnNewLine(node) { @@ -19613,34 +19738,22 @@ var ts; } function emitConditionalExpression(node) { emit(node.condition); - var indent1 = indentIfOnDifferentLines(node, node.condition, node.questionToken); - if (!indent1) { - write(" "); - } + var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); write("?"); - if (!indent1) { - var indent2 = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue); - } - if (!indent2) { - write(" "); - } + var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); emit(node.whenTrue); - if (indent1 || indent2) { + decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); + var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); + write(":"); + var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); + emit(node.whenFalse); + decreaseIndentIf(indentedBeforeColon, indentedAfterColon); + } + function decreaseIndentIf(value1, value2) { + if (value1) { decreaseIndent(); } - var indent3 = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken); - if (!indent3) { - write(" "); - } - write(":"); - if (!indent3) { - var indent4 = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse); - } - if (!indent4) { - write(" "); - } - emit(node.whenFalse); - if (indent3 || indent4) { + if (value2) { decreaseIndent(); } } @@ -19651,7 +19764,7 @@ var ts; } } function emitBlock(node) { - if (isSingleLineEmptyBlock(node)) { + if (preserveNewLines && isSingleLineEmptyBlock(node)) { emitToken(14, node.pos); write(" "); emitToken(15, node.statements.end); @@ -19773,6 +19886,9 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { + if (languageVersion < 2 && node.kind === 183) { + return emitDownLevelForOfStatement(node); + } var endPos = emitToken(81, node.pos); write(" "); endPos = emitToken(16, endPos); @@ -19798,6 +19914,86 @@ var ts; emitToken(17, node.expression.end); emitEmbeddedStatement(node.statement); } + function emitDownLevelForOfStatement(node) { + var endPos = emitToken(81, node.pos); + write(" "); + endPos = emitToken(16, endPos); + var rhsIsIdentifier = node.expression.kind === 64; + var counter = createTempVariable(node, true); + var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, false); + emitStart(node.expression); + write("var "); + emitNodeWithoutSourceMap(counter); + write(" = 0"); + emitEnd(node.expression); + if (!rhsIsIdentifier) { + write(", "); + emitStart(node.expression); + emitNodeWithoutSourceMap(rhsReference); + write(" = "); + emitNodeWithoutSourceMap(node.expression); + emitEnd(node.expression); + } + write("; "); + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write(" < "); + emitNodeWithoutSourceMap(rhsReference); + write(".length"); + emitEnd(node.initializer); + write("; "); + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write("++"); + emitEnd(node.initializer); + emitToken(17, node.expression.end); + write(" {"); + writeLine(); + increaseIndent(); + var rhsIterationValue = createElementAccessExpression(rhsReference, counter); + emitStart(node.initializer); + if (node.initializer.kind === 194) { + write("var "); + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length > 0) { + var declaration = variableDeclarationList.declarations[0]; + if (ts.isBindingPattern(declaration.name)) { + emitDestructuring(declaration, false, rhsIterationValue); + } + else { + emitNodeWithoutSourceMap(declaration); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + emitNodeWithoutSourceMap(createTempVariable(node, false)); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + var assignmentExpression = createBinaryExpression(node.initializer, 52, rhsIterationValue, false); + if (node.initializer.kind === 151 || node.initializer.kind === 152) { + emitDestructuring(assignmentExpression, true, undefined, node); + } + else { + emitNodeWithoutSourceMap(assignmentExpression); + } + } + emitEnd(node.initializer); + write(";"); + if (node.statement.kind === 174) { + emitLines(node.statement.statements); + } + else { + writeLine(); + emit(node.statement); + } + writeLine(); + decreaseIndent(); + write("}"); + } function emitBreakOrContinueStatement(node) { emitToken(node.kind === 185 ? 65 : 70, node.pos); emitOptional(" ", node.label); @@ -19821,7 +20017,10 @@ var ts; emit(node.expression); endPos = emitToken(17, node.expression.end); write(" "); - emitToken(14, endPos); + emitCaseBlock(node.caseBlock, endPos); + } + function emitCaseBlock(node, startPos) { + emitToken(14, startPos); increaseIndent(); emitLines(node.clauses); decreaseIndent(); @@ -19841,7 +20040,7 @@ var ts; getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 213) { + if (node.kind === 214) { write("case "); emit(node.expression); write(":"); @@ -19849,7 +20048,7 @@ var ts; else { write("default:"); } - if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + if (preserveNewLines && node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -19909,7 +20108,7 @@ var ts; emitContainingModuleName(node); write("."); } - emitNode(node.name); + emitNodeWithoutSourceMap(node.name); emitEnd(node.name); } function createVoidZero() { @@ -19926,21 +20125,22 @@ var ts; emitStart(specifier.name); emitContainingModuleName(specifier); write("."); - emitNode(specifier.name); + emitNodeWithoutSourceMap(specifier.name); emitEnd(specifier.name); write(" = "); - emitNode(name); + emitNodeWithoutSourceMap(name); write(";"); }); } } - function emitDestructuring(root, value) { + function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; var isDeclaration = (root.kind === 193 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 128; if (root.kind === 167) { emitAssignmentExpression(root); } else { + ts.Debug.assert(!isAssignmentExpressionStatement); emitBindingElement(root, value); } function emitAssignment(name, value) { @@ -19959,7 +20159,7 @@ var ts; } function ensureIdentifier(expr) { if (expr.kind !== 64) { - var identifier = createTempVariable(root); + var identifier = createTempVariable(lowestNonSynthesizedAncestor || root); if (!isDeclaration) { recordTempDeclaration(identifier); } @@ -20017,7 +20217,7 @@ var ts; } for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 217 || p.kind === 218) { + if (p.kind === 218 || p.kind === 219) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -20062,7 +20262,7 @@ var ts; function emitAssignmentExpression(root) { var target = root.left; var value = root.right; - if (root.parent.kind === 177) { + if (isAssignmentExpressionStatement) { emitDestructuringAssignment(target, value); } else { @@ -20119,7 +20319,7 @@ var ts; function emitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { if (languageVersion < 2) { - emitDestructuring(node); + emitDestructuring(node, false); } else { emit(node.name); @@ -20127,7 +20327,7 @@ var ts; } } else { - var isLet = renameNonTopLevelLetAndConst(node.name); + renameNonTopLevelLetAndConst(node.name); emitModuleMemberName(node); var initializer = node.initializer; if (!initializer && languageVersion < 2) { @@ -20151,29 +20351,6 @@ var ts; ts.forEach(name.elements, emitExportVariableAssignments); } } - function getEnclosingBlockScopeContainer(node) { - var current = node; - while (current) { - if (ts.isFunctionLike(current)) { - return current; - } - switch (current.kind) { - case 220: - case 91: - case 216: - case 200: - case 181: - case 182: - case 183: - return current; - case 174: - if (!ts.isFunctionLike(current.parent)) { - return current; - } - } - current = current.parent; - } - } function getCombinedFlagsForIdentifier(node) { if (!node.parent || (node.parent.kind !== 193 && node.parent.kind !== 150)) { return 0; @@ -20192,11 +20369,11 @@ var ts; return; } var list = ts.getAncestor(node, 194); - if (list.parent.kind === 175 && list.parent.parent.kind === 220) { + if (list.parent.kind === 175 && list.parent.parent.kind === 221) { return; } - var blockScopeContainer = getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 220 + var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); + var parent = blockScopeContainer.kind === 221 ? blockScopeContainer : blockScopeContainer.parent; var generatedName = generateUniqueNameForLocation(parent, node.text); @@ -20245,7 +20422,7 @@ var ts; if (ts.isBindingPattern(p.name)) { writeLine(); write("var "); - emitDestructuring(p, tempParameters[tempIndex]); + emitDestructuring(p, false, tempParameters[tempIndex]); write(";"); tempIndex++; } @@ -20253,14 +20430,14 @@ var ts; writeLine(); emitStart(p); write("if ("); - emitNode(p.name); + emitNodeWithoutSourceMap(p.name); write(" === void 0)"); emitEnd(p); write(" { "); emitStart(p); - emitNode(p.name); + emitNodeWithoutSourceMap(p.name); write(" = "); - emitNode(p.initializer); + emitNodeWithoutSourceMap(p.initializer); emitEnd(p); write("; }"); } @@ -20276,7 +20453,7 @@ var ts; emitLeadingComments(restParam); emitStart(restParam); write("var "); - emitNode(restParam.name); + emitNodeWithoutSourceMap(restParam.name); write(" = [];"); emitEnd(restParam); emitTrailingComments(restParam); @@ -20297,7 +20474,7 @@ var ts; increaseIndent(); writeLine(); emitStart(restParam); - emitNode(restParam.name); + emitNodeWithoutSourceMap(restParam.name); write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); emitEnd(restParam); decreaseIndent(); @@ -20315,7 +20492,7 @@ var ts; } function emitDeclarationName(node) { if (node.name) { - emitNode(node.name); + emitNodeWithoutSourceMap(node.name); } else { write(resolver.getGeneratedNameForNode(node)); @@ -20432,11 +20609,11 @@ var ts; emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); - if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + if (preserveNewLines && !preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { write(" "); emitStart(body); write("return "); - emitNode(body, true); + emitWithoutComments(body); emitEnd(body); write(";"); emitTempDeclarations(false); @@ -20447,7 +20624,7 @@ var ts; writeLine(); emitLeadingComments(node.body); write("return "); - emit(node.body, true); + emitWithoutComments(node.body); write(";"); emitTrailingComments(node.body); emitTempDeclarations(true); @@ -20469,7 +20646,7 @@ var ts; emitFunctionBodyPreamble(node); decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { for (var i = 0, n = body.statements.length; i < n; i++) { write(" "); emit(body.statements[i]); @@ -20510,7 +20687,7 @@ var ts; emitStart(param); emitStart(param.name); write("this."); - emitNode(param.name); + emitNodeWithoutSourceMap(param.name); emitEnd(param.name); write(" = "); emit(param.name); @@ -20522,7 +20699,7 @@ var ts; function emitMemberAccessForPropertyName(memberName) { if (memberName.kind === 8 || memberName.kind === 7) { write("["); - emitNode(memberName); + emitNodeWithoutSourceMap(memberName); write("]"); } else if (memberName.kind === 126) { @@ -20530,7 +20707,7 @@ var ts; } else { write("."); - emitNode(memberName); + emitNodeWithoutSourceMap(memberName); } } function emitMemberAssignments(node, staticFlag) { @@ -20989,11 +21166,11 @@ var ts; emitStart(specifier); emitContainingModuleName(specifier); write("."); - emitNode(specifier.name); + emitNodeWithoutSourceMap(specifier.name); write(" = "); write(generatedName); write("."); - emitNode(specifier.propertyName || specifier.name); + emitNodeWithoutSourceMap(specifier.propertyName || specifier.name); write(";"); emitEnd(specifier); }); @@ -21011,15 +21188,15 @@ var ts; } } function createExternalImportInfo(node) { - if (node.kind === 202) { - if (node.moduleReference.kind === 212) { + if (node.kind === 203) { + if (node.moduleReference.kind === 213) { return { rootNode: node, declarationNode: node }; } } - else if (node.kind === 203) { + else if (node.kind === 204) { var importClause = node.importClause; if (importClause) { if (importClause.name) { @@ -21028,7 +21205,7 @@ var ts; declarationNode: importClause }; } - if (importClause.namedBindings.kind === 205) { + if (importClause.namedBindings.kind === 206) { return { rootNode: node, declarationNode: importClause.namedBindings @@ -21044,7 +21221,7 @@ var ts; rootNode: node }; } - else if (node.kind === 209) { + else if (node.kind === 210) { if (node.moduleSpecifier) { return { rootNode: node @@ -21057,7 +21234,7 @@ var ts; exportSpecifiers = {}; exportDefault = undefined; ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 209 && !node.moduleSpecifier) { + if (node.kind === 210 && !node.moduleSpecifier) { ts.forEach(node.exportClause.elements, function (specifier) { if (specifier.name.text === "default") { exportDefault = exportDefault || specifier; @@ -21066,7 +21243,7 @@ var ts; (exportSpecifiers[name] || (exportSpecifiers[name] = [])).push(specifier); }); } - else if (node.kind === 208) { + else if (node.kind === 209) { exportDefault = exportDefault || node; } else if (node.kind === 195 || node.kind === 196) { @@ -21096,7 +21273,7 @@ var ts; } function getFirstExportAssignment(sourceFile) { return ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 208) { + if (node.kind === 209) { return node; } }); @@ -21174,10 +21351,10 @@ var ts; writeLine(); emitStart(exportDefault); write(emitAsReturn ? "return " : "module.exports = "); - if (exportDefault.kind === 208) { + if (exportDefault.kind === 209) { emit(exportDefault.expression); } - else if (exportDefault.kind === 211) { + else if (exportDefault.kind === 212) { emit(exportDefault.propertyName); } else { @@ -21201,8 +21378,7 @@ var ts; } return statements.length; } - function emitSourceFile(node) { - currentSourceFile = node; + function emitSourceFileNode(node) { writeLine(); emitDetachedComments(node); var startIndex = emitDirectivePrologues(node.statements, false); @@ -21242,14 +21418,14 @@ var ts; } emitLeadingComments(node.endOfFileToken); } - function emitNode(node, disableComments) { + function emitNodeWithoutSourceMapWithComments(node) { if (!node) { return; } if (node.flags & 2) { return emitPinnedOrTripleSlashComments(node); } - var emitComments = !disableComments && shouldEmitLeadingAndTrailingComments(node); + var emitComments = shouldEmitLeadingAndTrailingComments(node); if (emitComments) { emitLeadingComments(node); } @@ -21258,14 +21434,23 @@ var ts; emitTrailingComments(node); } } + function emitNodeWithoutSourceMapWithoutComments(node) { + if (!node) { + return; + } + if (node.flags & 2) { + return emitPinnedOrTripleSlashComments(node); + } + emitJavaScriptWorker(node); + } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { case 197: case 195: + case 204: case 203: - case 202: case 198: - case 208: + case 209: return false; case 200: return shouldEmitModuleDeclaration(node); @@ -21320,9 +21505,9 @@ var ts; return emitArrayLiteral(node); case 152: return emitObjectLiteral(node); - case 217: - return emitPropertyAssignment(node); case 218: + return emitPropertyAssignment(node); + case 219: return emitShorthandPropertyAssignment(node); case 126: return emitComputedPropertyName(node); @@ -21391,8 +21576,8 @@ var ts; return emitWithStatement(node); case 188: return emitSwitchStatement(node); - case 213: case 214: + case 215: return emitCaseOrDefaultClause(node); case 189: return emitLabelledStatement(node); @@ -21400,7 +21585,7 @@ var ts; return emitThrowStatement(node); case 191: return emitTryStatement(node); - case 216: + case 217: return emitCatchClause(node); case 192: return emitDebuggerStatement(node); @@ -21412,18 +21597,18 @@ var ts; return emitInterfaceDeclaration(node); case 199: return emitEnumDeclaration(node); - case 219: + case 220: return emitEnumMember(node); case 200: return emitModuleDeclaration(node); - case 203: + case 204: return emitImportDeclaration(node); - case 202: + case 203: return emitImportEqualsDeclaration(node); - case 209: + case 210: return emitExportDeclaration(node); - case 220: - return emitSourceFile(node); + case 221: + return emitSourceFileNode(node); } } function hasDetachedComments(pos) { @@ -21441,7 +21626,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 220 || node.pos !== node.parent.pos) { + if (node.parent.kind === 221 || node.pos !== node.parent.pos) { var leadingComments; if (hasDetachedComments(node.pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -21460,7 +21645,7 @@ var ts; } function emitTrailingDeclarationComments(node) { if (node.parent) { - if (node.parent.kind === 220 || node.end !== node.parent.end) { + if (node.parent.kind === 221 || node.end !== node.parent.end) { var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); } @@ -21510,7 +21695,7 @@ var ts; } } } - function emitPinnedOrTripleSlashCommentsOfNode(node) { + function emitPinnedOrTripleSlashComments(node) { var pinnedComments = ts.filter(getLeadingCommentsToEmit(node), isPinnedOrTripleSlashComment); function isPinnedOrTripleSlashComment(comment) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { @@ -21556,6 +21741,7 @@ var ts; (function (ts) { ts.emitTime = 0; ts.ioReadTime = 0; + ts.version = "1.5.0.0"; function createCompilerHost(options) { var currentDirectory; var existingDirectories = {}; @@ -21846,7 +22032,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 203 || node.kind === 202 || node.kind === 209) { + if (node.kind === 204 || node.kind === 203 || node.kind === 210) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8) { var moduleNameText = moduleNameExpr.text; @@ -22087,6 +22273,12 @@ var ts; description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, experimental: true }, + { + name: "preserveNewLines", + type: "boolean", + description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, + experimental: true + }, { name: "target", shortName: "t", @@ -22289,7 +22481,6 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var version = "1.5.0.0"; function validateLocaleAndSetLanguage(locale, errors) { var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); if (!matchResult) { @@ -22424,7 +22615,7 @@ var ts; return ts.sys.exit(1); } if (commandLine.options.version) { - reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Version_0, version)); + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Version_0, ts.version)); return ts.sys.exit(0); } if (commandLine.options.help) { @@ -22600,13 +22791,13 @@ var ts; return 1; } if (diagnostics.length > 0 || emitOutput.diagnostics.length > 0) { - 2; + return 2; } return 0; } } function printVersion() { - ts.sys.write(getDiagnosticText(ts.Diagnostics.Version_0, version) + ts.sys.newLine); + ts.sys.write(getDiagnosticText(ts.Diagnostics.Version_0, ts.version) + ts.sys.newLine); } function printHelp() { var output = ""; diff --git a/bin/tsserver.js b/bin/tsserver.js index 3c4c266cb70..65a06ca9928 100644 --- a/bin/tsserver.js +++ b/bin/tsserver.js @@ -244,18 +244,21 @@ var ts; ts.arrayToMap = arrayToMap; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); + return text.replace(/{(\d+)}/g, function (match, index) { + return args[+index + baseIndex]; + }); } ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { - return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] - ? ts.localizedDiagnosticMessages[message] - : message; + return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] ? ts.localizedDiagnosticMessages[message] : message; } ts.getLocaleSpecificMessage = getLocaleSpecificMessage; function createFileDiagnostic(file, start, length, message) { + var end = start + length; Debug.assert(start >= 0, "start must be non-negative, is " + start); Debug.assert(length >= 0, "length must be non-negative, is " + length); + Debug.assert(start <= file.text.length, "start must be within the bounds of the file. " + start + " > " + file.text.length); + Debug.assert(end <= file.text.length, "end must be the bounds of the file. " + end + " > " + file.text.length); var text = getLocaleSpecificMessage(message.key); if (arguments.length > 4) { text = formatStringFromArgs(text, arguments, 4); @@ -318,12 +321,7 @@ var ts; return diagnostic.file ? diagnostic.file.fileName : undefined; } function compareDiagnostics(d1, d2) { - return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || - compareValues(d1.start, d2.start) || - compareValues(d1.length, d2.length) || - compareValues(d1.code, d2.code) || - compareMessageText(d1.messageText, d2.messageText) || - 0; + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0; } ts.compareDiagnostics = compareDiagnostics; function compareMessageText(text1, text2) { @@ -350,7 +348,9 @@ var ts; if (diagnostics.length < 2) { return diagnostics; } - var newDiagnostics = [diagnostics[0]]; + var newDiagnostics = [ + diagnostics[0] + ]; var previousDiagnostic = diagnostics[0]; for (var i = 1; i < diagnostics.length; i++) { var currentDiagnostic = diagnostics[i]; @@ -427,7 +427,9 @@ var ts; ts.isRootedDiskPath = isRootedDiskPath; function normalizedPathComponents(path, rootLength) { var normalizedParts = getNormalizedParts(path, rootLength); - return [path.substr(0, rootLength)].concat(normalizedParts); + return [ + path.substr(0, rootLength) + ].concat(normalizedParts); } function getNormalizedPathComponents(path, currentDirectory) { var path = normalizeSlashes(path); @@ -461,7 +463,9 @@ var ts; } } if (rootLength === urlLength) { - return [url]; + return [ + url + ]; } var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); if (indexOfNextSlash !== -1) { @@ -469,7 +473,9 @@ var ts; return normalizedPathComponents(url, rootLength); } else { - return [url + ts.directorySeparator]; + return [ + url + ts.directorySeparator + ]; } } function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { @@ -531,7 +537,11 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [".d.ts", ".ts", ".js"]; + var supportedExtensions = [ + ".d.ts", + ".ts", + ".js" + ]; function removeFileExtension(path) { for (var i = 0; i < supportedExtensions.length; i++) { var ext = supportedExtensions[i]; @@ -585,9 +595,15 @@ var ts; }; return Node; }, - getSymbolConstructor: function () { return Symbol; }, - getTypeConstructor: function () { return Type; }, - getSignatureConstructor: function () { return Signature; } + getSymbolConstructor: function () { + return Symbol; + }, + getTypeConstructor: function () { + return Type; + }, + getSignatureConstructor: function () { + return Signature; + } }; var Debug; (function (Debug) { @@ -805,9 +821,14 @@ var ts; readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { - _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + _fs.watchFile(fileName, { + persistent: true, + interval: 250 + }, fileChanged); return { - close: function () { _fs.unwatchFile(fileName, fileChanged); } + close: function () { + _fs.unwatchFile(fileName, fileChanged); + } }; function fileChanged(curr, prev) { if (+curr.mtime <= +prev.mtime) { @@ -863,488 +884,2431 @@ var ts; var ts; (function (ts) { ts.Diagnostics = { - Unterminated_string_literal: { code: 1002, category: 1, key: "Unterminated string literal." }, - Identifier_expected: { code: 1003, category: 1, key: "Identifier expected." }, - _0_expected: { code: 1005, category: 1, key: "'{0}' expected." }, - A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1, key: "A file cannot have a reference to itself." }, - Trailing_comma_not_allowed: { code: 1009, category: 1, key: "Trailing comma not allowed." }, - Asterisk_Slash_expected: { code: 1010, category: 1, key: "'*/' expected." }, - Unexpected_token: { code: 1012, category: 1, key: "Unexpected token." }, - A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1, key: "A rest parameter must be last in a parameter list." }, - Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1, key: "Parameter cannot have question mark and initializer." }, - A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1, key: "A required parameter cannot follow an optional parameter." }, - An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1, key: "An index signature cannot have a rest parameter." }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1, key: "An index signature parameter cannot have an accessibility modifier." }, - An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1, key: "An index signature parameter cannot have a question mark." }, - An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1, key: "An index signature parameter cannot have an initializer." }, - An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1, key: "An index signature must have a type annotation." }, - An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1, key: "An index signature parameter must have a type annotation." }, - An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1, key: "An index signature parameter type must be 'string' or 'number'." }, - A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1, key: "A class or interface declaration can only have one 'extends' clause." }, - An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1, key: "An 'extends' clause must precede an 'implements' clause." }, - A_class_can_only_extend_a_single_class: { code: 1026, category: 1, key: "A class can only extend a single class." }, - A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1, key: "A class declaration can only have one 'implements' clause." }, - Accessibility_modifier_already_seen: { code: 1028, category: 1, key: "Accessibility modifier already seen." }, - _0_modifier_must_precede_1_modifier: { code: 1029, category: 1, key: "'{0}' modifier must precede '{1}' modifier." }, - _0_modifier_already_seen: { code: 1030, category: 1, key: "'{0}' modifier already seen." }, - _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1, key: "'{0}' modifier cannot appear on a class element." }, - An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1, key: "An interface declaration cannot have an 'implements' clause." }, - super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1, key: "'super' must be followed by an argument list or member access." }, - Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1, key: "Only ambient modules can use quoted names." }, - Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1, key: "Statements are not allowed in ambient contexts." }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1, key: "A 'declare' modifier cannot be used in an already ambient context." }, - Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1, key: "Initializers are not allowed in ambient contexts." }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1, key: "'{0}' modifier cannot appear on a module element." }, - A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1, key: "A 'declare' modifier cannot be used with an interface declaration." }, - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, - A_rest_parameter_cannot_be_optional: { code: 1047, category: 1, key: "A rest parameter cannot be optional." }, - A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1, key: "A rest parameter cannot have an initializer." }, - A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1, key: "A 'set' accessor must have exactly one parameter." }, - A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1, key: "A 'set' accessor cannot have an optional parameter." }, - A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1, key: "A 'set' accessor parameter cannot have an initializer." }, - A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1, key: "A 'set' accessor cannot have rest parameter." }, - A_get_accessor_cannot_have_parameters: { code: 1054, category: 1, key: "A 'get' accessor cannot have parameters." }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, - Enum_member_must_have_initializer: { code: 1061, category: 1, key: "Enum member must have initializer." }, - An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1, key: "An export assignment cannot be used in an internal module." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1, key: "Ambient enum elements can only have integer literal initializers." }, - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, - A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1, key: "A 'declare' modifier cannot be used with an import declaration." }, - Invalid_reference_directive_syntax: { code: 1084, category: 1, key: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, - An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1, key: "An accessor cannot be declared in an ambient context." }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1, key: "'{0}' modifier cannot appear on a constructor declaration." }, - _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1, key: "'{0}' modifier cannot appear on a parameter." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1, key: "Type parameters cannot appear on a constructor declaration." }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1, key: "Type annotation cannot appear on a constructor declaration." }, - An_accessor_cannot_have_type_parameters: { code: 1094, category: 1, key: "An accessor cannot have type parameters." }, - A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1, key: "A 'set' accessor cannot have a return type annotation." }, - An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1, key: "An index signature must have exactly one parameter." }, - _0_list_cannot_be_empty: { code: 1097, category: 1, key: "'{0}' list cannot be empty." }, - Type_parameter_list_cannot_be_empty: { code: 1098, category: 1, key: "Type parameter list cannot be empty." }, - Type_argument_list_cannot_be_empty: { code: 1099, category: 1, key: "Type argument list cannot be empty." }, - Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1, key: "Invalid use of '{0}' in strict mode." }, - with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1, key: "'with' statements are not allowed in strict mode." }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1, key: "'delete' cannot be called on an identifier in strict mode." }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, - Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1, key: "Jump target cannot cross function boundary." }, - A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1, key: "A 'return' statement can only be used within a function body." }, - Expression_expected: { code: 1109, category: 1, key: "Expression expected." }, - Type_expected: { code: 1110, category: 1, key: "Type expected." }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: 1, key: "A class member cannot be declared optional." }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: 1, key: "Duplicate label '{0}'" }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1, key: "A 'break' statement can only jump to a label of an enclosing statement." }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1, key: "An object literal cannot have multiple properties with the same name in strict mode." }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1, key: "An object literal cannot have multiple get/set accessors with the same name." }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1, key: "An object literal cannot have property and accessor with the same name." }, - An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1, key: "An export assignment cannot have modifiers." }, - Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1, key: "Octal literals are not allowed in strict mode." }, - A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1, key: "A tuple type element list cannot be empty." }, - Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1, key: "Variable declaration list cannot be empty." }, - Digit_expected: { code: 1124, category: 1, key: "Digit expected." }, - Hexadecimal_digit_expected: { code: 1125, category: 1, key: "Hexadecimal digit expected." }, - Unexpected_end_of_text: { code: 1126, category: 1, key: "Unexpected end of text." }, - Invalid_character: { code: 1127, category: 1, key: "Invalid character." }, - Declaration_or_statement_expected: { code: 1128, category: 1, key: "Declaration or statement expected." }, - Statement_expected: { code: 1129, category: 1, key: "Statement expected." }, - case_or_default_expected: { code: 1130, category: 1, key: "'case' or 'default' expected." }, - Property_or_signature_expected: { code: 1131, category: 1, key: "Property or signature expected." }, - Enum_member_expected: { code: 1132, category: 1, key: "Enum member expected." }, - Type_reference_expected: { code: 1133, category: 1, key: "Type reference expected." }, - Variable_declaration_expected: { code: 1134, category: 1, key: "Variable declaration expected." }, - Argument_expression_expected: { code: 1135, category: 1, key: "Argument expression expected." }, - Property_assignment_expected: { code: 1136, category: 1, key: "Property assignment expected." }, - Expression_or_comma_expected: { code: 1137, category: 1, key: "Expression or comma expected." }, - Parameter_declaration_expected: { code: 1138, category: 1, key: "Parameter declaration expected." }, - Type_parameter_declaration_expected: { code: 1139, category: 1, key: "Type parameter declaration expected." }, - Type_argument_expected: { code: 1140, category: 1, key: "Type argument expected." }, - String_literal_expected: { code: 1141, category: 1, key: "String literal expected." }, - Line_break_not_permitted_here: { code: 1142, category: 1, key: "Line break not permitted here." }, - or_expected: { code: 1144, category: 1, key: "'{' or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1, key: "Modifiers not permitted on index signature members." }, - Declaration_expected: { code: 1146, category: 1, key: "Declaration expected." }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1, key: "Import declarations in an internal module cannot reference an external module." }, - Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1, key: "Cannot compile external modules unless the '--module' flag is provided." }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: 1, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - var_let_or_const_expected: { code: 1152, category: 1, key: "'var', 'let' or 'const' expected." }, - let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_must_be_initialized: { code: 1155, category: 1, key: "'const' declarations must be initialized" }, - const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1, key: "'const' declarations can only be declared inside a block." }, - let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1, key: "'let' declarations can only be declared inside a block." }, - Unterminated_template_literal: { code: 1160, category: 1, key: "Unterminated template literal." }, - Unterminated_regular_expression_literal: { code: 1161, category: 1, key: "Unterminated regular expression literal." }, - An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, - yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, - Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, - A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, - Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, - A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, - A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, - extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, - extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, - Classes_can_only_extend_a_single_class: { code: 1174, category: 1, key: "Classes can only extend a single class." }, - implements_clause_already_seen: { code: 1175, category: 1, key: "'implements' clause already seen." }, - Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1, key: "Interface declaration cannot have 'implements' clause." }, - Binary_digit_expected: { code: 1177, category: 1, key: "Binary digit expected." }, - Octal_digit_expected: { code: 1178, category: 1, key: "Octal digit expected." }, - Unexpected_token_expected: { code: 1179, category: 1, key: "Unexpected token. '{' expected." }, - Property_destructuring_pattern_expected: { code: 1180, category: 1, key: "Property destructuring pattern expected." }, - Array_element_destructuring_pattern_expected: { code: 1181, category: 1, key: "Array element destructuring pattern expected." }, - A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: 1, key: "A destructuring declaration must have an initializer." }, - Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: 1, key: "Destructuring declarations are not allowed in ambient contexts." }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: 1, key: "An implementation cannot be declared in ambient contexts." }, - Modifiers_cannot_appear_here: { code: 1184, category: 1, key: "Modifiers cannot appear here." }, - Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, - A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, - A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, - The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, - The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, - An_import_declaration_cannot_have_modifiers: { code: 1191, category: 1, key: "An import declaration cannot have modifiers." }, - External_module_0_has_no_default_export_or_export_assignment: { code: 1192, category: 1, key: "External module '{0}' has no default export or export assignment." }, - An_export_declaration_cannot_have_modifiers: { code: 1193, category: 1, key: "An export declaration cannot have modifiers." }, - Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: 1, key: "Export declarations are not permitted in an internal module." }, - Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: 1, key: "Catch clause variable name must be an identifier." }, - Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: 1, key: "Catch clause variable cannot have a type annotation." }, - Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: 1, key: "Catch clause variable cannot have an initializer." }, - An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: 1, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, - Unterminated_Unicode_escape_sequence: { code: 1199, category: 1, key: "Unterminated Unicode escape sequence." }, - Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, - Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1, key: "Static members cannot reference class type parameters." }, - Circular_definition_of_import_alias_0: { code: 2303, category: 1, key: "Circular definition of import alias '{0}'." }, - Cannot_find_name_0: { code: 2304, category: 1, key: "Cannot find name '{0}'." }, - Module_0_has_no_exported_member_1: { code: 2305, category: 1, key: "Module '{0}' has no exported member '{1}'." }, - File_0_is_not_an_external_module: { code: 2306, category: 1, key: "File '{0}' is not an external module." }, - Cannot_find_external_module_0: { code: 2307, category: 1, key: "Cannot find external module '{0}'." }, - A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1, key: "A module cannot have more than one export assignment." }, - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1, key: "An export assignment cannot be used in a module with other exported elements." }, - Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1, key: "Type '{0}' recursively references itself as a base type." }, - A_class_may_only_extend_another_class: { code: 2311, category: 1, key: "A class may only extend another class." }, - An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1, key: "An interface may only extend a class or another interface." }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, - Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1, key: "Generic type '{0}' requires {1} type argument(s)." }, - Type_0_is_not_generic: { code: 2315, category: 1, key: "Type '{0}' is not generic." }, - Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, - Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, - Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, - Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, - Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, - Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, - Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, - Property_0_is_missing_in_type_1: { code: 2324, category: 1, key: "Property '{0}' is missing in type '{1}'." }, - Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, - Types_of_property_0_are_incompatible: { code: 2326, category: 1, key: "Types of property '{0}' are incompatible." }, - Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, - Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1, key: "Types of parameters '{0}' and '{1}' are incompatible." }, - Index_signature_is_missing_in_type_0: { code: 2329, category: 1, key: "Index signature is missing in type '{0}'." }, - Index_signatures_are_incompatible: { code: 2330, category: 1, key: "Index signatures are incompatible." }, - this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1, key: "'this' cannot be referenced in a module body." }, - this_cannot_be_referenced_in_current_location: { code: 2332, category: 1, key: "'this' cannot be referenced in current location." }, - this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1, key: "'this' cannot be referenced in constructor arguments." }, - this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1, key: "'this' cannot be referenced in a static property initializer." }, - super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1, key: "'super' can only be referenced in a derived class." }, - super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1, key: "'super' cannot be referenced in constructor arguments." }, - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, - Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, - Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, - Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, - Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, - Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1, key: "Untyped function calls may not accept type arguments." }, - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1, key: "Cannot invoke an expression whose type lacks a call signature." }, - Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1, key: "Only a void function can be called with the 'new' keyword." }, - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, - No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1, key: "No best common type exists among return expressions." }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1, key: "Invalid left-hand side of assignment expression." }, - Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: 1, key: "Type parameter name cannot be '{0}'" }, - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1, key: "A parameter property is only allowed in a constructor implementation." }, - A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1, key: "A rest parameter must be of an array type." }, - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1, key: "A parameter initializer is only allowed in a function or constructor implementation." }, - Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1, key: "Parameter '{0}' cannot be referenced in its initializer." }, - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, - Duplicate_string_index_signature: { code: 2374, category: 1, key: "Duplicate string index signature." }, - Duplicate_number_index_signature: { code: 2375, category: 1, key: "Duplicate number index signature." }, - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, - Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1, key: "Constructors for derived classes must contain a 'super' call." }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, - Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1, key: "Getter and setter accessors do not agree in visibility." }, - get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1, key: "'get' and 'set' accessor must have the same type." }, - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1, key: "A signature with an implementation cannot use a string literal type." }, - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1, key: "Specialized overload signature is not assignable to any non-specialized signature." }, - Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1, key: "Overload signatures must all be exported or not exported." }, - Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1, key: "Overload signatures must all be ambient or non-ambient." }, - Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1, key: "Overload signatures must all be public, private or protected." }, - Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1, key: "Overload signatures must all be optional or required." }, - Function_overload_must_be_static: { code: 2387, category: 1, key: "Function overload must be static." }, - Function_overload_must_not_be_static: { code: 2388, category: 1, key: "Function overload must not be static." }, - Function_implementation_name_must_be_0: { code: 2389, category: 1, key: "Function implementation name must be '{0}'." }, - Constructor_implementation_is_missing: { code: 2390, category: 1, key: "Constructor implementation is missing." }, - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1, key: "Function implementation is missing or not immediately following the declaration." }, - Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1, key: "Multiple constructor implementations are not allowed." }, - Duplicate_function_implementation: { code: 2393, category: 1, key: "Duplicate function implementation." }, - Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1, key: "Overload signature is not compatible with function implementation." }, - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, - Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1, key: "Invalid left-hand side in 'for...in' statement." }, - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, - Setters_cannot_return_a_value: { code: 2408, category: 1, key: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1, key: "Return type of constructor signature must be assignable to the instance type of the class" }, - All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1, key: "All symbols within a 'with' block will be resolved to 'any'." }, - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: 1, key: "Class name cannot be '{0}'" }, - Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1, key: "Class '{0}' incorrectly extends base class '{1}'." }, - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, - Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1, key: "Class '{0}' incorrectly implements interface '{1}'." }, - A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1, key: "A class may only implement another class or interface." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: 1, key: "Interface name cannot be '{0}'" }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1, key: "All declarations of an interface must have identical type parameters." }, - Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1, key: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: 1, key: "Enum name cannot be '{0}'" }, - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, - A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, - Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1, key: "Ambient external modules cannot be nested in other modules." }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1, key: "Ambient external module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1, key: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: 1, key: "Import name cannot be '{0}'" }, - Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1, key: "Import declaration conflicts with local declaration of '{0}'" }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, - Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1, key: "Types have separate declarations of a private property '{0}'." }, - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, - Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, - Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1, key: "Block-scoped variable '{0}' used before its declaration." }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1, key: "The operand of an increment or decrement operator cannot be a constant." }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1, key: "Left-hand side of assignment expression cannot be a constant." }, - Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1, key: "Cannot redeclare block-scoped variable '{0}'." }, - An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1, key: "An enum member cannot have a numeric name." }, - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, - Type_alias_0_circularly_references_itself: { code: 2456, category: 1, key: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: 1, key: "Type alias name cannot be '{0}'" }, - An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1, key: "An AMD module cannot have multiple name assignments." }, - Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: 1, key: "Type '{0}' has no property '{1}' and no string index signature." }, - Type_0_has_no_property_1: { code: 2460, category: 1, key: "Type '{0}' has no property '{1}'." }, - Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, - this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, - super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, - Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, - The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, - Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, - A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, - for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: 1, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, - The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, - Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: 1, key: "Export declaration conflicts with exported declaration of '{0}'" }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: 1, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, - Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: 1, key: "Invalid left-hand side in 'for...of' statement." }, - The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: 1, key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." }, - The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { code: 2489, category: 1, key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." }, - The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: 1, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, - Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: 1, key: "Cannot redeclare identifier '{0}' in catch clause" }, - Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, - Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1, key: "Exported variable '{0}' has or is using private name '{1}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, - Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1, key: "Return type of public static method from exported class has or is using private name '{0}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1, key: "Return type of public method from exported class has or is using private name '{0}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1, key: "Return type of method from exported interface has or is using private name '{0}'." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, - Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1, key: "Return type of exported function has or is using private name '{0}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, - Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { code: 4091, category: 1, key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." }, - The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, - Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: 1, key: "Unsupported file encoding." }, - Unknown_compiler_option_0: { code: 5023, category: 1, key: "Unknown compiler option '{0}'." }, - Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1, key: "Compiler option '{0}' requires a value of type {1}." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: 1, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: 1, key: "Option 'project' cannot be mixed with source files on a command line." }, - Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2, key: "Concatenate and emit output to single file." }, - Generates_corresponding_d_ts_file: { code: 6002, category: 2, key: "Generates corresponding '.d.ts' file." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2, key: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, - Watch_input_files: { code: 6005, category: 2, key: "Watch input files." }, - Redirect_output_structure_to_the_directory: { code: 6006, category: 2, key: "Redirect output structure to the directory." }, - Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2, key: "Do not emit outputs if any type checking errors were reported." }, - Do_not_emit_comments_to_output: { code: 6009, category: 2, key: "Do not emit comments to output." }, - Do_not_emit_outputs: { code: 6010, category: 2, key: "Do not emit outputs." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2, key: "Specify module code generation: 'commonjs' or 'amd'" }, - Print_this_message: { code: 6017, category: 2, key: "Print this message." }, - Print_the_compiler_s_version: { code: 6019, category: 2, key: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: 2, key: "Compile the project in the given directory." }, - Syntax_Colon_0: { code: 6023, category: 2, key: "Syntax: {0}" }, - options: { code: 6024, category: 2, key: "options" }, - file: { code: 6025, category: 2, key: "file" }, - Examples_Colon_0: { code: 6026, category: 2, key: "Examples: {0}" }, - Options_Colon: { code: 6027, category: 2, key: "Options:" }, - Version_0: { code: 6029, category: 2, key: "Version {0}" }, - Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2, key: "Insert command line options and files from a file." }, - File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2, key: "File change detected. Starting incremental compilation..." }, - KIND: { code: 6034, category: 2, key: "KIND" }, - FILE: { code: 6035, category: 2, key: "FILE" }, - VERSION: { code: 6036, category: 2, key: "VERSION" }, - LOCATION: { code: 6037, category: 2, key: "LOCATION" }, - DIRECTORY: { code: 6038, category: 2, key: "DIRECTORY" }, - Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2, key: "Compilation complete. Watching for file changes." }, - Generates_corresponding_map_file: { code: 6043, category: 2, key: "Generates corresponding '.map' file." }, - Compiler_option_0_expects_an_argument: { code: 6044, category: 1, key: "Compiler option '{0}' expects an argument." }, - Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, - Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, - Unsupported_locale_0: { code: 6049, category: 1, key: "Unsupported locale '{0}'." }, - Unable_to_open_file_0: { code: 6050, category: 1, key: "Unable to open file '{0}'." }, - Corrupted_locale_file_0: { code: 6051, category: 1, key: "Corrupted locale file {0}." }, - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2, key: "Raise error on expressions and declarations with an implied 'any' type." }, - File_0_not_found: { code: 6053, category: 1, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: 2, key: "Do not emit declarations for code that has an '@internal' annotation." }, - Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1, key: "Variable '{0}' implicitly has an '{1}' type." }, - Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1, key: "Parameter '{0}' implicitly has an '{1}' type." }, - Member_0_implicitly_has_an_1_type: { code: 7008, category: 1, key: "Member '{0}' implicitly has an '{1}' type." }, - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, - Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1, key: "Index signature of object type implicitly has an 'any' type." }, - Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, - Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, - _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - You_cannot_rename_this_element: { code: 8000, category: 1, key: "You cannot rename this element." }, - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, - yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, - Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." } + Unterminated_string_literal: { + code: 1002, + category: 1, + key: "Unterminated string literal." + }, + Identifier_expected: { + code: 1003, + category: 1, + key: "Identifier expected." + }, + _0_expected: { + code: 1005, + category: 1, + key: "'{0}' expected." + }, + A_file_cannot_have_a_reference_to_itself: { + code: 1006, + category: 1, + key: "A file cannot have a reference to itself." + }, + Trailing_comma_not_allowed: { + code: 1009, + category: 1, + key: "Trailing comma not allowed." + }, + Asterisk_Slash_expected: { + code: 1010, + category: 1, + key: "'*/' expected." + }, + Unexpected_token: { + code: 1012, + category: 1, + key: "Unexpected token." + }, + A_rest_parameter_must_be_last_in_a_parameter_list: { + code: 1014, + category: 1, + key: "A rest parameter must be last in a parameter list." + }, + Parameter_cannot_have_question_mark_and_initializer: { + code: 1015, + category: 1, + key: "Parameter cannot have question mark and initializer." + }, + A_required_parameter_cannot_follow_an_optional_parameter: { + code: 1016, + category: 1, + key: "A required parameter cannot follow an optional parameter." + }, + An_index_signature_cannot_have_a_rest_parameter: { + code: 1017, + category: 1, + key: "An index signature cannot have a rest parameter." + }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { + code: 1018, + category: 1, + key: "An index signature parameter cannot have an accessibility modifier." + }, + An_index_signature_parameter_cannot_have_a_question_mark: { + code: 1019, + category: 1, + key: "An index signature parameter cannot have a question mark." + }, + An_index_signature_parameter_cannot_have_an_initializer: { + code: 1020, + category: 1, + key: "An index signature parameter cannot have an initializer." + }, + An_index_signature_must_have_a_type_annotation: { + code: 1021, + category: 1, + key: "An index signature must have a type annotation." + }, + An_index_signature_parameter_must_have_a_type_annotation: { + code: 1022, + category: 1, + key: "An index signature parameter must have a type annotation." + }, + An_index_signature_parameter_type_must_be_string_or_number: { + code: 1023, + category: 1, + key: "An index signature parameter type must be 'string' or 'number'." + }, + A_class_or_interface_declaration_can_only_have_one_extends_clause: { + code: 1024, + category: 1, + key: "A class or interface declaration can only have one 'extends' clause." + }, + An_extends_clause_must_precede_an_implements_clause: { + code: 1025, + category: 1, + key: "An 'extends' clause must precede an 'implements' clause." + }, + A_class_can_only_extend_a_single_class: { + code: 1026, + category: 1, + key: "A class can only extend a single class." + }, + A_class_declaration_can_only_have_one_implements_clause: { + code: 1027, + category: 1, + key: "A class declaration can only have one 'implements' clause." + }, + Accessibility_modifier_already_seen: { + code: 1028, + category: 1, + key: "Accessibility modifier already seen." + }, + _0_modifier_must_precede_1_modifier: { + code: 1029, + category: 1, + key: "'{0}' modifier must precede '{1}' modifier." + }, + _0_modifier_already_seen: { + code: 1030, + category: 1, + key: "'{0}' modifier already seen." + }, + _0_modifier_cannot_appear_on_a_class_element: { + code: 1031, + category: 1, + key: "'{0}' modifier cannot appear on a class element." + }, + An_interface_declaration_cannot_have_an_implements_clause: { + code: 1032, + category: 1, + key: "An interface declaration cannot have an 'implements' clause." + }, + super_must_be_followed_by_an_argument_list_or_member_access: { + code: 1034, + category: 1, + key: "'super' must be followed by an argument list or member access." + }, + Only_ambient_modules_can_use_quoted_names: { + code: 1035, + category: 1, + key: "Only ambient modules can use quoted names." + }, + Statements_are_not_allowed_in_ambient_contexts: { + code: 1036, + category: 1, + key: "Statements are not allowed in ambient contexts." + }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { + code: 1038, + category: 1, + key: "A 'declare' modifier cannot be used in an already ambient context." + }, + Initializers_are_not_allowed_in_ambient_contexts: { + code: 1039, + category: 1, + key: "Initializers are not allowed in ambient contexts." + }, + _0_modifier_cannot_appear_on_a_module_element: { + code: 1044, + category: 1, + key: "'{0}' modifier cannot appear on a module element." + }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { + code: 1045, + category: 1, + key: "A 'declare' modifier cannot be used with an interface declaration." + }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { + code: 1046, + category: 1, + key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." + }, + A_rest_parameter_cannot_be_optional: { + code: 1047, + category: 1, + key: "A rest parameter cannot be optional." + }, + A_rest_parameter_cannot_have_an_initializer: { + code: 1048, + category: 1, + key: "A rest parameter cannot have an initializer." + }, + A_set_accessor_must_have_exactly_one_parameter: { + code: 1049, + category: 1, + key: "A 'set' accessor must have exactly one parameter." + }, + A_set_accessor_cannot_have_an_optional_parameter: { + code: 1051, + category: 1, + key: "A 'set' accessor cannot have an optional parameter." + }, + A_set_accessor_parameter_cannot_have_an_initializer: { + code: 1052, + category: 1, + key: "A 'set' accessor parameter cannot have an initializer." + }, + A_set_accessor_cannot_have_rest_parameter: { + code: 1053, + category: 1, + key: "A 'set' accessor cannot have rest parameter." + }, + A_get_accessor_cannot_have_parameters: { + code: 1054, + category: 1, + key: "A 'get' accessor cannot have parameters." + }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { + code: 1056, + category: 1, + key: "Accessors are only available when targeting ECMAScript 5 and higher." + }, + Enum_member_must_have_initializer: { + code: 1061, + category: 1, + key: "Enum member must have initializer." + }, + An_export_assignment_cannot_be_used_in_an_internal_module: { + code: 1063, + category: 1, + key: "An export assignment cannot be used in an internal module." + }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { + code: 1066, + category: 1, + key: "Ambient enum elements can only have integer literal initializers." + }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { + code: 1068, + category: 1, + key: "Unexpected token. A constructor, method, accessor, or property was expected." + }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { + code: 1079, + category: 1, + key: "A 'declare' modifier cannot be used with an import declaration." + }, + Invalid_reference_directive_syntax: { + code: 1084, + category: 1, + key: "Invalid 'reference' directive syntax." + }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { + code: 1085, + category: 1, + key: "Octal literals are not available when targeting ECMAScript 5 and higher." + }, + An_accessor_cannot_be_declared_in_an_ambient_context: { + code: 1086, + category: 1, + key: "An accessor cannot be declared in an ambient context." + }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { + code: 1089, + category: 1, + key: "'{0}' modifier cannot appear on a constructor declaration." + }, + _0_modifier_cannot_appear_on_a_parameter: { + code: 1090, + category: 1, + key: "'{0}' modifier cannot appear on a parameter." + }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { + code: 1091, + category: 1, + key: "Only a single variable declaration is allowed in a 'for...in' statement." + }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { + code: 1092, + category: 1, + key: "Type parameters cannot appear on a constructor declaration." + }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { + code: 1093, + category: 1, + key: "Type annotation cannot appear on a constructor declaration." + }, + An_accessor_cannot_have_type_parameters: { + code: 1094, + category: 1, + key: "An accessor cannot have type parameters." + }, + A_set_accessor_cannot_have_a_return_type_annotation: { + code: 1095, + category: 1, + key: "A 'set' accessor cannot have a return type annotation." + }, + An_index_signature_must_have_exactly_one_parameter: { + code: 1096, + category: 1, + key: "An index signature must have exactly one parameter." + }, + _0_list_cannot_be_empty: { + code: 1097, + category: 1, + key: "'{0}' list cannot be empty." + }, + Type_parameter_list_cannot_be_empty: { + code: 1098, + category: 1, + key: "Type parameter list cannot be empty." + }, + Type_argument_list_cannot_be_empty: { + code: 1099, + category: 1, + key: "Type argument list cannot be empty." + }, + Invalid_use_of_0_in_strict_mode: { + code: 1100, + category: 1, + key: "Invalid use of '{0}' in strict mode." + }, + with_statements_are_not_allowed_in_strict_mode: { + code: 1101, + category: 1, + key: "'with' statements are not allowed in strict mode." + }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { + code: 1102, + category: 1, + key: "'delete' cannot be called on an identifier in strict mode." + }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { + code: 1104, + category: 1, + key: "A 'continue' statement can only be used within an enclosing iteration statement." + }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { + code: 1105, + category: 1, + key: "A 'break' statement can only be used within an enclosing iteration or switch statement." + }, + Jump_target_cannot_cross_function_boundary: { + code: 1107, + category: 1, + key: "Jump target cannot cross function boundary." + }, + A_return_statement_can_only_be_used_within_a_function_body: { + code: 1108, + category: 1, + key: "A 'return' statement can only be used within a function body." + }, + Expression_expected: { + code: 1109, + category: 1, + key: "Expression expected." + }, + Type_expected: { + code: 1110, + category: 1, + key: "Type expected." + }, + A_class_member_cannot_be_declared_optional: { + code: 1112, + category: 1, + key: "A class member cannot be declared optional." + }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { + code: 1113, + category: 1, + key: "A 'default' clause cannot appear more than once in a 'switch' statement." + }, + Duplicate_label_0: { + code: 1114, + category: 1, + key: "Duplicate label '{0}'" + }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { + code: 1115, + category: 1, + key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." + }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { + code: 1116, + category: 1, + key: "A 'break' statement can only jump to a label of an enclosing statement." + }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { + code: 1117, + category: 1, + key: "An object literal cannot have multiple properties with the same name in strict mode." + }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { + code: 1118, + category: 1, + key: "An object literal cannot have multiple get/set accessors with the same name." + }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { + code: 1119, + category: 1, + key: "An object literal cannot have property and accessor with the same name." + }, + An_export_assignment_cannot_have_modifiers: { + code: 1120, + category: 1, + key: "An export assignment cannot have modifiers." + }, + Octal_literals_are_not_allowed_in_strict_mode: { + code: 1121, + category: 1, + key: "Octal literals are not allowed in strict mode." + }, + A_tuple_type_element_list_cannot_be_empty: { + code: 1122, + category: 1, + key: "A tuple type element list cannot be empty." + }, + Variable_declaration_list_cannot_be_empty: { + code: 1123, + category: 1, + key: "Variable declaration list cannot be empty." + }, + Digit_expected: { + code: 1124, + category: 1, + key: "Digit expected." + }, + Hexadecimal_digit_expected: { + code: 1125, + category: 1, + key: "Hexadecimal digit expected." + }, + Unexpected_end_of_text: { + code: 1126, + category: 1, + key: "Unexpected end of text." + }, + Invalid_character: { + code: 1127, + category: 1, + key: "Invalid character." + }, + Declaration_or_statement_expected: { + code: 1128, + category: 1, + key: "Declaration or statement expected." + }, + Statement_expected: { + code: 1129, + category: 1, + key: "Statement expected." + }, + case_or_default_expected: { + code: 1130, + category: 1, + key: "'case' or 'default' expected." + }, + Property_or_signature_expected: { + code: 1131, + category: 1, + key: "Property or signature expected." + }, + Enum_member_expected: { + code: 1132, + category: 1, + key: "Enum member expected." + }, + Type_reference_expected: { + code: 1133, + category: 1, + key: "Type reference expected." + }, + Variable_declaration_expected: { + code: 1134, + category: 1, + key: "Variable declaration expected." + }, + Argument_expression_expected: { + code: 1135, + category: 1, + key: "Argument expression expected." + }, + Property_assignment_expected: { + code: 1136, + category: 1, + key: "Property assignment expected." + }, + Expression_or_comma_expected: { + code: 1137, + category: 1, + key: "Expression or comma expected." + }, + Parameter_declaration_expected: { + code: 1138, + category: 1, + key: "Parameter declaration expected." + }, + Type_parameter_declaration_expected: { + code: 1139, + category: 1, + key: "Type parameter declaration expected." + }, + Type_argument_expected: { + code: 1140, + category: 1, + key: "Type argument expected." + }, + String_literal_expected: { + code: 1141, + category: 1, + key: "String literal expected." + }, + Line_break_not_permitted_here: { + code: 1142, + category: 1, + key: "Line break not permitted here." + }, + or_expected: { + code: 1144, + category: 1, + key: "'{' or ';' expected." + }, + Modifiers_not_permitted_on_index_signature_members: { + code: 1145, + category: 1, + key: "Modifiers not permitted on index signature members." + }, + Declaration_expected: { + code: 1146, + category: 1, + key: "Declaration expected." + }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { + code: 1147, + category: 1, + key: "Import declarations in an internal module cannot reference an external module." + }, + Cannot_compile_external_modules_unless_the_module_flag_is_provided: { + code: 1148, + category: 1, + key: "Cannot compile external modules unless the '--module' flag is provided." + }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { + code: 1149, + category: 1, + key: "File name '{0}' differs from already included file name '{1}' only in casing" + }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { + code: 1150, + category: 1, + key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." + }, + var_let_or_const_expected: { + code: 1152, + category: 1, + key: "'var', 'let' or 'const' expected." + }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1153, + category: 1, + key: "'let' declarations are only available when targeting ECMAScript 6 and higher." + }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1154, + category: 1, + key: "'const' declarations are only available when targeting ECMAScript 6 and higher." + }, + const_declarations_must_be_initialized: { + code: 1155, + category: 1, + key: "'const' declarations must be initialized" + }, + const_declarations_can_only_be_declared_inside_a_block: { + code: 1156, + category: 1, + key: "'const' declarations can only be declared inside a block." + }, + let_declarations_can_only_be_declared_inside_a_block: { + code: 1157, + category: 1, + key: "'let' declarations can only be declared inside a block." + }, + Unterminated_template_literal: { + code: 1160, + category: 1, + key: "Unterminated template literal." + }, + Unterminated_regular_expression_literal: { + code: 1161, + category: 1, + key: "Unterminated regular expression literal." + }, + An_object_member_cannot_be_declared_optional: { + code: 1162, + category: 1, + key: "An object member cannot be declared optional." + }, + yield_expression_must_be_contained_within_a_generator_declaration: { + code: 1163, + category: 1, + key: "'yield' expression must be contained_within a generator declaration." + }, + Computed_property_names_are_not_allowed_in_enums: { + code: 1164, + category: 1, + key: "Computed property names are not allowed in enums." + }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { + code: 1165, + category: 1, + key: "A computed property name in an ambient context must directly refer to a built-in symbol." + }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { + code: 1166, + category: 1, + key: "A computed property name in a class property declaration must directly refer to a built-in symbol." + }, + Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1167, + category: 1, + key: "Computed property names are only available when targeting ECMAScript 6 and higher." + }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { + code: 1168, + category: 1, + key: "A computed property name in a method overload must directly refer to a built-in symbol." + }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { + code: 1169, + category: 1, + key: "A computed property name in an interface must directly refer to a built-in symbol." + }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { + code: 1170, + category: 1, + key: "A computed property name in a type literal must directly refer to a built-in symbol." + }, + A_comma_expression_is_not_allowed_in_a_computed_property_name: { + code: 1171, + category: 1, + key: "A comma expression is not allowed in a computed property name." + }, + extends_clause_already_seen: { + code: 1172, + category: 1, + key: "'extends' clause already seen." + }, + extends_clause_must_precede_implements_clause: { + code: 1173, + category: 1, + key: "'extends' clause must precede 'implements' clause." + }, + Classes_can_only_extend_a_single_class: { + code: 1174, + category: 1, + key: "Classes can only extend a single class." + }, + implements_clause_already_seen: { + code: 1175, + category: 1, + key: "'implements' clause already seen." + }, + Interface_declaration_cannot_have_implements_clause: { + code: 1176, + category: 1, + key: "Interface declaration cannot have 'implements' clause." + }, + Binary_digit_expected: { + code: 1177, + category: 1, + key: "Binary digit expected." + }, + Octal_digit_expected: { + code: 1178, + category: 1, + key: "Octal digit expected." + }, + Unexpected_token_expected: { + code: 1179, + category: 1, + key: "Unexpected token. '{' expected." + }, + Property_destructuring_pattern_expected: { + code: 1180, + category: 1, + key: "Property destructuring pattern expected." + }, + Array_element_destructuring_pattern_expected: { + code: 1181, + category: 1, + key: "Array element destructuring pattern expected." + }, + A_destructuring_declaration_must_have_an_initializer: { + code: 1182, + category: 1, + key: "A destructuring declaration must have an initializer." + }, + Destructuring_declarations_are_not_allowed_in_ambient_contexts: { + code: 1183, + category: 1, + key: "Destructuring declarations are not allowed in ambient contexts." + }, + An_implementation_cannot_be_declared_in_ambient_contexts: { + code: 1184, + category: 1, + key: "An implementation cannot be declared in ambient contexts." + }, + Modifiers_cannot_appear_here: { + code: 1184, + category: 1, + key: "Modifiers cannot appear here." + }, + Merge_conflict_marker_encountered: { + code: 1185, + category: 1, + key: "Merge conflict marker encountered." + }, + A_rest_element_cannot_have_an_initializer: { + code: 1186, + category: 1, + key: "A rest element cannot have an initializer." + }, + A_parameter_property_may_not_be_a_binding_pattern: { + code: 1187, + category: 1, + key: "A parameter property may not be a binding pattern." + }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { + code: 1188, + category: 1, + key: "Only a single variable declaration is allowed in a 'for...of' statement." + }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { + code: 1189, + category: 1, + key: "The variable declaration of a 'for...in' statement cannot have an initializer." + }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { + code: 1190, + category: 1, + key: "The variable declaration of a 'for...of' statement cannot have an initializer." + }, + An_import_declaration_cannot_have_modifiers: { + code: 1191, + category: 1, + key: "An import declaration cannot have modifiers." + }, + External_module_0_has_no_default_export_or_export_assignment: { + code: 1192, + category: 1, + key: "External module '{0}' has no default export or export assignment." + }, + An_export_declaration_cannot_have_modifiers: { + code: 1193, + category: 1, + key: "An export declaration cannot have modifiers." + }, + Export_declarations_are_not_permitted_in_an_internal_module: { + code: 1194, + category: 1, + key: "Export declarations are not permitted in an internal module." + }, + Catch_clause_variable_name_must_be_an_identifier: { + code: 1195, + category: 1, + key: "Catch clause variable name must be an identifier." + }, + Catch_clause_variable_cannot_have_a_type_annotation: { + code: 1196, + category: 1, + key: "Catch clause variable cannot have a type annotation." + }, + Catch_clause_variable_cannot_have_an_initializer: { + code: 1197, + category: 1, + key: "Catch clause variable cannot have an initializer." + }, + An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { + code: 1198, + category: 1, + key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." + }, + Unterminated_Unicode_escape_sequence: { + code: 1199, + category: 1, + key: "Unterminated Unicode escape sequence." + }, + Duplicate_identifier_0: { + code: 2300, + category: 1, + key: "Duplicate identifier '{0}'." + }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { + code: 2301, + category: 1, + key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." + }, + Static_members_cannot_reference_class_type_parameters: { + code: 2302, + category: 1, + key: "Static members cannot reference class type parameters." + }, + Circular_definition_of_import_alias_0: { + code: 2303, + category: 1, + key: "Circular definition of import alias '{0}'." + }, + Cannot_find_name_0: { + code: 2304, + category: 1, + key: "Cannot find name '{0}'." + }, + Module_0_has_no_exported_member_1: { + code: 2305, + category: 1, + key: "Module '{0}' has no exported member '{1}'." + }, + File_0_is_not_an_external_module: { + code: 2306, + category: 1, + key: "File '{0}' is not an external module." + }, + Cannot_find_external_module_0: { + code: 2307, + category: 1, + key: "Cannot find external module '{0}'." + }, + A_module_cannot_have_more_than_one_export_assignment: { + code: 2308, + category: 1, + key: "A module cannot have more than one export assignment." + }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { + code: 2309, + category: 1, + key: "An export assignment cannot be used in a module with other exported elements." + }, + Type_0_recursively_references_itself_as_a_base_type: { + code: 2310, + category: 1, + key: "Type '{0}' recursively references itself as a base type." + }, + A_class_may_only_extend_another_class: { + code: 2311, + category: 1, + key: "A class may only extend another class." + }, + An_interface_may_only_extend_a_class_or_another_interface: { + code: 2312, + category: 1, + key: "An interface may only extend a class or another interface." + }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { + code: 2313, + category: 1, + key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." + }, + Generic_type_0_requires_1_type_argument_s: { + code: 2314, + category: 1, + key: "Generic type '{0}' requires {1} type argument(s)." + }, + Type_0_is_not_generic: { + code: 2315, + category: 1, + key: "Type '{0}' is not generic." + }, + Global_type_0_must_be_a_class_or_interface_type: { + code: 2316, + category: 1, + key: "Global type '{0}' must be a class or interface type." + }, + Global_type_0_must_have_1_type_parameter_s: { + code: 2317, + category: 1, + key: "Global type '{0}' must have {1} type parameter(s)." + }, + Cannot_find_global_type_0: { + code: 2318, + category: 1, + key: "Cannot find global type '{0}'." + }, + Named_property_0_of_types_1_and_2_are_not_identical: { + code: 2319, + category: 1, + key: "Named property '{0}' of types '{1}' and '{2}' are not identical." + }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { + code: 2320, + category: 1, + key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." + }, + Excessive_stack_depth_comparing_types_0_and_1: { + code: 2321, + category: 1, + key: "Excessive stack depth comparing types '{0}' and '{1}'." + }, + Type_0_is_not_assignable_to_type_1: { + code: 2322, + category: 1, + key: "Type '{0}' is not assignable to type '{1}'." + }, + Property_0_is_missing_in_type_1: { + code: 2324, + category: 1, + key: "Property '{0}' is missing in type '{1}'." + }, + Property_0_is_private_in_type_1_but_not_in_type_2: { + code: 2325, + category: 1, + key: "Property '{0}' is private in type '{1}' but not in type '{2}'." + }, + Types_of_property_0_are_incompatible: { + code: 2326, + category: 1, + key: "Types of property '{0}' are incompatible." + }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { + code: 2327, + category: 1, + key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." + }, + Types_of_parameters_0_and_1_are_incompatible: { + code: 2328, + category: 1, + key: "Types of parameters '{0}' and '{1}' are incompatible." + }, + Index_signature_is_missing_in_type_0: { + code: 2329, + category: 1, + key: "Index signature is missing in type '{0}'." + }, + Index_signatures_are_incompatible: { + code: 2330, + category: 1, + key: "Index signatures are incompatible." + }, + this_cannot_be_referenced_in_a_module_body: { + code: 2331, + category: 1, + key: "'this' cannot be referenced in a module body." + }, + this_cannot_be_referenced_in_current_location: { + code: 2332, + category: 1, + key: "'this' cannot be referenced in current location." + }, + this_cannot_be_referenced_in_constructor_arguments: { + code: 2333, + category: 1, + key: "'this' cannot be referenced in constructor arguments." + }, + this_cannot_be_referenced_in_a_static_property_initializer: { + code: 2334, + category: 1, + key: "'this' cannot be referenced in a static property initializer." + }, + super_can_only_be_referenced_in_a_derived_class: { + code: 2335, + category: 1, + key: "'super' can only be referenced in a derived class." + }, + super_cannot_be_referenced_in_constructor_arguments: { + code: 2336, + category: 1, + key: "'super' cannot be referenced in constructor arguments." + }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { + code: 2337, + category: 1, + key: "Super calls are not permitted outside constructors or in nested functions inside constructors" + }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { + code: 2338, + category: 1, + key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" + }, + Property_0_does_not_exist_on_type_1: { + code: 2339, + category: 1, + key: "Property '{0}' does not exist on type '{1}'." + }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { + code: 2340, + category: 1, + key: "Only public and protected methods of the base class are accessible via the 'super' keyword" + }, + Property_0_is_private_and_only_accessible_within_class_1: { + code: 2341, + category: 1, + key: "Property '{0}' is private and only accessible within class '{1}'." + }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { + code: 2342, + category: 1, + key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." + }, + Type_0_does_not_satisfy_the_constraint_1: { + code: 2344, + category: 1, + key: "Type '{0}' does not satisfy the constraint '{1}'." + }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { + code: 2345, + category: 1, + key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." + }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { + code: 2346, + category: 1, + key: "Supplied parameters do not match any signature of call target." + }, + Untyped_function_calls_may_not_accept_type_arguments: { + code: 2347, + category: 1, + key: "Untyped function calls may not accept type arguments." + }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { + code: 2348, + category: 1, + key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" + }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { + code: 2349, + category: 1, + key: "Cannot invoke an expression whose type lacks a call signature." + }, + Only_a_void_function_can_be_called_with_the_new_keyword: { + code: 2350, + category: 1, + key: "Only a void function can be called with the 'new' keyword." + }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { + code: 2351, + category: 1, + key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." + }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { + code: 2352, + category: 1, + key: "Neither type '{0}' nor type '{1}' is assignable to the other." + }, + No_best_common_type_exists_among_return_expressions: { + code: 2354, + category: 1, + key: "No best common type exists among return expressions." + }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { + code: 2355, + category: 1, + key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." + }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { + code: 2356, + category: 1, + key: "An arithmetic operand must be of type 'any', 'number' or an enum type." + }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { + code: 2357, + category: 1, + key: "The operand of an increment or decrement operator must be a variable, property or indexer." + }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2358, + category: 1, + key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." + }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { + code: 2359, + category: 1, + key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." + }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { + code: 2360, + category: 1, + key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." + }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2361, + category: 1, + key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" + }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { + code: 2362, + category: 1, + key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." + }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { + code: 2363, + category: 1, + key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." + }, + Invalid_left_hand_side_of_assignment_expression: { + code: 2364, + category: 1, + key: "Invalid left-hand side of assignment expression." + }, + Operator_0_cannot_be_applied_to_types_1_and_2: { + code: 2365, + category: 1, + key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." + }, + Type_parameter_name_cannot_be_0: { + code: 2368, + category: 1, + key: "Type parameter name cannot be '{0}'" + }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { + code: 2369, + category: 1, + key: "A parameter property is only allowed in a constructor implementation." + }, + A_rest_parameter_must_be_of_an_array_type: { + code: 2370, + category: 1, + key: "A rest parameter must be of an array type." + }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { + code: 2371, + category: 1, + key: "A parameter initializer is only allowed in a function or constructor implementation." + }, + Parameter_0_cannot_be_referenced_in_its_initializer: { + code: 2372, + category: 1, + key: "Parameter '{0}' cannot be referenced in its initializer." + }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { + code: 2373, + category: 1, + key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." + }, + Duplicate_string_index_signature: { + code: 2374, + category: 1, + key: "Duplicate string index signature." + }, + Duplicate_number_index_signature: { + code: 2375, + category: 1, + key: "Duplicate number index signature." + }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { + code: 2376, + category: 1, + key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." + }, + Constructors_for_derived_classes_must_contain_a_super_call: { + code: 2377, + category: 1, + key: "Constructors for derived classes must contain a 'super' call." + }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { + code: 2378, + category: 1, + key: "A 'get' accessor must return a value or consist of a single 'throw' statement." + }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { + code: 2379, + category: 1, + key: "Getter and setter accessors do not agree in visibility." + }, + get_and_set_accessor_must_have_the_same_type: { + code: 2380, + category: 1, + key: "'get' and 'set' accessor must have the same type." + }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { + code: 2381, + category: 1, + key: "A signature with an implementation cannot use a string literal type." + }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { + code: 2382, + category: 1, + key: "Specialized overload signature is not assignable to any non-specialized signature." + }, + Overload_signatures_must_all_be_exported_or_not_exported: { + code: 2383, + category: 1, + key: "Overload signatures must all be exported or not exported." + }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { + code: 2384, + category: 1, + key: "Overload signatures must all be ambient or non-ambient." + }, + Overload_signatures_must_all_be_public_private_or_protected: { + code: 2385, + category: 1, + key: "Overload signatures must all be public, private or protected." + }, + Overload_signatures_must_all_be_optional_or_required: { + code: 2386, + category: 1, + key: "Overload signatures must all be optional or required." + }, + Function_overload_must_be_static: { + code: 2387, + category: 1, + key: "Function overload must be static." + }, + Function_overload_must_not_be_static: { + code: 2388, + category: 1, + key: "Function overload must not be static." + }, + Function_implementation_name_must_be_0: { + code: 2389, + category: 1, + key: "Function implementation name must be '{0}'." + }, + Constructor_implementation_is_missing: { + code: 2390, + category: 1, + key: "Constructor implementation is missing." + }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { + code: 2391, + category: 1, + key: "Function implementation is missing or not immediately following the declaration." + }, + Multiple_constructor_implementations_are_not_allowed: { + code: 2392, + category: 1, + key: "Multiple constructor implementations are not allowed." + }, + Duplicate_function_implementation: { + code: 2393, + category: 1, + key: "Duplicate function implementation." + }, + Overload_signature_is_not_compatible_with_function_implementation: { + code: 2394, + category: 1, + key: "Overload signature is not compatible with function implementation." + }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { + code: 2395, + category: 1, + key: "Individual declarations in merged declaration {0} must be all exported or all local." + }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { + code: 2396, + category: 1, + key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." + }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { + code: 2399, + category: 1, + key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." + }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { + code: 2400, + category: 1, + key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." + }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { + code: 2401, + category: 1, + key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." + }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { + code: 2402, + category: 1, + key: "Expression resolves to '_super' that compiler uses to capture base class reference." + }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { + code: 2403, + category: 1, + key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." + }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { + code: 2404, + category: 1, + key: "The left-hand side of a 'for...in' statement cannot use a type annotation." + }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { + code: 2405, + category: 1, + key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." + }, + Invalid_left_hand_side_in_for_in_statement: { + code: 2406, + category: 1, + key: "Invalid left-hand side in 'for...in' statement." + }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2407, + category: 1, + key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." + }, + Setters_cannot_return_a_value: { + code: 2408, + category: 1, + key: "Setters cannot return a value." + }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { + code: 2409, + category: 1, + key: "Return type of constructor signature must be assignable to the instance type of the class" + }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { + code: 2410, + category: 1, + key: "All symbols within a 'with' block will be resolved to 'any'." + }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { + code: 2411, + category: 1, + key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." + }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { + code: 2412, + category: 1, + key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." + }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { + code: 2413, + category: 1, + key: "Numeric index type '{0}' is not assignable to string index type '{1}'." + }, + Class_name_cannot_be_0: { + code: 2414, + category: 1, + key: "Class name cannot be '{0}'" + }, + Class_0_incorrectly_extends_base_class_1: { + code: 2415, + category: 1, + key: "Class '{0}' incorrectly extends base class '{1}'." + }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { + code: 2417, + category: 1, + key: "Class static side '{0}' incorrectly extends base class static side '{1}'." + }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { + code: 2419, + category: 1, + key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." + }, + Class_0_incorrectly_implements_interface_1: { + code: 2420, + category: 1, + key: "Class '{0}' incorrectly implements interface '{1}'." + }, + A_class_may_only_implement_another_class_or_interface: { + code: 2422, + category: 1, + key: "A class may only implement another class or interface." + }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { + code: 2423, + category: 1, + key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." + }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { + code: 2424, + category: 1, + key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." + }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { + code: 2425, + category: 1, + key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." + }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { + code: 2426, + category: 1, + key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." + }, + Interface_name_cannot_be_0: { + code: 2427, + category: 1, + key: "Interface name cannot be '{0}'" + }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { + code: 2428, + category: 1, + key: "All declarations of an interface must have identical type parameters." + }, + Interface_0_incorrectly_extends_interface_1: { + code: 2430, + category: 1, + key: "Interface '{0}' incorrectly extends interface '{1}'." + }, + Enum_name_cannot_be_0: { + code: 2431, + category: 1, + key: "Enum name cannot be '{0}'" + }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { + code: 2432, + category: 1, + key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." + }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { + code: 2433, + category: 1, + key: "A module declaration cannot be in a different file from a class or function with which it is merged" + }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { + code: 2434, + category: 1, + key: "A module declaration cannot be located prior to a class or function with which it is merged" + }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { + code: 2435, + category: 1, + key: "Ambient external modules cannot be nested in other modules." + }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { + code: 2436, + category: 1, + key: "Ambient external module declaration cannot specify relative module name." + }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { + code: 2437, + category: 1, + key: "Module '{0}' is hidden by a local declaration with the same name" + }, + Import_name_cannot_be_0: { + code: 2438, + category: 1, + key: "Import name cannot be '{0}'" + }, + Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { + code: 2439, + category: 1, + key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." + }, + Import_declaration_conflicts_with_local_declaration_of_0: { + code: 2440, + category: 1, + key: "Import declaration conflicts with local declaration of '{0}'" + }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { + code: 2441, + category: 1, + key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." + }, + Types_have_separate_declarations_of_a_private_property_0: { + code: 2442, + category: 1, + key: "Types have separate declarations of a private property '{0}'." + }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { + code: 2443, + category: 1, + key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." + }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { + code: 2444, + category: 1, + key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." + }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { + code: 2445, + category: 1, + key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." + }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { + code: 2446, + category: 1, + key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." + }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { + code: 2447, + category: 1, + key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." + }, + Block_scoped_variable_0_used_before_its_declaration: { + code: 2448, + category: 1, + key: "Block-scoped variable '{0}' used before its declaration." + }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { + code: 2449, + category: 1, + key: "The operand of an increment or decrement operator cannot be a constant." + }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { + code: 2450, + category: 1, + key: "Left-hand side of assignment expression cannot be a constant." + }, + Cannot_redeclare_block_scoped_variable_0: { + code: 2451, + category: 1, + key: "Cannot redeclare block-scoped variable '{0}'." + }, + An_enum_member_cannot_have_a_numeric_name: { + code: 2452, + category: 1, + key: "An enum member cannot have a numeric name." + }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { + code: 2453, + category: 1, + key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." + }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { + code: 2455, + category: 1, + key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." + }, + Type_alias_0_circularly_references_itself: { + code: 2456, + category: 1, + key: "Type alias '{0}' circularly references itself." + }, + Type_alias_name_cannot_be_0: { + code: 2457, + category: 1, + key: "Type alias name cannot be '{0}'" + }, + An_AMD_module_cannot_have_multiple_name_assignments: { + code: 2458, + category: 1, + key: "An AMD module cannot have multiple name assignments." + }, + Type_0_has_no_property_1_and_no_string_index_signature: { + code: 2459, + category: 1, + key: "Type '{0}' has no property '{1}' and no string index signature." + }, + Type_0_has_no_property_1: { + code: 2460, + category: 1, + key: "Type '{0}' has no property '{1}'." + }, + Type_0_is_not_an_array_type: { + code: 2461, + category: 1, + key: "Type '{0}' is not an array type." + }, + A_rest_element_must_be_last_in_an_array_destructuring_pattern: { + code: 2462, + category: 1, + key: "A rest element must be last in an array destructuring pattern" + }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { + code: 2463, + category: 1, + key: "A binding pattern parameter cannot be optional in an implementation signature." + }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { + code: 2464, + category: 1, + key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." + }, + this_cannot_be_referenced_in_a_computed_property_name: { + code: 2465, + category: 1, + key: "'this' cannot be referenced in a computed property name." + }, + super_cannot_be_referenced_in_a_computed_property_name: { + code: 2466, + category: 1, + key: "'super' cannot be referenced in a computed property name." + }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { + code: 2467, + category: 1, + key: "A computed property name cannot reference a type parameter from its containing type." + }, + Cannot_find_global_value_0: { + code: 2468, + category: 1, + key: "Cannot find global value '{0}'." + }, + The_0_operator_cannot_be_applied_to_type_symbol: { + code: 2469, + category: 1, + key: "The '{0}' operator cannot be applied to type 'symbol'." + }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { + code: 2470, + category: 1, + key: "'Symbol' reference does not refer to the global Symbol constructor object." + }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { + code: 2471, + category: 1, + key: "A computed property name of the form '{0}' must be of type 'symbol'." + }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 2472, + category: 1, + key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." + }, + Enum_declarations_must_all_be_const_or_non_const: { + code: 2473, + category: 1, + key: "Enum declarations must all be const or non-const." + }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { + code: 2474, + category: 1, + key: "In 'const' enum declarations member initializer must be constant expression." + }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { + code: 2475, + category: 1, + key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." + }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { + code: 2476, + category: 1, + key: "A const enum member can only be accessed using a string literal." + }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { + code: 2477, + category: 1, + key: "'const' enum member initializer was evaluated to a non-finite value." + }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { + code: 2478, + category: 1, + key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." + }, + Property_0_does_not_exist_on_const_enum_1: { + code: 2479, + category: 1, + key: "Property '{0}' does not exist on 'const' enum '{1}'." + }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { + code: 2480, + category: 1, + key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." + }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { + code: 2481, + category: 1, + key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." + }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { + code: 2483, + category: 1, + key: "The left-hand side of a 'for...of' statement cannot use a type annotation." + }, + Export_declaration_conflicts_with_exported_declaration_of_0: { + code: 2484, + category: 1, + key: "Export declaration conflicts with exported declaration of '{0}'" + }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { + code: 2485, + category: 1, + key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." + }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { + code: 2486, + category: 1, + key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." + }, + Invalid_left_hand_side_in_for_of_statement: { + code: 2487, + category: 1, + key: "Invalid left-hand side in 'for...of' statement." + }, + The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { + code: 2488, + category: 1, + key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." + }, + The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { + code: 2489, + category: 1, + key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." + }, + The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { + code: 2490, + category: 1, + key: "The type returned by the 'next()' method of an iterator must have a 'value' property." + }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { + code: 2491, + category: 1, + key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." + }, + Cannot_redeclare_identifier_0_in_catch_clause: { + code: 2492, + category: 1, + key: "Cannot redeclare identifier '{0}' in catch clause" + }, + Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { + code: 2493, + category: 1, + key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." + }, + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { + code: 2494, + category: 1, + key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." + }, + Type_0_is_not_an_array_type_or_a_string_type: { + code: 2461, + category: 1, + key: "Type '{0}' is not an array type or a string type." + }, + Import_declaration_0_is_using_private_name_1: { + code: 4000, + category: 1, + key: "Import declaration '{0}' is using private name '{1}'." + }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4002, + category: 1, + key: "Type parameter '{0}' of exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { + code: 4004, + category: 1, + key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4006, + category: 1, + key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4008, + category: 1, + key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4010, + category: 1, + key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4012, + category: 1, + key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { + code: 4014, + category: 1, + key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { + code: 4016, + category: 1, + key: "Type parameter '{0}' of exported function has or is using private name '{1}'." + }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { + code: 4019, + category: 1, + key: "Implements clause of exported class '{0}' has or is using private name '{1}'." + }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { + code: 4020, + category: 1, + key: "Extends clause of exported class '{0}' has or is using private name '{1}'." + }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { + code: 4022, + category: 1, + key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." + }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4023, + category: 1, + key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." + }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { + code: 4024, + category: 1, + key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." + }, + Exported_variable_0_has_or_is_using_private_name_1: { + code: 4025, + category: 1, + key: "Exported variable '{0}' has or is using private name '{1}'." + }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4026, + category: 1, + key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4027, + category: 1, + key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." + }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4028, + category: 1, + key: "Public static property '{0}' of exported class has or is using private name '{1}'." + }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4029, + category: 1, + key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4030, + category: 1, + key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." + }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4031, + category: 1, + key: "Public property '{0}' of exported class has or is using private name '{1}'." + }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4032, + category: 1, + key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." + }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { + code: 4033, + category: 1, + key: "Property '{0}' of exported interface has or is using private name '{1}'." + }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4034, + category: 1, + key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { + code: 4035, + category: 1, + key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." + }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4036, + category: 1, + key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { + code: 4037, + category: 1, + key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4038, + category: 1, + key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4039, + category: 1, + key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { + code: 4040, + category: 1, + key: "Return type of public static property getter from exported class has or is using private name '{0}'." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4041, + category: 1, + key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4042, + category: 1, + key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { + code: 4043, + category: 1, + key: "Return type of public property getter from exported class has or is using private name '{0}'." + }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4044, + category: 1, + key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4045, + category: 1, + key: "Return type of constructor signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4046, + category: 1, + key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4047, + category: 1, + key: "Return type of call signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4048, + category: 1, + key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4049, + category: 1, + key: "Return type of index signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4050, + category: 1, + key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4051, + category: 1, + key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { + code: 4052, + category: 1, + key: "Return type of public static method from exported class has or is using private name '{0}'." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4053, + category: 1, + key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4054, + category: 1, + key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { + code: 4055, + category: 1, + key: "Return type of public method from exported class has or is using private name '{0}'." + }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4056, + category: 1, + key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { + code: 4057, + category: 1, + key: "Return type of method from exported interface has or is using private name '{0}'." + }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4058, + category: 1, + key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { + code: 4059, + category: 1, + key: "Return type of exported function has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { + code: 4060, + category: 1, + key: "Return type of exported function has or is using private name '{0}'." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4061, + category: 1, + key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4062, + category: 1, + key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { + code: 4063, + category: 1, + key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." + }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4064, + category: 1, + key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4065, + category: 1, + key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4066, + category: 1, + key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4067, + category: 1, + key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4068, + category: 1, + key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4069, + category: 1, + key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4070, + category: 1, + key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4071, + category: 1, + key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4072, + category: 1, + key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4073, + category: 1, + key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." + }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4074, + category: 1, + key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { + code: 4075, + category: 1, + key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4076, + category: 1, + key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { + code: 4077, + category: 1, + key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { + code: 4078, + category: 1, + key: "Parameter '{0}' of exported function has or is using private name '{1}'." + }, + Exported_type_alias_0_has_or_is_using_private_name_1: { + code: 4081, + category: 1, + key: "Exported type alias '{0}' has or is using private name '{1}'." + }, + Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { + code: 4091, + category: 1, + key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." + }, + The_current_host_does_not_support_the_0_option: { + code: 5001, + category: 1, + key: "The current host does not support the '{0}' option." + }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { + code: 5009, + category: 1, + key: "Cannot find the common subdirectory path for the input files." + }, + Cannot_read_file_0_Colon_1: { + code: 5012, + category: 1, + key: "Cannot read file '{0}': {1}" + }, + Unsupported_file_encoding: { + code: 5013, + category: 1, + key: "Unsupported file encoding." + }, + Unknown_compiler_option_0: { + code: 5023, + category: 1, + key: "Unknown compiler option '{0}'." + }, + Compiler_option_0_requires_a_value_of_type_1: { + code: 5024, + category: 1, + key: "Compiler option '{0}' requires a value of type {1}." + }, + Could_not_write_file_0_Colon_1: { + code: 5033, + category: 1, + key: "Could not write file '{0}': {1}" + }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { + code: 5038, + category: 1, + key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." + }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { + code: 5039, + category: 1, + key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." + }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { + code: 5040, + category: 1, + key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." + }, + Option_noEmit_cannot_be_specified_with_option_declaration: { + code: 5041, + category: 1, + key: "Option 'noEmit' cannot be specified with option 'declaration'." + }, + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { + code: 5042, + category: 1, + key: "Option 'project' cannot be mixed with source files on a command line." + }, + Concatenate_and_emit_output_to_single_file: { + code: 6001, + category: 2, + key: "Concatenate and emit output to single file." + }, + Generates_corresponding_d_ts_file: { + code: 6002, + category: 2, + key: "Generates corresponding '.d.ts' file." + }, + Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { + code: 6003, + category: 2, + key: "Specifies the location where debugger should locate map files instead of generated locations." + }, + Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { + code: 6004, + category: 2, + key: "Specifies the location where debugger should locate TypeScript files instead of source locations." + }, + Watch_input_files: { + code: 6005, + category: 2, + key: "Watch input files." + }, + Redirect_output_structure_to_the_directory: { + code: 6006, + category: 2, + key: "Redirect output structure to the directory." + }, + Do_not_erase_const_enum_declarations_in_generated_code: { + code: 6007, + category: 2, + key: "Do not erase const enum declarations in generated code." + }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { + code: 6008, + category: 2, + key: "Do not emit outputs if any type checking errors were reported." + }, + Do_not_emit_comments_to_output: { + code: 6009, + category: 2, + key: "Do not emit comments to output." + }, + Do_not_emit_outputs: { + code: 6010, + category: 2, + key: "Do not emit outputs." + }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { + code: 6015, + category: 2, + key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" + }, + Specify_module_code_generation_Colon_commonjs_or_amd: { + code: 6016, + category: 2, + key: "Specify module code generation: 'commonjs' or 'amd'" + }, + Print_this_message: { + code: 6017, + category: 2, + key: "Print this message." + }, + Print_the_compiler_s_version: { + code: 6019, + category: 2, + key: "Print the compiler's version." + }, + Compile_the_project_in_the_given_directory: { + code: 6020, + category: 2, + key: "Compile the project in the given directory." + }, + Syntax_Colon_0: { + code: 6023, + category: 2, + key: "Syntax: {0}" + }, + options: { + code: 6024, + category: 2, + key: "options" + }, + file: { + code: 6025, + category: 2, + key: "file" + }, + Examples_Colon_0: { + code: 6026, + category: 2, + key: "Examples: {0}" + }, + Options_Colon: { + code: 6027, + category: 2, + key: "Options:" + }, + Version_0: { + code: 6029, + category: 2, + key: "Version {0}" + }, + Insert_command_line_options_and_files_from_a_file: { + code: 6030, + category: 2, + key: "Insert command line options and files from a file." + }, + File_change_detected_Starting_incremental_compilation: { + code: 6032, + category: 2, + key: "File change detected. Starting incremental compilation..." + }, + KIND: { + code: 6034, + category: 2, + key: "KIND" + }, + FILE: { + code: 6035, + category: 2, + key: "FILE" + }, + VERSION: { + code: 6036, + category: 2, + key: "VERSION" + }, + LOCATION: { + code: 6037, + category: 2, + key: "LOCATION" + }, + DIRECTORY: { + code: 6038, + category: 2, + key: "DIRECTORY" + }, + Compilation_complete_Watching_for_file_changes: { + code: 6042, + category: 2, + key: "Compilation complete. Watching for file changes." + }, + Generates_corresponding_map_file: { + code: 6043, + category: 2, + key: "Generates corresponding '.map' file." + }, + Compiler_option_0_expects_an_argument: { + code: 6044, + category: 1, + key: "Compiler option '{0}' expects an argument." + }, + Unterminated_quoted_string_in_response_file_0: { + code: 6045, + category: 1, + key: "Unterminated quoted string in response file '{0}'." + }, + Argument_for_module_option_must_be_commonjs_or_amd: { + code: 6046, + category: 1, + key: "Argument for '--module' option must be 'commonjs' or 'amd'." + }, + Argument_for_target_option_must_be_es3_es5_or_es6: { + code: 6047, + category: 1, + key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." + }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { + code: 6048, + category: 1, + key: "Locale must be of the form or -. For example '{0}' or '{1}'." + }, + Unsupported_locale_0: { + code: 6049, + category: 1, + key: "Unsupported locale '{0}'." + }, + Unable_to_open_file_0: { + code: 6050, + category: 1, + key: "Unable to open file '{0}'." + }, + Corrupted_locale_file_0: { + code: 6051, + category: 1, + key: "Corrupted locale file {0}." + }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { + code: 6052, + category: 2, + key: "Raise error on expressions and declarations with an implied 'any' type." + }, + File_0_not_found: { + code: 6053, + category: 1, + key: "File '{0}' not found." + }, + File_0_must_have_extension_ts_or_d_ts: { + code: 6054, + category: 1, + key: "File '{0}' must have extension '.ts' or '.d.ts'." + }, + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { + code: 6055, + category: 2, + key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." + }, + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { + code: 6056, + category: 2, + key: "Do not emit declarations for code that has an '@internal' annotation." + }, + Preserve_new_lines_when_emitting_code: { + code: 6057, + category: 2, + key: "Preserve new-lines when emitting code." + }, + Variable_0_implicitly_has_an_1_type: { + code: 7005, + category: 1, + key: "Variable '{0}' implicitly has an '{1}' type." + }, + Parameter_0_implicitly_has_an_1_type: { + code: 7006, + category: 1, + key: "Parameter '{0}' implicitly has an '{1}' type." + }, + Member_0_implicitly_has_an_1_type: { + code: 7008, + category: 1, + key: "Member '{0}' implicitly has an '{1}' type." + }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { + code: 7009, + category: 1, + key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." + }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { + code: 7010, + category: 1, + key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." + }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { + code: 7011, + category: 1, + key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." + }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { + code: 7013, + category: 1, + key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." + }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { + code: 7016, + category: 1, + key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." + }, + Index_signature_of_object_type_implicitly_has_an_any_type: { + code: 7017, + category: 1, + key: "Index signature of object type implicitly has an 'any' type." + }, + Object_literal_s_property_0_implicitly_has_an_1_type: { + code: 7018, + category: 1, + key: "Object literal's property '{0}' implicitly has an '{1}' type." + }, + Rest_parameter_0_implicitly_has_an_any_type: { + code: 7019, + category: 1, + key: "Rest parameter '{0}' implicitly has an 'any[]' type." + }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { + code: 7020, + category: 1, + key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." + }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { + code: 7021, + category: 1, + key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." + }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { + code: 7022, + category: 1, + key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." + }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { + code: 7023, + category: 1, + key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." + }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { + code: 7024, + category: 1, + key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." + }, + You_cannot_rename_this_element: { + code: 8000, + category: 1, + key: "You cannot rename this element." + }, + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { + code: 8001, + category: 1, + key: "You cannot rename elements that are defined in the standard TypeScript library." + }, + yield_expressions_are_not_currently_supported: { + code: 9000, + category: 1, + key: "'yield' expressions are not currently supported." + }, + Generators_are_not_currently_supported: { + code: 9001, + category: 1, + key: "Generators are not currently supported." + }, + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { + code: 9002, + category: 1, + key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." + } }; })(ts || (ts = {})); var ts; @@ -1461,10 +3425,2806 @@ var ts; "|=": 62, "^=": 63 }; - var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierStart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 543, + 546, + 563, + 592, + 685, + 688, + 696, + 699, + 705, + 720, + 721, + 736, + 740, + 750, + 750, + 890, + 890, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 974, + 976, + 983, + 986, + 1011, + 1024, + 1153, + 1164, + 1220, + 1223, + 1224, + 1227, + 1228, + 1232, + 1269, + 1272, + 1273, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1488, + 1514, + 1520, + 1522, + 1569, + 1594, + 1600, + 1610, + 1649, + 1747, + 1749, + 1749, + 1765, + 1766, + 1786, + 1788, + 1808, + 1808, + 1810, + 1836, + 1920, + 1957, + 2309, + 2361, + 2365, + 2365, + 2384, + 2384, + 2392, + 2401, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2524, + 2525, + 2527, + 2529, + 2544, + 2545, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2649, + 2652, + 2654, + 2654, + 2674, + 2676, + 2693, + 2699, + 2701, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2749, + 2749, + 2768, + 2768, + 2784, + 2784, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2870, + 2873, + 2877, + 2877, + 2908, + 2909, + 2911, + 2913, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 2997, + 2999, + 3001, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3168, + 3169, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3294, + 3294, + 3296, + 3297, + 3333, + 3340, + 3342, + 3344, + 3346, + 3368, + 3370, + 3385, + 3424, + 3425, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3585, + 3632, + 3634, + 3635, + 3648, + 3654, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3760, + 3762, + 3763, + 3773, + 3773, + 3776, + 3780, + 3782, + 3782, + 3804, + 3805, + 3840, + 3840, + 3904, + 3911, + 3913, + 3946, + 3976, + 3979, + 4096, + 4129, + 4131, + 4135, + 4137, + 4138, + 4176, + 4181, + 4256, + 4293, + 4304, + 4342, + 4352, + 4441, + 4447, + 4514, + 4520, + 4601, + 4608, + 4614, + 4616, + 4678, + 4680, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4742, + 4744, + 4744, + 4746, + 4749, + 4752, + 4782, + 4784, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4814, + 4816, + 4822, + 4824, + 4846, + 4848, + 4878, + 4880, + 4880, + 4882, + 4885, + 4888, + 4894, + 4896, + 4934, + 4936, + 4954, + 5024, + 5108, + 5121, + 5740, + 5743, + 5750, + 5761, + 5786, + 5792, + 5866, + 6016, + 6067, + 6176, + 6263, + 6272, + 6312, + 7680, + 7835, + 7840, + 7929, + 7936, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8319, + 8319, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8497, + 8499, + 8505, + 8544, + 8579, + 12293, + 12295, + 12321, + 12329, + 12337, + 12341, + 12344, + 12346, + 12353, + 12436, + 12445, + 12446, + 12449, + 12538, + 12540, + 12542, + 12549, + 12588, + 12593, + 12686, + 12704, + 12727, + 13312, + 19893, + 19968, + 40869, + 40960, + 42124, + 44032, + 55203, + 63744, + 64045, + 64256, + 64262, + 64275, + 64279, + 64285, + 64285, + 64287, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65136, + 65138, + 65140, + 65140, + 65142, + 65276, + 65313, + 65338, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES3IdentifierPart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 543, + 546, + 563, + 592, + 685, + 688, + 696, + 699, + 705, + 720, + 721, + 736, + 740, + 750, + 750, + 768, + 846, + 864, + 866, + 890, + 890, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 974, + 976, + 983, + 986, + 1011, + 1024, + 1153, + 1155, + 1158, + 1164, + 1220, + 1223, + 1224, + 1227, + 1228, + 1232, + 1269, + 1272, + 1273, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1425, + 1441, + 1443, + 1465, + 1467, + 1469, + 1471, + 1471, + 1473, + 1474, + 1476, + 1476, + 1488, + 1514, + 1520, + 1522, + 1569, + 1594, + 1600, + 1621, + 1632, + 1641, + 1648, + 1747, + 1749, + 1756, + 1759, + 1768, + 1770, + 1773, + 1776, + 1788, + 1808, + 1836, + 1840, + 1866, + 1920, + 1968, + 2305, + 2307, + 2309, + 2361, + 2364, + 2381, + 2384, + 2388, + 2392, + 2403, + 2406, + 2415, + 2433, + 2435, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2492, + 2492, + 2494, + 2500, + 2503, + 2504, + 2507, + 2509, + 2519, + 2519, + 2524, + 2525, + 2527, + 2531, + 2534, + 2545, + 2562, + 2562, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2620, + 2620, + 2622, + 2626, + 2631, + 2632, + 2635, + 2637, + 2649, + 2652, + 2654, + 2654, + 2662, + 2676, + 2689, + 2691, + 2693, + 2699, + 2701, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2748, + 2757, + 2759, + 2761, + 2763, + 2765, + 2768, + 2768, + 2784, + 2784, + 2790, + 2799, + 2817, + 2819, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2870, + 2873, + 2876, + 2883, + 2887, + 2888, + 2891, + 2893, + 2902, + 2903, + 2908, + 2909, + 2911, + 2913, + 2918, + 2927, + 2946, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 2997, + 2999, + 3001, + 3006, + 3010, + 3014, + 3016, + 3018, + 3021, + 3031, + 3031, + 3047, + 3055, + 3073, + 3075, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3134, + 3140, + 3142, + 3144, + 3146, + 3149, + 3157, + 3158, + 3168, + 3169, + 3174, + 3183, + 3202, + 3203, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3262, + 3268, + 3270, + 3272, + 3274, + 3277, + 3285, + 3286, + 3294, + 3294, + 3296, + 3297, + 3302, + 3311, + 3330, + 3331, + 3333, + 3340, + 3342, + 3344, + 3346, + 3368, + 3370, + 3385, + 3390, + 3395, + 3398, + 3400, + 3402, + 3405, + 3415, + 3415, + 3424, + 3425, + 3430, + 3439, + 3458, + 3459, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3530, + 3530, + 3535, + 3540, + 3542, + 3542, + 3544, + 3551, + 3570, + 3571, + 3585, + 3642, + 3648, + 3662, + 3664, + 3673, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3769, + 3771, + 3773, + 3776, + 3780, + 3782, + 3782, + 3784, + 3789, + 3792, + 3801, + 3804, + 3805, + 3840, + 3840, + 3864, + 3865, + 3872, + 3881, + 3893, + 3893, + 3895, + 3895, + 3897, + 3897, + 3902, + 3911, + 3913, + 3946, + 3953, + 3972, + 3974, + 3979, + 3984, + 3991, + 3993, + 4028, + 4038, + 4038, + 4096, + 4129, + 4131, + 4135, + 4137, + 4138, + 4140, + 4146, + 4150, + 4153, + 4160, + 4169, + 4176, + 4185, + 4256, + 4293, + 4304, + 4342, + 4352, + 4441, + 4447, + 4514, + 4520, + 4601, + 4608, + 4614, + 4616, + 4678, + 4680, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4742, + 4744, + 4744, + 4746, + 4749, + 4752, + 4782, + 4784, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4814, + 4816, + 4822, + 4824, + 4846, + 4848, + 4878, + 4880, + 4880, + 4882, + 4885, + 4888, + 4894, + 4896, + 4934, + 4936, + 4954, + 4969, + 4977, + 5024, + 5108, + 5121, + 5740, + 5743, + 5750, + 5761, + 5786, + 5792, + 5866, + 6016, + 6099, + 6112, + 6121, + 6160, + 6169, + 6176, + 6263, + 6272, + 6313, + 7680, + 7835, + 7840, + 7929, + 7936, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8255, + 8256, + 8319, + 8319, + 8400, + 8412, + 8417, + 8417, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8497, + 8499, + 8505, + 8544, + 8579, + 12293, + 12295, + 12321, + 12335, + 12337, + 12341, + 12344, + 12346, + 12353, + 12436, + 12441, + 12442, + 12445, + 12446, + 12449, + 12542, + 12549, + 12588, + 12593, + 12686, + 12704, + 12727, + 13312, + 19893, + 19968, + 40869, + 40960, + 42124, + 44032, + 55203, + 63744, + 64045, + 64256, + 64262, + 64275, + 64279, + 64285, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65056, + 65059, + 65075, + 65076, + 65101, + 65103, + 65136, + 65138, + 65140, + 65140, + 65142, + 65276, + 65296, + 65305, + 65313, + 65338, + 65343, + 65343, + 65345, + 65370, + 65381, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES5IdentifierStart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 705, + 710, + 721, + 736, + 740, + 748, + 748, + 750, + 750, + 880, + 884, + 886, + 887, + 890, + 893, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 1013, + 1015, + 1153, + 1162, + 1319, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1488, + 1514, + 1520, + 1522, + 1568, + 1610, + 1646, + 1647, + 1649, + 1747, + 1749, + 1749, + 1765, + 1766, + 1774, + 1775, + 1786, + 1788, + 1791, + 1791, + 1808, + 1808, + 1810, + 1839, + 1869, + 1957, + 1969, + 1969, + 1994, + 2026, + 2036, + 2037, + 2042, + 2042, + 2048, + 2069, + 2074, + 2074, + 2084, + 2084, + 2088, + 2088, + 2112, + 2136, + 2208, + 2208, + 2210, + 2220, + 2308, + 2361, + 2365, + 2365, + 2384, + 2384, + 2392, + 2401, + 2417, + 2423, + 2425, + 2431, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2493, + 2493, + 2510, + 2510, + 2524, + 2525, + 2527, + 2529, + 2544, + 2545, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2649, + 2652, + 2654, + 2654, + 2674, + 2676, + 2693, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2749, + 2749, + 2768, + 2768, + 2784, + 2785, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2869, + 2873, + 2877, + 2877, + 2908, + 2909, + 2911, + 2913, + 2929, + 2929, + 2947, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 3001, + 3024, + 3024, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3133, + 3133, + 3160, + 3161, + 3168, + 3169, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3261, + 3261, + 3294, + 3294, + 3296, + 3297, + 3313, + 3314, + 3333, + 3340, + 3342, + 3344, + 3346, + 3386, + 3389, + 3389, + 3406, + 3406, + 3424, + 3425, + 3450, + 3455, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3585, + 3632, + 3634, + 3635, + 3648, + 3654, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3760, + 3762, + 3763, + 3773, + 3773, + 3776, + 3780, + 3782, + 3782, + 3804, + 3807, + 3840, + 3840, + 3904, + 3911, + 3913, + 3948, + 3976, + 3980, + 4096, + 4138, + 4159, + 4159, + 4176, + 4181, + 4186, + 4189, + 4193, + 4193, + 4197, + 4198, + 4206, + 4208, + 4213, + 4225, + 4238, + 4238, + 4256, + 4293, + 4295, + 4295, + 4301, + 4301, + 4304, + 4346, + 4348, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4744, + 4746, + 4749, + 4752, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4822, + 4824, + 4880, + 4882, + 4885, + 4888, + 4954, + 4992, + 5007, + 5024, + 5108, + 5121, + 5740, + 5743, + 5759, + 5761, + 5786, + 5792, + 5866, + 5870, + 5872, + 5888, + 5900, + 5902, + 5905, + 5920, + 5937, + 5952, + 5969, + 5984, + 5996, + 5998, + 6000, + 6016, + 6067, + 6103, + 6103, + 6108, + 6108, + 6176, + 6263, + 6272, + 6312, + 6314, + 6314, + 6320, + 6389, + 6400, + 6428, + 6480, + 6509, + 6512, + 6516, + 6528, + 6571, + 6593, + 6599, + 6656, + 6678, + 6688, + 6740, + 6823, + 6823, + 6917, + 6963, + 6981, + 6987, + 7043, + 7072, + 7086, + 7087, + 7098, + 7141, + 7168, + 7203, + 7245, + 7247, + 7258, + 7293, + 7401, + 7404, + 7406, + 7409, + 7413, + 7414, + 7424, + 7615, + 7680, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8305, + 8305, + 8319, + 8319, + 8336, + 8348, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8505, + 8508, + 8511, + 8517, + 8521, + 8526, + 8526, + 8544, + 8584, + 11264, + 11310, + 11312, + 11358, + 11360, + 11492, + 11499, + 11502, + 11506, + 11507, + 11520, + 11557, + 11559, + 11559, + 11565, + 11565, + 11568, + 11623, + 11631, + 11631, + 11648, + 11670, + 11680, + 11686, + 11688, + 11694, + 11696, + 11702, + 11704, + 11710, + 11712, + 11718, + 11720, + 11726, + 11728, + 11734, + 11736, + 11742, + 11823, + 11823, + 12293, + 12295, + 12321, + 12329, + 12337, + 12341, + 12344, + 12348, + 12353, + 12438, + 12445, + 12447, + 12449, + 12538, + 12540, + 12543, + 12549, + 12589, + 12593, + 12686, + 12704, + 12730, + 12784, + 12799, + 13312, + 19893, + 19968, + 40908, + 40960, + 42124, + 42192, + 42237, + 42240, + 42508, + 42512, + 42527, + 42538, + 42539, + 42560, + 42606, + 42623, + 42647, + 42656, + 42735, + 42775, + 42783, + 42786, + 42888, + 42891, + 42894, + 42896, + 42899, + 42912, + 42922, + 43000, + 43009, + 43011, + 43013, + 43015, + 43018, + 43020, + 43042, + 43072, + 43123, + 43138, + 43187, + 43250, + 43255, + 43259, + 43259, + 43274, + 43301, + 43312, + 43334, + 43360, + 43388, + 43396, + 43442, + 43471, + 43471, + 43520, + 43560, + 43584, + 43586, + 43588, + 43595, + 43616, + 43638, + 43642, + 43642, + 43648, + 43695, + 43697, + 43697, + 43701, + 43702, + 43705, + 43709, + 43712, + 43712, + 43714, + 43714, + 43739, + 43741, + 43744, + 43754, + 43762, + 43764, + 43777, + 43782, + 43785, + 43790, + 43793, + 43798, + 43808, + 43814, + 43816, + 43822, + 43968, + 44002, + 44032, + 55203, + 55216, + 55238, + 55243, + 55291, + 63744, + 64109, + 64112, + 64217, + 64256, + 64262, + 64275, + 64279, + 64285, + 64285, + 64287, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65136, + 65140, + 65142, + 65276, + 65313, + 65338, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES5IdentifierPart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 705, + 710, + 721, + 736, + 740, + 748, + 748, + 750, + 750, + 768, + 884, + 886, + 887, + 890, + 893, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 1013, + 1015, + 1153, + 1155, + 1159, + 1162, + 1319, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1425, + 1469, + 1471, + 1471, + 1473, + 1474, + 1476, + 1477, + 1479, + 1479, + 1488, + 1514, + 1520, + 1522, + 1552, + 1562, + 1568, + 1641, + 1646, + 1747, + 1749, + 1756, + 1759, + 1768, + 1770, + 1788, + 1791, + 1791, + 1808, + 1866, + 1869, + 1969, + 1984, + 2037, + 2042, + 2042, + 2048, + 2093, + 2112, + 2139, + 2208, + 2208, + 2210, + 2220, + 2276, + 2302, + 2304, + 2403, + 2406, + 2415, + 2417, + 2423, + 2425, + 2431, + 2433, + 2435, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2492, + 2500, + 2503, + 2504, + 2507, + 2510, + 2519, + 2519, + 2524, + 2525, + 2527, + 2531, + 2534, + 2545, + 2561, + 2563, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2620, + 2620, + 2622, + 2626, + 2631, + 2632, + 2635, + 2637, + 2641, + 2641, + 2649, + 2652, + 2654, + 2654, + 2662, + 2677, + 2689, + 2691, + 2693, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2748, + 2757, + 2759, + 2761, + 2763, + 2765, + 2768, + 2768, + 2784, + 2787, + 2790, + 2799, + 2817, + 2819, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2869, + 2873, + 2876, + 2884, + 2887, + 2888, + 2891, + 2893, + 2902, + 2903, + 2908, + 2909, + 2911, + 2915, + 2918, + 2927, + 2929, + 2929, + 2946, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 3001, + 3006, + 3010, + 3014, + 3016, + 3018, + 3021, + 3024, + 3024, + 3031, + 3031, + 3046, + 3055, + 3073, + 3075, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3133, + 3140, + 3142, + 3144, + 3146, + 3149, + 3157, + 3158, + 3160, + 3161, + 3168, + 3171, + 3174, + 3183, + 3202, + 3203, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3260, + 3268, + 3270, + 3272, + 3274, + 3277, + 3285, + 3286, + 3294, + 3294, + 3296, + 3299, + 3302, + 3311, + 3313, + 3314, + 3330, + 3331, + 3333, + 3340, + 3342, + 3344, + 3346, + 3386, + 3389, + 3396, + 3398, + 3400, + 3402, + 3406, + 3415, + 3415, + 3424, + 3427, + 3430, + 3439, + 3450, + 3455, + 3458, + 3459, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3530, + 3530, + 3535, + 3540, + 3542, + 3542, + 3544, + 3551, + 3570, + 3571, + 3585, + 3642, + 3648, + 3662, + 3664, + 3673, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3769, + 3771, + 3773, + 3776, + 3780, + 3782, + 3782, + 3784, + 3789, + 3792, + 3801, + 3804, + 3807, + 3840, + 3840, + 3864, + 3865, + 3872, + 3881, + 3893, + 3893, + 3895, + 3895, + 3897, + 3897, + 3902, + 3911, + 3913, + 3948, + 3953, + 3972, + 3974, + 3991, + 3993, + 4028, + 4038, + 4038, + 4096, + 4169, + 4176, + 4253, + 4256, + 4293, + 4295, + 4295, + 4301, + 4301, + 4304, + 4346, + 4348, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4744, + 4746, + 4749, + 4752, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4822, + 4824, + 4880, + 4882, + 4885, + 4888, + 4954, + 4957, + 4959, + 4992, + 5007, + 5024, + 5108, + 5121, + 5740, + 5743, + 5759, + 5761, + 5786, + 5792, + 5866, + 5870, + 5872, + 5888, + 5900, + 5902, + 5908, + 5920, + 5940, + 5952, + 5971, + 5984, + 5996, + 5998, + 6000, + 6002, + 6003, + 6016, + 6099, + 6103, + 6103, + 6108, + 6109, + 6112, + 6121, + 6155, + 6157, + 6160, + 6169, + 6176, + 6263, + 6272, + 6314, + 6320, + 6389, + 6400, + 6428, + 6432, + 6443, + 6448, + 6459, + 6470, + 6509, + 6512, + 6516, + 6528, + 6571, + 6576, + 6601, + 6608, + 6617, + 6656, + 6683, + 6688, + 6750, + 6752, + 6780, + 6783, + 6793, + 6800, + 6809, + 6823, + 6823, + 6912, + 6987, + 6992, + 7001, + 7019, + 7027, + 7040, + 7155, + 7168, + 7223, + 7232, + 7241, + 7245, + 7293, + 7376, + 7378, + 7380, + 7414, + 7424, + 7654, + 7676, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8204, + 8205, + 8255, + 8256, + 8276, + 8276, + 8305, + 8305, + 8319, + 8319, + 8336, + 8348, + 8400, + 8412, + 8417, + 8417, + 8421, + 8432, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8505, + 8508, + 8511, + 8517, + 8521, + 8526, + 8526, + 8544, + 8584, + 11264, + 11310, + 11312, + 11358, + 11360, + 11492, + 11499, + 11507, + 11520, + 11557, + 11559, + 11559, + 11565, + 11565, + 11568, + 11623, + 11631, + 11631, + 11647, + 11670, + 11680, + 11686, + 11688, + 11694, + 11696, + 11702, + 11704, + 11710, + 11712, + 11718, + 11720, + 11726, + 11728, + 11734, + 11736, + 11742, + 11744, + 11775, + 11823, + 11823, + 12293, + 12295, + 12321, + 12335, + 12337, + 12341, + 12344, + 12348, + 12353, + 12438, + 12441, + 12442, + 12445, + 12447, + 12449, + 12538, + 12540, + 12543, + 12549, + 12589, + 12593, + 12686, + 12704, + 12730, + 12784, + 12799, + 13312, + 19893, + 19968, + 40908, + 40960, + 42124, + 42192, + 42237, + 42240, + 42508, + 42512, + 42539, + 42560, + 42607, + 42612, + 42621, + 42623, + 42647, + 42655, + 42737, + 42775, + 42783, + 42786, + 42888, + 42891, + 42894, + 42896, + 42899, + 42912, + 42922, + 43000, + 43047, + 43072, + 43123, + 43136, + 43204, + 43216, + 43225, + 43232, + 43255, + 43259, + 43259, + 43264, + 43309, + 43312, + 43347, + 43360, + 43388, + 43392, + 43456, + 43471, + 43481, + 43520, + 43574, + 43584, + 43597, + 43600, + 43609, + 43616, + 43638, + 43642, + 43643, + 43648, + 43714, + 43739, + 43741, + 43744, + 43759, + 43762, + 43766, + 43777, + 43782, + 43785, + 43790, + 43793, + 43798, + 43808, + 43814, + 43816, + 43822, + 43968, + 44010, + 44012, + 44013, + 44016, + 44025, + 44032, + 55203, + 55216, + 55238, + 55243, + 55291, + 63744, + 64109, + 64112, + 64217, + 64256, + 64262, + 64275, + 64279, + 64285, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65024, + 65039, + 65056, + 65062, + 65075, + 65076, + 65101, + 65103, + 65136, + 65140, + 65142, + 65276, + 65296, + 65305, + 65313, + 65338, + 65343, + 65343, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; function lookupInUnicodeMap(code, map) { if (code < map[0]) { return false; @@ -1488,15 +6248,11 @@ var ts; return false; } function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierStart) : - lookupInUnicodeMap(code, unicodeES3IdentifierStart); + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); } ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierPart) : - lookupInUnicodeMap(code, unicodeES3IdentifierPart); + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); } function makeReverseMap(source) { var result = []; @@ -1569,9 +6325,7 @@ var ts; ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { - return ch === 32 || ch === 9 || ch === 11 || ch === 12 || - ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || - ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { @@ -1658,8 +6412,7 @@ var ts; return false; } } - return ch === 61 || - text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + return ch === 61 || text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } return false; @@ -1739,7 +6492,11 @@ var ts; if (collecting) { if (!result) result = []; - result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); + result.push({ + pos: startPos, + end: pos, + hasTrailingNewLine: hasTrailingNewLine + }); } continue; } @@ -1766,15 +6523,11 @@ var ts; } ts.getTrailingCommentRanges = getTrailingCommentRanges; function isIdentifierStart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } ts.isIdentifierStart = isIdentifierStart; function isIdentifierPart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; function createScanner(languageVersion, skipTrivia, text, onError) { @@ -1793,14 +6546,10 @@ var ts; } } function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } function isIdentifierPart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } function scanNumber() { var start = pos; @@ -2523,17 +7272,39 @@ var ts; } setText(text); return { - getStartPos: function () { return startPos; }, - getTextPos: function () { return pos; }, - getToken: function () { return token; }, - getTokenPos: function () { return tokenPos; }, - getTokenText: function () { return text.substring(tokenPos, pos); }, - getTokenValue: function () { return tokenValue; }, - hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, - hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 64 || token > 100; }, - isReservedWord: function () { return token >= 65 && token <= 100; }, - isUnterminated: function () { return tokenIsUnterminated; }, + getStartPos: function () { + return startPos; + }, + getTextPos: function () { + return pos; + }, + getToken: function () { + return token; + }, + getTokenPos: function () { + return tokenPos; + }, + getTokenText: function () { + return text.substring(tokenPos, pos); + }, + getTokenValue: function () { + return tokenValue; + }, + hasExtendedUnicodeEscape: function () { + return hasExtendedUnicodeEscape; + }, + hasPrecedingLineBreak: function () { + return precedingLineBreak; + }, + isIdentifier: function () { + return token === 64 || token > 100; + }, + isReservedWord: function () { + return token >= 65 && token <= 100; + }, + isUnterminated: function () { + return tokenIsUnterminated; + }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, @@ -2684,10 +7455,20 @@ var ts; description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, experimental: true }, + { + name: "preserveNewLines", + type: "boolean", + description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, + experimental: true + }, { name: "target", shortName: "t", - type: { "es3": 0, "es5": 1, "es6": 2 }, + type: { + "es3": 0, + "es5": 1, + "es6": 2 + }, description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, paramType: ts.Diagnostics.VERSION, error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6 @@ -2867,7 +7648,9 @@ var ts; var files = []; if (ts.hasProperty(json, "files")) { if (json["files"] instanceof Array) { - var files = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); + var files = ts.map(json["files"], function (s) { + return ts.combinePaths(basePath, s); + }); } } else { @@ -2901,9 +7684,13 @@ var ts; function getSingleLineStringWriter() { if (stringWriters.length == 0) { var str = ""; - var writeText = function (text) { return str += text; }; + var writeText = function (text) { + return str += text; + }; return { - string: function () { return str; }, + string: function () { + return str; + }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -2911,11 +7698,18 @@ var ts; writeStringLiteral: writeText, writeParameter: writeText, writeSymbol: writeText, - writeLine: function () { return str += " "; }, - increaseIndent: function () { }, - decreaseIndent: function () { }, - clear: function () { return str = ""; }, - trackSymbol: function () { } + writeLine: function () { + return str += " "; + }, + increaseIndent: function () { + }, + decreaseIndent: function () { + }, + clear: function () { + return str = ""; + }, + trackSymbol: function () { + } }; } return stringWriters.pop(); @@ -2937,8 +7731,7 @@ var ts; ts.containsParseError = containsParseError; function aggregateChildData(node) { if (!(node.parserContextFlags & 64)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || - ts.forEachChild(node, containsParseError); + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { node.parserContextFlags |= 32; } @@ -2946,7 +7739,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 220) { + while (node && node.kind !== 221) { node = node.parent; } return node; @@ -3017,15 +7810,35 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 12288) !== 0 || - isCatchClauseVariableDeclaration(declaration); + return (getCombinedNodeFlags(declaration) & 12288) !== 0 || isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; + function getEnclosingBlockScopeContainer(node) { + var current = node; + while (current) { + if (isFunctionLike(current)) { + return current; + } + switch (current.kind) { + case 221: + case 202: + case 217: + case 200: + case 181: + case 182: + case 183: + return current; + case 174: + if (!isFunctionLike(current.parent)) { + return current; + } + } + current = current.parent; + } + } + ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { - return declaration && - declaration.kind === 193 && - declaration.parent && - declaration.parent.kind === 216; + return declaration && declaration.kind === 193 && declaration.parent && declaration.parent.kind === 217; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3068,7 +7881,7 @@ var ts; case 197: case 200: case 199: - case 219: + case 220: case 195: case 160: errorNode = node.name; @@ -3077,9 +7890,7 @@ var ts; if (errorNode === undefined) { return getSpanOfTokenAtPosition(sourceFile, node.pos); } - var pos = nodeIsMissing(errorNode) - ? errorNode.pos - : ts.skipTrivia(sourceFile.text, errorNode.pos); + var pos = nodeIsMissing(errorNode) ? errorNode.pos : ts.skipTrivia(sourceFile.text, errorNode.pos); return createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; @@ -3142,9 +7953,7 @@ var ts; function getJsDocComments(node, sourceFileOfNode) { return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); function isJsDocComment(comment) { - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; + return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; } } ts.getJsDocComments = getJsDocComments; @@ -3155,6 +7964,7 @@ var ts; switch (node.kind) { case 186: return visitor(node); + case 202: case 174: case 178: case 179: @@ -3164,11 +7974,11 @@ var ts; case 183: case 187: case 188: - case 213: case 214: + case 215: case 189: case 191: - case 216: + case 217: return ts.forEachChild(node, traverse); } } @@ -3178,12 +7988,12 @@ var ts; if (node) { switch (node.kind) { case 150: - case 219: + case 220: case 128: - case 217: + case 218: case 130: case 129: - case 218: + case 219: case 193: return true; } @@ -3261,7 +8071,7 @@ var ts; case 134: case 135: case 199: - case 220: + case 221: return node; } } @@ -3352,8 +8162,8 @@ var ts; case 128: case 130: case 129: - case 219: - case 217: + case 220: + case 218: case 150: return parent.initializer === node; case 177: @@ -3363,20 +8173,17 @@ var ts; case 186: case 187: case 188: - case 213: + case 214: case 190: case 188: return parent.expression === node; case 181: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || - forStatement.condition === node || - forStatement.iterator === node; + return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || forStatement.condition === node || forStatement.iterator === node; case 182: case 183: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || - forInStatement.expression === node; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || forInStatement.expression === node; case 158: return node === parent.expression; case 173: @@ -3394,12 +8201,11 @@ var ts; ts.isExpression = isExpression; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 || - (preserveConstEnums && moduleState === 2); + return moduleState === 1 || (preserveConstEnums && moduleState === 2); } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 202 && node.moduleReference.kind === 212; + return node.kind === 203 && node.moduleReference.kind === 213; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -3408,20 +8214,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 202 && node.moduleReference.kind !== 212; + return node.kind === 203 && node.moduleReference.kind !== 213; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 203) { + if (node.kind === 204) { return node.moduleSpecifier; } - if (node.kind === 202) { + if (node.kind === 203) { var reference = node.moduleReference; - if (reference.kind === 212) { + if (reference.kind === 213) { return reference.expression; } } - if (node.kind === 209) { + if (node.kind === 210) { return node.moduleSpecifier; } } @@ -3438,8 +8244,8 @@ var ts; case 132: case 131: return node.questionToken !== undefined; + case 219: case 218: - case 217: case 130: case 129: return node.questionToken !== undefined; @@ -3485,25 +8291,25 @@ var ts; case 196: case 133: case 199: - case 219: - case 211: + case 220: + case 212: case 195: case 160: case 134: - case 204: - case 202: - case 207: + case 205: + case 203: + case 208: case 197: case 132: case 131: case 200: - case 205: + case 206: case 128: - case 217: + case 218: case 130: case 129: case 135: - case 218: + case 219: case 198: case 127: case 193: @@ -3532,7 +8338,7 @@ var ts; case 175: case 180: case 187: - case 208: + case 209: return true; default: return false; @@ -3544,7 +8350,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 207 || parent.kind === 211) { + if (parent.kind === 208 || parent.kind === 212) { if (parent.propertyName) { return true; } @@ -3642,9 +8448,7 @@ var ts; } ts.isTrivia = isTrivia; function hasDynamicName(declaration) { - return declaration.name && - declaration.name.kind === 126 && - !isWellKnownSymbolSyntactically(declaration.name.expression); + return declaration.name && declaration.name.kind === 126 && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { @@ -3748,7 +8552,10 @@ var ts; if (length < 0) { throw new Error("length < 0"); } - return { start: start, length: length }; + return { + start: start, + length: length + }; } ts.createTextSpan = createTextSpan; function createTextSpanFromBounds(start, end) { @@ -3767,7 +8574,10 @@ var ts; if (newLength < 0) { throw new Error("newLength < 0"); } - return { span: span, newLength: newLength }; + return { + span: span, + newLength: newLength + }; } ts.createTextChangeRange = createTextChangeRange; ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); @@ -3798,11 +8608,11 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 200 || n.kind === 220; + return isFunctionLike(n) || n.kind === 200 || n.kind === 221; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { - return node.pos === -1 && node.end === -1; + return node.pos === -1; } ts.nodeIsSynthesized = nodeIsSynthesized; function createSynthesizedNode(kind, startsOnNewLine) { @@ -3928,15 +8738,15 @@ var ts; } var nonAsciiCharacters = /[^\u0000-\u007F]/g; function escapeNonAsciiCharacters(s) { - return nonAsciiCharacters.test(s) ? - s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) : - s; + return nonAsciiCharacters.test(s) ? s.replace(nonAsciiCharacters, function (c) { + return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + }) : s; } ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters; })(ts || (ts = {})); var ts; (function (ts) { - var nodeConstructors = new Array(222); + var nodeConstructors = new Array(223); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -3974,35 +8784,23 @@ var ts; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { case 125: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); case 127: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); case 128: case 130: case 129: - case 217: case 218: + case 219: case 193: case 150: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 140: case 141: case 136: case 137: case 138: - return visitNodes(cbNodes, node.modifiers) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); case 132: case 131: case 133: @@ -4011,17 +8809,9 @@ var ts; case 160: case 195: case 161: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); case 139: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNodes, node.typeArguments); + return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); case 142: return visitNode(cbNode, node.exprName); case 143: @@ -4042,23 +8832,16 @@ var ts; case 152: return visitNodes(cbNodes, node.properties); case 153: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.dotToken) || - visitNode(cbNode, node.name); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); case 154: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.argumentExpression); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); case 155: case 156: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.typeArguments) || - visitNodes(cbNodes, node.arguments); + return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); case 157: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.template); + return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); case 158: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); case 159: return visitNode(cbNode, node.expression); case 162: @@ -4070,189 +8853,169 @@ var ts; case 165: return visitNode(cbNode, node.operand); case 170: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); case 166: return visitNode(cbNode, node.operand); case 167: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); case 168: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); + return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); case 171: return visitNode(cbNode, node.expression); case 174: case 201: return visitNodes(cbNodes, node.statements); - case 220: - return visitNodes(cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); + case 221: + return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 175: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); case 194: return visitNodes(cbNodes, node.declarations); case 177: return visitNode(cbNode, node.expression); case 178: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); case 179: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); case 180: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 181: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.iterator) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); case 182: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 183: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 184: case 185: return visitNode(cbNode, node.label); case 186: return visitNode(cbNode, node.expression); case 187: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 188: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.clauses); - case 213: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.statements); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); + case 202: + return visitNodes(cbNodes, node.clauses); case 214: + return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); + case 215: return visitNodes(cbNodes, node.statements); case 189: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); case 190: return visitNode(cbNode, node.expression); case 191: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 216: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); + return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); + case 217: + return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 196: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); case 197: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); case 198: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); case 199: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.members); - case 219: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); + case 220: + return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 200: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 202: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); case 203: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); case 204: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); case 205: - return visitNode(cbNode, node.name); + return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); case 206: - case 210: - return visitNodes(cbNodes, node.elements); - case 209: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier); + return visitNode(cbNode, node.name); case 207: case 211: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); + return visitNodes(cbNodes, node.elements); + case 210: + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); case 208: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); + case 212: + return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); + case 209: + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 169: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); case 173: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 126: return visitNode(cbNode, node.expression); - case 215: + case 216: return visitNodes(cbNodes, node.types); - case 212: + case 213: return visitNode(cbNode, node.expression); } } ts.forEachChild = forEachChild; function parsingContextErrors(context) { switch (context) { - case 0: return ts.Diagnostics.Declaration_or_statement_expected; - case 1: return ts.Diagnostics.Declaration_or_statement_expected; - case 2: return ts.Diagnostics.Statement_expected; - case 3: return ts.Diagnostics.case_or_default_expected; - case 4: return ts.Diagnostics.Statement_expected; - case 5: return ts.Diagnostics.Property_or_signature_expected; - case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; - case 7: return ts.Diagnostics.Enum_member_expected; - case 8: return ts.Diagnostics.Type_reference_expected; - case 9: return ts.Diagnostics.Variable_declaration_expected; - case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; - case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; - case 12: return ts.Diagnostics.Argument_expression_expected; - case 13: return ts.Diagnostics.Property_assignment_expected; - case 14: return ts.Diagnostics.Expression_or_comma_expected; - case 15: return ts.Diagnostics.Parameter_declaration_expected; - case 16: return ts.Diagnostics.Type_parameter_declaration_expected; - case 17: return ts.Diagnostics.Type_argument_expected; - case 18: return ts.Diagnostics.Type_expected; - case 19: return ts.Diagnostics.Unexpected_token_expected; - case 20: return ts.Diagnostics.Identifier_expected; + case 0: + return ts.Diagnostics.Declaration_or_statement_expected; + case 1: + return ts.Diagnostics.Declaration_or_statement_expected; + case 2: + return ts.Diagnostics.Statement_expected; + case 3: + return ts.Diagnostics.case_or_default_expected; + case 4: + return ts.Diagnostics.Statement_expected; + case 5: + return ts.Diagnostics.Property_or_signature_expected; + case 6: + return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7: + return ts.Diagnostics.Enum_member_expected; + case 8: + return ts.Diagnostics.Type_reference_expected; + case 9: + return ts.Diagnostics.Variable_declaration_expected; + case 10: + return ts.Diagnostics.Property_destructuring_pattern_expected; + case 11: + return ts.Diagnostics.Array_element_destructuring_pattern_expected; + case 12: + return ts.Diagnostics.Argument_expression_expected; + case 13: + return ts.Diagnostics.Property_assignment_expected; + case 14: + return ts.Diagnostics.Expression_or_comma_expected; + case 15: + return ts.Diagnostics.Parameter_declaration_expected; + case 16: + return ts.Diagnostics.Type_parameter_declaration_expected; + case 17: + return ts.Diagnostics.Type_argument_expected; + case 18: + return ts.Diagnostics.Type_expected; + case 19: + return ts.Diagnostics.Unexpected_token_expected; + case 20: + return ts.Diagnostics.Identifier_expected; } } ; function modifierToFlag(token) { switch (token) { - case 109: return 128; - case 108: return 16; - case 107: return 64; - case 106: return 32; - case 77: return 1; - case 114: return 2; - case 69: return 8192; - case 72: return 256; + case 109: + return 128; + case 108: + return 16; + case 107: + return 64; + case 106: + return 32; + case 77: + return 1; + case 114: + return 2; + case 69: + return 8192; + case 72: + return 256; } return 0; } @@ -4483,8 +9246,7 @@ var ts; } ts.updateSourceFile = updateSourceFile; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 64 && - (node.text === "eval" || node.text === "arguments"); + return node.kind === 64 && (node.text === "eval" || node.text === "arguments"); } ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; function isUseStrictPrologueDirective(sourceFile, node) { @@ -4566,7 +9328,7 @@ var ts; var identifierCount = 0; var nodeCount = 0; var token; - var sourceFile = createNode(220, 0); + var sourceFile = createNode(221, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -4702,9 +9464,7 @@ var ts; var saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; var saveContextFlags = contextFlags; - var result = isLookAhead - ? scanner.lookAhead(callback) - : scanner.tryScan(callback); + var result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); ts.Debug.assert(saveContextFlags === contextFlags); if (!result || isLookAhead) { token = saveToken; @@ -4755,8 +9515,7 @@ var ts; return undefined; } function parseExpectedToken(t, reportAtCurrentPosition, diagnosticMessage, arg0) { - return parseOptionalToken(t) || - createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); + return parseOptionalToken(t) || createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); } function parseTokenNode() { var node = createNode(token); @@ -4833,9 +9592,7 @@ var ts; return createIdentifier(isIdentifierOrKeyword()); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || - token === 8 || - token === 7; + return isIdentifierOrKeyword() || token === 8 || token === 7; } function parsePropertyName() { if (token === 8 || token === 7) { @@ -4888,10 +9645,7 @@ var ts; return canFollowModifier(); } function canFollowModifier() { - return token === 18 - || token === 14 - || token === 35 - || isLiteralPropertyName(); + return token === 18 || token === 14 || token === 35 || isLiteralPropertyName(); } function nextTokenIsClassOrFunction() { nextToken(); @@ -4949,8 +9703,7 @@ var ts; return isIdentifier(); } function isNotHeritageClauseTypeName() { - if (token === 102 || - token === 78) { + if (token === 102 || token === 78) { return lookAhead(nextTokenIsIdentifier); } return false; @@ -5116,10 +9869,10 @@ var ts; function isReusableModuleElement(node) { if (node) { switch (node.kind) { + case 204: case 203: - case 202: + case 210: case 209: - case 208: case 196: case 197: case 200: @@ -5147,8 +9900,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 213: case 214: + case 215: return true; } } @@ -5183,7 +9936,7 @@ var ts; return false; } function isReusableEnumMember(node) { - return node.kind === 219; + return node.kind === 220; } function isReusableTypeMember(node) { if (node) { @@ -5331,9 +10084,7 @@ var ts; var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - if (node.kind === 7 - && sourceText.charCodeAt(tokenPos) === 48 - && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + if (node.kind === 7 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { node.flags |= 16384; } return node; @@ -5372,9 +10123,7 @@ var ts; } function parseParameterType() { if (parseOptional(51)) { - return token === 8 - ? parseLiteralNode(true) - : parseType(); + return token === 8 ? parseLiteralNode(true) : parseType(); } return undefined; } @@ -5532,11 +10281,7 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 || - token === 24 || - token === 50 || - token === 51 || - canParseSemicolon(); + return token === 16 || token === 24 || token === 50 || token === 51 || canParseSemicolon(); } function parseTypeMember() { switch (token) { @@ -5544,9 +10289,7 @@ var ts; case 24: return parseSignatureMember(136); case 18: - return isIndexSignature() - ? parseIndexSignatureDeclaration(undefined) - : parsePropertyOrMethodSignature(); + return isIndexSignature() ? parseIndexSignatureDeclaration(undefined) : parsePropertyOrMethodSignature(); case 87: if (lookAhead(isStartOfConstructSignature)) { return parseSignatureMember(137); @@ -5568,9 +10311,7 @@ var ts; } function parseIndexSignatureWithModifiers() { var modifiers = parseModifiers(); - return isIndexSignature() - ? parseIndexSignatureDeclaration(modifiers) - : undefined; + return isIndexSignature() ? parseIndexSignatureDeclaration(modifiers) : undefined; } function isStartOfConstructSignature() { nextToken(); @@ -5676,7 +10417,9 @@ var ts; function parseUnionTypeOrHigher() { var type = parseArrayTypeOrHigher(); if (token === 44) { - var types = [type]; + var types = [ + type + ]; types.pos = type.pos; while (parseOptional(44)) { types.push(parseArrayTypeOrHigher()); @@ -5701,9 +10444,7 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 51 || token === 23 || - token === 50 || token === 52 || - isIdentifier() || ts.isModifier(token)) { + if (token === 51 || token === 23 || token === 50 || token === 52 || isIdentifier() || ts.isModifier(token)) { return true; } if (token === 17) { @@ -5831,8 +10572,7 @@ var ts; function parseYieldExpression() { var node = createNode(170); nextToken(); - if (!scanner.hasPrecedingLineBreak() && - (token === 35 || isStartOfExpression())) { + if (!scanner.hasPrecedingLineBreak() && (token === 35 || isStartOfExpression())) { node.asteriskToken = parseOptionalToken(35); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); @@ -5847,7 +10587,9 @@ var ts; var parameter = createNode(128, identifier.pos); parameter.name = identifier; finishNode(parameter); - node.parameters = [parameter]; + node.parameters = [ + parameter + ]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; parseExpected(32); @@ -5859,9 +10601,7 @@ var ts; if (triState === 0) { return undefined; } - var arrowFunction = triState === 1 - ? parseParenthesizedArrowFunctionExpressionHead(true) - : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + var arrowFunction = triState === 1 ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); if (!arrowFunction) { return undefined; } @@ -6083,9 +10823,7 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 90 - ? parseSuperExpression() - : parseMemberExpressionOrHigher(); + var expression = token === 90 ? parseSuperExpression() : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); } function parseMemberExpressionOrHigher() { @@ -6139,9 +10877,7 @@ var ts; if (token === 10 || token === 11) { var tagExpression = createNode(157, expression.pos); tagExpression.tag = expression; - tagExpression.template = token === 10 - ? parseLiteralNode() - : parseTemplateExpression(); + tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); expression = finishNode(tagExpression); continue; } @@ -6187,9 +10923,7 @@ var ts; if (!parseExpected(25)) { return undefined; } - return typeArguments && canFollowTypeArgumentsInExpression() - ? typeArguments - : undefined; + return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; } function canFollowTypeArgumentsInExpression() { switch (token) { @@ -6264,9 +10998,7 @@ var ts; return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(172) : - parseAssignmentExpressionOrHigher(); + return token === 21 ? parseSpreadElement() : token === 23 ? createNode(172) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return allowInAnd(parseArgumentOrArrayLiteralElement); @@ -6305,13 +11037,13 @@ var ts; return parseMethodDeclaration(fullStart, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(218, fullStart); + var shorthandDeclaration = createNode(219, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(217, fullStart); + var propertyAssignment = createNode(218, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -6477,7 +11209,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(213); + var node = createNode(214); parseExpected(66); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -6485,7 +11217,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(214); + var node = createNode(215); parseExpected(72); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -6500,9 +11232,11 @@ var ts; parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); + var caseBlock = createNode(202, scanner.getStartPos()); parseExpected(14); - node.clauses = parseList(3, false, parseCaseOrDefaultClause); + caseBlock.clauses = parseList(3, false, parseCaseOrDefaultClause); parseExpected(15); + node.caseBlock = finishNode(caseBlock); return finishNode(node); } function parseThrowStatement() { @@ -6524,7 +11258,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(216); + var result = createNode(217); parseExpected(67); if (parseExpected(16)) { result.variableDeclaration = parseVariableDeclaration(); @@ -6914,11 +11648,7 @@ var ts; if (isIndexSignature()) { return parseIndexSignatureDeclaration(modifiers); } - if (isIdentifierOrKeyword() || - token === 8 || - token === 7 || - token === 35 || - token === 18) { + if (isIdentifierOrKeyword() || token === 8 || token === 7 || token === 35 || token === 18) { return parsePropertyOrMethodDeclaration(fullStart, modifiers); } ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -6931,9 +11661,7 @@ var ts; node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); if (parseExpected(14)) { - node.members = inGeneratorParameterContext() - ? doOutsideOfYieldContext(parseClassMembers) - : parseClassMembers(); + node.members = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); parseExpected(15); } else { @@ -6943,9 +11671,7 @@ var ts; } function parseHeritageClauses(isClassHeritageClause) { if (isHeritageClause()) { - return isClassHeritageClause && inGeneratorParameterContext() - ? doOutsideOfYieldContext(parseHeritageClausesWorker) - : parseHeritageClausesWorker(); + return isClassHeritageClause && inGeneratorParameterContext() ? doOutsideOfYieldContext(parseHeritageClausesWorker) : parseHeritageClausesWorker(); } return undefined; } @@ -6954,7 +11680,7 @@ var ts; } function parseHeritageClause() { if (token === 78 || token === 102) { - var node = createNode(215); + var node = createNode(216); node.token = token; nextToken(); node.types = parseDelimitedList(8, parseTypeReference); @@ -6989,7 +11715,7 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(219, scanner.getStartPos()); + var node = createNode(220, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); @@ -7024,9 +11750,7 @@ var ts; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(20) - ? parseInternalModuleTail(getNodePos(), undefined, 1) - : parseModuleBlock(); + node.body = parseOptional(20) ? parseInternalModuleTail(getNodePos(), undefined, 1) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { @@ -7038,21 +11762,17 @@ var ts; } function parseModuleDeclaration(fullStart, modifiers) { parseExpected(116); - return token === 8 - ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) - : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); + return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); } function isExternalModuleReference() { - return token === 117 && - lookAhead(nextTokenIsOpenParen); + return token === 117 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 16; } function nextTokenIsCommaOrFromKeyword() { nextToken(); - return token === 23 || - token === 123; + return token === 23 || token === 123; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, modifiers) { parseExpected(84); @@ -7061,7 +11781,7 @@ var ts; if (isIdentifier()) { identifier = parseIdentifier(); if (token !== 23 && token !== 123) { - var importEqualsDeclaration = createNode(202, fullStart); + var importEqualsDeclaration = createNode(203, fullStart); setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; parseExpected(52); @@ -7070,11 +11790,9 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(203, fullStart); + var importDeclaration = createNode(204, fullStart); setModifiers(importDeclaration, modifiers); - if (identifier || - token === 35 || - token === 14) { + if (identifier || token === 35 || token === 14) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); parseExpected(123); } @@ -7083,23 +11801,20 @@ var ts; return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(204, fullStart); + var importClause = createNode(205, fullStart); if (identifier) { importClause.name = identifier; } - if (!importClause.name || - parseOptional(23)) { - importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(206); + if (!importClause.name || parseOptional(23)) { + importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(207); } return finishNode(importClause); } function parseModuleReference() { - return isExternalModuleReference() - ? parseExternalModuleReference() - : parseEntityName(false); + return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(212); + var node = createNode(213); parseExpected(117); parseExpected(16); node.expression = parseModuleSpecifier(); @@ -7114,7 +11829,7 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(205); + var namespaceImport = createNode(206); parseExpected(35); parseExpected(101); namespaceImport.name = parseIdentifier(); @@ -7122,14 +11837,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(20, kind === 206 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(20, kind === 207 ? parseImportSpecifier : parseExportSpecifier, 14, 15); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(211); + return parseImportOrExportSpecifier(212); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(207); + return parseImportOrExportSpecifier(208); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -7155,14 +11870,14 @@ var ts; return finishNode(node); } function parseExportDeclaration(fullStart, modifiers) { - var node = createNode(209, fullStart); + var node = createNode(210, fullStart); setModifiers(node, modifiers); if (parseOptional(35)) { parseExpected(123); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(210); + node.exportClause = parseNamedImportsOrExports(211); if (parseOptional(123)) { node.moduleSpecifier = parseModuleSpecifier(); } @@ -7171,7 +11886,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, modifiers) { - var node = createNode(208, fullStart); + var node = createNode(209, fullStart); setModifiers(node, modifiers); if (parseOptional(52)) { node.isExportEquals = true; @@ -7226,13 +11941,11 @@ var ts; } function nextTokenCanFollowImportKeyword() { nextToken(); - return isIdentifierOrKeyword() || token === 8 || - token === 35 || token === 14; + return isIdentifierOrKeyword() || token === 8 || token === 35 || token === 14; } function nextTokenCanFollowExportKeyword() { nextToken(); - return token === 52 || token === 35 || - token === 14 || token === 72 || isDeclarationStart(); + return token === 52 || token === 35 || token === 14 || token === 72 || isDeclarationStart(); } function nextTokenIsDeclarationStart() { nextToken(); @@ -7286,9 +11999,7 @@ var ts; return parseSourceElementOrModuleElement(); } function parseSourceElementOrModuleElement() { - return isDeclarationStart() - ? parseDeclaration() - : parseStatement(); + return isDeclarationStart() ? parseDeclaration() : parseStatement(); } function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, sourceText); @@ -7303,7 +12014,10 @@ var ts; if (kind !== 2) { break; } - var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; + var range = { + pos: triviaScanner.getTokenPos(), + end: triviaScanner.getTextPos() + }; var comment = sourceText.substring(range.pos, range.end); var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { @@ -7334,7 +12048,10 @@ var ts; var pathMatchResult = pathRegex.exec(comment); var nameMatchResult = nameRegex.exec(comment); if (pathMatchResult) { - var amdDependency = { path: pathMatchResult[2], name: nameMatchResult ? nameMatchResult[2] : undefined }; + var amdDependency = { + path: pathMatchResult[2], + name: nameMatchResult ? nameMatchResult[2] : undefined + }; amdDependencies.push(amdDependency); } } @@ -7346,13 +12063,7 @@ var ts; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 1 - || node.kind === 202 && node.moduleReference.kind === 212 - || node.kind === 203 - || node.kind === 208 - || node.kind === 209 - ? node - : undefined; + return node.flags & 1 || node.kind === 203 && node.moduleReference.kind === 213 || node.kind === 204 || node.kind === 209 || node.kind === 210 ? node : undefined; }); } } @@ -7400,7 +12111,7 @@ var ts; else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 203 || node.kind === 202) && !(node.flags & 1)) { + else if ((node.kind === 204 || node.kind === 203) && !(node.flags & 1)) { return 0; } else if (node.kind === 201) { @@ -7493,9 +12204,9 @@ var ts; return "__new"; case 138: return "__index"; - case 209: + case 210: return "__export"; - case 208: + case 209: return "default"; case 195: case 196: @@ -7514,9 +12225,7 @@ var ts; if (node.name) { node.name.parent = node; } - var message = symbol.flags & 2 - ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 - : ts.Diagnostics.Duplicate_identifier_0; + var message = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); @@ -7553,7 +12262,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolKind & 8388608) { - if (node.kind === 211 || (node.kind === 202 && hasExportModifier)) { + if (node.kind === 212 || (node.kind === 203 && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -7562,9 +12271,7 @@ var ts; } else { if (hasExportModifier || isAmbientContext(container)) { - var exportKind = (symbolKind & 107455 ? 1048576 : 0) | - (symbolKind & 793056 ? 2097152 : 0) | - (symbolKind & 1536 ? 4194304 : 0); + var exportKind = (symbolKind & 107455 ? 1048576 : 0) | (symbolKind & 793056 ? 2097152 : 0) | (symbolKind & 1536 ? 4194304 : 0); var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); node.localSymbol = local; @@ -7590,7 +12297,7 @@ var ts; lastContainer = container; } if (isBlockScopeContainer) { - setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 220); + setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 221); } ts.forEachChild(node, bind); container = saveContainer; @@ -7602,7 +12309,7 @@ var ts; case 200: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 220: + case 221: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -7680,7 +12387,7 @@ var ts; case 200: declareModuleMember(node, 2, 107455); break; - case 220: + case 221: if (ts.isExternalModule(container)) { declareModuleMember(node, 2, 107455); break; @@ -7721,11 +12428,11 @@ var ts; case 129: bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 217: case 218: + case 219: bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 219: + case 220: bindPropertyOrMethodOrAccessor(node, 8, 107455, false); break; case 136: @@ -7763,7 +12470,7 @@ var ts; case 161: bindAnonymousDeclaration(node, 16, "__function", true); break; - case 216: + case 217: bindCatchVariableDeclaration(node); break; case 196: @@ -7786,13 +12493,13 @@ var ts; case 200: bindModuleDeclaration(node); break; - case 202: - case 205: - case 207: - case 211: + case 203: + case 206: + case 208: + case 212: bindDeclaration(node, 8388608, 8388608, false); break; - case 204: + case 205: if (node.name) { bindDeclaration(node, 8388608, 8388608, false); } @@ -7800,13 +12507,13 @@ var ts; bindChildren(node, 0, false); } break; - case 209: + case 210: if (!node.exportClause) { declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); } bindChildren(node, 0, false); break; - case 208: + case 209: if (node.expression.kind === 64) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 8388608); } @@ -7815,7 +12522,7 @@ var ts; } bindChildren(node, 0, false); break; - case 220: + case 221: if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; @@ -7823,11 +12530,11 @@ var ts; case 174: bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 216: + case 217: case 181: case 182: case 183: - case 188: + case 202: bindChildren(node, 0, true); break; default: @@ -7844,9 +12551,7 @@ var ts; else { bindDeclaration(node, 1, 107455, false); } - if (node.flags & 112 && - node.parent.kind === 133 && - node.parent.parent.kind === 196) { + if (node.flags & 112 && node.parent.kind === 133 && node.parent.parent.kind === 196) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -7878,12 +12583,24 @@ var ts; var languageVersion = compilerOptions.target || 0; var emitResolver = createResolver(); var checker = { - getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, - getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, - getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, - getTypeCount: function () { return typeCount; }, - isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, - isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + getNodeCount: function () { + return ts.sum(host.getSourceFiles(), "nodeCount"); + }, + getIdentifierCount: function () { + return ts.sum(host.getSourceFiles(), "identifierCount"); + }, + getSymbolCount: function () { + return ts.sum(host.getSourceFiles(), "symbolCount"); + }, + getTypeCount: function () { + return typeCount; + }, + isUndefinedSymbol: function (symbol) { + return symbol === undefinedSymbol; + }, + isArgumentsSymbol: function (symbol) { + return symbol === argumentsSymbol; + }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, @@ -7979,9 +12696,7 @@ var ts; return emitResolver; } function error(location, message, arg0, arg1, arg2) { - var diagnostic = location - ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) - : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); + var diagnostic = location ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); diagnostics.add(diagnostic); } function createSymbol(flags, name) { @@ -8067,8 +12782,7 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 || source.flags & 2 - ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { error(node.name ? node.name : node, message, symbolToString(source)); }); @@ -8115,10 +12829,10 @@ var ts; return nodeLinks[node.id] || (nodeLinks[node.id] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 220); + return ts.getAncestor(node, 221); } function isGlobalSourceFile(node) { - return node.kind === 220 && !ts.isExternalModule(node); + return node.kind === 221 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -8159,12 +12873,12 @@ var ts; } } switch (location.kind) { - case 220: + case 221: if (!ts.isExternalModule(location)) break; case 200: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { - if (!(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 211)) { + if (!(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 212)) { break loop; } result = undefined; @@ -8248,28 +12962,54 @@ var ts; return undefined; } if (result.flags & 2) { - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); - ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!isDefinedBefore(declaration, errorLocation)) { - error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); - } + checkResolvedBlockScopedVariable(result, errorLocation); } } return result; } + function checkResolvedBlockScopedVariable(result, errorLocation) { + ts.Debug.assert((result.flags & 2) !== 0); + var declaration = ts.forEach(result.declarations, function (d) { + return ts.isBlockOrCatchScoped(d) ? d : undefined; + }); + ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); + var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); + if (!isUsedBeforeDeclaration) { + var variableDeclaration = ts.getAncestor(declaration, 193); + var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); + if (variableDeclaration.parent.parent.kind === 175 || variableDeclaration.parent.parent.kind === 181) { + isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); + } + else if (variableDeclaration.parent.parent.kind === 183 || variableDeclaration.parent.parent.kind === 182) { + var expression = variableDeclaration.parent.parent.expression; + isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); + } + } + if (isUsedBeforeDeclaration) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + } + function isSameScopeDescendentOf(initial, parent, stopAt) { + if (!parent) { + return false; + } + for (var current = initial; current && current !== stopAt && !ts.isFunctionLike(current); current = current.parent) { + if (current === parent) { + return true; + } + } + return false; + } function isAliasSymbolDeclaration(node) { - return node.kind === 202 || - node.kind === 204 && !!node.name || - node.kind === 205 || - node.kind === 207 || - node.kind === 211 || - node.kind === 208; + return node.kind === 203 || node.kind === 205 && !!node.name || node.kind === 206 || node.kind === 208 || node.kind === 212 || node.kind === 209; } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.forEach(symbol.declarations, function (d) { + return isAliasSymbolDeclaration(d) ? d : undefined; + }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 212) { + if (node.moduleReference.kind === 213) { var moduleSymbol = resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)); var exportAssignmentSymbol = moduleSymbol && getResolvedExportAssignmentSymbol(moduleSymbol); return exportAssignmentSymbol || moduleSymbol; @@ -8307,26 +13047,24 @@ var ts; return getExternalModuleMember(node.parent.parent.parent, node); } function getTargetOfExportSpecifier(node) { - return node.parent.parent.moduleSpecifier ? - getExternalModuleMember(node.parent.parent, node) : - resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); + return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); } function getTargetOfExportAssignment(node) { return resolveEntityName(node.expression, 107455 | 793056 | 1536); } function getTargetOfImportDeclaration(node) { switch (node.kind) { - case 202: + case 203: return getTargetOfImportEqualsDeclaration(node); - case 204: - return getTargetOfImportClause(node); case 205: + return getTargetOfImportClause(node); + case 206: return getTargetOfNamespaceImport(node); - case 207: - return getTargetOfImportSpecifier(node); - case 211: - return getTargetOfExportSpecifier(node); case 208: + return getTargetOfImportSpecifier(node); + case 212: + return getTargetOfExportSpecifier(node); + case 209: return getTargetOfExportAssignment(node); } } @@ -8361,10 +13099,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 208) { + if (node.kind === 209) { checkExpressionCached(node.expression); } - else if (node.kind === 211) { + else if (node.kind === 212) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -8374,7 +13112,7 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 202); + importDeclaration = ts.getAncestor(entityName, 203); ts.Debug.assert(importDeclaration !== undefined); } if (entityName.kind === 64 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { @@ -8384,7 +13122,7 @@ var ts; return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 202); + ts.Debug.assert(entityName.parent.kind === 203); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -8524,9 +13262,7 @@ var ts; return getMergedSymbol(symbol.parent); } function getExportSymbolOfValueSymbolIfExported(symbol) { - return symbol && (symbol.flags & 1048576) !== 0 - ? getMergedSymbol(symbol.exportSymbol) - : symbol; + return symbol && (symbol.flags & 1048576) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; } function symbolIsValue(symbol) { if (symbol.flags & 16777216) { @@ -8565,10 +13301,7 @@ var ts; return type; } function isReservedMemberName(name) { - return name.charCodeAt(0) === 95 && - name.charCodeAt(1) === 95 && - name.charCodeAt(2) !== 95 && - name.charCodeAt(2) !== 64; + return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && name.charCodeAt(2) !== 95 && name.charCodeAt(2) !== 64; } function getNamedMembers(members) { var result; @@ -8609,7 +13342,7 @@ var ts; } } switch (location.kind) { - case 220: + case 221: if (!ts.isExternalModule(location)) { break; } @@ -8642,24 +13375,28 @@ var ts; } function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { - return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && - canQualifySymbol(symbolFromSymbolTable, meaning); + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); } } if (isAccessible(ts.lookUp(symbols, symbol.name))) { - return [symbol]; + return [ + symbol + ]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608) { - if (!useOnlyExternalAliasing || - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; + return [ + symbolFromSymbolTable + ]; } var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + return [ + symbolFromSymbolTable + ].concat(accessibleSymbolsFromExports); } } } @@ -8724,7 +13461,9 @@ var ts; errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) }; } - return { accessibility: 0 }; + return { + accessibility: 0 + }; function getExternalModuleContainer(declaration) { for (; declaration; declaration = declaration.parent) { if (hasExternalModuleSymbol(declaration)) { @@ -8734,20 +13473,22 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 200 && declaration.name.kind === 8) || - (declaration.kind === 220 && ts.isExternalModule(declaration)); + return (declaration.kind === 200 && declaration.name.kind === 8) || (declaration.kind === 221 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; - if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { + if (ts.forEach(symbol.declarations, function (declaration) { + return !getIsDeclarationVisible(declaration); + })) { return undefined; } - return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; + return { + accessibility: 0, + aliasesToMakeVisible: aliasesToMakeVisible + }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 202 && - !(declaration.flags & 1) && - isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 203 && !(declaration.flags & 1) && isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -8755,7 +13496,9 @@ var ts; } } else { - aliasesToMakeVisible = [declaration]; + aliasesToMakeVisible = [ + declaration + ]; } return true; } @@ -8769,8 +13512,7 @@ var ts; if (entityName.parent.kind === 142) { meaning = 107455 | 1048576; } - else if (entityName.kind === 125 || - entityName.parent.kind === 202) { + else if (entityName.kind === 125 || entityName.parent.kind === 203) { meaning = 1536; } else { @@ -8856,8 +13598,7 @@ var ts; function walkSymbol(symbol, meaning) { if (symbol) { var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); - if (!accessibleSymbolChain || - needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { @@ -8889,8 +13630,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { if (type.flags & 1048703) { - writer.writeKeyword(!(globalFlags & 16) && - (type.flags & 1) ? "any" : type.intrinsicName); + writer.writeKeyword(!(globalFlags & 16) && (type.flags & 1) ? "any" : type.intrinsicName); } else if (type.flags & 4096) { writeTypeReference(type, flags); @@ -8983,16 +13723,14 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && - ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && - (type.symbol.parent || - ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 220 || declaration.parent.kind === 201; - })); + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.flags & 128; + })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.parent.kind === 221 || declaration.parent.kind === 201; + })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { - return !!(flags & 2) || - (typeStack && ts.contains(typeStack, type)); + return !!(flags & 2) || (typeStack && ts.contains(typeStack, type)); } } } @@ -9222,7 +13960,7 @@ var ts; return node; } } - else if (node.kind === 220) { + else if (node.kind === 221) { return ts.isExternalModule(node) ? node : undefined; } } @@ -9272,10 +14010,9 @@ var ts; case 198: case 195: case 199: - case 202: + case 203: var parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 202 && parent.kind !== 220 && ts.isInAmbientContext(parent))) { + if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 203 && parent.kind !== 221 && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(parent); @@ -9304,7 +14041,7 @@ var ts; case 147: return isDeclarationVisible(node.parent); case 127: - case 220: + case 221: return true; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -9330,7 +14067,9 @@ var ts; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); - return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; + return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { + return anyType; + })) : classType; } function getTypeOfPropertyOfType(type, name) { var prop = getPropertyOfType(type, name); @@ -9350,9 +14089,7 @@ var ts; } if (pattern.kind === 148) { var name = declaration.propertyName || declaration.name; - var type = getTypeOfPropertyOfType(parentType, name.text) || - isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || - getIndexTypeOfType(parentType, 0); + var type = getTypeOfPropertyOfType(parentType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; @@ -9367,7 +14104,12 @@ var ts; var propName = "" + ts.indexOf(pattern.elements, declaration); var type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1); if (!type) { - error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName); + if (isTupleType(parentType)) { + error(declaration, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), parentType.elementTypes.length, pattern.elements.length); + } + else { + error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName); + } return unknownType; } } @@ -9382,7 +14124,7 @@ var ts; return anyType; } if (declaration.parent.parent.kind === 183) { - return getTypeForVariableDeclarationInForOfStatement(declaration.parent.parent); + return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); @@ -9406,7 +14148,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 218) { + if (declaration.kind === 219) { return checkIdentifier(declaration.name); } return undefined; @@ -9443,9 +14185,7 @@ var ts; return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 148 - ? getTypeFromObjectBindingPattern(pattern) - : getTypeFromArrayBindingPattern(pattern); + return pattern.kind === 148 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -9453,7 +14193,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 217 ? getWidenedType(type) : type; + return declaration.kind !== 218 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -9474,10 +14214,10 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 216) { + if (declaration.parent.kind === 217) { return links.type = anyType; } - if (declaration.kind === 208) { + if (declaration.kind === 209) { return links.type = checkExpression(declaration.expression); } links.type = resolvingType; @@ -9489,9 +14229,7 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); } } @@ -9625,7 +14363,9 @@ var ts; ts.forEach(declaration.typeParameters, function (node) { var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); if (!result) { - result = [tp]; + result = [ + tp + ]; } else if (!ts.contains(result, tp)) { result.push(tp); @@ -9871,14 +14611,15 @@ var ts; var baseType = classType.baseTypes[0]; var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1); return ts.map(baseSignatures, function (baseSignature) { - var signature = baseType.flags & 4096 ? - getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); + var signature = baseType.flags & 4096 ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); signature.typeParameters = classType.typeParameters; signature.resolvedReturnType = classType; return signature; }); } - return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; + return [ + createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false) + ]; } function createTupleTypeMemberSymbols(memberTypes) { var members = {}; @@ -9907,7 +14648,9 @@ var ts; return true; } function getUnionSignatures(types, kind) { - var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); + var signatureLists = ts.map(types, function (t) { + return getSignaturesOfType(t, kind); + }); var signatures = signatureLists[0]; for (var i = 0; i < signatures.length; i++) { if (signatures[i].typeParameters) { @@ -9923,7 +14666,9 @@ var ts; for (var i = 0; i < result.length; i++) { var s = result[i]; s.resolvedReturnType = undefined; - s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); + s.unionSignatures = ts.map(signatureLists, function (signatures) { + return signatures[i]; + }); } return result; } @@ -10067,7 +14812,9 @@ var ts; return undefined; } if (!props) { - props = [prop]; + props = [ + prop + ]; } else { props.push(prop); @@ -10167,8 +14914,7 @@ var ts; var links = getNodeLinks(declaration); if (!links.resolvedSignature) { var classType = declaration.kind === 133 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; - var typeParameters = classType ? classType.typeParameters : - declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; + var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; @@ -10299,8 +15045,12 @@ var ts; var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; - type.callSignatures = !isConstructor ? [signature] : emptyArray; - type.constructSignatures = isConstructor ? [signature] : emptyArray; + type.callSignatures = !isConstructor ? [ + signature + ] : emptyArray; + type.constructSignatures = isConstructor ? [ + signature + ] : emptyArray; signature.isolatedSignatureType = type; } return signature.isolatedSignatureType; @@ -10327,9 +15077,7 @@ var ts; } function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); - return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType - : undefined; + return declaration ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType : undefined; } function getConstraintOfTypeParameter(type) { if (!type.constraint) { @@ -10383,7 +15131,9 @@ var ts; return links.isIllegalTypeReferenceInConstraint; } var currentNode = typeReferenceNode; - while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { + while (!ts.forEach(typeParameterSymbol.declarations, function (d) { + return d.parent === currentNode.parent; + })) { currentNode = currentNode.parent; } links.isIllegalTypeReferenceInConstraint = currentNode.kind === 127; @@ -10397,7 +15147,9 @@ var ts; if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); if (symbol && (symbol.flags & 262144)) { - links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); + links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { + return d.parent == typeParameter.parent; + }); } } if (links.isIllegalTypeReferenceInConstraint) { @@ -10496,7 +15248,9 @@ var ts; } function createArrayType(elementType) { var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); - return arrayType !== emptyObjectType ? createTypeReference(arrayType, [elementType]) : emptyObjectType; + return arrayType !== emptyObjectType ? createTypeReference(arrayType, [ + elementType + ]) : emptyObjectType; } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); @@ -10682,15 +15436,21 @@ var ts; return items; } function createUnaryTypeMapper(source, target) { - return function (t) { return t === source ? target : t; }; + return function (t) { + return t === source ? target : t; + }; } function createBinaryTypeMapper(source1, target1, source2, target2) { - return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; + return function (t) { + return t === source1 ? target1 : t === source2 ? target2 : t; + }; } function createTypeMapper(sources, targets) { switch (sources.length) { - case 1: return createUnaryTypeMapper(sources[0], targets[0]); - case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); + case 1: + return createUnaryTypeMapper(sources[0], targets[0]); + case 2: + return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); } return function (t) { for (var i = 0; i < sources.length; i++) { @@ -10701,15 +15461,21 @@ var ts; }; } function createUnaryTypeEraser(source) { - return function (t) { return t === source ? anyType : t; }; + return function (t) { + return t === source ? anyType : t; + }; } function createBinaryTypeEraser(source1, source2) { - return function (t) { return t === source1 || t === source2 ? anyType : t; }; + return function (t) { + return t === source1 || t === source2 ? anyType : t; + }; } function createTypeEraser(sources) { switch (sources.length) { - case 1: return createUnaryTypeEraser(sources[0]); - case 2: return createBinaryTypeEraser(sources[0], sources[1]); + case 1: + return createUnaryTypeEraser(sources[0]); + case 2: + return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { for (var i = 0; i < sources.length; i++) { @@ -10733,7 +15499,9 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return mapper2(mapper1(t)); }; + return function (t) { + return mapper2(mapper1(t)); + }; } function instantiateTypeParameter(typeParameter, mapper) { var result = createType(512); @@ -10793,8 +15561,7 @@ var ts; return mapper(type); } if (type.flags & 32768) { - return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? - instantiateAnonymousType(type, mapper) : type; + return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096) { return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); @@ -10819,12 +15586,10 @@ var ts; case 151: return ts.forEach(node.elements, isContextSensitive); case 168: - return isContextSensitive(node.whenTrue) || - isContextSensitive(node.whenFalse); + return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); case 167: - return node.operatorToken.kind === 49 && - (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 217: + return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 218: return isContextSensitive(node.initializer); case 132: case 131: @@ -10835,7 +15600,9 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { + return p.type; + }); } function getTypeWithoutConstructors(type) { if (type.flags & 48128) { @@ -10974,8 +15741,7 @@ var ts; } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && - (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; return result; } @@ -11432,9 +16198,7 @@ var ts; if (source === target) { return -1; } - if (source.parameters.length !== target.parameters.length || - source.minArgumentCount !== target.minArgumentCount || - source.hasRestParameter !== target.hasRestParameter) { + if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { return 0; } var result = -1; @@ -11477,7 +16241,9 @@ var ts; return true; } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + return ts.forEach(types, function (t) { + return isSupertypeOfEach(t, types) ? t : undefined; + }); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { var bestSupertype; @@ -11514,6 +16280,9 @@ var ts; function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); } + function isTupleType(type) { + return (type.flags & 8192) && !!type.elementTypes; + } function getWidenedTypeOfObjectLiteral(type) { var properties = getPropertiesOfObjectType(type); var members = {}; @@ -11593,9 +16362,7 @@ var ts; var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; case 128: - var diagnostic = declaration.dotDotDotToken ? - ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : - ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + var diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; case 195: case 132: @@ -11651,7 +16418,10 @@ var ts; function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; for (var i = 0; i < typeParameters.length; i++) { - inferences.push({ primary: undefined, secondary: undefined }); + inferences.push({ + primary: undefined, + secondary: undefined + }); } return { typeParameters: typeParameters, @@ -11696,9 +16466,7 @@ var ts; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { var inferences = context.inferences[i]; - var candidates = inferiority ? - inferences.secondary || (inferences.secondary = []) : - inferences.primary || (inferences.primary = []); + var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); if (!ts.contains(candidates, source)) candidates.push(source); break; @@ -11738,8 +16506,7 @@ var ts; inferFromTypes(sourceTypes[i], target); } } - else if (source.flags & 48128 && (target.flags & (4096 | 8192) || - (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -11846,16 +16613,23 @@ var ts; } ts.Debug.fail("should not get here"); } - function removeTypesFromUnionType(type, typeKind, isOfTypeKind) { + function removeTypesFromUnionType(type, typeKind, isOfTypeKind, allowEmptyUnionResult) { if (type.flags & 16384) { var types = type.types; - if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { - var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); - if (narrowedType !== emptyObjectType) { + if (ts.forEach(types, function (t) { + return !!(t.flags & typeKind) === isOfTypeKind; + })) { + var narrowedType = getUnionType(ts.filter(types, function (t) { + return !(t.flags & typeKind) === isOfTypeKind; + })); + if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { return narrowedType; } } } + else if (allowEmptyUnionResult && !!(type.flags & typeKind) === isOfTypeKind) { + return getUnionType(emptyArray); + } return type; } function hasInitializer(node) { @@ -11927,12 +16701,12 @@ var ts; case 186: case 187: case 188: - case 213: case 214: + case 215: case 189: case 190: case 191: - case 216: + case 217: return ts.forEachChild(node, isAssignedIn); } return false; @@ -11941,12 +16715,13 @@ var ts; function resolveLocation(node) { var containerNodes = []; for (var parent = node.parent; parent; parent = parent.parent) { - if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && - isContextSensitive(parent)) { + if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(parent)) { containerNodes.unshift(parent); } } - ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); + ts.forEach(containerNodes, function (node) { + getTypeOfNode(node); + }); } function getSymbolAtLocation(node) { resolveLocation(node); @@ -11988,7 +16763,7 @@ var ts; } } break; - case 220: + case 221: case 200: case 195: case 132: @@ -12022,16 +16797,16 @@ var ts; } if (assumeTrue) { if (!typeInfo) { - return removeTypesFromUnionType(type, 258 | 132 | 8 | 1048576, true); + return removeTypesFromUnionType(type, 258 | 132 | 8 | 1048576, true, false); } if (isTypeSubtypeOf(typeInfo.type, type)) { return typeInfo.type; } - return removeTypesFromUnionType(type, typeInfo.flags, false); + return removeTypesFromUnionType(type, typeInfo.flags, false, false); } else { if (typeInfo) { - return removeTypesFromUnionType(type, typeInfo.flags, true); + return removeTypesFromUnionType(type, typeInfo.flags, true, false); } return type; } @@ -12075,7 +16850,9 @@ var ts; return targetType; } if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + return getUnionType(ts.filter(type.types, function (t) { + return isTypeSubtypeOf(t, targetType); + })); } return type; } @@ -12131,9 +16908,7 @@ var ts; return false; } function checkBlockScopedBindingCapturedInLoop(node, symbol) { - if (languageVersion >= 2 || - (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 216) { + if (languageVersion >= 2 || (symbol.flags & 2) === 0 || symbol.valueDeclaration.parent.kind === 217) { return; } var container = symbol.valueDeclaration; @@ -12240,21 +17015,10 @@ var ts; } if (container && container.parent && container.parent.kind === 196) { if (container.flags & 128) { - canUseSuperExpression = - container.kind === 132 || - container.kind === 131 || - container.kind === 134 || - container.kind === 135; + canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135; } else { - canUseSuperExpression = - container.kind === 132 || - container.kind === 131 || - container.kind === 134 || - container.kind === 135 || - container.kind === 130 || - container.kind === 129 || - container.kind === 133; + canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135 || container.kind === 130 || container.kind === 129 || container.kind === 133; } } } @@ -12301,8 +17065,7 @@ var ts; if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } - if (indexOfParameter === (func.parameters.length - 1) && - funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); } } @@ -12387,7 +17150,10 @@ var ts; mappedType = t; } else if (!mappedTypes) { - mappedTypes = [mappedType, t]; + mappedTypes = [ + mappedType, + t + ]; } else { mappedTypes.push(t); @@ -12403,13 +17169,17 @@ var ts; }); } function getIndexTypeOfContextualType(type, kind) { - return applyToContextualType(type, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }); + return applyToContextualType(type, function (t) { + return getIndexTypeOfObjectOrUnionType(t, kind); + }); } function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } function contextualTypeHasIndexSignature(type, kind) { - return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); + return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { + return getIndexTypeOfObjectOrUnionType(t, kind); + }) : getIndexTypeOfObjectOrUnionType(type, kind)); } function getContextualTypeForObjectLiteralMethod(node) { ts.Debug.assert(ts.isObjectLiteralMethod(node)); @@ -12429,8 +17199,7 @@ var ts; return propertyType; } } - return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || - getIndexTypeOfContextualType(type, 0); + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || getIndexTypeOfContextualType(type, 0); } return undefined; } @@ -12439,9 +17208,7 @@ var ts; var type = getContextualType(arrayLiteral); if (type) { var index = ts.indexOf(arrayLiteral.elements, node); - return getTypeOfPropertyOfContextualType(type, "" + index) - || getIndexTypeOfContextualType(type, 1) - || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); + return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1) || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); } return undefined; } @@ -12474,7 +17241,7 @@ var ts; return getTypeFromTypeNode(parent.type); case 167: return getContextualTypeForBinaryOperand(node); - case 217: + case 218: return getContextualTypeForObjectLiteralElement(parent); case 151: return getContextualTypeForElementExpression(node); @@ -12505,9 +17272,7 @@ var ts; } function getContextualSignature(node) { ts.Debug.assert(node.kind !== 132 || ts.isObjectLiteralMethod(node)); - var type = ts.isObjectLiteralMethod(node) - ? getContextualTypeForObjectLiteralMethod(node) - : getContextualType(node); + var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); if (!type) { return undefined; } @@ -12517,14 +17282,15 @@ var ts; var signatureList; var types = type.types; for (var i = 0; i < types.length; i++) { - if (signatureList && - getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { + if (signatureList && getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { return undefined; } var signature = getNonGenericSignature(types[i]); if (signature) { if (!signatureList) { - signatureList = [signature]; + signatureList = [ + signature + ]; } else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { return undefined; @@ -12550,7 +17316,7 @@ var ts; if (parent.kind === 167 && parent.operatorToken.kind === 52 && parent.left === node) { return true; } - if (parent.kind === 217) { + if (parent.kind === 218) { return isAssignmentTarget(parent.parent); } if (parent.kind === 151) { @@ -12622,20 +17388,16 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 217 || - memberDecl.kind === 218 || - ts.isObjectLiteralMethod(memberDecl)) { - if (memberDecl.kind === 217) { + if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 218) { var type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 132) { var type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 218); - var type = memberDecl.name.kind === 126 - ? unknownType - : checkExpression(memberDecl.name, contextualMapper); + ts.Debug.assert(memberDecl.kind === 219); + var type = memberDecl.name.kind === 126 ? unknownType : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -12751,9 +17513,7 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 153 - ? node.expression - : node.left; + var left = node.kind === 153 ? node.expression : node.left; var type = checkExpressionOrQualifiedName(left); if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); @@ -12790,8 +17550,7 @@ var ts; return unknownType; } var isConstEnum = isConstEnumObjectType(objectType); - if (isConstEnum && - (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } @@ -12958,8 +17717,7 @@ var ts; callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; } - var hasRightNumberOfTypeArgs = !typeArguments || - (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); if (!hasRightNumberOfTypeArgs) { return false; } @@ -12976,8 +17734,7 @@ var ts; function getSingleCallSignature(type) { if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); - if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && - resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { return resolved.callSignatures[0]; } } @@ -13047,9 +17804,7 @@ var ts; var arg = args[i]; if (arg.kind !== 172) { var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); - var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : - arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : - checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { return false; } @@ -13061,7 +17816,9 @@ var ts; var args; if (node.kind === 157) { var template = node.template; - args = [template]; + args = [ + template + ]; if (template.kind === 169) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); @@ -13313,10 +18070,7 @@ var ts; } if (node.kind === 156) { var declaration = signature.declaration; - if (declaration && - declaration.kind !== 133 && - declaration.kind !== 137 && - declaration.kind !== 141) { + if (declaration && declaration.kind !== 133 && declaration.kind !== 137 && declaration.kind !== 141) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -13341,13 +18095,9 @@ var ts; } function getTypeAtPosition(signature, pos) { if (pos >= 0) { - return signature.hasRestParameter ? - pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : - pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; } - return signature.hasRestParameter ? - getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : - anyArrayType; + return signature.hasRestParameter ? getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : anyArrayType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -13647,12 +18397,9 @@ var ts; var properties = node.properties; for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 217 || p.kind === 218) { + if (p.kind === 218 || p.kind === 219) { var name = p.name; - var type = sourceType.flags & 1 ? sourceType : - getTypeOfPropertyOfType(sourceType, name.text) || - isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || - getIndexTypeOfType(sourceType, 0); + var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { checkDestructuringAssignment(p.initializer || name, type); } @@ -13677,14 +18424,17 @@ var ts; if (e.kind !== 172) { if (e.kind !== 171) { var propName = "" + i; - var type = sourceType.flags & 1 ? sourceType : - isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : - getIndexTypeOfType(sourceType, 1); + var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); if (type) { checkDestructuringAssignment(e, type, contextualMapper); } else { - error(e, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + if (isTupleType(sourceType)) { + error(e, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), sourceType.elementTypes.length, elements.length); + } + else { + error(e, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + } } } else { @@ -13755,9 +18505,7 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var suggestedOperator; - if ((leftType.flags & 8) && - (rightType.flags & 8) && - (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { @@ -13819,7 +18567,10 @@ var ts; case 48: return rightType; case 49: - return getUnionType([leftType, rightType]); + return getUnionType([ + leftType, + rightType + ]); case 52: checkAssignmentOperator(rightType); return rightType; @@ -13827,9 +18578,7 @@ var ts; return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : - someConstituentTypeHasKind(rightType, 1048576) ? node.right : - undefined; + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); return false; @@ -13875,7 +18624,10 @@ var ts; checkExpression(node.condition); var type1 = checkExpression(node.whenTrue, contextualMapper); var type2 = checkExpression(node.whenFalse, contextualMapper); - return getUnionType([type1, type2]); + return getUnionType([ + type1, + type2 + ]); } function checkTemplateExpression(node) { ts.forEach(node.templateSpans, function (templateSpan) { @@ -13939,9 +18691,7 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 153 && node.parent.expression === node) || - (node.parent.kind === 154 && node.parent.expression === node) || - ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 153 && node.parent.expression === node) || (node.parent.kind === 154 && node.parent.expression === node) || ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -14051,9 +18801,7 @@ var ts; if (node.kind === 138) { checkGrammarIndexSignature(node); } - else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || - node.kind === 136 || node.kind === 133 || - node.kind === 137) { + else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || node.kind === 136 || node.kind === 133 || node.kind === 137) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -14146,8 +18894,10 @@ var ts; case 160: case 195: case 161: - case 152: return false; - default: return ts.forEachChild(n, containsSuperCall); + case 152: + return false; + default: + return ts.forEachChild(n, containsSuperCall); } } function markThisReferencesAsErrors(n) { @@ -14159,14 +18909,13 @@ var ts; } } function isInstancePropertyWithInitializer(n) { - return n.kind === 130 && - !(n.flags & 128) && - !!n.initializer; + return n.kind === 130 && !(n.flags & 128) && !!n.initializer; } if (ts.getClassBaseTypeNode(node.parent)) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { + return p.flags & (16 | 32 | 64); + }); if (superCallShouldBeFirst) { var statements = node.body.statements; if (!statements.length || statements[0].kind !== 177 || !isSuperCallExpression(statements[0].expression)) { @@ -14488,16 +19237,16 @@ var ts; case 197: return 2097152; case 200: - return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 - ? 4194304 | 1048576 - : 4194304; + return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; case 196: case 199: return 2097152 | 1048576; - case 202: + case 203: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); + ts.forEach(target.declarations, function (d) { + result |= getDeclarationSpaces(d); + }); return result; default: return 1048576; @@ -14506,10 +19255,7 @@ var ts; } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || - checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || - checkGrammarFunctionName(node.name) || - checkGrammarForGenerator(node); + checkFunctionLikeDeclaration(node) || checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -14564,12 +19310,7 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 130 || - node.kind === 129 || - node.kind === 132 || - node.kind === 131 || - node.kind === 134 || - node.kind === 135) { + if (node.kind === 130 || node.kind === 129 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135) { return false; } if (ts.isInAmbientContext(node)) { @@ -14628,7 +19369,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 220 && ts.isExternalModule(parent)) { + if (parent.kind === 221 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -14637,17 +19378,11 @@ var ts; var symbol = getSymbolOfNode(node); if (symbol.flags & 1) { var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); - if (localDeclarationSymbol && - localDeclarationSymbol !== symbol && - localDeclarationSymbol.flags & 2) { + if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 194); - var container = varDeclList.parent.kind === 175 && - varDeclList.parent.parent; - var namesShareScope = container && - (container.kind === 174 && ts.isFunctionLike(container.parent) || - (container.kind === 201 && container.kind === 200) || - container.kind === 220); + var container = varDeclList.parent.kind === 175 && varDeclList.parent.parent; + var namesShareScope = container && (container.kind === 174 && ts.isFunctionLike(container.parent) || (container.kind === 201 && container.kind === 200) || container.kind === 221); if (!namesShareScope) { var name = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); @@ -14806,18 +19541,13 @@ var ts; checkSourceElement(node.statement); } function checkForOfStatement(node) { - if (languageVersion < 2) { - grammarErrorOnFirstToken(node, ts.Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); - return; - } checkGrammarForInOrForOfStatement(node); if (node.initializer.kind === 194) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; - var rightType = checkExpression(node.expression); - var iteratedType = checkIteratedType(rightType, node.expression); + var iteratedType = checkRightHandSideOfForOf(node.expression); if (varExpr.kind === 151 || varExpr.kind === 152) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } @@ -14866,20 +19596,17 @@ var ts; checkVariableDeclaration(decl); } } - function getTypeForVariableDeclarationInForOfStatement(forOfStatement) { - if (languageVersion < 2) { - return anyType; - } - var expressionType = getTypeOfExpression(forOfStatement.expression); - return checkIteratedType(expressionType, forOfStatement.expression) || anyType; + function checkRightHandSideOfForOf(rhsExpression) { + var expressionType = getTypeOfExpression(rhsExpression); + return languageVersion >= 2 ? checkIteratedType(expressionType, rhsExpression) : checkElementTypeOfArrayOrString(expressionType, rhsExpression); } function checkIteratedType(iterable, expressionForError) { ts.Debug.assert(languageVersion >= 2); var iteratedType = getIteratedType(iterable, expressionForError); if (expressionForError && iteratedType) { - var completeIterableType = globalIterableType !== emptyObjectType - ? createTypeReference(globalIterableType, [iteratedType]) - : emptyObjectType; + var completeIterableType = globalIterableType !== emptyObjectType ? createTypeReference(globalIterableType, [ + iteratedType + ]) : emptyObjectType; checkTypeAssignableTo(iterable, completeIterableType, expressionForError); } return iteratedType; @@ -14927,6 +19654,39 @@ var ts; return iteratorNextValue; } } + function checkElementTypeOfArrayOrString(arrayOrStringType, expressionForError) { + ts.Debug.assert(languageVersion < 2); + var arrayType = removeTypesFromUnionType(arrayOrStringType, 258, true, true); + var hasStringConstituent = arrayOrStringType !== arrayType; + var reportedError = false; + if (hasStringConstituent) { + if (languageVersion < 1) { + error(expressionForError, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); + reportedError = true; + } + if (arrayType === emptyObjectType) { + return stringType; + } + } + if (!isArrayLikeType(arrayType)) { + if (!reportedError) { + var diagnostic = hasStringConstituent ? ts.Diagnostics.Type_0_is_not_an_array_type : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + error(expressionForError, diagnostic, typeToString(arrayType)); + } + return hasStringConstituent ? stringType : unknownType; + } + var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType; + if (hasStringConstituent) { + if (arrayElementType.flags & 258) { + return stringType; + } + return getUnionType([ + arrayElementType, + stringType + ]); + } + return arrayElementType; + } function checkBreakOrContinueStatement(node) { checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } @@ -14975,8 +19735,8 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); - ts.forEach(node.clauses, function (clause) { - if (clause.kind === 214 && !hasDuplicateDefaultClause) { + ts.forEach(node.caseBlock.clauses, function (clause) { + if (clause.kind === 215 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -14988,7 +19748,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 213) { + if (produceDiagnostics && clause.kind === 214) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -15085,7 +19845,9 @@ var ts; if (stringIndexType && numberIndexType) { errorNode = declaredNumberIndexer || declaredStringIndexer; if (!errorNode && (type.flags & 2048)) { - var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); }); + var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { + return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); + }); errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; } } @@ -15107,13 +19869,13 @@ var ts; errorNode = indexDeclaration; } else if (containingType.flags & 2048) { - var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { + return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); + }); errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { - var errorMessage = indexKind === 0 - ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 - : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); } } @@ -15277,7 +20039,12 @@ var ts; return true; } var seen = {}; - ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(type.declaredProperties, function (p) { + seen[p.name] = { + prop: p, + containingType: type + }; + }); var ok = true; for (var i = 0, len = type.baseTypes.length; i < len; ++i) { var base = type.baseTypes[i]; @@ -15285,7 +20052,10 @@ var ts; for (var j = 0, proplen = properties.length; j < proplen; ++j) { var prop = properties[j]; if (!ts.hasProperty(seen, prop.name)) { - seen[prop.name] = { prop: prop, containingType: base }; + seen[prop.name] = { + prop: prop, + containingType: base + }; } else { var existing = seen[prop.name]; @@ -15388,9 +20158,12 @@ var ts; return undefined; } switch (e.operator) { - case 33: return value; - case 34: return -value; - case 47: return enumIsConst ? ~value : undefined; + case 33: + return value; + case 34: + return -value; + case 47: + return enumIsConst ? ~value : undefined; } return undefined; case 167: @@ -15406,17 +20179,28 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 44: return left | right; - case 43: return left & right; - case 41: return left >> right; - case 42: return left >>> right; - case 40: return left << right; - case 45: return left ^ right; - case 35: return left * right; - case 36: return left / right; - case 33: return left + right; - case 34: return left - right; - case 37: return left % right; + case 44: + return left | right; + case 43: + return left & right; + case 41: + return left >> right; + case 42: + return left >>> right; + case 40: + return left << right; + case 45: + return left ^ right; + case 35: + return left * right; + case 36: + return left / right; + case 33: + return left + right; + case 34: + return left - right; + case 37: + return left % right; } return undefined; case 7: @@ -15439,8 +20223,7 @@ var ts; } else { if (e.kind === 154) { - if (e.argumentExpression === undefined || - e.argumentExpression.kind !== 8) { + if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { return undefined; } var enumType = getTypeOfNode(e.expression); @@ -15536,10 +20319,7 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - if (symbol.flags & 512 - && symbol.declarations.length > 1 - && !ts.isInAmbientContext(node) - && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -15574,10 +20354,8 @@ var ts; return false; } var inAmbientExternalModule = node.parent.kind === 201 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 220 && !inAmbientExternalModule) { - error(moduleName, node.kind === 209 ? - ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : - ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + if (node.parent.kind !== 221 && !inAmbientExternalModule) { + error(moduleName, node.kind === 210 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { @@ -15590,13 +20368,9 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | - (symbol.flags & 793056 ? 793056 : 0) | - (symbol.flags & 1536 ? 1536 : 0); + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 211 ? - ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : - ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; + var message = node.kind === 212 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); } } @@ -15617,7 +20391,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 205) { + if (importClause.namedBindings.kind === 206) { checkImportBinding(importClause.namedBindings); } else { @@ -15667,7 +20441,7 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 220 ? node.parent : node.parent.parent; + var container = node.parent.kind === 221 ? node.parent : node.parent.parent; if (container.kind === 200 && container.name.kind === 64) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); return; @@ -15684,7 +20458,7 @@ var ts; checkExternalModuleExports(container); } function getModuleStatements(node) { - if (node.kind === 220) { + if (node.kind === 221) { return node.statements; } if (node.kind === 200 && node.body.kind === 201) { @@ -15698,7 +20472,7 @@ var ts; var statements = getModuleStatements(declarations[i]); for (var j = 0; j < statements.length; j++) { var node = statements[j]; - if (node.kind === 209) { + if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; @@ -15711,7 +20485,7 @@ var ts; } } } - else if (node.kind !== 208 && node.flags & 1 && !(node.flags & 256)) { + else if (node.kind !== 209 && node.flags & 1 && !(node.flags & 256)) { return true; } } @@ -15821,13 +20595,13 @@ var ts; return checkEnumDeclaration(node); case 200: return checkModuleDeclaration(node); - case 203: + case 204: return checkImportDeclaration(node); - case 202: + case 203: return checkImportEqualsDeclaration(node); - case 209: + case 210: return checkExportDeclaration(node); - case 208: + case 209: return checkExportAssignment(node); case 176: checkGrammarStatementInAmbientContext(node); @@ -15868,7 +20642,7 @@ var ts; case 150: case 151: case 152: - case 217: + case 218: case 153: case 154: case 155: @@ -15900,19 +20674,20 @@ var ts; case 185: case 186: case 188: - case 213: + case 202: case 214: + case 215: case 189: case 190: case 191: - case 216: + case 217: case 193: case 194: case 196: case 199: - case 219: - case 208: case 220: + case 209: + case 221: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -16000,7 +20775,7 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 220: + case 221: if (!ts.isExternalModule(location)) break; case 200: @@ -16028,9 +20803,7 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 64 && - isTypeDeclaration(name.parent) && - name.parent.name === name; + return name.kind == 64 && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { @@ -16112,10 +20885,10 @@ var ts; while (nodeOnRightSide.parent.kind === 125) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 202) { + if (nodeOnRightSide.parent.kind === 203) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 208) { + if (nodeOnRightSide.parent.kind === 209) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -16124,14 +20897,13 @@ var ts; return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 125 && node.parent.right === node) || - (node.parent.kind === 153 && node.parent.name === node); + return (node.parent.kind === 125 && node.parent.right === node) || (node.parent.kind === 153 && node.parent.name === node); } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 208) { + if (entityName.parent.kind === 209) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } if (entityName.kind !== 153) { @@ -16180,9 +20952,7 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 64 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 208 - ? getSymbolOfEntityNameOrPropertyAccessExpression(node) - : getSymbolOfPartOfRightHandSideOfImportEquals(node); + return node.parent.kind === 209 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } switch (node.kind) { case 64: @@ -16201,10 +20971,7 @@ var ts; return undefined; case 8: var moduleName; - if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && - ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 203 || node.parent.kind === 209) && - node.parent.moduleSpecifier === node)) { + if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || ((node.parent.kind === 204 || node.parent.kind === 210) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 7: @@ -16222,7 +20989,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 218) { + if (location && location.kind === 219) { return resolveEntityName(location.name, 107455); } return undefined; @@ -16290,13 +21057,17 @@ var ts; else if (symbol.flags & 67108864) { var target = getSymbolLinks(symbol).target; if (target) { - return [target]; + return [ + target + ]; } } - return [symbol]; + return [ + symbol + ]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 220; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 221; } function isNodeDescendentOf(node, ancestor) { while (node) { @@ -16337,16 +21108,16 @@ var ts; case 199: generateNameForModuleOrEnum(node); break; - case 203: + case 204: generateNameForImportDeclaration(node); break; - case 209: + case 210: generateNameForExportDeclaration(node); break; - case 208: + case 209: generateNameForExportAssignment(node); break; - case 220: + case 221: case 201: ts.forEach(node.statements, generateNames); break; @@ -16375,12 +21146,11 @@ var ts; } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 8 ? - ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + var baseName = expr.kind === 8 ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; assignGeneratedName(node, makeUniqueName(baseName)); } function generateNameForImportDeclaration(node) { - if (node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 206) { + if (node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 207) { generateNameForImportOrExportDeclaration(node); } } @@ -16410,7 +21180,7 @@ var ts; } function getAliasNameSubstitution(symbol) { var declaration = getDeclarationOfAliasSymbol(symbol); - if (declaration && declaration.kind === 207) { + if (declaration && declaration.kind === 208) { var moduleName = getGeneratedNameForNode(declaration.parent.parent.parent); var propertyName = declaration.propertyName || declaration.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -16449,7 +21219,7 @@ var ts; return symbol && symbol !== unknownSymbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol); } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 220 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 221 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } return isAliasResolvedToValue(getSymbolOfNode(node)); @@ -16474,8 +21244,7 @@ var ts; if (ts.nodeIsPresent(node.body)) { var symbol = getSymbolOfNode(node); var signaturesOfSymbol = getSignaturesOfSymbol(symbol); - return signaturesOfSymbol.length > 1 || - (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); } return false; } @@ -16487,14 +21256,14 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 219) { + if (node.kind === 220) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; if (symbol && (symbol.flags & 8)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 219) { + if (declaration.kind === 220) { return getEnumMemberValue(declaration); } } @@ -16502,9 +21271,7 @@ var ts; } function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { var symbol = getSymbolOfNode(declaration); - var type = symbol && !(symbol.flags & (2048 | 131072)) - ? getTypeOfSymbol(symbol) - : unknownType; + var type = symbol && !(symbol.flags & (2048 | 131072)) ? getTypeOfSymbol(symbol) : unknownType; getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -16512,29 +21279,20 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function isUnknownIdentifier(location, name) { - return !resolveName(location, name, 107455, undefined, undefined) && - !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); + ts.Debug.assert(!ts.nodeIsSynthesized(location), "isUnknownIdentifier called with a synthesized location"); + return !resolveName(location, name, 107455, undefined, undefined) && !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - if (n.parent.kind === 153 && - n.parent.name === n) { + if (n.parent.kind === 153 && n.parent.name === n) { return undefined; } - if (n.parent.kind === 150 && - n.parent.propertyName === n) { + if (n.parent.kind === 150 && n.parent.propertyName === n) { return undefined; } - var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || - n.parent.kind === 150 - ? getSymbolOfNode(n.parent) - : undefined; - var symbol = declarationSymbol || - getNodeLinks(n).resolvedSymbol || - resolveName(n, n.text, 2 | 8388608, undefined, undefined); - var isLetOrConst = symbol && - (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 216; + var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || n.parent.kind === 150 ? getSymbolOfNode(n.parent) : undefined; + var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 2 | 8388608, undefined, undefined); + var isLetOrConst = symbol && (symbol.flags & 2) && symbol.valueDeclaration.parent.kind !== 217; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -16611,10 +21369,10 @@ var ts; case 175: case 195: case 198: + case 204: case 203: - case 202: + case 210: case 209: - case 208: case 128: break; default: @@ -16649,7 +21407,7 @@ var ts; else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 201 || node.parent.kind === 220) { + else if (node.parent.kind === 201 || node.parent.kind === 221) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -16658,7 +21416,7 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 201 || node.parent.kind === 220) { + else if (node.parent.kind === 201 || node.parent.kind === 221) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } else if (node.kind === 128) { @@ -16711,7 +21469,7 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 203 || node.kind === 202) && flags & 2) { + else if ((node.kind === 204 || node.kind === 203) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } else if (node.kind === 197 && flags & 2) { @@ -16824,8 +21582,7 @@ var ts; } } function checkGrammarTypeArguments(node, typeArguments) { - return checkGrammarForDisallowedTrailingComma(typeArguments) || - checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { @@ -16839,8 +21596,7 @@ var ts; } } function checkGrammarArguments(node, arguments) { - return checkGrammarForDisallowedTrailingComma(arguments) || - checkGrammarForOmittedArgument(node, arguments); + return checkGrammarForDisallowedTrailingComma(arguments) || checkGrammarForOmittedArgument(node, arguments); } function checkGrammarHeritageClause(node) { var types = node.types; @@ -16936,13 +21692,12 @@ var ts; for (var i = 0, n = node.properties.length; i < n; i++) { var prop = node.properties[i]; var name = prop.name; - if (prop.kind === 172 || - name.kind === 126) { + if (prop.kind === 172 || name.kind === 126) { checkGrammarComputedPropertyName(name); continue; } var currentKind; - if (prop.kind === 217 || prop.kind === 218) { + if (prop.kind === 218 || prop.kind === 219) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 7) { checkGrammarNumbericLiteral(name); @@ -16993,22 +21748,16 @@ var ts; var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 182 - ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement - : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 182 - ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer - : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 182 - ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation - : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); } } @@ -17062,9 +21811,7 @@ var ts; } } function checkGrammarMethod(node) { - if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || - checkGrammarFunctionLikeDeclaration(node) || - checkGrammarForGenerator(node)) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarForGenerator(node)) { return true; } if (node.parent.kind === 152) { @@ -17115,8 +21862,7 @@ var ts; switch (current.kind) { case 189: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 184 - && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 184 && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } @@ -17137,15 +21883,11 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 185 - ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement - : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + var message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 185 - ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement - : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + var message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } } @@ -17182,8 +21924,7 @@ var ts; } } var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); - return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || - checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 64) { @@ -17315,8 +22056,7 @@ var ts; } function checkGrammarProperty(node) { if (node.parent.kind === 196) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } @@ -17335,12 +22075,7 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 197 || - node.kind === 203 || - node.kind === 202 || - node.kind === 209 || - node.kind === 208 || - (node.flags & 2)) { + if (node.kind === 197 || node.kind === 204 || node.kind === 203 || node.kind === 210 || node.kind === 209 || (node.flags & 2)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -17367,7 +22102,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 174 || node.parent.kind === 201 || node.parent.kind === 220) { + if (node.parent.kind === 174 || node.parent.kind === 201 || node.parent.kind === 221) { var links = getNodeLinks(node.parent); if (!links.hasReportedStatementInAmbientContext) { return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -17402,7 +22137,10 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var indentStrings = ["", " "]; + var indentStrings = [ + "", + " " + ]; function getIndentString(level) { if (indentStrings[level] === undefined) { indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; @@ -17477,21 +22215,34 @@ var ts; writeTextOfNode: writeTextOfNode, writeLiteral: writeLiteral, writeLine: writeLine, - increaseIndent: function () { return indent++; }, - decreaseIndent: function () { return indent--; }, - getIndent: function () { return indent; }, - getTextPos: function () { return output.length; }, - getLine: function () { return lineCount + 1; }, - getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, - getText: function () { return output; } + increaseIndent: function () { + return indent++; + }, + decreaseIndent: function () { + return indent--; + }, + getIndent: function () { + return indent; + }, + getTextPos: function () { + return output.length; + }, + getLine: function () { + return lineCount + 1; + }, + getColumn: function () { + return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; + }, + getText: function () { + return output; + } }; } function getLineOfLocalPosition(currentSourceFile, pos) { return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { - if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -17520,9 +22271,7 @@ var ts; var lineCount = ts.getLineStarts(currentSourceFile).length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = (currentLine + 1) === lineCount - ? currentSourceFile.text.length + 1 - : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); + var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { firstCommentLineIndent = calculateIndent(ts.getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); @@ -17600,8 +22349,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 134 || member.kind === 135) - && (member.flags & 128) === (accessor.flags & 128)) { + if ((member.kind === 134 || member.kind === 135) && (member.flags & 128) === (accessor.flags & 128)) { var memberName = ts.getPropertyNameForPropertyNameNode(member.name); var accessorName = ts.getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -17657,7 +22405,8 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { + } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var aliasDeclarationEmitInfo = []; var referencePathsOutput = ""; @@ -17666,9 +22415,7 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 2048) || - shouldEmitToOwnFile(referencedFile, compilerOptions) || - !addedGlobalFileReference)) { + if (referencedFile && ((referencedFile.flags & 2048) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { writeReferencePath(referencedFile); if (!isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -17685,8 +22432,7 @@ var ts; if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && - !ts.contains(emittedReferencedFiles, referencedFile))) { + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } @@ -17740,7 +22486,9 @@ var ts; function writeAsychronousImportEqualsDeclarations(importEqualsDeclarations) { var oldWriter = writer; ts.forEach(importEqualsDeclarations, function (aliasToWrite) { - var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; }); + var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { + return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; + }); if (aliasEmitInfo) { createAndSetNewTextWriterWithSymbolWriter(); for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { @@ -17858,7 +22606,7 @@ var ts; ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 202 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 203 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -18065,15 +22813,8 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 140 || - node.parent.kind === 141 || - (node.parent.parent && node.parent.parent.kind === 143)) { - ts.Debug.assert(node.parent.kind === 132 || - node.parent.kind === 131 || - node.parent.kind === 140 || - node.parent.kind === 141 || - node.parent.kind === 136 || - node.parent.kind === 137); + if (node.parent.kind === 140 || node.parent.kind === 141 || (node.parent.parent && node.parent.parent.kind === 143)) { + ts.Debug.assert(node.parent.kind === 132 || node.parent.kind === 131 || node.parent.kind === 140 || node.parent.kind === 141 || node.parent.kind === 136 || node.parent.kind === 137); emitType(node.constraint); } else { @@ -18136,9 +22877,7 @@ var ts; function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.parent.parent.kind === 196) { - diagnosticMessage = isImplementsList ? - ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : - ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; @@ -18171,7 +22910,9 @@ var ts; emitTypeParameters(node.typeParameters); var baseTypeNode = ts.getClassBaseTypeNode(node); if (baseTypeNode) { - emitHeritageClause([baseTypeNode], false); + emitHeritageClause([ + baseTypeNode + ], false); } emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); write(" {"); @@ -18231,31 +22972,17 @@ var ts; function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.kind === 193) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } else if (node.kind === 130 || node.kind === 129) { if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } return diagnosticMessage !== undefined ? { @@ -18272,7 +22999,9 @@ var ts; } } function emitVariableStatement(node) { - var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); + var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { + return resolver.isDeclarationVisible(varDeclaration); + }); if (hasDeclarationWithEmit) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); @@ -18317,25 +23046,17 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 134 - ? accessor.type - : accessor.parameters.length > 0 - ? accessor.parameters[0].type - : undefined; + return accessor.kind === 134 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; } } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (accessorWithTypeAnnotation.kind === 135) { if (accessorWithTypeAnnotation.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } return { diagnosticMessage: diagnosticMessage, @@ -18345,18 +23066,10 @@ var ts; } else { if (accessorWithTypeAnnotation.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; } return { diagnosticMessage: diagnosticMessage, @@ -18370,8 +23083,7 @@ var ts; if (ts.hasDynamicName(node)) { return; } - if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && - !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); if (node.kind === 195) { emitModuleElementDeclarationFlags(node); @@ -18438,48 +23150,28 @@ var ts; var diagnosticMessage; switch (node.kind) { case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 132: case 131: if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: ts.Debug.fail("This is unknown kind for signature: " + node.kind); @@ -18506,9 +23198,7 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 140 || - node.parent.kind === 141 || - node.parent.parent.kind === 143) { + if (node.parent.kind === 140 || node.parent.kind === 141 || node.parent.parent.kind === 143) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -18518,50 +23208,28 @@ var ts; var diagnosticMessage; switch (node.parent.kind) { case 133: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; break; case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 132: case 131: if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } else if (node.parent.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); @@ -18598,26 +23266,22 @@ var ts; return emitClassDeclaration(node); case 198: return emitTypeAliasDeclaration(node); - case 219: + case 220: return emitEnumMemberDeclaration(node); case 199: return emitEnumDeclaration(node); case 200: return emitModuleDeclaration(node); - case 202: + case 203: return emitImportEqualsDeclaration(node); - case 208: + case 209: return emitExportAssignment(node); - case 220: + case 221: return emitSourceFile(node); } } function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 2048 - ? referencedFile.fileName - : shouldEmitToOwnFile(referencedFile, compilerOptions) - ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") - : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + var declFileName = referencedFile.flags & 2048 ? referencedFile.fileName : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencePathsOutput += "/// " + newLine; } @@ -18668,6 +23332,7 @@ var ts; var writeLine = writer.writeLine; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; + var preserveNewLines = compilerOptions.preserveNewLines || false; var currentSourceFile; var lastFrame; var currentScopeNames; @@ -18680,41 +23345,57 @@ var ts; var exportSpecifiers; var exportDefault; var writeEmittedFiles = writeJavaScriptFile; - var emitLeadingComments = compilerOptions.removeComments ? function (node) { } : emitLeadingDeclarationComments; - var emitTrailingComments = compilerOptions.removeComments ? function (node) { } : emitTrailingDeclarationComments; - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfLocalPosition; + var emitLeadingComments = compilerOptions.removeComments ? function (node) { + } : emitLeadingDeclarationComments; + var emitTrailingComments = compilerOptions.removeComments ? function (node) { + } : emitTrailingDeclarationComments; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { + } : emitLeadingCommentsOfLocalPosition; var detachedCommentsInfo; - var emitDetachedComments = compilerOptions.removeComments ? function (node) { } : emitDetachedCommentsAtPosition; - var emitPinnedOrTripleSlashComments = compilerOptions.removeComments ? function (node) { } : emitPinnedOrTripleSlashCommentsOfNode; + var emitDetachedComments = compilerOptions.removeComments ? function (node) { + } : emitDetachedCommentsAtPosition; var writeComment = writeCommentRange; - var emit = emitNode; - var emitStart = function (node) { }; - var emitEnd = function (node) { }; + var emitNodeWithoutSourceMap = compilerOptions.removeComments ? emitNodeWithoutSourceMapWithoutComments : emitNodeWithoutSourceMapWithComments; + var emit = emitNodeWithoutSourceMap; + var emitWithoutComments = emitNodeWithoutSourceMapWithoutComments; + var emitStart = function (node) { + }; + var emitEnd = function (node) { + }; var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { }; - var scopeEmitEnd = function () { }; + var scopeEmitStart = function (scopeDeclaration, scopeName) { + }; + var scopeEmitEnd = function () { + }; var sourceMapData; if (compilerOptions.sourceMap) { initializeEmitterWithSourceMaps(); } if (root) { - emit(root); + emitSourceFile(root); } else { ts.forEach(host.getSourceFiles(), function (sourceFile) { if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emit(sourceFile); + emitSourceFile(sourceFile); } }); } writeLine(); writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); return; + function emitSourceFile(sourceFile) { + currentSourceFile = sourceFile; + emit(sourceFile); + } function enterNameScope() { var names = currentScopeNames; currentScopeNames = undefined; if (names) { - lastFrame = { names: names, previous: lastFrame }; + lastFrame = { + names: names, + previous: lastFrame + }; return true; } return false; @@ -18734,8 +23415,13 @@ var ts; name = baseName; } else { - name = ts.generateUniqueName(baseName, function (n) { return isExistingName(location, n); }); + name = ts.generateUniqueName(baseName, function (n) { + return isExistingName(location, n); + }); } + return recordNameInCurrentScope(name); + } + function recordNameInCurrentScope(name) { if (!currentScopeNames) { currentScopeNames = {}; } @@ -18831,12 +23517,7 @@ var ts; sourceLinePos.character++; var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || - lastRecordedSourceMapSpan.emittedLine != emittedLine || - lastRecordedSourceMapSpan.emittedColumn != emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { encodeLastRecordedSourceMapSpan(); lastRecordedSourceMapSpan = { emittedLine: emittedLine, @@ -18899,20 +23580,10 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 195 || - node.kind === 160 || - node.kind === 132 || - node.kind === 131 || - node.kind === 134 || - node.kind === 135 || - node.kind === 200 || - node.kind === 196 || - node.kind === 199) { + else if (node.kind === 195 || node.kind === 160 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135 || node.kind === 200 || node.kind === 196 || node.kind === 199) { if (node.name) { var name = node.name; - scopeName = name.kind === 126 - ? ts.getTextOfNode(name) - : node.name.text; + scopeName = name.kind === 126 ? ts.getTextOfNode(name) : node.name.text; } recordScopeNameStart(scopeName); } @@ -18990,21 +23661,32 @@ var ts; else { sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); } - function emitNodeWithMap(node) { + function emitNodeWithSourceMap(node) { if (node) { - if (node.kind != 220) { + if (ts.nodeIsSynthesized(node)) { + return emitNodeWithoutSourceMap(node); + } + if (node.kind != 221) { recordEmitNodeStartSpan(node); - emitNode(node); + emitNodeWithoutSourceMap(node); recordEmitNodeEndSpan(node); } else { recordNewSourceFileStart(node); - emitNode(node); + emitNodeWithoutSourceMap(node); } } } + function emitNodeWithSourceMapWithoutComments(node) { + if (node) { + recordEmitNodeStartSpan(node); + emitNodeWithoutSourceMapWithoutComments(node); + recordEmitNodeEndSpan(node); + } + } writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithMap; + emit = emitNodeWithSourceMap; + emitWithoutComments = emitNodeWithSourceMapWithoutComments; emitStart = recordEmitNodeStartSpan; emitEnd = recordEmitNodeEndSpan; emitToken = writeTextWithSpanRecord; @@ -19024,6 +23706,7 @@ var ts; name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); tempCount++; } + recordNameInCurrentScope(name); var result = ts.createSynthesizedNode(64); result.text = name; return result; @@ -19085,7 +23768,7 @@ var ts; function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); - if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (preserveNewLines && nodeStartPositionsAreOnSameLine(parent, nodes[0])) { if (spacesBetweenBraces) { write(" "); } @@ -19095,7 +23778,7 @@ var ts; } for (var i = 0, n = nodes.length; i < n; i++) { if (i) { - if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + if (preserveNewLines && nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { write(", "); } else { @@ -19105,12 +23788,11 @@ var ts; } emit(nodes[i]); } - var closeTokenIsOnSameLineAsLastElement = nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes)); if (nodes.hasTrailingComma && allowTrailingComma) { write(","); } decreaseIndent(); - if (closeTokenIsOnSameLineAsLastElement) { + if (preserveNewLines && nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { if (spacesBetweenBraces) { write(" "); } @@ -19244,8 +23926,7 @@ var ts; if (node.template.kind === 169) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 167 - && templateSpan.expression.operatorToken.kind === 23; + var needsParens = templateSpan.expression.kind === 167 && templateSpan.expression.operatorToken.kind === 23; emitParenthesizedIf(templateSpan.expression, needsParens); }); } @@ -19256,8 +23937,7 @@ var ts; ts.forEachChild(node, emit); return; } - var emitOuterParens = ts.isExpression(node.parent) - && templateNeedsParens(node, node.parent); + var emitOuterParens = ts.isExpression(node.parent) && templateNeedsParens(node, node.parent); if (emitOuterParens) { write("("); } @@ -19268,8 +23948,7 @@ var ts; } for (var i = 0; i < node.templateSpans.length; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 159 - && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + var needsParens = templateSpan.expression.kind !== 159 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); } @@ -19350,9 +24029,9 @@ var ts; case 150: case 130: case 129: - case 217: case 218: case 219: + case 220: case 132: case 131: case 195: @@ -19363,11 +24042,11 @@ var ts; case 197: case 199: case 200: - case 202: + case 203: return parent.name === node; case 185: case 184: - case 208: + case 209: return false; case 189: return node.parent.label === node; @@ -19555,9 +24234,9 @@ var ts; } function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { switch (property.kind) { - case 217: - return property.initializer; case 218: + return property.initializer; + case 219: return createIdentifier(resolver.getExpressionNameSubstitution(property.name)); case 132: return createFunctionExpression(property.parameters, property.body); @@ -19611,6 +24290,11 @@ var ts; result.right = right; return result; } + function createExpressionStatement(expression) { + var result = ts.createSynthesizedNode(177); + result.expression = expression; + return result; + } function createMemberAccessForPropertyName(expression, memberName) { if (memberName.kind === 64) { return createPropertyAccessExpression(expression, memberName); @@ -19626,7 +24310,7 @@ var ts; } } function createPropertyAssignment(name, initializer) { - var result = ts.createSynthesizedNode(217); + var result = ts.createSynthesizedNode(218); result.name = name; result.initializer = initializer; return result; @@ -19721,29 +24405,31 @@ var ts; } return false; } - function indentIfOnDifferentLines(parent, node1, node2) { - var isSynthesized = ts.nodeIsSynthesized(parent); - var realNodesAreOnDifferentLines = !isSynthesized && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { + var realNodesAreOnDifferentLines = preserveNewLines && !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { increaseIndent(); writeLine(); return true; } - return false; + else { + if (valueToWriteWhenNotIndenting) { + write(valueToWriteWhenNotIndenting); + } + return false; + } } function emitPropertyAccess(node) { if (tryEmitConstantValue(node)) { return; } emit(node.expression); - var indented = indentIfOnDifferentLines(node, node.expression, node.dotToken); + var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); write("."); - indented = indented || indentIfOnDifferentLines(node, node.dotToken, node.name); + var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); emit(node.name); - if (indented) { - decreaseIndent(); - } + decreaseIndentIf(indentedBeforeDot, indentedAfterDot); } function emitQualifiedName(node) { emit(node.left); @@ -19760,7 +24446,9 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 171; }); + return ts.forEach(elements, function (e) { + return e.kind === 171; + }); } function skipParentheses(node) { while (node.kind === 159 || node.kind === 158) { @@ -19873,14 +24561,7 @@ var ts; while (operand.kind == 158) { operand = operand.expression; } - if (operand.kind !== 165 && - operand.kind !== 164 && - operand.kind !== 163 && - operand.kind !== 162 && - operand.kind !== 166 && - operand.kind !== 156 && - !(operand.kind === 155 && node.parent.kind === 156) && - !(operand.kind === 160 && node.parent.kind === 155)) { + if (operand.kind !== 165 && operand.kind !== 164 && operand.kind !== 163 && operand.kind !== 162 && operand.kind !== 166 && operand.kind !== 156 && !(operand.kind === 155 && node.parent.kind === 156) && !(operand.kind === 160 && node.parent.kind === 155)) { emit(operand); return; } @@ -19923,27 +24604,16 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operatorToken.kind === 52 && - (node.left.kind === 152 || node.left.kind === 151)) { - emitDestructuring(node); + if (languageVersion < 2 && node.operatorToken.kind === 52 && (node.left.kind === 152 || node.left.kind === 151)) { + emitDestructuring(node, node.parent.kind === 177); } else { emit(node.left); - var indented1 = indentIfOnDifferentLines(node, node.left, node.operatorToken); - if (!indented1 && node.operatorToken.kind !== 23) { - write(" "); - } + var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 23 ? " " : undefined); write(ts.tokenToString(node.operatorToken.kind)); - if (!indented1) { - var indented2 = indentIfOnDifferentLines(node, node.operatorToken, node.right); - } - if (!indented2) { - write(" "); - } + var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); emit(node.right); - if (indented1 || indented2) { - decreaseIndent(); - } + decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); } } function synthesizedNodeStartsOnNewLine(node) { @@ -19951,34 +24621,22 @@ var ts; } function emitConditionalExpression(node) { emit(node.condition); - var indent1 = indentIfOnDifferentLines(node, node.condition, node.questionToken); - if (!indent1) { - write(" "); - } + var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); write("?"); - if (!indent1) { - var indent2 = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue); - } - if (!indent2) { - write(" "); - } + var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); emit(node.whenTrue); - if (indent1 || indent2) { + decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); + var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); + write(":"); + var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); + emit(node.whenFalse); + decreaseIndentIf(indentedBeforeColon, indentedAfterColon); + } + function decreaseIndentIf(value1, value2) { + if (value1) { decreaseIndent(); } - var indent3 = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken); - if (!indent3) { - write(" "); - } - write(":"); - if (!indent3) { - var indent4 = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse); - } - if (!indent4) { - write(" "); - } - emit(node.whenFalse); - if (indent3 || indent4) { + if (value2) { decreaseIndent(); } } @@ -19989,7 +24647,7 @@ var ts; } } function emitBlock(node) { - if (isSingleLineEmptyBlock(node)) { + if (preserveNewLines && isSingleLineEmptyBlock(node)) { emitToken(14, node.pos); write(" "); emitToken(15, node.statements.end); @@ -20111,6 +24769,9 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { + if (languageVersion < 2 && node.kind === 183) { + return emitDownLevelForOfStatement(node); + } var endPos = emitToken(81, node.pos); write(" "); endPos = emitToken(16, endPos); @@ -20136,6 +24797,86 @@ var ts; emitToken(17, node.expression.end); emitEmbeddedStatement(node.statement); } + function emitDownLevelForOfStatement(node) { + var endPos = emitToken(81, node.pos); + write(" "); + endPos = emitToken(16, endPos); + var rhsIsIdentifier = node.expression.kind === 64; + var counter = createTempVariable(node, true); + var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, false); + emitStart(node.expression); + write("var "); + emitNodeWithoutSourceMap(counter); + write(" = 0"); + emitEnd(node.expression); + if (!rhsIsIdentifier) { + write(", "); + emitStart(node.expression); + emitNodeWithoutSourceMap(rhsReference); + write(" = "); + emitNodeWithoutSourceMap(node.expression); + emitEnd(node.expression); + } + write("; "); + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write(" < "); + emitNodeWithoutSourceMap(rhsReference); + write(".length"); + emitEnd(node.initializer); + write("; "); + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write("++"); + emitEnd(node.initializer); + emitToken(17, node.expression.end); + write(" {"); + writeLine(); + increaseIndent(); + var rhsIterationValue = createElementAccessExpression(rhsReference, counter); + emitStart(node.initializer); + if (node.initializer.kind === 194) { + write("var "); + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length > 0) { + var declaration = variableDeclarationList.declarations[0]; + if (ts.isBindingPattern(declaration.name)) { + emitDestructuring(declaration, false, rhsIterationValue); + } + else { + emitNodeWithoutSourceMap(declaration); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + emitNodeWithoutSourceMap(createTempVariable(node, false)); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + var assignmentExpression = createBinaryExpression(node.initializer, 52, rhsIterationValue, false); + if (node.initializer.kind === 151 || node.initializer.kind === 152) { + emitDestructuring(assignmentExpression, true, undefined, node); + } + else { + emitNodeWithoutSourceMap(assignmentExpression); + } + } + emitEnd(node.initializer); + write(";"); + if (node.statement.kind === 174) { + emitLines(node.statement.statements); + } + else { + writeLine(); + emit(node.statement); + } + writeLine(); + decreaseIndent(); + write("}"); + } function emitBreakOrContinueStatement(node) { emitToken(node.kind === 185 ? 65 : 70, node.pos); emitOptional(" ", node.label); @@ -20159,7 +24900,10 @@ var ts; emit(node.expression); endPos = emitToken(17, node.expression.end); write(" "); - emitToken(14, endPos); + emitCaseBlock(node.caseBlock, endPos); + } + function emitCaseBlock(node, startPos) { + emitToken(14, startPos); increaseIndent(); emitLines(node.clauses); decreaseIndent(); @@ -20167,19 +24911,16 @@ var ts; emitToken(15, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === - getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function nodeEndPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === - getLineOfLocalPosition(currentSourceFile, node2.end); + return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === - getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 213) { + if (node.kind === 214) { write("case "); emit(node.expression); write(":"); @@ -20187,7 +24928,7 @@ var ts; else { write("default:"); } - if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + if (preserveNewLines && node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -20247,7 +24988,7 @@ var ts; emitContainingModuleName(node); write("."); } - emitNode(node.name); + emitNodeWithoutSourceMap(node.name); emitEnd(node.name); } function createVoidZero() { @@ -20264,21 +25005,22 @@ var ts; emitStart(specifier.name); emitContainingModuleName(specifier); write("."); - emitNode(specifier.name); + emitNodeWithoutSourceMap(specifier.name); emitEnd(specifier.name); write(" = "); - emitNode(name); + emitNodeWithoutSourceMap(name); write(";"); }); } } - function emitDestructuring(root, value) { + function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; var isDeclaration = (root.kind === 193 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 128; if (root.kind === 167) { emitAssignmentExpression(root); } else { + ts.Debug.assert(!isAssignmentExpressionStatement); emitBindingElement(root, value); } function emitAssignment(name, value) { @@ -20297,7 +25039,7 @@ var ts; } function ensureIdentifier(expr) { if (expr.kind !== 64) { - var identifier = createTempVariable(root); + var identifier = createTempVariable(lowestNonSynthesizedAncestor || root); if (!isDeclaration) { recordTempDeclaration(identifier); } @@ -20355,7 +25097,7 @@ var ts; } for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 217 || p.kind === 218) { + if (p.kind === 218 || p.kind === 219) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -20400,7 +25142,7 @@ var ts; function emitAssignmentExpression(root) { var target = root.left; var value = root.right; - if (root.parent.kind === 177) { + if (isAssignmentExpressionStatement) { emitDestructuringAssignment(target, value); } else { @@ -20457,7 +25199,7 @@ var ts; function emitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { if (languageVersion < 2) { - emitDestructuring(node); + emitDestructuring(node, false); } else { emit(node.name); @@ -20465,15 +25207,12 @@ var ts; } } else { - var isLet = renameNonTopLevelLetAndConst(node.name); + renameNonTopLevelLetAndConst(node.name); emitModuleMemberName(node); var initializer = node.initializer; if (!initializer && languageVersion < 2) { - var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && - (getCombinedFlagsForIdentifier(node.name) & 4096); - if (isUninitializedLet && - node.parent.parent.kind !== 182 && - node.parent.parent.kind !== 183) { + var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); + if (isUninitializedLet && node.parent.parent.kind !== 182 && node.parent.parent.kind !== 183) { initializer = createVoidZero(); } } @@ -20489,29 +25228,6 @@ var ts; ts.forEach(name.elements, emitExportVariableAssignments); } } - function getEnclosingBlockScopeContainer(node) { - var current = node; - while (current) { - if (ts.isFunctionLike(current)) { - return current; - } - switch (current.kind) { - case 220: - case 91: - case 216: - case 200: - case 181: - case 182: - case 183: - return current; - case 174: - if (!ts.isFunctionLike(current.parent)) { - return current; - } - } - current = current.parent; - } - } function getCombinedFlagsForIdentifier(node) { if (!node.parent || (node.parent.kind !== 193 && node.parent.kind !== 150)) { return 0; @@ -20519,10 +25235,7 @@ var ts; return ts.getCombinedNodeFlags(node.parent); } function renameNonTopLevelLetAndConst(node) { - if (languageVersion >= 2 || - ts.nodeIsSynthesized(node) || - node.kind !== 64 || - (node.parent.kind !== 193 && node.parent.kind !== 150)) { + if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 64 || (node.parent.kind !== 193 && node.parent.kind !== 150)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); @@ -20530,13 +25243,11 @@ var ts; return; } var list = ts.getAncestor(node, 194); - if (list.parent.kind === 175 && list.parent.parent.kind === 220) { + if (list.parent.kind === 175 && list.parent.parent.kind === 221) { return; } - var blockScopeContainer = getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 220 - ? blockScopeContainer - : blockScopeContainer.parent; + var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); + var parent = blockScopeContainer.kind === 221 ? blockScopeContainer : blockScopeContainer.parent; var generatedName = generateUniqueNameForLocation(parent, node.text); var variableId = resolver.getBlockScopedVariableId(node); if (!generatedBlockScopeNames) { @@ -20583,7 +25294,7 @@ var ts; if (ts.isBindingPattern(p.name)) { writeLine(); write("var "); - emitDestructuring(p, tempParameters[tempIndex]); + emitDestructuring(p, false, tempParameters[tempIndex]); write(";"); tempIndex++; } @@ -20591,14 +25302,14 @@ var ts; writeLine(); emitStart(p); write("if ("); - emitNode(p.name); + emitNodeWithoutSourceMap(p.name); write(" === void 0)"); emitEnd(p); write(" { "); emitStart(p); - emitNode(p.name); + emitNodeWithoutSourceMap(p.name); write(" = "); - emitNode(p.initializer); + emitNodeWithoutSourceMap(p.initializer); emitEnd(p); write("; }"); } @@ -20614,7 +25325,7 @@ var ts; emitLeadingComments(restParam); emitStart(restParam); write("var "); - emitNode(restParam.name); + emitNodeWithoutSourceMap(restParam.name); write(" = [];"); emitEnd(restParam); emitTrailingComments(restParam); @@ -20635,7 +25346,7 @@ var ts; increaseIndent(); writeLine(); emitStart(restParam); - emitNode(restParam.name); + emitNodeWithoutSourceMap(restParam.name); write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); emitEnd(restParam); decreaseIndent(); @@ -20653,7 +25364,7 @@ var ts; } function emitDeclarationName(node) { if (node.name) { - emitNode(node.name); + emitNodeWithoutSourceMap(node.name); } else { write(resolver.getGeneratedNameForNode(node)); @@ -20770,11 +25481,11 @@ var ts; emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); - if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + if (preserveNewLines && !preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { write(" "); emitStart(body); write("return "); - emitNode(body, true); + emitWithoutComments(body); emitEnd(body); write(";"); emitTempDeclarations(false); @@ -20785,7 +25496,7 @@ var ts; writeLine(); emitLeadingComments(node.body); write("return "); - emit(node.body, true); + emitWithoutComments(node.body); write(";"); emitTrailingComments(node.body); emitTempDeclarations(true); @@ -20807,7 +25518,7 @@ var ts; emitFunctionBodyPreamble(node); decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { for (var i = 0, n = body.statements.length; i < n; i++) { write(" "); emit(body.statements[i]); @@ -20848,7 +25559,7 @@ var ts; emitStart(param); emitStart(param.name); write("this."); - emitNode(param.name); + emitNodeWithoutSourceMap(param.name); emitEnd(param.name); write(" = "); emit(param.name); @@ -20860,7 +25571,7 @@ var ts; function emitMemberAccessForPropertyName(memberName) { if (memberName.kind === 8 || memberName.kind === 7) { write("["); - emitNode(memberName); + emitNodeWithoutSourceMap(memberName); write("]"); } else if (memberName.kind === 126) { @@ -20868,7 +25579,7 @@ var ts; } else { write("."); - emitNode(memberName); + emitNodeWithoutSourceMap(memberName); } } function emitMemberAssignments(node, staticFlag) { @@ -21297,8 +26008,7 @@ var ts; emitImportDeclaration(node); return; } - if (resolver.isReferencedAliasDeclaration(node) || - (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + if (resolver.isReferencedAliasDeclaration(node) || (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); if (!(node.flags & 1)) @@ -21327,11 +26037,11 @@ var ts; emitStart(specifier); emitContainingModuleName(specifier); write("."); - emitNode(specifier.name); + emitNodeWithoutSourceMap(specifier.name); write(" = "); write(generatedName); write("."); - emitNode(specifier.propertyName || specifier.name); + emitNodeWithoutSourceMap(specifier.propertyName || specifier.name); write(";"); emitEnd(specifier); }); @@ -21349,15 +26059,15 @@ var ts; } } function createExternalImportInfo(node) { - if (node.kind === 202) { - if (node.moduleReference.kind === 212) { + if (node.kind === 203) { + if (node.moduleReference.kind === 213) { return { rootNode: node, declarationNode: node }; } } - else if (node.kind === 203) { + else if (node.kind === 204) { var importClause = node.importClause; if (importClause) { if (importClause.name) { @@ -21366,7 +26076,7 @@ var ts; declarationNode: importClause }; } - if (importClause.namedBindings.kind === 205) { + if (importClause.namedBindings.kind === 206) { return { rootNode: node, declarationNode: importClause.namedBindings @@ -21382,7 +26092,7 @@ var ts; rootNode: node }; } - else if (node.kind === 209) { + else if (node.kind === 210) { if (node.moduleSpecifier) { return { rootNode: node @@ -21395,7 +26105,7 @@ var ts; exportSpecifiers = {}; exportDefault = undefined; ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 209 && !node.moduleSpecifier) { + if (node.kind === 210 && !node.moduleSpecifier) { ts.forEach(node.exportClause.elements, function (specifier) { if (specifier.name.text === "default") { exportDefault = exportDefault || specifier; @@ -21404,7 +26114,7 @@ var ts; (exportSpecifiers[name] || (exportSpecifiers[name] = [])).push(specifier); }); } - else if (node.kind === 208) { + else if (node.kind === 209) { exportDefault = exportDefault || node; } else if (node.kind === 195 || node.kind === 196) { @@ -21434,7 +26144,7 @@ var ts; } function getFirstExportAssignment(sourceFile) { return ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 208) { + if (node.kind === 209) { return node; } }); @@ -21512,10 +26222,10 @@ var ts; writeLine(); emitStart(exportDefault); write(emitAsReturn ? "return " : "module.exports = "); - if (exportDefault.kind === 208) { + if (exportDefault.kind === 209) { emit(exportDefault.expression); } - else if (exportDefault.kind === 211) { + else if (exportDefault.kind === 212) { emit(exportDefault.propertyName); } else { @@ -21539,8 +26249,7 @@ var ts; } return statements.length; } - function emitSourceFile(node) { - currentSourceFile = node; + function emitSourceFileNode(node) { writeLine(); emitDetachedComments(node); var startIndex = emitDirectivePrologues(node.statements, false); @@ -21580,14 +26289,14 @@ var ts; } emitLeadingComments(node.endOfFileToken); } - function emitNode(node, disableComments) { + function emitNodeWithoutSourceMapWithComments(node) { if (!node) { return; } if (node.flags & 2) { return emitPinnedOrTripleSlashComments(node); } - var emitComments = !disableComments && shouldEmitLeadingAndTrailingComments(node); + var emitComments = shouldEmitLeadingAndTrailingComments(node); if (emitComments) { emitLeadingComments(node); } @@ -21596,14 +26305,23 @@ var ts; emitTrailingComments(node); } } + function emitNodeWithoutSourceMapWithoutComments(node) { + if (!node) { + return; + } + if (node.flags & 2) { + return emitPinnedOrTripleSlashComments(node); + } + emitJavaScriptWorker(node); + } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { case 197: case 195: + case 204: case 203: - case 202: case 198: - case 208: + case 209: return false; case 200: return shouldEmitModuleDeclaration(node); @@ -21658,9 +26376,9 @@ var ts; return emitArrayLiteral(node); case 152: return emitObjectLiteral(node); - case 217: - return emitPropertyAssignment(node); case 218: + return emitPropertyAssignment(node); + case 219: return emitShorthandPropertyAssignment(node); case 126: return emitComputedPropertyName(node); @@ -21729,8 +26447,8 @@ var ts; return emitWithStatement(node); case 188: return emitSwitchStatement(node); - case 213: case 214: + case 215: return emitCaseOrDefaultClause(node); case 189: return emitLabelledStatement(node); @@ -21738,7 +26456,7 @@ var ts; return emitThrowStatement(node); case 191: return emitTryStatement(node); - case 216: + case 217: return emitCatchClause(node); case 192: return emitDebuggerStatement(node); @@ -21750,18 +26468,18 @@ var ts; return emitInterfaceDeclaration(node); case 199: return emitEnumDeclaration(node); - case 219: + case 220: return emitEnumMember(node); case 200: return emitModuleDeclaration(node); - case 203: + case 204: return emitImportDeclaration(node); - case 202: + case 203: return emitImportEqualsDeclaration(node); - case 209: + case 210: return emitExportDeclaration(node); - case 220: - return emitSourceFile(node); + case 221: + return emitSourceFileNode(node); } } function hasDetachedComments(pos) { @@ -21779,7 +26497,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 220 || node.pos !== node.parent.pos) { + if (node.parent.kind === 221 || node.pos !== node.parent.pos) { var leadingComments; if (hasDetachedComments(node.pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -21798,7 +26516,7 @@ var ts; } function emitTrailingDeclarationComments(node) { if (node.parent) { - if (node.parent.kind === 220 || node.end !== node.parent.end) { + if (node.parent.kind === 221 || node.end !== node.parent.end) { var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); } @@ -21812,7 +26530,10 @@ var ts; else { leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); } - emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, { + pos: pos, + end: pos + }, leadingComments); emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitDetachedCommentsAtPosition(node) { @@ -21837,27 +26558,29 @@ var ts; if (nodeLine >= lastCommentLine + 2) { emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; + var currentDetachedCommentInfo = { + nodePos: node.pos, + detachedCommentEndPos: detachedComments[detachedComments.length - 1].end + }; if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); } else { - detachedCommentsInfo = [currentDetachedCommentInfo]; + detachedCommentsInfo = [ + currentDetachedCommentInfo + ]; } } } } } - function emitPinnedOrTripleSlashCommentsOfNode(node) { + function emitPinnedOrTripleSlashComments(node) { var pinnedComments = ts.filter(getLeadingCommentsToEmit(node), isPinnedOrTripleSlashComment); function isPinnedOrTripleSlashComment(comment) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && - currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { return true; } } @@ -21894,6 +26617,7 @@ var ts; (function (ts) { ts.emitTime = 0; ts.ioReadTime = 0; + ts.version = "1.5.0.0"; function createCompilerHost(options) { var currentDirectory; var existingDirectories = {}; @@ -21909,9 +26633,7 @@ var ts; } catch (e) { if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode - ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText - : e.message); + onError(e.number === unsupportedFileEncodingErrorCode ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText : e.message); } text = ""; } @@ -21947,12 +26669,20 @@ var ts; } return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + getDefaultLibFileName: function (options) { + return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); + }, writeFile: writeFile, - getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, - useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, + getCurrentDirectory: function () { + return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); + }, + useCaseSensitiveFileNames: function () { + return ts.sys.useCaseSensitiveFileNames; + }, getCanonicalFileName: getCanonicalFileName, - getNewLine: function () { return ts.sys.newLine; } + getNewLine: function () { + return ts.sys.newLine; + } }; } ts.createCompilerHost = createCompilerHost; @@ -21992,7 +26722,9 @@ var ts; var seenNoDefaultLib = options.noLib; var commonSourceDirectory; host = host || createCompilerHost(options); - ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + ts.forEach(rootNames, function (name) { + return processRootFile(name, false); + }); if (!seenNoDefaultLib) { processRootFile(host.getDefaultLibFileName(options), true); } @@ -22001,21 +26733,35 @@ var ts; var noDiagnosticsTypeChecker; program = { getSourceFile: getSourceFile, - getSourceFiles: function () { return files; }, - getCompilerOptions: function () { return options; }, + getSourceFiles: function () { + return files; + }, + getCompilerOptions: function () { + return options; + }, getSyntacticDiagnostics: getSyntacticDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, getDeclarationDiagnostics: getDeclarationDiagnostics, getTypeChecker: getTypeChecker, getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, - getCommonSourceDirectory: function () { return commonSourceDirectory; }, + getCommonSourceDirectory: function () { + return commonSourceDirectory; + }, emit: emit, getCurrentDirectory: host.getCurrentDirectory, - getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, - getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, - getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, - getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } + getNodeCount: function () { + return getDiagnosticsProducingTypeChecker().getNodeCount(); + }, + getIdentifierCount: function () { + return getDiagnosticsProducingTypeChecker().getIdentifierCount(); + }, + getSymbolCount: function () { + return getDiagnosticsProducingTypeChecker().getSymbolCount(); + }, + getTypeCount: function () { + return getDiagnosticsProducingTypeChecker().getTypeCount(); + } }; return program; function getEmitHost(writeFileCallback) { @@ -22042,7 +26788,11 @@ var ts; } function emit(sourceFile, writeFileCallback) { if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { - return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; + return { + diagnostics: [], + sourceMaps: undefined, + emitSkipped: true + }; } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); var start = new Date().getTime(); @@ -22184,7 +26934,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 203 || node.kind === 202 || node.kind === 209) { + if (node.kind === 204 || node.kind === 203 || node.kind === 210) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8) { var moduleNameText = moduleNameExpr.text; @@ -22206,8 +26956,7 @@ var ts; } else if (node.kind === 200 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && - ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { @@ -22235,19 +26984,17 @@ var ts; } return; } - var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); + var firstExternalModuleSourceFile = ts.forEach(files, function (f) { + return ts.isExternalModule(f) ? f : undefined; + }); if (firstExternalModuleSourceFile && !options.module) { var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } - if (options.outDir || - options.sourceRoot || - (options.mapRoot && - (!options.out || firstExternalModuleSourceFile !== undefined))) { + if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModuleSourceFile !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { - if (!(sourceFile.flags & 2048) - && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { + if (!(sourceFile.flags & 2048) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); sourcePathComponents.pop(); if (commonPathComponents) { @@ -22362,7 +27109,7 @@ var ts; } case 201: return spanInBlock(node); - case 216: + case 217: return spanInBlock(node.block); case 177: return textSpan(node.expression); @@ -22388,20 +27135,20 @@ var ts; return textSpan(node, ts.findNextToken(node.expression, node)); case 188: return textSpan(node, ts.findNextToken(node.expression, node)); - case 213: case 214: + case 215: return spanInNode(node.statements[0]); case 191: return spanInBlock(node.tryBlock); case 190: return textSpan(node, node.expression); - case 208: - return textSpan(node, node.expression); - case 202: - return textSpan(node, node.moduleReference); - case 203: - return textSpan(node, node.moduleSpecifier); case 209: + return textSpan(node, node.expression); + case 203: + return textSpan(node, node.moduleReference); + case 204: + return textSpan(node, node.moduleSpecifier); + case 210: return textSpan(node, node.moduleSpecifier); case 200: if (ts.getModuleInstanceState(node) !== 1) { @@ -22409,7 +27156,7 @@ var ts; } case 196: case 199: - case 219: + case 220: case 155: case 156: return textSpan(node); @@ -22443,7 +27190,7 @@ var ts; case 80: return spanInNextNode(node); default: - if (node.parent.kind === 217 && node.parent.name === node) { + if (node.parent.kind === 218 && node.parent.name === node) { return spanInNode(node.parent.initializer); } if (node.parent.kind === 158 && node.parent.type === node) { @@ -22456,17 +27203,12 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 182 || - variableDeclaration.parent.parent.kind === 183) { + if (variableDeclaration.parent.parent.kind === 182 || variableDeclaration.parent.parent.kind === 183) { return spanInNode(variableDeclaration.parent.parent); } var isParentVariableStatement = variableDeclaration.parent.parent.kind === 175; var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 181 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); - var declarations = isParentVariableStatement - ? variableDeclaration.parent.parent.declarationList.declarations - : isDeclarationOfForStatement - ? variableDeclaration.parent.parent.initializer.declarations - : undefined; + var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement ? variableDeclaration.parent.parent.initializer.declarations : undefined; if (variableDeclaration.initializer || (variableDeclaration.flags & 1)) { if (declarations && declarations[0] === variableDeclaration) { if (isParentVariableStatement) { @@ -22487,8 +27229,7 @@ var ts; } } function canHaveSpanInParameterDeclaration(parameter) { - return !!parameter.initializer || parameter.dotDotDotToken !== undefined || - !!(parameter.flags & 16) || !!(parameter.flags & 32); + return !!parameter.initializer || parameter.dotDotDotToken !== undefined || !!(parameter.flags & 16) || !!(parameter.flags & 32); } function spanInParameterDeclaration(parameter) { if (canHaveSpanInParameterDeclaration(parameter)) { @@ -22506,8 +27247,7 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 1) || - (functionDeclaration.parent.kind === 196 && functionDeclaration.kind !== 133); + return !!(functionDeclaration.flags & 1) || (functionDeclaration.parent.kind === 196 && functionDeclaration.kind !== 133); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -22568,8 +27308,8 @@ var ts; case 196: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 188: - return spanInNodeIfStartsOnSameLine(node.parent, node.parent.clauses[0]); + case 202: + return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } @@ -22586,12 +27326,12 @@ var ts; if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 216: + case 217: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 188: - var switchStatement = node.parent; - var lastClause = switchStatement.clauses[switchStatement.clauses.length - 1]; + case 202: + var caseBlock = node.parent; + var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; if (lastClause) { return spanInNode(lastClause.statements[lastClause.statements.length - 1]); } @@ -22626,7 +27366,7 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isFunctionLike(node.parent) || node.parent.kind === 217) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 218) { return spanInPreviousNode(node); } return spanInNode(node.parent); @@ -22681,14 +27421,7 @@ var ts; var parent = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent.kind === 179 || - parent.kind === 182 || - parent.kind === 183 || - parent.kind === 181 || - parent.kind === 178 || - parent.kind === 180 || - parent.kind === 187 || - parent.kind === 216) { + if (parent.kind === 179 || parent.kind === 182 || parent.kind === 183 || parent.kind === 181 || parent.kind === 178 || parent.kind === 180 || parent.kind === 187 || parent.kind === 217) { addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } @@ -22724,7 +27457,7 @@ var ts; case 197: case 199: case 152: - case 188: + case 202: var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); @@ -22775,7 +27508,13 @@ var ts; } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ + name: name, + fileName: fileName, + matchKind: matchKind, + isCaseSensitive: allMatchesAreCaseSensitive(matches), + declaration: declaration + }); } } }); @@ -22809,9 +27548,7 @@ var ts; return undefined; } function getTextOfIdentifierOrLiteral(node) { - if (node.kind === 64 || - node.kind === 8 || - node.kind === 7) { + if (node.kind === 64 || node.kind === 8 || node.kind === 7) { return node.text; } return undefined; @@ -22875,11 +27612,11 @@ var ts; } return bestMatchKind; } - var baseSensitivity = { sensitivity: "base" }; + var baseSensitivity = { + sensitivity: "base" + }; function compareNavigateToItems(i1, i2) { - return i1.matchKind - i2.matchKind || - i1.name.localeCompare(i2.name, undefined, baseSensitivity) || - i1.name.localeCompare(i2.name); + return i1.matchKind - i2.matchKind || i1.name.localeCompare(i2.name, undefined, baseSensitivity) || i1.name.localeCompare(i2.name); } function createNavigateToItem(rawItem) { var declaration = rawItem.declaration; @@ -22937,19 +27674,19 @@ var ts; case 149: ts.forEach(node.elements, visit); break; - case 209: + case 210: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 203: + case 204: var importClause = node.importClause; if (importClause) { if (importClause.name) { childNodes.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 205) { + if (importClause.namedBindings.kind === 206) { childNodes.push(importClause.namedBindings); } else { @@ -22969,9 +27706,9 @@ var ts; case 197: case 200: case 195: - case 202: - case 207: - case 211: + case 203: + case 208: + case 212: childNodes.push(node); break; } @@ -23029,7 +27766,9 @@ var ts; function isTopLevelFunctionDeclaration(functionDeclaration) { if (functionDeclaration.kind === 195) { if (functionDeclaration.body && functionDeclaration.body.kind === 174) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 195 && !isEmpty(s.name.text); })) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { + return s.kind === 195 && !isEmpty(s.name.text); + })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -23099,7 +27838,7 @@ var ts; return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); case 138: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 219: + case 220: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); case 136: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); @@ -23138,16 +27877,18 @@ var ts; } case 133: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 211: - case 207: - case 202: - case 204: + case 212: + case 208: + case 203: case 205: + case 206: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; function createItem(node, name, scriptElementKind) { - return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)]); + return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ]); } } function isEmpty(text) { @@ -23172,7 +27913,7 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 220: + case 221: return createSourceFileItem(node); case 196: return createClassItem(node); @@ -23201,12 +27942,16 @@ var ts; function createModuleItem(node) { var moduleName = getModuleName(node); var childItems = getItemsWorker(getChildNodes(getInnermostModule(node).body.statements), createChildItem); - return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ], childItems, getIndent(node)); } function createFunctionItem(node) { if (node.name && node.body && node.body.kind === 174) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ], childItems, getIndent(node)); } return undefined; } @@ -23216,10 +27961,10 @@ var ts; return undefined; } hasGlobalNode = true; - var rootName = ts.isExternalModule(node) - ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(node.fileName)))) + "\"" - : ""; - return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [getNodeSpan(node)], childItems); + var rootName = ts.isExternalModule(node) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(node.fileName)))) + "\"" : ""; + return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [ + getNodeSpan(node) + ], childItems); } function createClassItem(node) { if (!node.name) { @@ -23232,26 +27977,38 @@ var ts; }); var nodes = removeDynamicallyNamedProperties(node); if (constructor) { - nodes.push.apply(nodes, ts.filter(constructor.parameters, function (p) { return !ts.isBindingPattern(p.name); })); + nodes.push.apply(nodes, ts.filter(constructor.parameters, function (p) { + return !ts.isBindingPattern(p.name); + })); } var childItems = getItemsWorker(sortNodes(nodes), createChildItem); } - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ], childItems, getIndent(node)); } function createEnumItem(node) { var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ], childItems, getIndent(node)); } function createIterfaceItem(node) { var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ], childItems, getIndent(node)); } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 126; }); + return ts.filter(node.members, function (member) { + return member.name === undefined || member.name.kind !== 126; + }); } function removeDynamicallyNamedProperties(node) { - return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); + return ts.filter(node.members, function (member) { + return !ts.hasDynamicName(member); + }); } function getInnermostModule(node) { while (node.body.kind === 200) { @@ -23260,9 +28017,7 @@ var ts; return node; } function getNodeSpan(node) { - return node.kind === 220 - ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) - : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + return node.kind === 221 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } function getTextOfNode(node) { return ts.getTextOfNodeFromSourceText(sourceFile.text, node); @@ -23292,7 +28047,9 @@ var ts; var stringToWordSpans = {}; pattern = pattern.trim(); var fullPatternSegment = createSegment(pattern); - var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); + var dotSeparatedSegments = pattern.split(".").map(function (p) { + return createSegment(p.trim()); + }); var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); return { getMatches: getMatches, @@ -23400,7 +28157,9 @@ var ts; if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { var match = matchTextChunk(candidate, segment.totalTextChunk, false); if (match) { - return [match]; + return [ + match + ]; } } var subWordTextChunks = segment.subWordTextChunks; @@ -23467,8 +28226,7 @@ var ts; for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; if (gotOneMatchThisCandidate) { - if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || - !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { break; } } @@ -23489,10 +28247,7 @@ var ts; } ts.createPatternMatcher = createPatternMatcher; function patternMatchCompareTo(match1, match2) { - return compareType(match1, match2) || - compareCamelCase(match1, match2) || - compareCase(match1, match2) || - comparePunctuation(match1, match2); + return compareType(match1, match2) || compareCamelCase(match1, match2) || compareCase(match1, match2) || comparePunctuation(match1, match2); } function comparePunctuation(result1, result2) { if (result1.punctuationStripped !== result2.punctuationStripped) { @@ -23641,11 +28396,7 @@ var ts; var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); - if (charIsPunctuation(identifier.charCodeAt(i - 1)) || - charIsPunctuation(identifier.charCodeAt(i)) || - lastIsDigit != currentIsDigit || - hasTransitionFromLowerToUpper || - hasTransitionFromUpperToLower) { + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || charIsPunctuation(identifier.charCodeAt(i)) || lastIsDigit != currentIsDigit || hasTransitionFromLowerToUpper || hasTransitionFromUpperToLower) { if (!isAllPunctuation(identifier, wordStart, i)) { result.push(ts.createTextSpan(wordStart, i - wordStart)); } @@ -23697,8 +28448,7 @@ var ts; } function transitionFromUpperToLower(identifier, word, index, wordStart) { if (word) { - if (index != wordStart && - index + 1 < identifier.length) { + if (index != wordStart && index + 1 < identifier.length) { var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); if (currentIsUpper && nextIsLower) { @@ -23716,9 +28466,7 @@ var ts; function transitionFromLowerToUpper(identifier, word, index) { var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); - var transition = word - ? (currentIsUpper && !lastIsUpper) - : currentIsUpper; + var transition = word ? (currentIsUpper && !lastIsUpper) : currentIsUpper; return transition; } })(ts || (ts = {})); @@ -23748,8 +28496,7 @@ var ts; function getImmediatelyContainingArgumentInfo(node) { if (node.parent.kind === 155 || node.parent.kind === 156) { var callExpression = node.parent; - if (node.kind === 24 || - node.kind === 16) { + if (node.kind === 24 || node.kind === 16) { var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; ts.Debug.assert(list !== undefined); @@ -23758,15 +28505,15 @@ var ts; invocation: callExpression, argumentsSpan: getApplicableSpanForArguments(list), argumentIndex: 0, - argumentCount: getCommaBasedArgCount(list) + argumentCount: getArgumentCount(list) }; } var listItemInfo = ts.findListItemInfo(node); if (listItemInfo) { var list = listItemInfo.list; var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; - var argumentIndex = (listItemInfo.listItemIndex + 1) >> 1; - var argumentCount = getCommaBasedArgCount(list); + var argumentIndex = getArgumentIndex(list, node); + var argumentCount = getArgumentCount(list); ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); return { kind: isTypeArgList ? 0 : 1, @@ -23803,10 +28550,29 @@ var ts; } return undefined; } - function getCommaBasedArgCount(argumentsList) { - return argumentsList.getChildCount() === 0 - ? 0 - : 1 + ts.countWhere(argumentsList.getChildren(), function (arg) { return arg.kind === 23; }); + function getArgumentIndex(argumentsList, node) { + var argumentIndex = 0; + var listChildren = argumentsList.getChildren(); + for (var i = 0, n = listChildren.length; i < n; i++) { + var child = listChildren[i]; + if (child === node) { + break; + } + if (child.kind !== 23) { + argumentIndex++; + } + } + return argumentIndex; + } + function getArgumentCount(argumentsList) { + var listChildren = argumentsList.getChildren(); + var argumentCount = ts.countWhere(listChildren, function (arg) { + return arg.kind !== 23; + }); + if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 23) { + argumentCount++; + } + return argumentCount; } function getArgumentIndexForTemplatePiece(spanIndex, node) { ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); @@ -23819,9 +28585,7 @@ var ts; return spanIndex + 1; } function getArgumentListInfoForTemplate(tagExpression, argumentIndex) { - var argumentCount = tagExpression.template.kind === 10 - ? 1 - : tagExpression.template.templateSpans.length + 1; + var argumentCount = tagExpression.template.kind === 10 ? 1 : tagExpression.template.templateSpans.length + 1; ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); return { kind: 2, @@ -23849,7 +28613,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 220; n = n.parent) { + for (var n = node; n.kind !== 221; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -23926,7 +28690,10 @@ var ts; isVariadic: candidateSignature.hasRestParameter, prefixDisplayParts: prefixDisplayParts, suffixDisplayParts: suffixDisplayParts, - separatorDisplayParts: [ts.punctuationPart(23), ts.spacePart()], + separatorDisplayParts: [ + ts.punctuationPart(23), + ts.spacePart() + ], parameters: signatureHelpParameters, documentation: candidateSignature.getDocumentationComment() }; @@ -24035,24 +28802,31 @@ var ts; } ts.findListItemInfo = findListItemInfo; function findChildOfKind(n, kind, sourceFile) { - return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; }); + return ts.forEach(n.getChildren(sourceFile), function (c) { + return c.kind === kind && c; + }); } ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 221 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 222 && c.pos <= node.pos && c.end >= node.end) { return c; } }); + ts.Debug.assert(!syntaxList || ts.contains(syntaxList.getChildren(), node)); return syntaxList; } ts.findContainingList = findContainingList; function getTouchingWord(sourceFile, position) { - return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }); + return getTouchingToken(sourceFile, position, function (n) { + return isWord(n.kind); + }); } ts.getTouchingWord = getTouchingWord; function getTouchingPropertyName(sourceFile, position) { - return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }); + return getTouchingToken(sourceFile, position, function (n) { + return isPropertyName(n.kind); + }); } ts.getTouchingPropertyName = getTouchingPropertyName; function getTouchingToken(sourceFile, position, includeItemAtEndPosition) { @@ -24106,8 +28880,7 @@ var ts; var children = n.getChildren(); for (var i = 0, len = children.length; i < len; ++i) { var child = children[i]; - var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || - (child.pos === previousToken.end); + var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { return find(child); } @@ -24145,7 +28918,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 220); + ts.Debug.assert(startNode !== undefined || n.kind === 221); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -24210,8 +28983,7 @@ var ts; } ts.isPunctuation = isPunctuation; function isInsideTemplateLiteral(node, position) { - return ts.isTemplateLiteralKind(node.kind) - && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); + return ts.isTemplateLiteralKind(node.kind) && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); } ts.isInsideTemplateLiteral = isInsideTemplateLiteral; function compareDataObjects(dst, src) { @@ -24244,19 +29016,38 @@ var ts; var indent; resetWriter(); return { - displayParts: function () { return displayParts; }, - writeKeyword: function (text) { return writeKind(text, 5); }, - writeOperator: function (text) { return writeKind(text, 12); }, - writePunctuation: function (text) { return writeKind(text, 15); }, - writeSpace: function (text) { return writeKind(text, 16); }, - writeStringLiteral: function (text) { return writeKind(text, 8); }, - writeParameter: function (text) { return writeKind(text, 13); }, + displayParts: function () { + return displayParts; + }, + writeKeyword: function (text) { + return writeKind(text, 5); + }, + writeOperator: function (text) { + return writeKind(text, 12); + }, + writePunctuation: function (text) { + return writeKind(text, 15); + }, + writeSpace: function (text) { + return writeKind(text, 16); + }, + writeStringLiteral: function (text) { + return writeKind(text, 8); + }, + writeParameter: function (text) { + return writeKind(text, 13); + }, writeSymbol: writeSymbol, writeLine: writeLine, - increaseIndent: function () { indent++; }, - decreaseIndent: function () { indent--; }, + increaseIndent: function () { + indent++; + }, + decreaseIndent: function () { + indent--; + }, clear: resetWriter, - trackSymbol: function () { } + trackSymbol: function () { + } }; function writeIndent() { if (lineStart) { @@ -24410,7 +29201,9 @@ var ts; advance: advance, readTokenInfo: readTokenInfo, isOnToken: isOnToken, - lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, + lastTrailingTriviaWasNewLine: function () { + return wasNewLine; + }, close: function () { lastTokenInfo = undefined; scanner.setText(undefined); @@ -24471,8 +29264,7 @@ var ts; return container.kind === 9; } function shouldRescanTemplateToken(container) { - return container.kind === 12 || - container.kind === 13; + return container.kind === 12 || container.kind === 13; } function startsWithSlashToken(t) { return t === 36 || t === 56; @@ -24485,13 +29277,7 @@ var ts; token: undefined }; } - var expectedScanAction = shouldRescanGreaterThanToken(n) - ? 1 - : shouldRescanSlashToken(n) - ? 2 - : shouldRescanTemplateToken(n) - ? 3 - : 0; + var expectedScanAction = shouldRescanGreaterThanToken(n) ? 1 : shouldRescanSlashToken(n) ? 2 : shouldRescanTemplateToken(n) ? 3 : 0; if (lastTokenInfo && expectedScanAction === lastScanAction) { return fixTokenKind(lastTokenInfo, n); } @@ -24645,6 +29431,7 @@ var ts; formatting.FormattingContext = FormattingContext; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); +/// var ts; (function (ts) { var formatting; @@ -24657,15 +29444,14 @@ var ts; this.Flag = Flag; } Rule.prototype.toString = function () { - return "[desc=" + this.Descriptor + "," + - "operation=" + this.Operation + "," + - "flag=" + this.Flag + "]"; + return "[desc=" + this.Descriptor + "," + "operation=" + this.Operation + "," + "flag=" + this.Flag + "]"; }; return Rule; })(); formatting.Rule = Rule; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); +/// var ts; (function (ts) { var formatting; @@ -24676,8 +29462,7 @@ var ts; this.RightTokenRange = RightTokenRange; } RuleDescriptor.prototype.toString = function () { - return "[leftRange=" + this.LeftTokenRange + "," + - "rightRange=" + this.RightTokenRange + "]"; + return "[leftRange=" + this.LeftTokenRange + "," + "rightRange=" + this.RightTokenRange + "]"; }; RuleDescriptor.create1 = function (left, right) { return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right)); @@ -24696,6 +29481,7 @@ var ts; formatting.RuleDescriptor = RuleDescriptor; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); +/// var ts; (function (ts) { var formatting; @@ -24706,8 +29492,7 @@ var ts; this.Action = null; } RuleOperation.prototype.toString = function () { - return "[context=" + this.Context + "," + - "action=" + this.Action + "]"; + return "[context=" + this.Context + "," + "action=" + this.Action + "]"; }; RuleOperation.create1 = function (action) { return RuleOperation.create2(formatting.RuleOperationContext.Any, action); @@ -24773,7 +29558,12 @@ var ts; this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(15, 75), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(15, 99), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.FromTokens([17, 19, 23, 22])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.FromTokens([ + 17, + 19, + 23, + 22 + ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); @@ -24782,9 +29572,19 @@ var ts; this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([64, 3]); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([ + 64, + 3 + ]); this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([17, 3, 74, 95, 80, 75]); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([ + 17, + 3, + 74, + 95, + 80, + 75 + ]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(14, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); @@ -24803,79 +29603,151 @@ var ts; this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(34, 34), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(34, 39), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([97, 93, 87, 73, 89, 96]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([104, 69]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ + 97, + 93, + 87, + 73, + 89, + 96 + ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ + 104, + 69 + ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(82, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(98, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2)); this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(89, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([17, 74, 75, 66]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([95, 80]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([115, 119]), 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ + 17, + 74, + 75, + 66 + ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ + 95, + 80 + ]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ + 115, + 119 + ]), 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(113, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([116, 117]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([68, 114, 76, 77, 78, 115, 102, 84, 103, 116, 106, 108, 119, 109]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([78, 102])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ + 116, + 117 + ]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ + 68, + 114, + 76, + 77, + 78, + 115, + 102, + 84, + 103, + 116, + 106, + 108, + 119, + 109 + ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([ + 78, + 102 + ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(8, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(32, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(21, 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.FromTokens([17, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.FromTokens([ + 17, + 23 + ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(17, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.TypeNames), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); - this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([16, 18, 25, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([ + 16, + 18, + 25, + 23 + ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8)); - this.HighPriorityCommonRules = - [ - this.IgnoreBeforeComment, this.IgnoreAfterLineComment, - this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, - this.NoSpaceAfterQuestionMark, - this.NoSpaceBeforeDot, this.NoSpaceAfterDot, - this.NoSpaceAfterUnaryPrefixOperator, - this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, - this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, - this.SpaceAfterPostincrementWhenFollowedByAdd, - this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, - this.SpaceAfterPostdecrementWhenFollowedBySubtract, - this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, - this.NoSpaceAfterCloseBrace, - this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, - this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, - this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, - this.NoSpaceBetweenReturnAndSemicolon, - this.SpaceAfterCertainKeywords, - this.SpaceAfterLetConstInVariableDeclaration, - this.NoSpaceBeforeOpenParenInFuncCall, - this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, - this.SpaceAfterVoidOperator, - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, - this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, - this.SpaceAfterModuleName, - this.SpaceAfterArrow, - this.NoSpaceAfterEllipsis, - this.NoSpaceAfterOptionalParameters, - this.NoSpaceBetweenEmptyInterfaceBraceBrackets, - this.NoSpaceBeforeOpenAngularBracket, - this.NoSpaceBetweenCloseParenAndAngularBracket, - this.NoSpaceAfterOpenAngularBracket, - this.NoSpaceBeforeCloseAngularBracket, - this.NoSpaceAfterCloseAngularBracket - ]; - this.LowPriorityCommonRules = - [ - this.NoSpaceBeforeSemicolon, - this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, - this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket, - this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket, - this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, - this.SpaceBetweenStatements, this.SpaceAfterTryFinally - ]; + this.HighPriorityCommonRules = [ + this.IgnoreBeforeComment, + this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, + this.SpaceAfterColon, + this.NoSpaceBeforeQuestionMark, + this.SpaceAfterQuestionMarkInConditionalOperator, + this.NoSpaceAfterQuestionMark, + this.NoSpaceBeforeDot, + this.NoSpaceAfterDot, + this.NoSpaceAfterUnaryPrefixOperator, + this.NoSpaceAfterUnaryPreincrementOperator, + this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, + this.NoSpaceBeforeUnaryPostdecrementOperator, + this.SpaceAfterPostincrementWhenFollowedByAdd, + this.SpaceAfterAddWhenFollowedByUnaryPlus, + this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterPostdecrementWhenFollowedBySubtract, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, + this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.NoSpaceAfterCloseBrace, + this.SpaceAfterOpenBrace, + this.SpaceBeforeCloseBrace, + this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, + this.SpaceBetweenCloseBraceAndElse, + this.SpaceBetweenCloseBraceAndWhile, + this.NoSpaceBetweenEmptyBraceBrackets, + this.SpaceAfterFunctionInFuncDecl, + this.NewLineAfterOpenBraceInBlockContext, + this.SpaceAfterGetSetInMember, + this.NoSpaceBetweenReturnAndSemicolon, + this.SpaceAfterCertainKeywords, + this.SpaceAfterLetConstInVariableDeclaration, + this.NoSpaceBeforeOpenParenInFuncCall, + this.SpaceBeforeBinaryKeywordOperator, + this.SpaceAfterBinaryKeywordOperator, + this.SpaceAfterVoidOperator, + this.NoSpaceAfterConstructor, + this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, + this.SpaceBeforeCertainTypeScriptKeywords, + this.SpaceAfterModuleName, + this.SpaceAfterArrow, + this.NoSpaceAfterEllipsis, + this.NoSpaceAfterOptionalParameters, + this.NoSpaceBetweenEmptyInterfaceBraceBrackets, + this.NoSpaceBeforeOpenAngularBracket, + this.NoSpaceBetweenCloseParenAndAngularBracket, + this.NoSpaceAfterOpenAngularBracket, + this.NoSpaceBeforeCloseAngularBracket, + this.NoSpaceAfterCloseAngularBracket + ]; + this.LowPriorityCommonRules = [ + this.NoSpaceBeforeSemicolon, + this.SpaceBeforeOpenBraceInControl, + this.SpaceBeforeOpenBraceInFunction, + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.NoSpaceBeforeComma, + this.NoSpaceBeforeOpenBracket, + this.NoSpaceAfterOpenBracket, + this.NoSpaceBeforeCloseBracket, + this.NoSpaceAfterCloseBracket, + this.SpaceAfterSemicolon, + this.NoSpaceBeforeOpenParenInFuncDecl, + this.SpaceBetweenStatements, + this.SpaceAfterTryFinally + ]; this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); @@ -24917,10 +29789,10 @@ var ts; case 167: case 168: return true; - case 202: + case 203: case 193: case 128: - case 219: + case 220: case 130: case 129: return context.currentTokenSpan.kind === 52 || context.nextTokenSpan.kind === 52; @@ -24963,7 +29835,7 @@ var ts; } switch (node.kind) { case 174: - case 188: + case 202: case 152: case 201: return true; @@ -25006,7 +29878,7 @@ var ts; case 200: case 199: case 174: - case 216: + case 217: case 201: case 188: return true; @@ -25024,7 +29896,7 @@ var ts; case 191: case 179: case 187: - case 216: + case 217: return true; default: return false; @@ -25049,8 +29921,7 @@ var ts; return context.TokensAreOnSameLine(); }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 194 && - context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; + return context.currentTokenParent.kind === 194 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind != 2; @@ -25084,8 +29955,7 @@ var ts; } }; Rules.IsTypeArgumentOrParameterContext = function (context) { - return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || - Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); + return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsVoidOpContext = function (context) { return context.currentTokenSpan.kind === 98 && context.currentTokenParent.kind === 164; @@ -25128,8 +29998,7 @@ var ts; }; RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) { var _this = this; - var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && - rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; + var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) { rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) { var rulesBucketIndex = _this.GetRuleBucketIndex(left, right); @@ -25203,19 +30072,13 @@ var ts; RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) { var position; if (rule.Operation.Action == 1) { - position = specificTokens ? - 0 : - RulesPosition.IgnoreRulesAny; + position = specificTokens ? 0 : RulesPosition.IgnoreRulesAny; } else if (!rule.Operation.Context.IsAny()) { - position = specificTokens ? - RulesPosition.ContextRulesSpecific : - RulesPosition.ContextRulesAny; + position = specificTokens ? RulesPosition.ContextRulesSpecific : RulesPosition.ContextRulesAny; } else { - position = specificTokens ? - RulesPosition.NoContextRulesSpecific : - RulesPosition.NoContextRulesAny; + position = specificTokens ? RulesPosition.NoContextRulesSpecific : RulesPosition.NoContextRulesAny; } var state = constructionState[rulesBucketIndex]; if (state === undefined) { @@ -25272,7 +30135,9 @@ var ts; this.token = token; } TokenSingleValueAccess.prototype.GetTokens = function () { - return [this.token]; + return [ + this.token + ]; }; TokenSingleValueAccess.prototype.Contains = function (tokenValue) { return tokenValue == this.token; @@ -25326,18 +30191,68 @@ var ts; return this.tokenAccess.toString(); }; TokenRange.Any = TokenRange.AllTokens(); - TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); + TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([ + 3 + ])); TokenRange.Keywords = TokenRange.FromRange(65, 124); TokenRange.BinaryOperators = TokenRange.FromRange(24, 63); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([85, 86, 124]); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([38, 39, 47, 46]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7, 64, 16, 18, 14, 92, 87]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); - TokenRange.Comments = TokenRange.FromTokens([2, 3]); - TokenRange.TypeNames = TokenRange.FromTokens([64, 118, 120, 112, 121, 98, 111]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([ + 85, + 86, + 124 + ]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([ + 38, + 39, + 47, + 46 + ]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([ + 7, + 64, + 16, + 18, + 14, + 92, + 87 + ]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([ + 64, + 16, + 92, + 87 + ]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([ + 64, + 17, + 19, + 87 + ]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([ + 64, + 16, + 92, + 87 + ]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([ + 64, + 17, + 19, + 87 + ]); + TokenRange.Comments = TokenRange.FromTokens([ + 2, + 3 + ]); + TokenRange.TypeNames = TokenRange.FromTokens([ + 64, + 118, + 120, + 112, + 121, + 98, + 111 + ]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -25482,16 +30397,11 @@ var ts; } function findOutermostParent(position, expectedTokenKind, sourceFile) { var precedingToken = ts.findPrecedingToken(position, sourceFile); - if (!precedingToken || - precedingToken.kind !== expectedTokenKind || - position !== precedingToken.getEnd()) { + if (!precedingToken || precedingToken.kind !== expectedTokenKind || position !== precedingToken.getEnd()) { return undefined; } var current = precedingToken; - while (current && - current.parent && - current.parent.end === precedingToken.end && - !isListElement(current.parent, current)) { + while (current && current.parent && current.parent.end === precedingToken.end && !isListElement(current.parent, current)) { current = current.parent; } return current; @@ -25504,11 +30414,11 @@ var ts; case 200: var body = parent.body; return body && body.kind === 174 && ts.rangeContainsRange(body.statements, node); - case 220: + case 221: case 174: case 201: return ts.rangeContainsRange(parent.statements, node); - case 216: + case 217: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -25516,7 +30426,9 @@ var ts; function findEnclosingNode(range, sourceFile) { return find(sourceFile); function find(n) { - var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; }); + var candidate = ts.forEachChild(n, function (c) { + return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; + }); if (candidate) { var result = find(candidate); if (result) { @@ -25530,9 +30442,11 @@ var ts; if (!errors.length) { return rangeHasNoErrors; } - var sorted = errors - .filter(function (d) { return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); }) - .sort(function (e1, e2) { return e1.start - e2.start; }); + var sorted = errors.filter(function (d) { + return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); + }).sort(function (e1, e2) { + return e1.start - e2.start; + }); if (!sorted.length) { return rangeHasNoErrors; } @@ -25626,10 +30540,7 @@ var ts; var indentation = inheritedIndentation; if (indentation === -1) { if (isSomeBlock(node.kind)) { - if (isSomeBlock(parent.kind) || - parent.kind === 220 || - parent.kind === 213 || - parent.kind === 214) { + if (isSomeBlock(parent.kind) || parent.kind === 221 || parent.kind === 214 || parent.kind === 215) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -25678,8 +30589,12 @@ var ts; return nodeStartLine !== line ? indentation + delta : indentation; } }, - getIndentation: function () { return indentation; }, - getDelta: function () { return delta; }, + getIndentation: function () { + return indentation; + }, + getDelta: function () { + return delta; + }, recomputeIndentation: function (lineAdded) { if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent.kind, node.kind)) { if (lineAdded) { @@ -25872,8 +30787,7 @@ var ts; trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { - lineAdded = - processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); + lineAdded = processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); } } previousRange = range; @@ -25901,9 +30815,7 @@ var ts; dynamicIndentation.recomputeIndentation(true); } } - trimTrailingWhitespaces = - (rule.Operation.Action & (4 | 2)) && - rule.Flag !== 1; + trimTrailingWhitespaces = (rule.Operation.Action & (4 | 2)) && rule.Flag !== 1; } else { trimTrailingWhitespaces = true; @@ -25940,10 +30852,16 @@ var ts; var startPos = commentRange.pos; for (var line = startLine; line < endLine; ++line) { var endOfLine = ts.getEndLinePosition(line, sourceFile); - parts.push({ pos: startPos, end: endOfLine }); + parts.push({ + pos: startPos, + end: endOfLine + }); startPos = ts.getStartPositionOfLine(line + 1, sourceFile); } - parts.push({ pos: startPos, end: commentRange.end }); + parts.push({ + pos: startPos, + end: commentRange.end + }); } var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options); @@ -25958,9 +30876,7 @@ var ts; var delta = indentation - nonWhitespaceColumnInFirstPart.column; for (var i = startIndex, len = parts.length; i < len; ++i, ++startLine) { var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); - var nonWhitespaceCharacterAndColumn = i === 0 - ? nonWhitespaceColumnInFirstPart - : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); + var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); var newIndentation = nonWhitespaceCharacterAndColumn.column + delta; if (newIndentation > 0) { var indentationString = getIndentationString(newIndentation, options); @@ -25989,7 +30905,10 @@ var ts; } } function newTextChange(start, len, newText) { - return { span: ts.createTextSpan(start, len), newText: newText }; + return { + span: ts.createTextSpan(start, len), + newText: newText + }; } function recordDelete(start, len) { if (len) { @@ -26139,12 +31058,7 @@ var ts; if (!precedingToken) { return 0; } - var precedingTokenIsLiteral = precedingToken.kind === 8 || - precedingToken.kind === 9 || - precedingToken.kind === 10 || - precedingToken.kind === 11 || - precedingToken.kind === 12 || - precedingToken.kind === 13; + var precedingTokenIsLiteral = precedingToken.kind === 8 || precedingToken.kind === 9 || precedingToken.kind === 10 || precedingToken.kind === 11 || precedingToken.kind === 12 || precedingToken.kind === 13; if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } @@ -26204,8 +31118,7 @@ var ts; } } parentStart = getParentStart(parent, current, sourceFile); - var parentAndChildShareLine = parentStart.line === currentStart.line || - childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); + var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); if (useActualIndentation) { var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); if (actualIndentation !== -1) { @@ -26238,8 +31151,7 @@ var ts; } } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { - var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 220 || !parentAndChildShareLine); + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && (parent.kind === 221 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -26279,8 +31191,7 @@ var ts; if (node.parent) { switch (node.parent.kind) { case 139: - if (node.parent.typeArguments && - ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { + if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; @@ -26296,8 +31207,7 @@ var ts; case 136: case 137: var start = node.getStart(sourceFile); - if (node.parent.typeParameters && - ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { + if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { return node.parent.typeParameters; } if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { @@ -26307,12 +31217,10 @@ var ts; case 156: case 155: var start = node.getStart(sourceFile); - if (node.parent.typeArguments && - ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { + if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { return node.parent.typeArguments; } - if (node.parent.arguments && - ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { + if (node.parent.arguments && ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { return node.parent.arguments; } break; @@ -26364,7 +31272,10 @@ var ts; } character++; } - return { column: column, character: character }; + return { + column: column, + character: character + }; } SmartIndenter.findFirstNonWhitespaceCharacterAndColumn = findFirstNonWhitespaceCharacterAndColumn; function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { @@ -26381,15 +31292,15 @@ var ts; case 201: case 152: case 143: - case 188: + case 202: + case 215: case 214: - case 213: case 159: case 155: case 156: case 175: case 193: - case 208: + case 209: case 186: case 168: return true; @@ -26445,9 +31356,9 @@ var ts; case 152: case 174: case 201: - case 188: + case 202: return nodeEndsWith(n, 15, sourceFile); - case 216: + case 217: return isCompletedNode(n.block, sourceFile); case 159: case 136: @@ -26471,9 +31382,15 @@ var ts; return isCompletedNode(n.expression, sourceFile); case 151: return nodeEndsWith(n, 19, sourceFile); - case 213: case 214: + case 215: return false; + case 181: + return isCompletedNode(n.statement, sourceFile); + case 182: + return isCompletedNode(n.statement, sourceFile); + case 183: + return isCompletedNode(n.statement, sourceFile); case 180: return isCompletedNode(n.statement, sourceFile); case 179: @@ -26572,7 +31489,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(221, nodes.pos, nodes.end, 1024, this); + var list = createNode(222, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; for (var i = 0, len = nodes.length; i < len; i++) { @@ -26741,10 +31658,7 @@ var ts; return pos; } function isName(pos, end, sourceFile, name) { - return pos + name.length < end && - sourceFile.text.substr(pos, name.length) === name && - (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || - ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); + return pos + name.length < end && sourceFile.text.substr(pos, name.length) === name && (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); } function isParamTag(pos, end, sourceFile) { return isName(pos, end, sourceFile, paramTag); @@ -26960,7 +31874,9 @@ var ts; }; SignatureObject.prototype.getDocumentationComment = function () { if (this.documentationComment === undefined) { - this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration], undefined, false) : []; + this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([ + this.declaration + ], undefined, false) : []; } return this.documentationComment; }; @@ -26994,9 +31910,7 @@ var ts; case 131: var functionDeclaration = node; if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) { - var lastDeclaration = namedDeclarations.length > 0 ? - namedDeclarations[namedDeclarations.length - 1] : - undefined; + var lastDeclaration = namedDeclarations.length > 0 ? namedDeclarations[namedDeclarations.length - 1] : undefined; if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) { if (functionDeclaration.body && !lastDeclaration.body) { namedDeclarations[namedDeclarations.length - 1] = functionDeclaration; @@ -27013,12 +31927,12 @@ var ts; case 198: case 199: case 200: - case 202: - case 211: - case 207: - case 202: - case 204: + case 203: + case 212: + case 208: + case 203: case 205: + case 206: case 134: case 135: case 143: @@ -27048,24 +31962,24 @@ var ts; ts.forEachChild(node.name, visit); break; } - case 219: + case 220: case 130: case 129: namedDeclarations.push(node); break; - case 209: + case 210: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 203: + case 204: var importClause = node.importClause; if (importClause) { if (importClause.name) { namedDeclarations.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 205) { + if (importClause.namedBindings.kind === 206) { namedDeclarations.push(importClause.namedBindings); } else { @@ -27194,7 +32108,9 @@ var ts; ts.ClassificationTypeNames = ClassificationTypeNames; function displayPartsToString(displayParts) { if (displayParts) { - return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(""); + return ts.map(displayParts, function (displayPart) { + return displayPart.text; + }).join(""); } return ""; } @@ -27211,7 +32127,7 @@ var ts; return false; } for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { - if (parent.kind === 220 || parent.kind === 201) { + if (parent.kind === 221 || parent.kind === 201) { return false; } } @@ -27371,7 +32287,9 @@ var ts; return bucket; } function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === '_'; }).map(function (name) { + var bucketInfoArray = Object.keys(buckets).filter(function (name) { + return name && name.charAt(0) === '_'; + }).map(function (name) { var entries = ts.lookUp(buckets, name); var sourceFiles = []; for (var i in entries) { @@ -27382,7 +32300,9 @@ var ts; references: entry.owners.slice(0) }); } - sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); + sourceFiles.sort(function (x, y) { + return y.refCount - x.refCount; + }); return { bucket: name, sourceFiles: sourceFiles @@ -27571,7 +32491,11 @@ var ts; processImport(); } processTripleSlashDirectives(); - return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib }; + return { + referencedFiles: referencedFiles, + importedFiles: importedFiles, + isLibFile: isNoDefaultLib + }; } ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { @@ -27584,14 +32508,10 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 64 && - (node.parent.kind === 185 || node.parent.kind === 184) && - node.parent.label === node; + return node.kind === 64 && (node.parent.kind === 185 || node.parent.kind === 184) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 64 && - node.parent.kind === 189 && - node.parent.label === node; + return node.kind === 64 && node.parent.kind === 189 && node.parent.label === node; } function isLabeledBy(node, labelName) { for (var owner = node.parent; owner.kind === 189; owner = owner.parent) { @@ -27626,20 +32546,18 @@ var ts; return node.parent.kind === 200 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 64 && - ts.isFunctionLike(node.parent) && node.parent.name === node; + return node.kind === 64 && ts.isFunctionLike(node.parent) && node.parent.name === node; } function isNameOfPropertyAssignment(node) { - return (node.kind === 64 || node.kind === 8 || node.kind === 7) && - (node.parent.kind === 217 || node.parent.kind === 218) && node.parent.name === node; + return (node.kind === 64 || node.kind === 8 || node.kind === 7) && (node.parent.kind === 218 || node.parent.kind === 219) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 || node.kind === 7) { switch (node.parent.kind) { case 130: case 129: - case 217: - case 219: + case 218: + case 220: case 132: case 131: case 134: @@ -27654,15 +32572,12 @@ var ts; } function isNameOfExternalModuleImportOrDeclaration(node) { if (node.kind === 8) { - return isNameOfModuleDeclaration(node) || - (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); + return isNameOfModuleDeclaration(node) || (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); } return false; } function isInsideComment(sourceFile, token, position) { - return position <= token.getStart(sourceFile) && - (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || - isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); + return position <= token.getStart(sourceFile) && (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); function isInsideCommentRange(comments) { return ts.forEach(comments, function (comment) { if (comment.pos < position && position < comment.end) { @@ -27675,8 +32590,7 @@ var ts; return true; } else { - return !(text.charCodeAt(comment.end - 1) === 47 && - text.charCodeAt(comment.end - 2) === 42); + return !(text.charCodeAt(comment.end - 1) === 47 && text.charCodeAt(comment.end - 2) === 42); } } return false; @@ -27698,7 +32612,7 @@ var ts; return undefined; } switch (node.kind) { - case 220: + case 221: case 132: case 131: case 195: @@ -27716,38 +32630,49 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 200: return ScriptElementKind.moduleElement; - case 196: return ScriptElementKind.classElement; - case 197: return ScriptElementKind.interfaceElement; - case 198: return ScriptElementKind.typeElement; - case 199: return ScriptElementKind.enumElement; + case 200: + return ScriptElementKind.moduleElement; + case 196: + return ScriptElementKind.classElement; + case 197: + return ScriptElementKind.interfaceElement; + case 198: + return ScriptElementKind.typeElement; + case 199: + return ScriptElementKind.enumElement; case 193: - return ts.isConst(node) - ? ScriptElementKind.constElement - : ts.isLet(node) - ? ScriptElementKind.letElement - : ScriptElementKind.variableElement; - case 195: return ScriptElementKind.functionElement; - case 134: return ScriptElementKind.memberGetAccessorElement; - case 135: return ScriptElementKind.memberSetAccessorElement; + return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; + case 195: + return ScriptElementKind.functionElement; + case 134: + return ScriptElementKind.memberGetAccessorElement; + case 135: + return ScriptElementKind.memberSetAccessorElement; case 132: case 131: return ScriptElementKind.memberFunctionElement; case 130: case 129: return ScriptElementKind.memberVariableElement; - case 138: return ScriptElementKind.indexSignatureElement; - case 137: return ScriptElementKind.constructSignatureElement; - case 136: return ScriptElementKind.callSignatureElement; - case 133: return ScriptElementKind.constructorImplementationElement; - case 127: return ScriptElementKind.typeParameterElement; - case 219: return ScriptElementKind.variableElement; - case 128: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 202: - case 207: - case 204: - case 211: + case 138: + return ScriptElementKind.indexSignatureElement; + case 137: + return ScriptElementKind.constructSignatureElement; + case 136: + return ScriptElementKind.callSignatureElement; + case 133: + return ScriptElementKind.constructorImplementationElement; + case 127: + return ScriptElementKind.typeParameterElement; + case 220: + return ScriptElementKind.variableElement; + case 128: + return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 203: + case 208: case 205: + case 212: + case 206: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -27798,13 +32723,26 @@ var ts; var changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { getSourceFile: getOrCreateSourceFile, - getCancellationToken: function () { return cancellationToken; }, - getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); }, - useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, - getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, - getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, - writeFile: function (fileName, data, writeByteOrderMark) { }, - getCurrentDirectory: function () { return host.getCurrentDirectory(); } + getCancellationToken: function () { + return cancellationToken; + }, + getCanonicalFileName: function (fileName) { + return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); + }, + useCaseSensitiveFileNames: function () { + return useCaseSensitivefileNames; + }, + getNewLine: function () { + return host.getNewLine ? host.getNewLine() : "\r\n"; + }, + getDefaultLibFileName: function (options) { + return host.getDefaultLibFileName(options); + }, + writeFile: function (fileName, data, writeByteOrderMark) { + }, + getCurrentDirectory: function () { + return host.getCurrentDirectory(); + } }); if (program) { var oldSourceFiles = program.getSourceFiles(); @@ -27891,8 +32829,7 @@ var ts; if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { return undefined; } - if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && - (firstCharCode === 39 || firstCharCode === 34)) { + if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && (firstCharCode === 39 || firstCharCode === 34)) { displayName = displayName.substring(1, displayName.length - 1); } var isValid = ts.isIdentifierStart(displayName.charCodeAt(0), target); @@ -28008,11 +32945,11 @@ var ts; getCompletionEntriesFromSymbols(filteredMembers, activeCompletionSession); } } - else if (ts.getAncestor(previousToken, 204)) { + else if (ts.getAncestor(previousToken, 205)) { isMemberCompletion = true; isNewIdentifierLocation = true; if (showCompletionsInImportsClause(previousToken)) { - var importDeclaration = ts.getAncestor(previousToken, 203); + var importDeclaration = ts.getAncestor(previousToken, 204); ts.Debug.assert(importDeclaration !== undefined); var exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); var filteredExports = filterModuleExports(exports, importDeclaration); @@ -28053,16 +32990,14 @@ var ts; } function isCompletionListBlocker(previousToken) { var start = new Date().getTime(); - var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || - isIdentifierDefinitionLocation(previousToken) || - isRightOfIllegalDot(previousToken); + var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); return result; } function showCompletionsInImportsClause(node) { if (node) { if (node.kind === 14 || node.kind === 23) { - return node.parent.kind === 206; + return node.parent.kind === 207; } } return false; @@ -28072,16 +33007,9 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 155 - || containingNodeKind === 133 - || containingNodeKind === 156 - || containingNodeKind === 151 - || containingNodeKind === 167; + return containingNodeKind === 155 || containingNodeKind === 133 || containingNodeKind === 156 || containingNodeKind === 151 || containingNodeKind === 167; case 16: - return containingNodeKind === 155 - || containingNodeKind === 133 - || containingNodeKind === 156 - || containingNodeKind === 159; + return containingNodeKind === 155 || containingNodeKind === 133 || containingNodeKind === 156 || containingNodeKind === 159; case 18: return containingNodeKind === 151; case 116: @@ -28091,8 +33019,7 @@ var ts; case 14: return containingNodeKind === 196; case 52: - return containingNodeKind === 193 - || containingNodeKind === 167; + return containingNodeKind === 193 || containingNodeKind === 167; case 11: return containingNodeKind === 169; case 12: @@ -28112,9 +33039,7 @@ var ts; return false; } function isInStringOrRegularExpressionOrTemplateLiteral(previousToken) { - if (previousToken.kind === 8 - || previousToken.kind === 9 - || ts.isTemplateLiteralKind(previousToken.kind)) { + if (previousToken.kind === 8 || previousToken.kind === 9 || ts.isTemplateLiteralKind(previousToken.kind)) { var start = previousToken.getStart(); var end = previousToken.getEnd(); if (start < position && position < end) { @@ -28161,43 +33086,23 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 193 || - containingNodeKind === 194 || - containingNodeKind === 175 || - containingNodeKind === 199 || - isFunction(containingNodeKind) || - containingNodeKind === 196 || - containingNodeKind === 195 || - containingNodeKind === 197 || - containingNodeKind === 149 || - containingNodeKind === 148; + return containingNodeKind === 193 || containingNodeKind === 194 || containingNodeKind === 175 || containingNodeKind === 199 || isFunction(containingNodeKind) || containingNodeKind === 196 || containingNodeKind === 195 || containingNodeKind === 197 || containingNodeKind === 149 || containingNodeKind === 148; case 20: return containingNodeKind === 149; case 18: return containingNodeKind === 149; case 16: - return containingNodeKind === 216 || - isFunction(containingNodeKind); + return containingNodeKind === 217 || isFunction(containingNodeKind); case 14: - return containingNodeKind === 199 || - containingNodeKind === 197 || - containingNodeKind === 143 || - containingNodeKind === 148; + return containingNodeKind === 199 || containingNodeKind === 197 || containingNodeKind === 143 || containingNodeKind === 148; case 22: - return containingNodeKind === 129 && - (previousToken.parent.parent.kind === 197 || - previousToken.parent.parent.kind === 143); + return containingNodeKind === 129 && (previousToken.parent.parent.kind === 197 || previousToken.parent.parent.kind === 143); case 24: - return containingNodeKind === 196 || - containingNodeKind === 195 || - containingNodeKind === 197 || - isFunction(containingNodeKind); + return containingNodeKind === 196 || containingNodeKind === 195 || containingNodeKind === 197 || isFunction(containingNodeKind); case 109: return containingNodeKind === 130; case 21: - return containingNodeKind === 128 || - containingNodeKind === 133 || - (previousToken.parent.parent.kind === 149); + return containingNodeKind === 128 || containingNodeKind === 133 || (previousToken.parent.parent.kind === 149); case 108: case 106: case 107: @@ -28242,8 +33147,7 @@ var ts; if (!importDeclaration.importClause) { return exports; } - if (importDeclaration.importClause.namedBindings && - importDeclaration.importClause.namedBindings.kind === 206) { + if (importDeclaration.importClause.namedBindings && importDeclaration.importClause.namedBindings.kind === 207) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { var name = el.propertyName || el.name; exisingImports[name.text] = true; @@ -28252,7 +33156,9 @@ var ts; if (ts.isEmpty(exisingImports)) { return exports; } - return ts.filter(exports, function (e) { return !ts.lookUp(exisingImports, e.name); }); + return ts.filter(exports, function (e) { + return !ts.lookUp(exisingImports, e.name); + }); } function filterContextualMembersList(contextualMemberSymbols, existingMembers) { if (!existingMembers || existingMembers.length === 0) { @@ -28260,7 +33166,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 217 && m.kind !== 218) { + if (m.kind !== 218 && m.kind !== 219) { return; } if (m.getStart() <= position && position <= m.getEnd()) { @@ -28302,7 +33208,9 @@ var ts; name: entryName, kind: ScriptElementKind.keyword, kindModifiers: ScriptElementKindModifier.none, - displayParts: [ts.displayPart(entryName, 5)], + displayParts: [ + ts.displayPart(entryName, 5) + ], documentation: undefined }; } @@ -28400,9 +33308,7 @@ var ts; return ScriptElementKind.unknown; } function getSymbolModifiers(symbol) { - return symbol && symbol.declarations && symbol.declarations.length > 0 - ? ts.getNodeModifiers(symbol.declarations[0]) - : ScriptElementKindModifier.none; + return symbol && symbol.declarations && symbol.declarations.length > 0 ? ts.getNodeModifiers(symbol.declarations[0]) : ScriptElementKindModifier.none; } function getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, enclosingDeclaration, typeResolver, location, semanticMeaning) { if (semanticMeaning === void 0) { semanticMeaning = getMeaningFromLocation(location); } @@ -28485,8 +33391,7 @@ var ts; hasAddedSymbolInfo = true; } } - else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || - (location.kind === 113 && location.parent.kind === 133)) { + else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || (location.kind === 113 && location.parent.kind === 133)) { var signature; var functionDeclaration = location.parent; var allSignatures = functionDeclaration.kind === 133 ? type.getConstructSignatures() : type.getCallSignatures(); @@ -28501,8 +33406,7 @@ var ts; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 136 && - !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 136 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); hasAddedSymbolInfo = true; @@ -28578,7 +33482,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 219) { + if (declaration.kind === 220) { var constantValue = typeResolver.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -28594,7 +33498,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 202) { + if (declaration.kind === 203) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -28622,9 +33526,7 @@ var ts; if (symbolKind !== ScriptElementKind.unknown) { if (type) { addPrefixForAnyFunctionOrVar(symbol, symbolKind); - if (symbolKind === ScriptElementKind.memberVariableElement || - symbolFlags & 3 || - symbolKind === ScriptElementKind.localVariableElement) { + if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 || symbolKind === ScriptElementKind.localVariableElement) { displayParts.push(ts.punctuationPart(51)); displayParts.push(ts.spacePart()); if (type.symbol && type.symbol.flags & 262144) { @@ -28637,12 +33539,7 @@ var ts; displayParts.push.apply(displayParts, ts.typeToDisplayParts(typeResolver, type, enclosingDeclaration)); } } - else if (symbolFlags & 16 || - symbolFlags & 8192 || - symbolFlags & 16384 || - symbolFlags & 131072 || - symbolFlags & 98304 || - symbolKind === ScriptElementKind.memberFunctionElement) { + else if (symbolFlags & 16 || symbolFlags & 8192 || symbolFlags & 16384 || symbolFlags & 131072 || symbolFlags & 98304 || symbolKind === ScriptElementKind.memberFunctionElement) { var allSignatures = type.getCallSignatures(); addSignatureDisplayParts(allSignatures[0], allSignatures); } @@ -28655,7 +33552,11 @@ var ts; if (!documentation) { documentation = symbol.getDocumentationComment(); } - return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; + return { + displayParts: displayParts, + documentation: documentation, + symbolKind: symbolKind + }; function addNewLineIfDisplayPartsExist() { if (displayParts.length) { displayParts.push(ts.lineBreakPart()); @@ -28742,20 +33643,26 @@ var ts; if (isJumpStatementTarget(node)) { var labelName = node.text; var label = getTargetLabel(node.parent, node.text); - return label ? [getDefinitionInfo(label, ScriptElementKind.label, labelName, undefined)] : undefined; + return label ? [ + getDefinitionInfo(label, ScriptElementKind.label, labelName, undefined) + ] : undefined; } - var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); + var comment = ts.forEach(sourceFile.referencedFiles, function (r) { + return (r.pos <= position && position < r.end) ? r : undefined; + }); if (comment) { var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); if (referenceFile) { - return [{ + return [ + { fileName: referenceFile.fileName, textSpan: ts.createTextSpanFromBounds(0, 0), kind: ScriptElementKind.scriptElement, name: comment.fileName, containerName: undefined, containerKind: undefined - }]; + } + ]; } return undefined; } @@ -28770,7 +33677,7 @@ var ts; } } var result = []; - if (node.parent.kind === 218) { + if (node.parent.kind === 219) { var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); var shorthandDeclarations = shorthandSymbol.getDeclarations(); var shorthandSymbolKind = getSymbolKind(shorthandSymbol, typeInfoResolver, node); @@ -28786,8 +33693,7 @@ var ts; var symbolKind = getSymbolKind(symbol, typeInfoResolver, node); var containerSymbol = symbol.parent; var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : ""; - if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && - !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { + if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { ts.forEach(declarations, function (declaration) { result.push(getDefinitionInfo(declaration, symbolKind, symbolName, containerName)); }); @@ -28807,8 +33713,7 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 133) || - (!selectConstructors && (d.kind === 195 || d.kind === 132 || d.kind === 131))) { + if ((selectConstructors && d.kind === 133) || (!selectConstructors && (d.kind === 195 || d.kind === 132 || d.kind === 131))) { declarations.push(d); if (d.body) definition = d; @@ -28848,9 +33753,10 @@ var ts; if (!node) { return undefined; } - if (node.kind === 64 || node.kind === 92 || node.kind === 90 || - isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { - return getReferencesForNode(node, [sourceFile], true, false, false); + if (node.kind === 64 || node.kind === 92 || node.kind === 90 || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + return getReferencesForNode(node, [ + sourceFile + ], true, false, false); } switch (node.kind) { case 83: @@ -28887,8 +33793,8 @@ var ts; break; case 66: case 72: - if (hasKind(parent(parent(node)), 188)) { - return getSwitchCaseDefaultOccurrences(node.parent.parent); + if (hasKind(parent(parent(parent(node))), 188)) { + return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 65: @@ -28898,9 +33804,7 @@ var ts; } break; case 81: - if (hasKind(node.parent, 181) || - hasKind(node.parent, 182) || - hasKind(node.parent, 183)) { + if (hasKind(node.parent, 181) || hasKind(node.parent, 182) || hasKind(node.parent, 183)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -28921,8 +33825,7 @@ var ts; return getGetAndSetOccurrences(node.parent); } default: - if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 175)) { + if (ts.isModifier(node.kind) && node.parent && (ts.isDeclaration(node.parent) || node.parent.kind === 175)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -29031,7 +33934,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 220) { + if (ts.isFunctionBlock(parent) || parent.kind === 221) { return parent; } if (parent.kind === 191) { @@ -29079,7 +33982,7 @@ var ts; function getSwitchCaseDefaultOccurrences(switchStatement) { var keywords = []; pushKeywordIf(keywords, switchStatement.getFirstToken(), 91); - ts.forEach(switchStatement.clauses, function (clause) { + ts.forEach(switchStatement.caseBlock.clauses, function (clause) { pushKeywordIf(keywords, clause.getFirstToken(), 66, 72); var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); ts.forEach(breaksAndContinues, function (statement) { @@ -29167,15 +34070,16 @@ var ts; function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 115, 119); }); + ts.forEach(accessor.getChildren(), function (child) { + return pushKeywordIf(keywords, child, 115, 119); + }); } } } function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (declaration.flags & 112) { - if (!(container.kind === 196 || - (declaration.kind === 128 && hasKind(container, 133)))) { + if (!(container.kind === 196 || (declaration.kind === 128 && hasKind(container, 133)))) { return undefined; } } @@ -29185,7 +34089,7 @@ var ts; } } else if (declaration.flags & (1 | 2)) { - if (!(container.kind === 201 || container.kind === 220)) { + if (!(container.kind === 201 || container.kind === 221)) { return undefined; } } @@ -29197,7 +34101,7 @@ var ts; var nodes; switch (container.kind) { case 201: - case 220: + case 221: nodes = container.statements; break; case 133: @@ -29219,7 +34123,9 @@ var ts; } ts.forEach(nodes, function (node) { if (node.modifiers && node.flags & modifierFlag) { - ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); + ts.forEach(node.modifiers, function (child) { + return pushKeywordIf(keywords, child, modifier); + }); } }); return ts.map(keywords, getReferenceEntryFromNode); @@ -29273,9 +34179,7 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 64 && - !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && - !isNameOfExternalModuleImportOrDeclaration(node)) { + if (node.kind !== 64 && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } ts.Debug.assert(node.kind === 64 || node.kind === 7 || node.kind === 8); @@ -29285,7 +34189,9 @@ var ts; if (isLabelName(node)) { if (isJumpStatementTarget(node)) { var labelDefinition = getTargetLabel(node.parent, node.text); - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [getReferenceEntryFromNode(node)]; + return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [ + getReferenceEntryFromNode(node) + ]; } else { return getLabelReferencesInNode(node.parent, node); @@ -29299,7 +34205,9 @@ var ts; } var symbol = typeInfoResolver.getSymbolAtLocation(node); if (!symbol) { - return [getReferenceEntryFromNode(node)]; + return [ + getReferenceEntryFromNode(node) + ]; } var declarations = symbol.declarations; if (!declarations || !declarations.length) { @@ -29333,17 +34241,17 @@ var ts; } return result; function isImportOrExportSpecifierName(location) { - return location.parent && - (location.parent.kind === 207 || location.parent.kind === 211) && - location.parent.propertyName === location; + return location.parent && (location.parent.kind === 208 || location.parent.kind === 212) && location.parent.propertyName === location; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 207 || declaration.kind === 211; + return declaration.kind === 208 || declaration.kind === 212; }); } function getDeclaredName(symbol, location) { - var functionExpression = ts.forEach(symbol.declarations, function (d) { return d.kind === 160 ? d : undefined; }); + var functionExpression = ts.forEach(symbol.declarations, function (d) { + return d.kind === 160 ? d : undefined; + }); if (functionExpression && functionExpression.name) { var name = functionExpression.name.text; } @@ -29357,7 +34265,9 @@ var ts; if (isImportOrExportSpecifierName(location)) { return location.getText(); } - var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 160 ? d : undefined; }); + var functionExpression = ts.forEach(declarations, function (d) { + return d.kind === 160 ? d : undefined; + }); if (functionExpression && functionExpression.name) { var name = functionExpression.name.text; } @@ -29376,7 +34286,9 @@ var ts; } function getSymbolScope(symbol) { if (symbol.flags & (4 | 8192)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { + return (d.flags & 32) ? d : undefined; + }); if (privateDeclaration) { return ts.getAncestor(privateDeclaration, 196); } @@ -29398,7 +34310,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 220 && !ts.isExternalModule(container)) { + if (container.kind === 221 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -29420,8 +34332,7 @@ var ts; if (position > end) break; var endPosition = position + symbolNameLength; - if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && - (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { positions.push(position); } position = text.indexOf(symbolName, position + symbolNameLength + 1); @@ -29439,8 +34350,7 @@ var ts; if (!node || node.getWidth() !== labelName.length) { return; } - if (node === targetLabel || - (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { + if (node === targetLabel || (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { result.push(getReferenceEntryFromNode(node)); } }); @@ -29452,8 +34362,7 @@ var ts; case 64: return node.getWidth() === searchSymbolName.length; case 8: - if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { return node.getWidth() === searchSymbolName.length + 2; } break; @@ -29476,8 +34385,7 @@ var ts; cancellationToken.throwIfCancellationRequested(); var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); if (!isValidReferencePosition(referenceLocation, searchText)) { - if ((findInStrings && isInString(position)) || - (findInComments && isInComment(position))) { + if ((findInStrings && isInString(position)) || (findInComments && isInComment(position))) { result.push({ fileName: sourceFile.fileName, textSpan: ts.createTextSpan(position, searchText.length), @@ -29575,7 +34483,7 @@ var ts; staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 220: + case 221: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } @@ -29586,7 +34494,7 @@ var ts; return undefined; } var result = []; - if (searchSpaceNode.kind === 220) { + if (searchSpaceNode.kind === 221) { ts.forEach(sourceFiles, function (sourceFile) { var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, result); @@ -29624,8 +34532,8 @@ var ts; result.push(getReferenceEntryFromNode(node)); } break; - case 220: - if (container.kind === 220 && !ts.isExternalModule(container)) { + case 221: + if (container.kind === 221 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -29634,7 +34542,9 @@ var ts; } } function populateSearchSymbolSet(symbol, location) { - var result = [symbol]; + var result = [ + symbol + ]; if (isImportOrExportSpecifierImportSymbol(symbol)) { result.push(typeInfoResolver.getAliasedSymbol(symbol)); } @@ -29687,13 +34597,14 @@ var ts; if (searchSymbols.indexOf(referenceSymbol) >= 0) { return true; } - if (isImportOrExportSpecifierImportSymbol(referenceSymbol) && - searchSymbols.indexOf(typeInfoResolver.getAliasedSymbol(referenceSymbol)) >= 0) { + if (isImportOrExportSpecifierImportSymbol(referenceSymbol) && searchSymbols.indexOf(typeInfoResolver.getAliasedSymbol(referenceSymbol)) >= 0) { return true; } if (isNameOfPropertyAssignment(referenceLocation)) { return ts.forEach(getPropertySymbolsFromContextualType(referenceLocation), function (contextualSymbol) { - return ts.forEach(typeInfoResolver.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0; }); + return ts.forEach(typeInfoResolver.getRootSymbols(contextualSymbol), function (s) { + return searchSymbols.indexOf(s) >= 0; + }); }); } return ts.forEach(typeInfoResolver.getRootSymbols(referenceSymbol), function (rootSymbol) { @@ -29703,7 +34614,9 @@ var ts; if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { var result = []; getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); - return ts.forEach(result, function (s) { return searchSymbols.indexOf(s) >= 0; }); + return ts.forEach(result, function (s) { + return searchSymbols.indexOf(s) >= 0; + }); } return false; }); @@ -29717,7 +34630,9 @@ var ts; if (contextualType.flags & 16384) { var unionProperty = contextualType.getProperty(name); if (unionProperty) { - return [unionProperty]; + return [ + unionProperty + ]; } else { var result = []; @@ -29733,7 +34648,9 @@ var ts; else { var symbol = contextualType.getProperty(name); if (symbol) { - return [symbol]; + return [ + symbol + ]; } } } @@ -29789,7 +34706,9 @@ var ts; return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); } function containErrors(diagnostics) { - return ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1; }); + return ts.forEach(diagnostics, function (diagnostic) { + return diagnostic.category === 1; + }); } function getEmitOutput(fileName) { synchronizeHostData(); @@ -29815,9 +34734,9 @@ var ts; case 150: case 130: case 129: - case 217: case 218: case 219: + case 220: case 132: case 131: case 133: @@ -29826,7 +34745,7 @@ var ts; case 195: case 160: case 161: - case 216: + case 217: return 1; case 127: case 197: @@ -29846,14 +34765,14 @@ var ts; else { return 4; } - case 206: case 207: - case 202: - case 203: case 208: + case 203: + case 204: case 209: + case 210: return 1 | 2 | 4; - case 220: + case 221: return 4 | 1; } return 1 | 2 | 4; @@ -29883,15 +34802,13 @@ var ts; } function getMeaningFromRightHandSideOfImportEquals(node) { ts.Debug.assert(node.kind === 64); - if (node.parent.kind === 125 && - node.parent.right === node && - node.parent.parent.kind === 202) { + if (node.parent.kind === 125 && node.parent.right === node && node.parent.parent.kind === 203) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 208) { + if (node.parent.kind === 209) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -29944,8 +34861,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 200 && - nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + if (nodeForStartPos.parent.parent.kind === 200 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } else { @@ -29992,8 +34908,7 @@ var ts; } } else if (flags & 1536) { - if (meaningAtPosition & 4 || - (meaningAtPosition & 1 && hasValueSideModule(symbol))) { + if (meaningAtPosition & 4 || (meaningAtPosition & 1 && hasValueSideModule(symbol))) { return ClassificationTypeNames.moduleName; } } @@ -30118,16 +35033,11 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 52) { - if (token.parent.kind === 193 || - token.parent.kind === 130 || - token.parent.kind === 128) { + if (token.parent.kind === 193 || token.parent.kind === 130 || token.parent.kind === 128) { return ClassificationTypeNames.operator; } } - if (token.parent.kind === 167 || - token.parent.kind === 165 || - token.parent.kind === 166 || - token.parent.kind === 168) { + if (token.parent.kind === 167 || token.parent.kind === 165 || token.parent.kind === 166 || token.parent.kind === 168) { return ClassificationTypeNames.operator; } } @@ -30225,14 +35135,22 @@ var ts; return result; function getMatchingTokenKind(token) { switch (token.kind) { - case 14: return 15; - case 16: return 17; - case 18: return 19; - case 24: return 25; - case 15: return 14; - case 17: return 16; - case 19: return 18; - case 25: return 24; + case 14: + return 15; + case 16: + return 17; + case 18: + return 19; + case 24: + return 25; + case 15: + return 14; + case 17: + return 16; + case 19: + return 18; + case 25: + return 24; } return undefined; } @@ -30313,7 +35231,9 @@ var ts; var multiLineCommentStart = /(?:\/\*+\s*)/.source; var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; - var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; + var literals = "(?:" + ts.map(descriptors, function (d) { + return "(" + escapeRegExp(d.text) + ")"; + }).join("|") + ")"; var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; var messageRemainder = /(?:.*?)/.source; var messagePortion = "(" + literals + messageRemainder + ")"; @@ -30321,9 +35241,7 @@ var ts; return new RegExp(regExpString, "gim"); } function isLetterOrDigit(char) { - return (char >= 97 && char <= 122) || - (char >= 65 && char <= 90) || - (char >= 48 && char <= 57); + return (char >= 97 && char <= 122) || (char >= 65 && char <= 90) || (char >= 48 && char <= 57); } } function getRenameInfo(fileName, position) { @@ -30424,9 +35342,7 @@ var ts; break; case 8: case 7: - if (ts.isDeclarationName(node) || - node.parent.kind === 212 || - isArgumentOfElementAccessExpression(node)) { + if (ts.isDeclarationName(node) || node.parent.kind === 213 || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } break; @@ -30436,10 +35352,7 @@ var ts; } } function isArgumentOfElementAccessExpression(node) { - return node && - node.parent && - node.parent.kind === 154 && - node.parent.argumentExpression === node; + return node && node.parent && node.parent.kind === 154 && node.parent.argumentExpression === node; } function createClassifier() { var scanner = ts.createScanner(2, false); @@ -30468,10 +35381,7 @@ var ts; } function canFollow(keyword1, keyword2) { if (isAccessibilityModifier(keyword1)) { - if (keyword2 === 115 || - keyword2 === 119 || - keyword2 === 113 || - keyword2 === 109) { + if (keyword2 === 115 || keyword2 === 119 || keyword2 === 113 || keyword2 === 109) { return true; } return false; @@ -30529,18 +35439,13 @@ var ts; else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { token = 64; } - else if (lastNonTriviaToken === 64 && - token === 24) { + else if (lastNonTriviaToken === 64 && token === 24) { angleBracketStack++; } else if (token === 25 && angleBracketStack > 0) { angleBracketStack--; } - else if (token === 111 || - token === 120 || - token === 118 || - token === 112 || - token === 121) { + else if (token === 111 || token === 120 || token === 118 || token === 112 || token === 121) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { token = 64; } @@ -30591,9 +35496,7 @@ var ts; } if (numBackslashes & 1) { var quoteChar = tokenText.charCodeAt(0); - result.finalLexState = quoteChar === 34 - ? 3 - : 2; + result.finalLexState = quoteChar === 34 ? 3 : 2; } } } @@ -30625,7 +35528,10 @@ var ts; if (result.entries.length === 0) { length -= offset; } - result.entries.push({ length: length, classification: classification }); + result.entries.push({ + length: length, + classification: classification + }); } } } @@ -30720,7 +35626,9 @@ var ts; return 5; } } - return { getClassificationsForLine: getClassificationsForLine }; + return { + getClassificationsForLine: getClassificationsForLine + }; } ts.createClassifier = createClassifier; function getDefaultLibFilePath(options) { @@ -30735,7 +35643,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 220 ? new SourceFileObject() : new NodeObject(); + var proto = kind === 221 ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; @@ -30744,9 +35652,15 @@ var ts; Node.prototype = proto; return Node; }, - getSymbolConstructor: function () { return SymbolObject; }, - getTypeConstructor: function () { return TypeObject; }, - getSignatureConstructor: function () { return SignatureObject; } + getSymbolConstructor: function () { + return SymbolObject; + }, + getTypeConstructor: function () { + return TypeObject; + }, + getSignatureConstructor: function () { + return SignatureObject; + } }; } initializeServices(); @@ -30827,7 +35741,9 @@ var ts; return this.compilationSettings; }; LSHost.prototype.getScriptFileNames = function () { - return this.roots.map(function (root) { return root.fileName; }); + return this.roots.map(function (root) { + return root.fileName; + }); }; LSHost.prototype.getScriptVersion = function (filename) { return this.getScriptInfo(filename).svc.latestVersion().toString(); @@ -30920,7 +35836,10 @@ var ts; var script = this.filenameToScript[filename]; var index = script.snap().index; var lineCol = index.charOffsetToLineNumberAndPos(position); - return { line: lineCol.line, col: lineCol.col + 1 }; + return { + line: lineCol.line, + col: lineCol.col + 1 + }; }; return LSHost; })(); @@ -30998,7 +35917,9 @@ var ts; }; Project.prototype.filesToString = function () { var strBuilder = ""; - ts.forEachValue(this.filenameToSourceFile, function (sourceFile) { strBuilder += sourceFile.fileName + "\n"; }); + ts.forEachValue(this.filenameToSourceFile, function (sourceFile) { + strBuilder += sourceFile.fileName + "\n"; + }); return strBuilder; }; Project.prototype.setProjectOptions = function (projectOptions) { @@ -31095,8 +36016,7 @@ var ts; for (var i = 0, len = this.openFileRoots.length; i < len; i++) { var r = this.openFileRoots[i]; if (info.defaultProject.getSourceFile(r)) { - this.inferredProjects = - copyListRemovingItem(r.defaultProject, this.inferredProjects); + this.inferredProjects = copyListRemovingItem(r.defaultProject, this.inferredProjects); this.openFilesReferenced.push(r); r.defaultProject = info.defaultProject; } @@ -31218,7 +36138,9 @@ var ts; info = new ScriptInfo(this.host, fileName, content, openedByClient); this.filenameToScriptInfo[fileName] = info; if (!info.isOpen) { - info.fileWatcher = this.host.watchFile(fileName, function (_) { _this.watchedFileChanged(fileName); }); + info.fileWatcher = this.host.watchFile(fileName, function (_) { + _this.watchedFileChanged(fileName); + }); } } } @@ -31300,12 +36222,16 @@ var ts; var dirPath = ts.getDirectoryPath(configFilename); var rawConfig = ts.readConfigFile(configFilename); if (!rawConfig) { - return { errorMsg: "tsconfig syntax error" }; + return { + errorMsg: "tsconfig syntax error" + }; } else { var parsedCommandLine = ts.parseConfigFile(rawConfig); if (parsedCommandLine.errors) { - return { errorMsg: "tsconfig option errors" }; + return { + errorMsg: "tsconfig option errors" + }; } else if (parsedCommandLine.fileNames) { var proj = this.createProject(configFilename); @@ -31318,7 +36244,9 @@ var ts; proj.addRoot(info); } else { - return { errorMsg: "specified file " + rootFilename + " not found" }; + return { + errorMsg: "specified file " + rootFilename + " not found" + }; } } var projectOptions = { @@ -31329,10 +36257,15 @@ var ts; projectOptions.formatCodeOptions = rawConfig.formatCodeOptions; } proj.setProjectOptions(projectOptions); - return { success: true, project: proj }; + return { + success: true, + project: proj + }; } else { - return { errorMsg: "no files found" }; + return { + errorMsg: "no files found" + }; } } }; @@ -31409,8 +36342,12 @@ var ts; this.trailingText = ""; this.suppressTrailingText = false; this.lineIndex.root = new LineNode(); - this.startPath = [this.lineIndex.root]; - this.stack = [this.lineIndex.root]; + this.startPath = [ + this.lineIndex.root + ]; + this.stack = [ + this.lineIndex.root + ]; } EditWalker.prototype.insertLines = function (insertedText) { if (this.suppressTrailingText) { @@ -31602,9 +36539,7 @@ var ts; } ScriptVersionCache.prototype.edit = function (pos, deleteLen, insertedText) { this.changes[this.changes.length] = new TextChange(pos, deleteLen, insertedText); - if ((this.changes.length > ScriptVersionCache.changeNumberThreshold) || - (deleteLen > ScriptVersionCache.changeLengthThreshold) || - (insertedText && (insertedText.length > ScriptVersionCache.changeLengthThreshold))) { + if ((this.changes.length > ScriptVersionCache.changeNumberThreshold) || (deleteLen > ScriptVersionCache.changeLengthThreshold) || (insertedText && (insertedText.length > ScriptVersionCache.changeLengthThreshold))) { this.getSnapshot(); } }; @@ -31650,6 +36585,13 @@ var ts; this.currentVersion = snap.version; this.versions[snap.version] = snap; this.changes = []; + if ((this.currentVersion - this.minVersion) >= ScriptVersionCache.maxVersions) { + var oldMin = this.minVersion; + this.minVersion = (this.currentVersion - ScriptVersionCache.maxVersions) + 1; + for (var j = oldMin; j < this.minVersion; j++) { + this.versions[j] = undefined; + } + } } return snap; }; @@ -31685,6 +36627,7 @@ var ts; }; ScriptVersionCache.changeNumberThreshold = 8; ScriptVersionCache.changeLengthThreshold = 256; + ScriptVersionCache.maxVersions = 8; return ScriptVersionCache; })(); server.ScriptVersionCache = ScriptVersionCache; @@ -31701,7 +36644,9 @@ var ts; return this.index.root.charCount(); }; LineIndexSnapshot.prototype.getLineStartPositions = function () { - var starts = [-1]; + var starts = [ + -1 + ]; var count = 1; var pos = 0; this.index.every(function (ll, s, len) { @@ -31880,7 +36825,10 @@ var ts; LineIndex.linesFromText = function (text) { var lineStarts = ts.computeLineStarts(text); if (lineStarts.length == 0) { - return { lines: [], lineMap: lineStarts }; + return { + lines: [], + lineMap: lineStarts + }; } var lines = new Array(lineStarts.length); var lc = lineStarts.length - 1; @@ -31894,7 +36842,10 @@ var ts; else { lines.length--; } - return { lines: lines, lineMap: lineStarts }; + return { + lines: lines, + lineMap: lineStarts + }; }; return LineIndex; })(); @@ -32008,7 +36959,10 @@ var ts; } else { var lineInfo = this.lineNumberToInfo(this.lineCount(), 0); - return { line: this.lineCount(), col: lineInfo.leaf.charCount() }; + return { + line: this.lineCount(), + col: lineInfo.leaf.charCount() + }; } }; LineNode.prototype.lineNumberToInfo = function (lineNumber, charOffset) { @@ -32195,7 +37149,12 @@ var ts; (function (ts) { var server; (function (server) { - var spaceCache = [" ", " ", " ", " "]; + var spaceCache = [ + " ", + " ", + " ", + " " + ]; function generateSpaces(n) { if (!spaceCache[n]) { var strBuilder = ""; @@ -32281,16 +37240,22 @@ var ts; this.fileHash = {}; this.nextFileId = 1; this.changeSeq = 0; - this.projectService = - new server.ProjectService(host, logger, function (eventName, project, fileName) { - _this.handleEvent(eventName, project, fileName); - }); + this.projectService = new server.ProjectService(host, logger, function (eventName, project, fileName) { + _this.handleEvent(eventName, project, fileName); + }); } Session.prototype.handleEvent = function (eventName, project, fileName) { var _this = this; if (eventName == "context") { this.projectService.log("got context event, updating diagnostics for" + fileName, "Info"); - this.updateErrorCheck([{ fileName: fileName, project: project }], this.changeSeq, function (n) { return n == _this.changeSeq; }, 100); + this.updateErrorCheck([ + { + fileName: fileName, + project: project + } + ], this.changeSeq, function (n) { + return n == _this.changeSeq; + }, 100); } }; Session.prototype.logError = function (err, cmd) { @@ -32309,8 +37274,10 @@ var ts; }; Session.prototype.send = function (msg) { var json = JSON.stringify(msg); - this.sendLineToClient('Content-Length: ' + (1 + Buffer.byteLength(json, 'utf8')) + - '\r\n\r\n' + json); + if (this.logger.isVerbose()) { + this.logger.info(msg.type + ": " + json); + } + this.sendLineToClient('Content-Length: ' + (1 + Buffer.byteLength(json, 'utf8')) + '\r\n\r\n' + json); }; Session.prototype.event = function (info, eventName) { var ev = { @@ -32346,8 +37313,13 @@ var ts; try { var diags = project.compilerService.languageService.getSemanticDiagnostics(file); if (diags) { - var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); }); - this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag"); + var bakedDiags = diags.map(function (diag) { + return formatDiag(file, project, diag); + }); + this.event({ + file: file, + diagnostics: bakedDiags + }, "semanticDiag"); } } catch (err) { @@ -32358,8 +37330,13 @@ var ts; try { var diags = project.compilerService.languageService.getSyntacticDiagnostics(file); if (diags) { - var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); }); - this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag"); + var bakedDiags = diags.map(function (diag) { + return formatDiag(file, project, diag); + }); + this.event({ + file: file, + diagnostics: bakedDiags + }, "syntaxDiag"); } } catch (err) { @@ -32428,11 +37405,13 @@ var ts; if (!definitions) { return undefined; } - return definitions.map(function (def) { return ({ - file: def.fileName, - start: compilerService.host.positionToLineCol(def.fileName, def.textSpan.start), - end: compilerService.host.positionToLineCol(def.fileName, ts.textSpanEnd(def.textSpan)) - }); }); + return definitions.map(function (def) { + return ({ + file: def.fileName, + start: compilerService.host.positionToLineCol(def.fileName, def.textSpan.start), + end: compilerService.host.positionToLineCol(def.fileName, ts.textSpanEnd(def.textSpan)) + }); + }); }; Session.prototype.getRenameLocations = function (line, col, fileName, findInComments, findInStrings) { var file = ts.normalizePath(fileName); @@ -32456,11 +37435,13 @@ var ts; if (!renameLocations) { return undefined; } - var bakedRenameLocs = renameLocations.map(function (location) { return ({ - file: location.fileName, - start: compilerService.host.positionToLineCol(location.fileName, location.textSpan.start), - end: compilerService.host.positionToLineCol(location.fileName, ts.textSpanEnd(location.textSpan)) - }); }).sort(function (a, b) { + var bakedRenameLocs = renameLocations.map(function (location) { + return ({ + file: location.fileName, + start: compilerService.host.positionToLineCol(location.fileName, location.textSpan.start), + end: compilerService.host.positionToLineCol(location.fileName, ts.textSpanEnd(location.textSpan)) + }); + }).sort(function (a, b) { if (a.file < b.file) { return -1; } @@ -32487,13 +37468,22 @@ var ts; } } if (!curFileAccum) { - curFileAccum = { file: cur.file, locs: [] }; + curFileAccum = { + file: cur.file, + locs: [] + }; accum.push(curFileAccum); } - curFileAccum.locs.push({ start: cur.start, end: cur.end }); + curFileAccum.locs.push({ + start: cur.start, + end: cur.end + }); return accum; }, []); - return { info: renameInfo, locs: bakedRenameLocs }; + return { + info: renameInfo, + locs: bakedRenameLocs + }; }; Session.prototype.getReferences = function (line, col, fileName) { var file = ts.normalizePath(fileName); @@ -32593,16 +37583,42 @@ var ts; var position = compilerService.host.lineColToPosition(file, line, col); var edits = compilerService.languageService.getFormattingEditsAfterKeystroke(file, position, key, compilerService.formatCodeOptions); if ((key == "\n") && ((!edits) || (edits.length == 0) || allEditsBeforePos(edits, position))) { - var editorOptions = { - IndentSize: 4, - TabSize: 4, - NewLineCharacter: "\n", - ConvertTabsToSpaces: true - }; - var indentPosition = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions); - var spaces = generateSpaces(indentPosition); - if (indentPosition > 0) { - edits.push({ span: ts.createTextSpanFromBounds(position, position), newText: spaces }); + var scriptInfo = compilerService.host.getScriptInfo(file); + if (scriptInfo) { + var lineInfo = scriptInfo.getLineInfo(line); + if (lineInfo && (lineInfo.leaf) && (lineInfo.leaf.text)) { + var lineText = lineInfo.leaf.text; + if (lineText.search("\\S") < 0) { + var editorOptions = { + IndentSize: 4, + TabSize: 4, + NewLineCharacter: "\n", + ConvertTabsToSpaces: true + }; + var indentPosition = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions); + for (var i = 0, len = lineText.length; i < len; i++) { + if (lineText.charAt(i) == " ") { + indentPosition--; + } + else { + break; + } + } + if (indentPosition > 0) { + var spaces = generateSpaces(indentPosition); + edits.push({ + span: ts.createTextSpanFromBounds(position, position), + newText: spaces + }); + } + else if (indentPosition < 0) { + edits.push({ + span: ts.createTextSpanFromBounds(position, position - indentPosition), + newText: "" + }); + } + } + } } } if (!edits) { @@ -32660,12 +37676,17 @@ var ts; fileName = ts.normalizePath(fileName); var project = _this.projectService.getProjectForFile(fileName); if (project) { - accum.push({ fileName: fileName, project: project }); + accum.push({ + fileName: fileName, + project: project + }); } return accum; }, []); if (checkList.length > 0) { - this.updateErrorCheck(checkList, this.changeSeq, function (n) { return n == _this.changeSeq; }, delay); + this.updateErrorCheck(checkList, this.changeSeq, function (n) { + return n == _this.changeSeq; + }, delay); } }; Session.prototype.change = function (line, col, endLine, endCol, insertString, fileName) { @@ -32680,7 +37701,9 @@ var ts; compilerService.host.editScript(file, start, end, insertString); this.changeSeq++; } - this.updateProjectStructure(this.changeSeq, function (n) { return n == _this.changeSeq; }); + this.updateProjectStructure(this.changeSeq, function (n) { + return n == _this.changeSeq; + }); } }; Session.prototype.reload = function (fileName, tempFileName, reqSeq) { @@ -32714,16 +37737,20 @@ var ts; return undefined; } var compilerService = project.compilerService; - return items.map(function (item) { return ({ - text: item.text, - kind: item.kind, - kindModifiers: item.kindModifiers, - spans: item.spans.map(function (span) { return ({ - start: compilerService.host.positionToLineCol(fileName, span.start), - end: compilerService.host.positionToLineCol(fileName, ts.textSpanEnd(span)) - }); }), - childItems: _this.decorateNavigationBarItem(project, fileName, item.childItems) - }); }); + return items.map(function (item) { + return ({ + text: item.text, + kind: item.kind, + kindModifiers: item.kindModifiers, + spans: item.spans.map(function (span) { + return ({ + start: compilerService.host.positionToLineCol(fileName, span.start), + end: compilerService.host.positionToLineCol(fileName, ts.textSpanEnd(span)) + }); + }), + childItems: _this.decorateNavigationBarItem(project, fileName, item.childItems) + }); + }); }; Session.prototype.getNavigationBarItems = function (fileName) { var file = ts.normalizePath(fileName); @@ -32786,113 +37813,148 @@ var ts; if (!spans) { return undefined; } - return spans.map(function (span) { return ({ - start: compilerService.host.positionToLineCol(file, span.start), - end: compilerService.host.positionToLineCol(file, span.start + span.length) - }); }); + return spans.map(function (span) { + return ({ + start: compilerService.host.positionToLineCol(file, span.start), + end: compilerService.host.positionToLineCol(file, span.start + span.length) + }); + }); }; Session.prototype.onMessage = function (message) { + if (this.logger.isVerbose()) { + this.logger.info("request: " + message); + var start = process.hrtime(); + } try { var request = JSON.parse(message); var response; var errorMessage; var responseRequired = true; switch (request.command) { - case CommandNames.Definition: { - var defArgs = request.arguments; - response = this.getDefinition(defArgs.line, defArgs.col, defArgs.file); - break; - } - case CommandNames.References: { - var refArgs = request.arguments; - response = this.getReferences(refArgs.line, refArgs.col, refArgs.file); - break; - } - case CommandNames.Rename: { - var renameArgs = request.arguments; - response = this.getRenameLocations(renameArgs.line, renameArgs.col, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings); - break; - } - case CommandNames.Open: { - var openArgs = request.arguments; - this.openClientFile(openArgs.file); - responseRequired = false; - break; - } - case CommandNames.Quickinfo: { - var quickinfoArgs = request.arguments; - response = this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.col, quickinfoArgs.file); - break; - } - case CommandNames.Format: { - var formatArgs = request.arguments; - response = this.getFormattingEditsForRange(formatArgs.line, formatArgs.col, formatArgs.endLine, formatArgs.endCol, formatArgs.file); - break; - } - case CommandNames.Formatonkey: { - var formatOnKeyArgs = request.arguments; - response = this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.col, formatOnKeyArgs.key, formatOnKeyArgs.file); - break; - } - case CommandNames.Completions: { - var completionsArgs = request.arguments; - response = this.getCompletions(request.arguments.line, request.arguments.col, completionsArgs.prefix, request.arguments.file); - break; - } - case CommandNames.CompletionDetails: { - var completionDetailsArgs = request.arguments; - response = this.getCompletionEntryDetails(request.arguments.line, request.arguments.col, completionDetailsArgs.entryNames, request.arguments.file); - break; - } - case CommandNames.Geterr: { - var geterrArgs = request.arguments; - response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files); - responseRequired = false; - break; - } - case CommandNames.Change: { - var changeArgs = request.arguments; - this.change(changeArgs.line, changeArgs.col, changeArgs.endLine, changeArgs.endCol, changeArgs.insertString, changeArgs.file); - responseRequired = false; - break; - } - case CommandNames.Reload: { - var reloadArgs = request.arguments; - this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq); - break; - } - case CommandNames.Saveto: { - var savetoArgs = request.arguments; - this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); - responseRequired = false; - break; - } - case CommandNames.Close: { - var closeArgs = request.arguments; - this.closeClientFile(closeArgs.file); - responseRequired = false; - break; - } - case CommandNames.Navto: { - var navtoArgs = request.arguments; - response = this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount); - break; - } - case CommandNames.Brace: { - var braceArguments = request.arguments; - response = this.getBraceMatching(braceArguments.line, braceArguments.col, braceArguments.file); - break; - } - case CommandNames.NavBar: { - var navBarArgs = request.arguments; - response = this.getNavigationBarItems(navBarArgs.file); - break; - } - default: { - this.projectService.log("Unrecognized JSON command: " + message); - this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command); - break; + case CommandNames.Definition: + { + var defArgs = request.arguments; + response = this.getDefinition(defArgs.line, defArgs.col, defArgs.file); + break; + } + case CommandNames.References: + { + var refArgs = request.arguments; + response = this.getReferences(refArgs.line, refArgs.col, refArgs.file); + break; + } + case CommandNames.Rename: + { + var renameArgs = request.arguments; + response = this.getRenameLocations(renameArgs.line, renameArgs.col, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings); + break; + } + case CommandNames.Open: + { + var openArgs = request.arguments; + this.openClientFile(openArgs.file); + responseRequired = false; + break; + } + case CommandNames.Quickinfo: + { + var quickinfoArgs = request.arguments; + response = this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.col, quickinfoArgs.file); + break; + } + case CommandNames.Format: + { + var formatArgs = request.arguments; + response = this.getFormattingEditsForRange(formatArgs.line, formatArgs.col, formatArgs.endLine, formatArgs.endCol, formatArgs.file); + break; + } + case CommandNames.Formatonkey: + { + var formatOnKeyArgs = request.arguments; + response = this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.col, formatOnKeyArgs.key, formatOnKeyArgs.file); + break; + } + case CommandNames.Completions: + { + var completionsArgs = request.arguments; + response = this.getCompletions(request.arguments.line, request.arguments.col, completionsArgs.prefix, request.arguments.file); + break; + } + case CommandNames.CompletionDetails: + { + var completionDetailsArgs = request.arguments; + response = this.getCompletionEntryDetails(request.arguments.line, request.arguments.col, completionDetailsArgs.entryNames, request.arguments.file); + break; + } + case CommandNames.Geterr: + { + var geterrArgs = request.arguments; + response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files); + responseRequired = false; + break; + } + case CommandNames.Change: + { + var changeArgs = request.arguments; + this.change(changeArgs.line, changeArgs.col, changeArgs.endLine, changeArgs.endCol, changeArgs.insertString, changeArgs.file); + responseRequired = false; + break; + } + case CommandNames.Reload: + { + var reloadArgs = request.arguments; + this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq); + break; + } + case CommandNames.Saveto: + { + var savetoArgs = request.arguments; + this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); + responseRequired = false; + break; + } + case CommandNames.Close: + { + var closeArgs = request.arguments; + this.closeClientFile(closeArgs.file); + responseRequired = false; + break; + } + case CommandNames.Navto: + { + var navtoArgs = request.arguments; + response = this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount); + break; + } + case CommandNames.Brace: + { + var braceArguments = request.arguments; + response = this.getBraceMatching(braceArguments.line, braceArguments.col, braceArguments.file); + break; + } + case CommandNames.NavBar: + { + var navBarArgs = request.arguments; + response = this.getNavigationBarItems(navBarArgs.file); + break; + } + default: + { + this.projectService.log("Unrecognized JSON command: " + message); + this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command); + break; + } + } + if (this.logger.isVerbose()) { + var elapsed = process.hrtime(start); + var seconds = elapsed[0]; + var nanoseconds = elapsed[1]; + var elapsedMs = ((1e9 * seconds) + nanoseconds) / 1000000.0; + var leader = "Elapsed time (in milliseconds)"; + if (!responseRequired) { + leader = "Async elapsed time (in milliseconds)"; } + this.logger.msg(leader + ": " + elapsedMs.toFixed(4).toString(), "Perf"); } if (response) { this.output(response, request.command, request.seq); @@ -32927,8 +37989,9 @@ var ts; terminal: false }); var Logger = (function () { - function Logger(logFilename) { + function Logger(logFilename, level) { this.logFilename = logFilename; + this.level = level; this.fd = -1; this.seq = 0; this.inGroup = false; @@ -32957,10 +38020,18 @@ var ts; this.seq++; this.firstInGroup = true; }; + Logger.prototype.loggingEnabled = function () { + return !!this.logFilename; + }; + Logger.prototype.isVerbose = function () { + return this.loggingEnabled() && (this.level == "verbose"); + }; Logger.prototype.msg = function (s, type) { if (type === void 0) { type = "Err"; } if (this.fd < 0) { - this.fd = fs.openSync(this.logFilename, "w"); + if (this.logFilename) { + this.fd = fs.openSync(this.logFilename, "w"); + } } if (this.fd >= 0) { s = s + "\n"; @@ -33064,19 +38135,58 @@ var ts; _this.onMessage(message); }); rl.on('close', function () { - _this.projectService.closeLog(); _this.projectService.log("Exiting..."); + _this.projectService.closeLog(); process.exit(0); }); }; return IOSession; })(server.Session); - var logger = new Logger(__dirname + "/.log" + process.pid.toString()); + function parseLoggingEnvironmentString(logEnvStr) { + var logEnv = {}; + var args = logEnvStr.split(' '); + for (var i = 0, len = args.length; i < (len - 1); i += 2) { + var option = args[i]; + var value = args[i + 1]; + if (option && value) { + switch (option) { + case "-file": + logEnv.file = value; + break; + case "-level": + logEnv.detailLevel = value; + break; + } + } + } + return logEnv; + } + function createLoggerFromEnv() { + var fileName = undefined; + var detailLevel = "normal"; + var logEnvStr = process.env["TSS_LOG"]; + if (logEnvStr) { + var logEnv = parseLoggingEnvironmentString(logEnvStr); + if (logEnv.file) { + fileName = logEnv.file; + } + else { + fileName = __dirname + "/.log" + process.pid.toString(); + } + if (logEnv.detailLevel) { + detailLevel = logEnv.detailLevel; + } + } + return new Logger(fileName, detailLevel); + } + var logger = createLoggerFromEnv(); var watchedFileSet = new WatchedFileSet(); ts.sys.watchFile = function (fileName, callback) { var watchedFile = watchedFileSet.addFile(fileName, callback); return { - close: function () { return watchedFileSet.removeFile(watchedFile); } + close: function () { + return watchedFileSet.removeFile(watchedFile); + } }; }; var ioSession = new IOSession(ts.sys, logger); diff --git a/bin/typescript.d.ts b/bin/typescript.d.ts index 3de69b45409..bf6b204d3bb 100644 --- a/bin/typescript.d.ts +++ b/bin/typescript.d.ts @@ -224,27 +224,28 @@ declare module "typescript" { EnumDeclaration = 199, ModuleDeclaration = 200, ModuleBlock = 201, - ImportEqualsDeclaration = 202, - ImportDeclaration = 203, - ImportClause = 204, - NamespaceImport = 205, - NamedImports = 206, - ImportSpecifier = 207, - ExportAssignment = 208, - ExportDeclaration = 209, - NamedExports = 210, - ExportSpecifier = 211, - ExternalModuleReference = 212, - CaseClause = 213, - DefaultClause = 214, - HeritageClause = 215, - CatchClause = 216, - PropertyAssignment = 217, - ShorthandPropertyAssignment = 218, - EnumMember = 219, - SourceFile = 220, - SyntaxList = 221, - Count = 222, + CaseBlock = 202, + ImportEqualsDeclaration = 203, + ImportDeclaration = 204, + ImportClause = 205, + NamespaceImport = 206, + NamedImports = 207, + ImportSpecifier = 208, + ExportAssignment = 209, + ExportDeclaration = 210, + NamedExports = 211, + ExportSpecifier = 212, + ExternalModuleReference = 213, + CaseClause = 214, + DefaultClause = 215, + HeritageClause = 216, + CatchClause = 217, + PropertyAssignment = 218, + ShorthandPropertyAssignment = 219, + EnumMember = 220, + SourceFile = 221, + SyntaxList = 222, + Count = 223, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, @@ -619,6 +620,9 @@ declare module "typescript" { } interface SwitchStatement extends Statement { expression: Expression; + caseBlock: CaseBlock; + } + interface CaseBlock extends Node { clauses: NodeArray; } interface CaseClause extends Node { @@ -1197,6 +1201,7 @@ declare module "typescript" { version?: boolean; watch?: boolean; stripInternal?: boolean; + preserveNewLines?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { @@ -1437,12 +1442,15 @@ declare module "typescript" { function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; } declare module "typescript" { + /** The version of the TypeScript compiler release */ + var version: string; function createCompilerHost(options: CompilerOptions): CompilerHost; function getPreEmitDiagnostics(program: Program): Diagnostic[]; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } declare module "typescript" { + /** The version of the language service API */ var servicesVersion: string; interface Node { getSourceFile(): SourceFile; diff --git a/bin/typescript.js b/bin/typescript.js index f3c487b2079..0fb345eea1b 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -218,27 +218,28 @@ var ts; SyntaxKind[SyntaxKind["EnumDeclaration"] = 199] = "EnumDeclaration"; SyntaxKind[SyntaxKind["ModuleDeclaration"] = 200] = "ModuleDeclaration"; SyntaxKind[SyntaxKind["ModuleBlock"] = 201] = "ModuleBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 202] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 203] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 204] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 205] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 206] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 207] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 208] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 209] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 210] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 211] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 212] = "ExternalModuleReference"; - SyntaxKind[SyntaxKind["CaseClause"] = 213] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 214] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 215] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 216] = "CatchClause"; - SyntaxKind[SyntaxKind["PropertyAssignment"] = 217] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 218] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["EnumMember"] = 219] = "EnumMember"; - SyntaxKind[SyntaxKind["SourceFile"] = 220] = "SourceFile"; - SyntaxKind[SyntaxKind["SyntaxList"] = 221] = "SyntaxList"; - SyntaxKind[SyntaxKind["Count"] = 222] = "Count"; + SyntaxKind[SyntaxKind["CaseBlock"] = 202] = "CaseBlock"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 203] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 204] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 205] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 206] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 207] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 208] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 209] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 210] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 211] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 212] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 213] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["CaseClause"] = 214] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 215] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 216] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 217] = "CatchClause"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 218] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 219] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 220] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 221] = "SourceFile"; + SyntaxKind[SyntaxKind["SyntaxList"] = 222] = "SyntaxList"; + SyntaxKind[SyntaxKind["Count"] = 223] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = 52] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 63] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = 65] = "FirstReservedWord"; @@ -824,18 +825,21 @@ var ts; ts.arrayToMap = arrayToMap; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); + return text.replace(/{(\d+)}/g, function (match, index) { + return args[+index + baseIndex]; + }); } ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { - return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] - ? ts.localizedDiagnosticMessages[message] - : message; + return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] ? ts.localizedDiagnosticMessages[message] : message; } ts.getLocaleSpecificMessage = getLocaleSpecificMessage; function createFileDiagnostic(file, start, length, message) { + var end = start + length; Debug.assert(start >= 0, "start must be non-negative, is " + start); Debug.assert(length >= 0, "length must be non-negative, is " + length); + Debug.assert(start <= file.text.length, "start must be within the bounds of the file. " + start + " > " + file.text.length); + Debug.assert(end <= file.text.length, "end must be the bounds of the file. " + end + " > " + file.text.length); var text = getLocaleSpecificMessage(message.key); if (arguments.length > 4) { text = formatStringFromArgs(text, arguments, 4); @@ -898,12 +902,7 @@ var ts; return diagnostic.file ? diagnostic.file.fileName : undefined; } function compareDiagnostics(d1, d2) { - return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || - compareValues(d1.start, d2.start) || - compareValues(d1.length, d2.length) || - compareValues(d1.code, d2.code) || - compareMessageText(d1.messageText, d2.messageText) || - 0; + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0; } ts.compareDiagnostics = compareDiagnostics; function compareMessageText(text1, text2) { @@ -930,7 +929,9 @@ var ts; if (diagnostics.length < 2) { return diagnostics; } - var newDiagnostics = [diagnostics[0]]; + var newDiagnostics = [ + diagnostics[0] + ]; var previousDiagnostic = diagnostics[0]; for (var i = 1; i < diagnostics.length; i++) { var currentDiagnostic = diagnostics[i]; @@ -1007,7 +1008,9 @@ var ts; ts.isRootedDiskPath = isRootedDiskPath; function normalizedPathComponents(path, rootLength) { var normalizedParts = getNormalizedParts(path, rootLength); - return [path.substr(0, rootLength)].concat(normalizedParts); + return [ + path.substr(0, rootLength) + ].concat(normalizedParts); } function getNormalizedPathComponents(path, currentDirectory) { var path = normalizeSlashes(path); @@ -1041,7 +1044,9 @@ var ts; } } if (rootLength === urlLength) { - return [url]; + return [ + url + ]; } var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); if (indexOfNextSlash !== -1) { @@ -1049,7 +1054,9 @@ var ts; return normalizedPathComponents(url, rootLength); } else { - return [url + ts.directorySeparator]; + return [ + url + ts.directorySeparator + ]; } } function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { @@ -1111,7 +1118,11 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [".d.ts", ".ts", ".js"]; + var supportedExtensions = [ + ".d.ts", + ".ts", + ".js" + ]; function removeFileExtension(path) { for (var i = 0; i < supportedExtensions.length; i++) { var ext = supportedExtensions[i]; @@ -1165,9 +1176,15 @@ var ts; }; return Node; }, - getSymbolConstructor: function () { return Symbol; }, - getTypeConstructor: function () { return Type; }, - getSignatureConstructor: function () { return Signature; } + getSymbolConstructor: function () { + return Symbol; + }, + getTypeConstructor: function () { + return Type; + }, + getSignatureConstructor: function () { + return Signature; + } }; (function (AssertionLevel) { AssertionLevel[AssertionLevel["None"] = 0] = "None"; @@ -1392,9 +1409,14 @@ var ts; readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { - _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + _fs.watchFile(fileName, { + persistent: true, + interval: 250 + }, fileChanged); return { - close: function () { _fs.unwatchFile(fileName, fileChanged); } + close: function () { + _fs.unwatchFile(fileName, fileChanged); + } }; function fileChanged(curr, prev) { if (+curr.mtime <= +prev.mtime) { @@ -1450,488 +1472,2431 @@ var ts; var ts; (function (ts) { ts.Diagnostics = { - Unterminated_string_literal: { code: 1002, category: 1, key: "Unterminated string literal." }, - Identifier_expected: { code: 1003, category: 1, key: "Identifier expected." }, - _0_expected: { code: 1005, category: 1, key: "'{0}' expected." }, - A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1, key: "A file cannot have a reference to itself." }, - Trailing_comma_not_allowed: { code: 1009, category: 1, key: "Trailing comma not allowed." }, - Asterisk_Slash_expected: { code: 1010, category: 1, key: "'*/' expected." }, - Unexpected_token: { code: 1012, category: 1, key: "Unexpected token." }, - A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1, key: "A rest parameter must be last in a parameter list." }, - Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1, key: "Parameter cannot have question mark and initializer." }, - A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1, key: "A required parameter cannot follow an optional parameter." }, - An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1, key: "An index signature cannot have a rest parameter." }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1, key: "An index signature parameter cannot have an accessibility modifier." }, - An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1, key: "An index signature parameter cannot have a question mark." }, - An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1, key: "An index signature parameter cannot have an initializer." }, - An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1, key: "An index signature must have a type annotation." }, - An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1, key: "An index signature parameter must have a type annotation." }, - An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1, key: "An index signature parameter type must be 'string' or 'number'." }, - A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1, key: "A class or interface declaration can only have one 'extends' clause." }, - An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1, key: "An 'extends' clause must precede an 'implements' clause." }, - A_class_can_only_extend_a_single_class: { code: 1026, category: 1, key: "A class can only extend a single class." }, - A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1, key: "A class declaration can only have one 'implements' clause." }, - Accessibility_modifier_already_seen: { code: 1028, category: 1, key: "Accessibility modifier already seen." }, - _0_modifier_must_precede_1_modifier: { code: 1029, category: 1, key: "'{0}' modifier must precede '{1}' modifier." }, - _0_modifier_already_seen: { code: 1030, category: 1, key: "'{0}' modifier already seen." }, - _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1, key: "'{0}' modifier cannot appear on a class element." }, - An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1, key: "An interface declaration cannot have an 'implements' clause." }, - super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1, key: "'super' must be followed by an argument list or member access." }, - Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1, key: "Only ambient modules can use quoted names." }, - Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1, key: "Statements are not allowed in ambient contexts." }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1, key: "A 'declare' modifier cannot be used in an already ambient context." }, - Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1, key: "Initializers are not allowed in ambient contexts." }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1, key: "'{0}' modifier cannot appear on a module element." }, - A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1, key: "A 'declare' modifier cannot be used with an interface declaration." }, - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, - A_rest_parameter_cannot_be_optional: { code: 1047, category: 1, key: "A rest parameter cannot be optional." }, - A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1, key: "A rest parameter cannot have an initializer." }, - A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1, key: "A 'set' accessor must have exactly one parameter." }, - A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1, key: "A 'set' accessor cannot have an optional parameter." }, - A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1, key: "A 'set' accessor parameter cannot have an initializer." }, - A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1, key: "A 'set' accessor cannot have rest parameter." }, - A_get_accessor_cannot_have_parameters: { code: 1054, category: 1, key: "A 'get' accessor cannot have parameters." }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, - Enum_member_must_have_initializer: { code: 1061, category: 1, key: "Enum member must have initializer." }, - An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1, key: "An export assignment cannot be used in an internal module." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1, key: "Ambient enum elements can only have integer literal initializers." }, - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, - A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1, key: "A 'declare' modifier cannot be used with an import declaration." }, - Invalid_reference_directive_syntax: { code: 1084, category: 1, key: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, - An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1, key: "An accessor cannot be declared in an ambient context." }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1, key: "'{0}' modifier cannot appear on a constructor declaration." }, - _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1, key: "'{0}' modifier cannot appear on a parameter." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1, key: "Type parameters cannot appear on a constructor declaration." }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1, key: "Type annotation cannot appear on a constructor declaration." }, - An_accessor_cannot_have_type_parameters: { code: 1094, category: 1, key: "An accessor cannot have type parameters." }, - A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1, key: "A 'set' accessor cannot have a return type annotation." }, - An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1, key: "An index signature must have exactly one parameter." }, - _0_list_cannot_be_empty: { code: 1097, category: 1, key: "'{0}' list cannot be empty." }, - Type_parameter_list_cannot_be_empty: { code: 1098, category: 1, key: "Type parameter list cannot be empty." }, - Type_argument_list_cannot_be_empty: { code: 1099, category: 1, key: "Type argument list cannot be empty." }, - Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1, key: "Invalid use of '{0}' in strict mode." }, - with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1, key: "'with' statements are not allowed in strict mode." }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1, key: "'delete' cannot be called on an identifier in strict mode." }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, - Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1, key: "Jump target cannot cross function boundary." }, - A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1, key: "A 'return' statement can only be used within a function body." }, - Expression_expected: { code: 1109, category: 1, key: "Expression expected." }, - Type_expected: { code: 1110, category: 1, key: "Type expected." }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: 1, key: "A class member cannot be declared optional." }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: 1, key: "Duplicate label '{0}'" }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1, key: "A 'break' statement can only jump to a label of an enclosing statement." }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1, key: "An object literal cannot have multiple properties with the same name in strict mode." }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1, key: "An object literal cannot have multiple get/set accessors with the same name." }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1, key: "An object literal cannot have property and accessor with the same name." }, - An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1, key: "An export assignment cannot have modifiers." }, - Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1, key: "Octal literals are not allowed in strict mode." }, - A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1, key: "A tuple type element list cannot be empty." }, - Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1, key: "Variable declaration list cannot be empty." }, - Digit_expected: { code: 1124, category: 1, key: "Digit expected." }, - Hexadecimal_digit_expected: { code: 1125, category: 1, key: "Hexadecimal digit expected." }, - Unexpected_end_of_text: { code: 1126, category: 1, key: "Unexpected end of text." }, - Invalid_character: { code: 1127, category: 1, key: "Invalid character." }, - Declaration_or_statement_expected: { code: 1128, category: 1, key: "Declaration or statement expected." }, - Statement_expected: { code: 1129, category: 1, key: "Statement expected." }, - case_or_default_expected: { code: 1130, category: 1, key: "'case' or 'default' expected." }, - Property_or_signature_expected: { code: 1131, category: 1, key: "Property or signature expected." }, - Enum_member_expected: { code: 1132, category: 1, key: "Enum member expected." }, - Type_reference_expected: { code: 1133, category: 1, key: "Type reference expected." }, - Variable_declaration_expected: { code: 1134, category: 1, key: "Variable declaration expected." }, - Argument_expression_expected: { code: 1135, category: 1, key: "Argument expression expected." }, - Property_assignment_expected: { code: 1136, category: 1, key: "Property assignment expected." }, - Expression_or_comma_expected: { code: 1137, category: 1, key: "Expression or comma expected." }, - Parameter_declaration_expected: { code: 1138, category: 1, key: "Parameter declaration expected." }, - Type_parameter_declaration_expected: { code: 1139, category: 1, key: "Type parameter declaration expected." }, - Type_argument_expected: { code: 1140, category: 1, key: "Type argument expected." }, - String_literal_expected: { code: 1141, category: 1, key: "String literal expected." }, - Line_break_not_permitted_here: { code: 1142, category: 1, key: "Line break not permitted here." }, - or_expected: { code: 1144, category: 1, key: "'{' or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1, key: "Modifiers not permitted on index signature members." }, - Declaration_expected: { code: 1146, category: 1, key: "Declaration expected." }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1, key: "Import declarations in an internal module cannot reference an external module." }, - Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1, key: "Cannot compile external modules unless the '--module' flag is provided." }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: 1, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - var_let_or_const_expected: { code: 1152, category: 1, key: "'var', 'let' or 'const' expected." }, - let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_must_be_initialized: { code: 1155, category: 1, key: "'const' declarations must be initialized" }, - const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1, key: "'const' declarations can only be declared inside a block." }, - let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1, key: "'let' declarations can only be declared inside a block." }, - Unterminated_template_literal: { code: 1160, category: 1, key: "Unterminated template literal." }, - Unterminated_regular_expression_literal: { code: 1161, category: 1, key: "Unterminated regular expression literal." }, - An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, - yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, - Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, - A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, - Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, - A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, - A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, - extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, - extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, - Classes_can_only_extend_a_single_class: { code: 1174, category: 1, key: "Classes can only extend a single class." }, - implements_clause_already_seen: { code: 1175, category: 1, key: "'implements' clause already seen." }, - Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1, key: "Interface declaration cannot have 'implements' clause." }, - Binary_digit_expected: { code: 1177, category: 1, key: "Binary digit expected." }, - Octal_digit_expected: { code: 1178, category: 1, key: "Octal digit expected." }, - Unexpected_token_expected: { code: 1179, category: 1, key: "Unexpected token. '{' expected." }, - Property_destructuring_pattern_expected: { code: 1180, category: 1, key: "Property destructuring pattern expected." }, - Array_element_destructuring_pattern_expected: { code: 1181, category: 1, key: "Array element destructuring pattern expected." }, - A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: 1, key: "A destructuring declaration must have an initializer." }, - Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: 1, key: "Destructuring declarations are not allowed in ambient contexts." }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: 1, key: "An implementation cannot be declared in ambient contexts." }, - Modifiers_cannot_appear_here: { code: 1184, category: 1, key: "Modifiers cannot appear here." }, - Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, - A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, - A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, - The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, - The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, - An_import_declaration_cannot_have_modifiers: { code: 1191, category: 1, key: "An import declaration cannot have modifiers." }, - External_module_0_has_no_default_export_or_export_assignment: { code: 1192, category: 1, key: "External module '{0}' has no default export or export assignment." }, - An_export_declaration_cannot_have_modifiers: { code: 1193, category: 1, key: "An export declaration cannot have modifiers." }, - Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: 1, key: "Export declarations are not permitted in an internal module." }, - Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: 1, key: "Catch clause variable name must be an identifier." }, - Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: 1, key: "Catch clause variable cannot have a type annotation." }, - Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: 1, key: "Catch clause variable cannot have an initializer." }, - An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: 1, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, - Unterminated_Unicode_escape_sequence: { code: 1199, category: 1, key: "Unterminated Unicode escape sequence." }, - Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, - Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1, key: "Static members cannot reference class type parameters." }, - Circular_definition_of_import_alias_0: { code: 2303, category: 1, key: "Circular definition of import alias '{0}'." }, - Cannot_find_name_0: { code: 2304, category: 1, key: "Cannot find name '{0}'." }, - Module_0_has_no_exported_member_1: { code: 2305, category: 1, key: "Module '{0}' has no exported member '{1}'." }, - File_0_is_not_an_external_module: { code: 2306, category: 1, key: "File '{0}' is not an external module." }, - Cannot_find_external_module_0: { code: 2307, category: 1, key: "Cannot find external module '{0}'." }, - A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1, key: "A module cannot have more than one export assignment." }, - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1, key: "An export assignment cannot be used in a module with other exported elements." }, - Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1, key: "Type '{0}' recursively references itself as a base type." }, - A_class_may_only_extend_another_class: { code: 2311, category: 1, key: "A class may only extend another class." }, - An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1, key: "An interface may only extend a class or another interface." }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, - Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1, key: "Generic type '{0}' requires {1} type argument(s)." }, - Type_0_is_not_generic: { code: 2315, category: 1, key: "Type '{0}' is not generic." }, - Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, - Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, - Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, - Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, - Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, - Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, - Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, - Property_0_is_missing_in_type_1: { code: 2324, category: 1, key: "Property '{0}' is missing in type '{1}'." }, - Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, - Types_of_property_0_are_incompatible: { code: 2326, category: 1, key: "Types of property '{0}' are incompatible." }, - Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, - Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1, key: "Types of parameters '{0}' and '{1}' are incompatible." }, - Index_signature_is_missing_in_type_0: { code: 2329, category: 1, key: "Index signature is missing in type '{0}'." }, - Index_signatures_are_incompatible: { code: 2330, category: 1, key: "Index signatures are incompatible." }, - this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1, key: "'this' cannot be referenced in a module body." }, - this_cannot_be_referenced_in_current_location: { code: 2332, category: 1, key: "'this' cannot be referenced in current location." }, - this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1, key: "'this' cannot be referenced in constructor arguments." }, - this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1, key: "'this' cannot be referenced in a static property initializer." }, - super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1, key: "'super' can only be referenced in a derived class." }, - super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1, key: "'super' cannot be referenced in constructor arguments." }, - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, - Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, - Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, - Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, - Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, - Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1, key: "Untyped function calls may not accept type arguments." }, - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1, key: "Cannot invoke an expression whose type lacks a call signature." }, - Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1, key: "Only a void function can be called with the 'new' keyword." }, - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, - No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1, key: "No best common type exists among return expressions." }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1, key: "Invalid left-hand side of assignment expression." }, - Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: 1, key: "Type parameter name cannot be '{0}'" }, - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1, key: "A parameter property is only allowed in a constructor implementation." }, - A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1, key: "A rest parameter must be of an array type." }, - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1, key: "A parameter initializer is only allowed in a function or constructor implementation." }, - Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1, key: "Parameter '{0}' cannot be referenced in its initializer." }, - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, - Duplicate_string_index_signature: { code: 2374, category: 1, key: "Duplicate string index signature." }, - Duplicate_number_index_signature: { code: 2375, category: 1, key: "Duplicate number index signature." }, - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, - Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1, key: "Constructors for derived classes must contain a 'super' call." }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, - Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1, key: "Getter and setter accessors do not agree in visibility." }, - get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1, key: "'get' and 'set' accessor must have the same type." }, - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1, key: "A signature with an implementation cannot use a string literal type." }, - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1, key: "Specialized overload signature is not assignable to any non-specialized signature." }, - Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1, key: "Overload signatures must all be exported or not exported." }, - Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1, key: "Overload signatures must all be ambient or non-ambient." }, - Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1, key: "Overload signatures must all be public, private or protected." }, - Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1, key: "Overload signatures must all be optional or required." }, - Function_overload_must_be_static: { code: 2387, category: 1, key: "Function overload must be static." }, - Function_overload_must_not_be_static: { code: 2388, category: 1, key: "Function overload must not be static." }, - Function_implementation_name_must_be_0: { code: 2389, category: 1, key: "Function implementation name must be '{0}'." }, - Constructor_implementation_is_missing: { code: 2390, category: 1, key: "Constructor implementation is missing." }, - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1, key: "Function implementation is missing or not immediately following the declaration." }, - Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1, key: "Multiple constructor implementations are not allowed." }, - Duplicate_function_implementation: { code: 2393, category: 1, key: "Duplicate function implementation." }, - Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1, key: "Overload signature is not compatible with function implementation." }, - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, - Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1, key: "Invalid left-hand side in 'for...in' statement." }, - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, - Setters_cannot_return_a_value: { code: 2408, category: 1, key: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1, key: "Return type of constructor signature must be assignable to the instance type of the class" }, - All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1, key: "All symbols within a 'with' block will be resolved to 'any'." }, - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: 1, key: "Class name cannot be '{0}'" }, - Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1, key: "Class '{0}' incorrectly extends base class '{1}'." }, - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, - Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1, key: "Class '{0}' incorrectly implements interface '{1}'." }, - A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1, key: "A class may only implement another class or interface." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: 1, key: "Interface name cannot be '{0}'" }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1, key: "All declarations of an interface must have identical type parameters." }, - Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1, key: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: 1, key: "Enum name cannot be '{0}'" }, - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, - A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, - Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1, key: "Ambient external modules cannot be nested in other modules." }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1, key: "Ambient external module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1, key: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: 1, key: "Import name cannot be '{0}'" }, - Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1, key: "Import declaration conflicts with local declaration of '{0}'" }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, - Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1, key: "Types have separate declarations of a private property '{0}'." }, - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, - Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, - Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1, key: "Block-scoped variable '{0}' used before its declaration." }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1, key: "The operand of an increment or decrement operator cannot be a constant." }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1, key: "Left-hand side of assignment expression cannot be a constant." }, - Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1, key: "Cannot redeclare block-scoped variable '{0}'." }, - An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1, key: "An enum member cannot have a numeric name." }, - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, - Type_alias_0_circularly_references_itself: { code: 2456, category: 1, key: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: 1, key: "Type alias name cannot be '{0}'" }, - An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1, key: "An AMD module cannot have multiple name assignments." }, - Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: 1, key: "Type '{0}' has no property '{1}' and no string index signature." }, - Type_0_has_no_property_1: { code: 2460, category: 1, key: "Type '{0}' has no property '{1}'." }, - Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, - this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, - super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, - Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, - The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, - Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, - A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, - for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: 1, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, - The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, - Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: 1, key: "Export declaration conflicts with exported declaration of '{0}'" }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: 1, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, - Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: 1, key: "Invalid left-hand side in 'for...of' statement." }, - The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: 1, key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." }, - The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { code: 2489, category: 1, key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." }, - The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: 1, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, - Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: 1, key: "Cannot redeclare identifier '{0}' in catch clause" }, - Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, - Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1, key: "Exported variable '{0}' has or is using private name '{1}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, - Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1, key: "Return type of public static method from exported class has or is using private name '{0}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1, key: "Return type of public method from exported class has or is using private name '{0}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1, key: "Return type of method from exported interface has or is using private name '{0}'." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, - Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1, key: "Return type of exported function has or is using private name '{0}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, - Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { code: 4091, category: 1, key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." }, - The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, - Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: 1, key: "Unsupported file encoding." }, - Unknown_compiler_option_0: { code: 5023, category: 1, key: "Unknown compiler option '{0}'." }, - Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1, key: "Compiler option '{0}' requires a value of type {1}." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: 1, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: 1, key: "Option 'project' cannot be mixed with source files on a command line." }, - Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2, key: "Concatenate and emit output to single file." }, - Generates_corresponding_d_ts_file: { code: 6002, category: 2, key: "Generates corresponding '.d.ts' file." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2, key: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, - Watch_input_files: { code: 6005, category: 2, key: "Watch input files." }, - Redirect_output_structure_to_the_directory: { code: 6006, category: 2, key: "Redirect output structure to the directory." }, - Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2, key: "Do not emit outputs if any type checking errors were reported." }, - Do_not_emit_comments_to_output: { code: 6009, category: 2, key: "Do not emit comments to output." }, - Do_not_emit_outputs: { code: 6010, category: 2, key: "Do not emit outputs." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2, key: "Specify module code generation: 'commonjs' or 'amd'" }, - Print_this_message: { code: 6017, category: 2, key: "Print this message." }, - Print_the_compiler_s_version: { code: 6019, category: 2, key: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: 2, key: "Compile the project in the given directory." }, - Syntax_Colon_0: { code: 6023, category: 2, key: "Syntax: {0}" }, - options: { code: 6024, category: 2, key: "options" }, - file: { code: 6025, category: 2, key: "file" }, - Examples_Colon_0: { code: 6026, category: 2, key: "Examples: {0}" }, - Options_Colon: { code: 6027, category: 2, key: "Options:" }, - Version_0: { code: 6029, category: 2, key: "Version {0}" }, - Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2, key: "Insert command line options and files from a file." }, - File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2, key: "File change detected. Starting incremental compilation..." }, - KIND: { code: 6034, category: 2, key: "KIND" }, - FILE: { code: 6035, category: 2, key: "FILE" }, - VERSION: { code: 6036, category: 2, key: "VERSION" }, - LOCATION: { code: 6037, category: 2, key: "LOCATION" }, - DIRECTORY: { code: 6038, category: 2, key: "DIRECTORY" }, - Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2, key: "Compilation complete. Watching for file changes." }, - Generates_corresponding_map_file: { code: 6043, category: 2, key: "Generates corresponding '.map' file." }, - Compiler_option_0_expects_an_argument: { code: 6044, category: 1, key: "Compiler option '{0}' expects an argument." }, - Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, - Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, - Unsupported_locale_0: { code: 6049, category: 1, key: "Unsupported locale '{0}'." }, - Unable_to_open_file_0: { code: 6050, category: 1, key: "Unable to open file '{0}'." }, - Corrupted_locale_file_0: { code: 6051, category: 1, key: "Corrupted locale file {0}." }, - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2, key: "Raise error on expressions and declarations with an implied 'any' type." }, - File_0_not_found: { code: 6053, category: 1, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: 2, key: "Do not emit declarations for code that has an '@internal' annotation." }, - Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1, key: "Variable '{0}' implicitly has an '{1}' type." }, - Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1, key: "Parameter '{0}' implicitly has an '{1}' type." }, - Member_0_implicitly_has_an_1_type: { code: 7008, category: 1, key: "Member '{0}' implicitly has an '{1}' type." }, - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, - Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1, key: "Index signature of object type implicitly has an 'any' type." }, - Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, - Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, - _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - You_cannot_rename_this_element: { code: 8000, category: 1, key: "You cannot rename this element." }, - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, - yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, - Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." } + Unterminated_string_literal: { + code: 1002, + category: 1, + key: "Unterminated string literal." + }, + Identifier_expected: { + code: 1003, + category: 1, + key: "Identifier expected." + }, + _0_expected: { + code: 1005, + category: 1, + key: "'{0}' expected." + }, + A_file_cannot_have_a_reference_to_itself: { + code: 1006, + category: 1, + key: "A file cannot have a reference to itself." + }, + Trailing_comma_not_allowed: { + code: 1009, + category: 1, + key: "Trailing comma not allowed." + }, + Asterisk_Slash_expected: { + code: 1010, + category: 1, + key: "'*/' expected." + }, + Unexpected_token: { + code: 1012, + category: 1, + key: "Unexpected token." + }, + A_rest_parameter_must_be_last_in_a_parameter_list: { + code: 1014, + category: 1, + key: "A rest parameter must be last in a parameter list." + }, + Parameter_cannot_have_question_mark_and_initializer: { + code: 1015, + category: 1, + key: "Parameter cannot have question mark and initializer." + }, + A_required_parameter_cannot_follow_an_optional_parameter: { + code: 1016, + category: 1, + key: "A required parameter cannot follow an optional parameter." + }, + An_index_signature_cannot_have_a_rest_parameter: { + code: 1017, + category: 1, + key: "An index signature cannot have a rest parameter." + }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { + code: 1018, + category: 1, + key: "An index signature parameter cannot have an accessibility modifier." + }, + An_index_signature_parameter_cannot_have_a_question_mark: { + code: 1019, + category: 1, + key: "An index signature parameter cannot have a question mark." + }, + An_index_signature_parameter_cannot_have_an_initializer: { + code: 1020, + category: 1, + key: "An index signature parameter cannot have an initializer." + }, + An_index_signature_must_have_a_type_annotation: { + code: 1021, + category: 1, + key: "An index signature must have a type annotation." + }, + An_index_signature_parameter_must_have_a_type_annotation: { + code: 1022, + category: 1, + key: "An index signature parameter must have a type annotation." + }, + An_index_signature_parameter_type_must_be_string_or_number: { + code: 1023, + category: 1, + key: "An index signature parameter type must be 'string' or 'number'." + }, + A_class_or_interface_declaration_can_only_have_one_extends_clause: { + code: 1024, + category: 1, + key: "A class or interface declaration can only have one 'extends' clause." + }, + An_extends_clause_must_precede_an_implements_clause: { + code: 1025, + category: 1, + key: "An 'extends' clause must precede an 'implements' clause." + }, + A_class_can_only_extend_a_single_class: { + code: 1026, + category: 1, + key: "A class can only extend a single class." + }, + A_class_declaration_can_only_have_one_implements_clause: { + code: 1027, + category: 1, + key: "A class declaration can only have one 'implements' clause." + }, + Accessibility_modifier_already_seen: { + code: 1028, + category: 1, + key: "Accessibility modifier already seen." + }, + _0_modifier_must_precede_1_modifier: { + code: 1029, + category: 1, + key: "'{0}' modifier must precede '{1}' modifier." + }, + _0_modifier_already_seen: { + code: 1030, + category: 1, + key: "'{0}' modifier already seen." + }, + _0_modifier_cannot_appear_on_a_class_element: { + code: 1031, + category: 1, + key: "'{0}' modifier cannot appear on a class element." + }, + An_interface_declaration_cannot_have_an_implements_clause: { + code: 1032, + category: 1, + key: "An interface declaration cannot have an 'implements' clause." + }, + super_must_be_followed_by_an_argument_list_or_member_access: { + code: 1034, + category: 1, + key: "'super' must be followed by an argument list or member access." + }, + Only_ambient_modules_can_use_quoted_names: { + code: 1035, + category: 1, + key: "Only ambient modules can use quoted names." + }, + Statements_are_not_allowed_in_ambient_contexts: { + code: 1036, + category: 1, + key: "Statements are not allowed in ambient contexts." + }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { + code: 1038, + category: 1, + key: "A 'declare' modifier cannot be used in an already ambient context." + }, + Initializers_are_not_allowed_in_ambient_contexts: { + code: 1039, + category: 1, + key: "Initializers are not allowed in ambient contexts." + }, + _0_modifier_cannot_appear_on_a_module_element: { + code: 1044, + category: 1, + key: "'{0}' modifier cannot appear on a module element." + }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { + code: 1045, + category: 1, + key: "A 'declare' modifier cannot be used with an interface declaration." + }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { + code: 1046, + category: 1, + key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." + }, + A_rest_parameter_cannot_be_optional: { + code: 1047, + category: 1, + key: "A rest parameter cannot be optional." + }, + A_rest_parameter_cannot_have_an_initializer: { + code: 1048, + category: 1, + key: "A rest parameter cannot have an initializer." + }, + A_set_accessor_must_have_exactly_one_parameter: { + code: 1049, + category: 1, + key: "A 'set' accessor must have exactly one parameter." + }, + A_set_accessor_cannot_have_an_optional_parameter: { + code: 1051, + category: 1, + key: "A 'set' accessor cannot have an optional parameter." + }, + A_set_accessor_parameter_cannot_have_an_initializer: { + code: 1052, + category: 1, + key: "A 'set' accessor parameter cannot have an initializer." + }, + A_set_accessor_cannot_have_rest_parameter: { + code: 1053, + category: 1, + key: "A 'set' accessor cannot have rest parameter." + }, + A_get_accessor_cannot_have_parameters: { + code: 1054, + category: 1, + key: "A 'get' accessor cannot have parameters." + }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { + code: 1056, + category: 1, + key: "Accessors are only available when targeting ECMAScript 5 and higher." + }, + Enum_member_must_have_initializer: { + code: 1061, + category: 1, + key: "Enum member must have initializer." + }, + An_export_assignment_cannot_be_used_in_an_internal_module: { + code: 1063, + category: 1, + key: "An export assignment cannot be used in an internal module." + }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { + code: 1066, + category: 1, + key: "Ambient enum elements can only have integer literal initializers." + }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { + code: 1068, + category: 1, + key: "Unexpected token. A constructor, method, accessor, or property was expected." + }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { + code: 1079, + category: 1, + key: "A 'declare' modifier cannot be used with an import declaration." + }, + Invalid_reference_directive_syntax: { + code: 1084, + category: 1, + key: "Invalid 'reference' directive syntax." + }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { + code: 1085, + category: 1, + key: "Octal literals are not available when targeting ECMAScript 5 and higher." + }, + An_accessor_cannot_be_declared_in_an_ambient_context: { + code: 1086, + category: 1, + key: "An accessor cannot be declared in an ambient context." + }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { + code: 1089, + category: 1, + key: "'{0}' modifier cannot appear on a constructor declaration." + }, + _0_modifier_cannot_appear_on_a_parameter: { + code: 1090, + category: 1, + key: "'{0}' modifier cannot appear on a parameter." + }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { + code: 1091, + category: 1, + key: "Only a single variable declaration is allowed in a 'for...in' statement." + }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { + code: 1092, + category: 1, + key: "Type parameters cannot appear on a constructor declaration." + }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { + code: 1093, + category: 1, + key: "Type annotation cannot appear on a constructor declaration." + }, + An_accessor_cannot_have_type_parameters: { + code: 1094, + category: 1, + key: "An accessor cannot have type parameters." + }, + A_set_accessor_cannot_have_a_return_type_annotation: { + code: 1095, + category: 1, + key: "A 'set' accessor cannot have a return type annotation." + }, + An_index_signature_must_have_exactly_one_parameter: { + code: 1096, + category: 1, + key: "An index signature must have exactly one parameter." + }, + _0_list_cannot_be_empty: { + code: 1097, + category: 1, + key: "'{0}' list cannot be empty." + }, + Type_parameter_list_cannot_be_empty: { + code: 1098, + category: 1, + key: "Type parameter list cannot be empty." + }, + Type_argument_list_cannot_be_empty: { + code: 1099, + category: 1, + key: "Type argument list cannot be empty." + }, + Invalid_use_of_0_in_strict_mode: { + code: 1100, + category: 1, + key: "Invalid use of '{0}' in strict mode." + }, + with_statements_are_not_allowed_in_strict_mode: { + code: 1101, + category: 1, + key: "'with' statements are not allowed in strict mode." + }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { + code: 1102, + category: 1, + key: "'delete' cannot be called on an identifier in strict mode." + }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { + code: 1104, + category: 1, + key: "A 'continue' statement can only be used within an enclosing iteration statement." + }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { + code: 1105, + category: 1, + key: "A 'break' statement can only be used within an enclosing iteration or switch statement." + }, + Jump_target_cannot_cross_function_boundary: { + code: 1107, + category: 1, + key: "Jump target cannot cross function boundary." + }, + A_return_statement_can_only_be_used_within_a_function_body: { + code: 1108, + category: 1, + key: "A 'return' statement can only be used within a function body." + }, + Expression_expected: { + code: 1109, + category: 1, + key: "Expression expected." + }, + Type_expected: { + code: 1110, + category: 1, + key: "Type expected." + }, + A_class_member_cannot_be_declared_optional: { + code: 1112, + category: 1, + key: "A class member cannot be declared optional." + }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { + code: 1113, + category: 1, + key: "A 'default' clause cannot appear more than once in a 'switch' statement." + }, + Duplicate_label_0: { + code: 1114, + category: 1, + key: "Duplicate label '{0}'" + }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { + code: 1115, + category: 1, + key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." + }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { + code: 1116, + category: 1, + key: "A 'break' statement can only jump to a label of an enclosing statement." + }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { + code: 1117, + category: 1, + key: "An object literal cannot have multiple properties with the same name in strict mode." + }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { + code: 1118, + category: 1, + key: "An object literal cannot have multiple get/set accessors with the same name." + }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { + code: 1119, + category: 1, + key: "An object literal cannot have property and accessor with the same name." + }, + An_export_assignment_cannot_have_modifiers: { + code: 1120, + category: 1, + key: "An export assignment cannot have modifiers." + }, + Octal_literals_are_not_allowed_in_strict_mode: { + code: 1121, + category: 1, + key: "Octal literals are not allowed in strict mode." + }, + A_tuple_type_element_list_cannot_be_empty: { + code: 1122, + category: 1, + key: "A tuple type element list cannot be empty." + }, + Variable_declaration_list_cannot_be_empty: { + code: 1123, + category: 1, + key: "Variable declaration list cannot be empty." + }, + Digit_expected: { + code: 1124, + category: 1, + key: "Digit expected." + }, + Hexadecimal_digit_expected: { + code: 1125, + category: 1, + key: "Hexadecimal digit expected." + }, + Unexpected_end_of_text: { + code: 1126, + category: 1, + key: "Unexpected end of text." + }, + Invalid_character: { + code: 1127, + category: 1, + key: "Invalid character." + }, + Declaration_or_statement_expected: { + code: 1128, + category: 1, + key: "Declaration or statement expected." + }, + Statement_expected: { + code: 1129, + category: 1, + key: "Statement expected." + }, + case_or_default_expected: { + code: 1130, + category: 1, + key: "'case' or 'default' expected." + }, + Property_or_signature_expected: { + code: 1131, + category: 1, + key: "Property or signature expected." + }, + Enum_member_expected: { + code: 1132, + category: 1, + key: "Enum member expected." + }, + Type_reference_expected: { + code: 1133, + category: 1, + key: "Type reference expected." + }, + Variable_declaration_expected: { + code: 1134, + category: 1, + key: "Variable declaration expected." + }, + Argument_expression_expected: { + code: 1135, + category: 1, + key: "Argument expression expected." + }, + Property_assignment_expected: { + code: 1136, + category: 1, + key: "Property assignment expected." + }, + Expression_or_comma_expected: { + code: 1137, + category: 1, + key: "Expression or comma expected." + }, + Parameter_declaration_expected: { + code: 1138, + category: 1, + key: "Parameter declaration expected." + }, + Type_parameter_declaration_expected: { + code: 1139, + category: 1, + key: "Type parameter declaration expected." + }, + Type_argument_expected: { + code: 1140, + category: 1, + key: "Type argument expected." + }, + String_literal_expected: { + code: 1141, + category: 1, + key: "String literal expected." + }, + Line_break_not_permitted_here: { + code: 1142, + category: 1, + key: "Line break not permitted here." + }, + or_expected: { + code: 1144, + category: 1, + key: "'{' or ';' expected." + }, + Modifiers_not_permitted_on_index_signature_members: { + code: 1145, + category: 1, + key: "Modifiers not permitted on index signature members." + }, + Declaration_expected: { + code: 1146, + category: 1, + key: "Declaration expected." + }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { + code: 1147, + category: 1, + key: "Import declarations in an internal module cannot reference an external module." + }, + Cannot_compile_external_modules_unless_the_module_flag_is_provided: { + code: 1148, + category: 1, + key: "Cannot compile external modules unless the '--module' flag is provided." + }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { + code: 1149, + category: 1, + key: "File name '{0}' differs from already included file name '{1}' only in casing" + }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { + code: 1150, + category: 1, + key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." + }, + var_let_or_const_expected: { + code: 1152, + category: 1, + key: "'var', 'let' or 'const' expected." + }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1153, + category: 1, + key: "'let' declarations are only available when targeting ECMAScript 6 and higher." + }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1154, + category: 1, + key: "'const' declarations are only available when targeting ECMAScript 6 and higher." + }, + const_declarations_must_be_initialized: { + code: 1155, + category: 1, + key: "'const' declarations must be initialized" + }, + const_declarations_can_only_be_declared_inside_a_block: { + code: 1156, + category: 1, + key: "'const' declarations can only be declared inside a block." + }, + let_declarations_can_only_be_declared_inside_a_block: { + code: 1157, + category: 1, + key: "'let' declarations can only be declared inside a block." + }, + Unterminated_template_literal: { + code: 1160, + category: 1, + key: "Unterminated template literal." + }, + Unterminated_regular_expression_literal: { + code: 1161, + category: 1, + key: "Unterminated regular expression literal." + }, + An_object_member_cannot_be_declared_optional: { + code: 1162, + category: 1, + key: "An object member cannot be declared optional." + }, + yield_expression_must_be_contained_within_a_generator_declaration: { + code: 1163, + category: 1, + key: "'yield' expression must be contained_within a generator declaration." + }, + Computed_property_names_are_not_allowed_in_enums: { + code: 1164, + category: 1, + key: "Computed property names are not allowed in enums." + }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { + code: 1165, + category: 1, + key: "A computed property name in an ambient context must directly refer to a built-in symbol." + }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { + code: 1166, + category: 1, + key: "A computed property name in a class property declaration must directly refer to a built-in symbol." + }, + Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1167, + category: 1, + key: "Computed property names are only available when targeting ECMAScript 6 and higher." + }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { + code: 1168, + category: 1, + key: "A computed property name in a method overload must directly refer to a built-in symbol." + }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { + code: 1169, + category: 1, + key: "A computed property name in an interface must directly refer to a built-in symbol." + }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { + code: 1170, + category: 1, + key: "A computed property name in a type literal must directly refer to a built-in symbol." + }, + A_comma_expression_is_not_allowed_in_a_computed_property_name: { + code: 1171, + category: 1, + key: "A comma expression is not allowed in a computed property name." + }, + extends_clause_already_seen: { + code: 1172, + category: 1, + key: "'extends' clause already seen." + }, + extends_clause_must_precede_implements_clause: { + code: 1173, + category: 1, + key: "'extends' clause must precede 'implements' clause." + }, + Classes_can_only_extend_a_single_class: { + code: 1174, + category: 1, + key: "Classes can only extend a single class." + }, + implements_clause_already_seen: { + code: 1175, + category: 1, + key: "'implements' clause already seen." + }, + Interface_declaration_cannot_have_implements_clause: { + code: 1176, + category: 1, + key: "Interface declaration cannot have 'implements' clause." + }, + Binary_digit_expected: { + code: 1177, + category: 1, + key: "Binary digit expected." + }, + Octal_digit_expected: { + code: 1178, + category: 1, + key: "Octal digit expected." + }, + Unexpected_token_expected: { + code: 1179, + category: 1, + key: "Unexpected token. '{' expected." + }, + Property_destructuring_pattern_expected: { + code: 1180, + category: 1, + key: "Property destructuring pattern expected." + }, + Array_element_destructuring_pattern_expected: { + code: 1181, + category: 1, + key: "Array element destructuring pattern expected." + }, + A_destructuring_declaration_must_have_an_initializer: { + code: 1182, + category: 1, + key: "A destructuring declaration must have an initializer." + }, + Destructuring_declarations_are_not_allowed_in_ambient_contexts: { + code: 1183, + category: 1, + key: "Destructuring declarations are not allowed in ambient contexts." + }, + An_implementation_cannot_be_declared_in_ambient_contexts: { + code: 1184, + category: 1, + key: "An implementation cannot be declared in ambient contexts." + }, + Modifiers_cannot_appear_here: { + code: 1184, + category: 1, + key: "Modifiers cannot appear here." + }, + Merge_conflict_marker_encountered: { + code: 1185, + category: 1, + key: "Merge conflict marker encountered." + }, + A_rest_element_cannot_have_an_initializer: { + code: 1186, + category: 1, + key: "A rest element cannot have an initializer." + }, + A_parameter_property_may_not_be_a_binding_pattern: { + code: 1187, + category: 1, + key: "A parameter property may not be a binding pattern." + }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { + code: 1188, + category: 1, + key: "Only a single variable declaration is allowed in a 'for...of' statement." + }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { + code: 1189, + category: 1, + key: "The variable declaration of a 'for...in' statement cannot have an initializer." + }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { + code: 1190, + category: 1, + key: "The variable declaration of a 'for...of' statement cannot have an initializer." + }, + An_import_declaration_cannot_have_modifiers: { + code: 1191, + category: 1, + key: "An import declaration cannot have modifiers." + }, + External_module_0_has_no_default_export_or_export_assignment: { + code: 1192, + category: 1, + key: "External module '{0}' has no default export or export assignment." + }, + An_export_declaration_cannot_have_modifiers: { + code: 1193, + category: 1, + key: "An export declaration cannot have modifiers." + }, + Export_declarations_are_not_permitted_in_an_internal_module: { + code: 1194, + category: 1, + key: "Export declarations are not permitted in an internal module." + }, + Catch_clause_variable_name_must_be_an_identifier: { + code: 1195, + category: 1, + key: "Catch clause variable name must be an identifier." + }, + Catch_clause_variable_cannot_have_a_type_annotation: { + code: 1196, + category: 1, + key: "Catch clause variable cannot have a type annotation." + }, + Catch_clause_variable_cannot_have_an_initializer: { + code: 1197, + category: 1, + key: "Catch clause variable cannot have an initializer." + }, + An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { + code: 1198, + category: 1, + key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." + }, + Unterminated_Unicode_escape_sequence: { + code: 1199, + category: 1, + key: "Unterminated Unicode escape sequence." + }, + Duplicate_identifier_0: { + code: 2300, + category: 1, + key: "Duplicate identifier '{0}'." + }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { + code: 2301, + category: 1, + key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." + }, + Static_members_cannot_reference_class_type_parameters: { + code: 2302, + category: 1, + key: "Static members cannot reference class type parameters." + }, + Circular_definition_of_import_alias_0: { + code: 2303, + category: 1, + key: "Circular definition of import alias '{0}'." + }, + Cannot_find_name_0: { + code: 2304, + category: 1, + key: "Cannot find name '{0}'." + }, + Module_0_has_no_exported_member_1: { + code: 2305, + category: 1, + key: "Module '{0}' has no exported member '{1}'." + }, + File_0_is_not_an_external_module: { + code: 2306, + category: 1, + key: "File '{0}' is not an external module." + }, + Cannot_find_external_module_0: { + code: 2307, + category: 1, + key: "Cannot find external module '{0}'." + }, + A_module_cannot_have_more_than_one_export_assignment: { + code: 2308, + category: 1, + key: "A module cannot have more than one export assignment." + }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { + code: 2309, + category: 1, + key: "An export assignment cannot be used in a module with other exported elements." + }, + Type_0_recursively_references_itself_as_a_base_type: { + code: 2310, + category: 1, + key: "Type '{0}' recursively references itself as a base type." + }, + A_class_may_only_extend_another_class: { + code: 2311, + category: 1, + key: "A class may only extend another class." + }, + An_interface_may_only_extend_a_class_or_another_interface: { + code: 2312, + category: 1, + key: "An interface may only extend a class or another interface." + }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { + code: 2313, + category: 1, + key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." + }, + Generic_type_0_requires_1_type_argument_s: { + code: 2314, + category: 1, + key: "Generic type '{0}' requires {1} type argument(s)." + }, + Type_0_is_not_generic: { + code: 2315, + category: 1, + key: "Type '{0}' is not generic." + }, + Global_type_0_must_be_a_class_or_interface_type: { + code: 2316, + category: 1, + key: "Global type '{0}' must be a class or interface type." + }, + Global_type_0_must_have_1_type_parameter_s: { + code: 2317, + category: 1, + key: "Global type '{0}' must have {1} type parameter(s)." + }, + Cannot_find_global_type_0: { + code: 2318, + category: 1, + key: "Cannot find global type '{0}'." + }, + Named_property_0_of_types_1_and_2_are_not_identical: { + code: 2319, + category: 1, + key: "Named property '{0}' of types '{1}' and '{2}' are not identical." + }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { + code: 2320, + category: 1, + key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." + }, + Excessive_stack_depth_comparing_types_0_and_1: { + code: 2321, + category: 1, + key: "Excessive stack depth comparing types '{0}' and '{1}'." + }, + Type_0_is_not_assignable_to_type_1: { + code: 2322, + category: 1, + key: "Type '{0}' is not assignable to type '{1}'." + }, + Property_0_is_missing_in_type_1: { + code: 2324, + category: 1, + key: "Property '{0}' is missing in type '{1}'." + }, + Property_0_is_private_in_type_1_but_not_in_type_2: { + code: 2325, + category: 1, + key: "Property '{0}' is private in type '{1}' but not in type '{2}'." + }, + Types_of_property_0_are_incompatible: { + code: 2326, + category: 1, + key: "Types of property '{0}' are incompatible." + }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { + code: 2327, + category: 1, + key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." + }, + Types_of_parameters_0_and_1_are_incompatible: { + code: 2328, + category: 1, + key: "Types of parameters '{0}' and '{1}' are incompatible." + }, + Index_signature_is_missing_in_type_0: { + code: 2329, + category: 1, + key: "Index signature is missing in type '{0}'." + }, + Index_signatures_are_incompatible: { + code: 2330, + category: 1, + key: "Index signatures are incompatible." + }, + this_cannot_be_referenced_in_a_module_body: { + code: 2331, + category: 1, + key: "'this' cannot be referenced in a module body." + }, + this_cannot_be_referenced_in_current_location: { + code: 2332, + category: 1, + key: "'this' cannot be referenced in current location." + }, + this_cannot_be_referenced_in_constructor_arguments: { + code: 2333, + category: 1, + key: "'this' cannot be referenced in constructor arguments." + }, + this_cannot_be_referenced_in_a_static_property_initializer: { + code: 2334, + category: 1, + key: "'this' cannot be referenced in a static property initializer." + }, + super_can_only_be_referenced_in_a_derived_class: { + code: 2335, + category: 1, + key: "'super' can only be referenced in a derived class." + }, + super_cannot_be_referenced_in_constructor_arguments: { + code: 2336, + category: 1, + key: "'super' cannot be referenced in constructor arguments." + }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { + code: 2337, + category: 1, + key: "Super calls are not permitted outside constructors or in nested functions inside constructors" + }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { + code: 2338, + category: 1, + key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" + }, + Property_0_does_not_exist_on_type_1: { + code: 2339, + category: 1, + key: "Property '{0}' does not exist on type '{1}'." + }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { + code: 2340, + category: 1, + key: "Only public and protected methods of the base class are accessible via the 'super' keyword" + }, + Property_0_is_private_and_only_accessible_within_class_1: { + code: 2341, + category: 1, + key: "Property '{0}' is private and only accessible within class '{1}'." + }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { + code: 2342, + category: 1, + key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." + }, + Type_0_does_not_satisfy_the_constraint_1: { + code: 2344, + category: 1, + key: "Type '{0}' does not satisfy the constraint '{1}'." + }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { + code: 2345, + category: 1, + key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." + }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { + code: 2346, + category: 1, + key: "Supplied parameters do not match any signature of call target." + }, + Untyped_function_calls_may_not_accept_type_arguments: { + code: 2347, + category: 1, + key: "Untyped function calls may not accept type arguments." + }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { + code: 2348, + category: 1, + key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" + }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { + code: 2349, + category: 1, + key: "Cannot invoke an expression whose type lacks a call signature." + }, + Only_a_void_function_can_be_called_with_the_new_keyword: { + code: 2350, + category: 1, + key: "Only a void function can be called with the 'new' keyword." + }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { + code: 2351, + category: 1, + key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." + }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { + code: 2352, + category: 1, + key: "Neither type '{0}' nor type '{1}' is assignable to the other." + }, + No_best_common_type_exists_among_return_expressions: { + code: 2354, + category: 1, + key: "No best common type exists among return expressions." + }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { + code: 2355, + category: 1, + key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." + }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { + code: 2356, + category: 1, + key: "An arithmetic operand must be of type 'any', 'number' or an enum type." + }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { + code: 2357, + category: 1, + key: "The operand of an increment or decrement operator must be a variable, property or indexer." + }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2358, + category: 1, + key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." + }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { + code: 2359, + category: 1, + key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." + }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { + code: 2360, + category: 1, + key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." + }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2361, + category: 1, + key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" + }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { + code: 2362, + category: 1, + key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." + }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { + code: 2363, + category: 1, + key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." + }, + Invalid_left_hand_side_of_assignment_expression: { + code: 2364, + category: 1, + key: "Invalid left-hand side of assignment expression." + }, + Operator_0_cannot_be_applied_to_types_1_and_2: { + code: 2365, + category: 1, + key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." + }, + Type_parameter_name_cannot_be_0: { + code: 2368, + category: 1, + key: "Type parameter name cannot be '{0}'" + }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { + code: 2369, + category: 1, + key: "A parameter property is only allowed in a constructor implementation." + }, + A_rest_parameter_must_be_of_an_array_type: { + code: 2370, + category: 1, + key: "A rest parameter must be of an array type." + }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { + code: 2371, + category: 1, + key: "A parameter initializer is only allowed in a function or constructor implementation." + }, + Parameter_0_cannot_be_referenced_in_its_initializer: { + code: 2372, + category: 1, + key: "Parameter '{0}' cannot be referenced in its initializer." + }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { + code: 2373, + category: 1, + key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." + }, + Duplicate_string_index_signature: { + code: 2374, + category: 1, + key: "Duplicate string index signature." + }, + Duplicate_number_index_signature: { + code: 2375, + category: 1, + key: "Duplicate number index signature." + }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { + code: 2376, + category: 1, + key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." + }, + Constructors_for_derived_classes_must_contain_a_super_call: { + code: 2377, + category: 1, + key: "Constructors for derived classes must contain a 'super' call." + }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { + code: 2378, + category: 1, + key: "A 'get' accessor must return a value or consist of a single 'throw' statement." + }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { + code: 2379, + category: 1, + key: "Getter and setter accessors do not agree in visibility." + }, + get_and_set_accessor_must_have_the_same_type: { + code: 2380, + category: 1, + key: "'get' and 'set' accessor must have the same type." + }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { + code: 2381, + category: 1, + key: "A signature with an implementation cannot use a string literal type." + }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { + code: 2382, + category: 1, + key: "Specialized overload signature is not assignable to any non-specialized signature." + }, + Overload_signatures_must_all_be_exported_or_not_exported: { + code: 2383, + category: 1, + key: "Overload signatures must all be exported or not exported." + }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { + code: 2384, + category: 1, + key: "Overload signatures must all be ambient or non-ambient." + }, + Overload_signatures_must_all_be_public_private_or_protected: { + code: 2385, + category: 1, + key: "Overload signatures must all be public, private or protected." + }, + Overload_signatures_must_all_be_optional_or_required: { + code: 2386, + category: 1, + key: "Overload signatures must all be optional or required." + }, + Function_overload_must_be_static: { + code: 2387, + category: 1, + key: "Function overload must be static." + }, + Function_overload_must_not_be_static: { + code: 2388, + category: 1, + key: "Function overload must not be static." + }, + Function_implementation_name_must_be_0: { + code: 2389, + category: 1, + key: "Function implementation name must be '{0}'." + }, + Constructor_implementation_is_missing: { + code: 2390, + category: 1, + key: "Constructor implementation is missing." + }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { + code: 2391, + category: 1, + key: "Function implementation is missing or not immediately following the declaration." + }, + Multiple_constructor_implementations_are_not_allowed: { + code: 2392, + category: 1, + key: "Multiple constructor implementations are not allowed." + }, + Duplicate_function_implementation: { + code: 2393, + category: 1, + key: "Duplicate function implementation." + }, + Overload_signature_is_not_compatible_with_function_implementation: { + code: 2394, + category: 1, + key: "Overload signature is not compatible with function implementation." + }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { + code: 2395, + category: 1, + key: "Individual declarations in merged declaration {0} must be all exported or all local." + }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { + code: 2396, + category: 1, + key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." + }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { + code: 2399, + category: 1, + key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." + }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { + code: 2400, + category: 1, + key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." + }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { + code: 2401, + category: 1, + key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." + }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { + code: 2402, + category: 1, + key: "Expression resolves to '_super' that compiler uses to capture base class reference." + }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { + code: 2403, + category: 1, + key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." + }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { + code: 2404, + category: 1, + key: "The left-hand side of a 'for...in' statement cannot use a type annotation." + }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { + code: 2405, + category: 1, + key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." + }, + Invalid_left_hand_side_in_for_in_statement: { + code: 2406, + category: 1, + key: "Invalid left-hand side in 'for...in' statement." + }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2407, + category: 1, + key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." + }, + Setters_cannot_return_a_value: { + code: 2408, + category: 1, + key: "Setters cannot return a value." + }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { + code: 2409, + category: 1, + key: "Return type of constructor signature must be assignable to the instance type of the class" + }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { + code: 2410, + category: 1, + key: "All symbols within a 'with' block will be resolved to 'any'." + }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { + code: 2411, + category: 1, + key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." + }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { + code: 2412, + category: 1, + key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." + }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { + code: 2413, + category: 1, + key: "Numeric index type '{0}' is not assignable to string index type '{1}'." + }, + Class_name_cannot_be_0: { + code: 2414, + category: 1, + key: "Class name cannot be '{0}'" + }, + Class_0_incorrectly_extends_base_class_1: { + code: 2415, + category: 1, + key: "Class '{0}' incorrectly extends base class '{1}'." + }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { + code: 2417, + category: 1, + key: "Class static side '{0}' incorrectly extends base class static side '{1}'." + }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { + code: 2419, + category: 1, + key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." + }, + Class_0_incorrectly_implements_interface_1: { + code: 2420, + category: 1, + key: "Class '{0}' incorrectly implements interface '{1}'." + }, + A_class_may_only_implement_another_class_or_interface: { + code: 2422, + category: 1, + key: "A class may only implement another class or interface." + }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { + code: 2423, + category: 1, + key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." + }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { + code: 2424, + category: 1, + key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." + }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { + code: 2425, + category: 1, + key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." + }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { + code: 2426, + category: 1, + key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." + }, + Interface_name_cannot_be_0: { + code: 2427, + category: 1, + key: "Interface name cannot be '{0}'" + }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { + code: 2428, + category: 1, + key: "All declarations of an interface must have identical type parameters." + }, + Interface_0_incorrectly_extends_interface_1: { + code: 2430, + category: 1, + key: "Interface '{0}' incorrectly extends interface '{1}'." + }, + Enum_name_cannot_be_0: { + code: 2431, + category: 1, + key: "Enum name cannot be '{0}'" + }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { + code: 2432, + category: 1, + key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." + }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { + code: 2433, + category: 1, + key: "A module declaration cannot be in a different file from a class or function with which it is merged" + }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { + code: 2434, + category: 1, + key: "A module declaration cannot be located prior to a class or function with which it is merged" + }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { + code: 2435, + category: 1, + key: "Ambient external modules cannot be nested in other modules." + }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { + code: 2436, + category: 1, + key: "Ambient external module declaration cannot specify relative module name." + }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { + code: 2437, + category: 1, + key: "Module '{0}' is hidden by a local declaration with the same name" + }, + Import_name_cannot_be_0: { + code: 2438, + category: 1, + key: "Import name cannot be '{0}'" + }, + Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { + code: 2439, + category: 1, + key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." + }, + Import_declaration_conflicts_with_local_declaration_of_0: { + code: 2440, + category: 1, + key: "Import declaration conflicts with local declaration of '{0}'" + }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { + code: 2441, + category: 1, + key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." + }, + Types_have_separate_declarations_of_a_private_property_0: { + code: 2442, + category: 1, + key: "Types have separate declarations of a private property '{0}'." + }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { + code: 2443, + category: 1, + key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." + }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { + code: 2444, + category: 1, + key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." + }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { + code: 2445, + category: 1, + key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." + }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { + code: 2446, + category: 1, + key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." + }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { + code: 2447, + category: 1, + key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." + }, + Block_scoped_variable_0_used_before_its_declaration: { + code: 2448, + category: 1, + key: "Block-scoped variable '{0}' used before its declaration." + }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { + code: 2449, + category: 1, + key: "The operand of an increment or decrement operator cannot be a constant." + }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { + code: 2450, + category: 1, + key: "Left-hand side of assignment expression cannot be a constant." + }, + Cannot_redeclare_block_scoped_variable_0: { + code: 2451, + category: 1, + key: "Cannot redeclare block-scoped variable '{0}'." + }, + An_enum_member_cannot_have_a_numeric_name: { + code: 2452, + category: 1, + key: "An enum member cannot have a numeric name." + }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { + code: 2453, + category: 1, + key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." + }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { + code: 2455, + category: 1, + key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." + }, + Type_alias_0_circularly_references_itself: { + code: 2456, + category: 1, + key: "Type alias '{0}' circularly references itself." + }, + Type_alias_name_cannot_be_0: { + code: 2457, + category: 1, + key: "Type alias name cannot be '{0}'" + }, + An_AMD_module_cannot_have_multiple_name_assignments: { + code: 2458, + category: 1, + key: "An AMD module cannot have multiple name assignments." + }, + Type_0_has_no_property_1_and_no_string_index_signature: { + code: 2459, + category: 1, + key: "Type '{0}' has no property '{1}' and no string index signature." + }, + Type_0_has_no_property_1: { + code: 2460, + category: 1, + key: "Type '{0}' has no property '{1}'." + }, + Type_0_is_not_an_array_type: { + code: 2461, + category: 1, + key: "Type '{0}' is not an array type." + }, + A_rest_element_must_be_last_in_an_array_destructuring_pattern: { + code: 2462, + category: 1, + key: "A rest element must be last in an array destructuring pattern" + }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { + code: 2463, + category: 1, + key: "A binding pattern parameter cannot be optional in an implementation signature." + }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { + code: 2464, + category: 1, + key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." + }, + this_cannot_be_referenced_in_a_computed_property_name: { + code: 2465, + category: 1, + key: "'this' cannot be referenced in a computed property name." + }, + super_cannot_be_referenced_in_a_computed_property_name: { + code: 2466, + category: 1, + key: "'super' cannot be referenced in a computed property name." + }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { + code: 2467, + category: 1, + key: "A computed property name cannot reference a type parameter from its containing type." + }, + Cannot_find_global_value_0: { + code: 2468, + category: 1, + key: "Cannot find global value '{0}'." + }, + The_0_operator_cannot_be_applied_to_type_symbol: { + code: 2469, + category: 1, + key: "The '{0}' operator cannot be applied to type 'symbol'." + }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { + code: 2470, + category: 1, + key: "'Symbol' reference does not refer to the global Symbol constructor object." + }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { + code: 2471, + category: 1, + key: "A computed property name of the form '{0}' must be of type 'symbol'." + }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 2472, + category: 1, + key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." + }, + Enum_declarations_must_all_be_const_or_non_const: { + code: 2473, + category: 1, + key: "Enum declarations must all be const or non-const." + }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { + code: 2474, + category: 1, + key: "In 'const' enum declarations member initializer must be constant expression." + }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { + code: 2475, + category: 1, + key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." + }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { + code: 2476, + category: 1, + key: "A const enum member can only be accessed using a string literal." + }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { + code: 2477, + category: 1, + key: "'const' enum member initializer was evaluated to a non-finite value." + }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { + code: 2478, + category: 1, + key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." + }, + Property_0_does_not_exist_on_const_enum_1: { + code: 2479, + category: 1, + key: "Property '{0}' does not exist on 'const' enum '{1}'." + }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { + code: 2480, + category: 1, + key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." + }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { + code: 2481, + category: 1, + key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." + }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { + code: 2483, + category: 1, + key: "The left-hand side of a 'for...of' statement cannot use a type annotation." + }, + Export_declaration_conflicts_with_exported_declaration_of_0: { + code: 2484, + category: 1, + key: "Export declaration conflicts with exported declaration of '{0}'" + }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { + code: 2485, + category: 1, + key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." + }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { + code: 2486, + category: 1, + key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." + }, + Invalid_left_hand_side_in_for_of_statement: { + code: 2487, + category: 1, + key: "Invalid left-hand side in 'for...of' statement." + }, + The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { + code: 2488, + category: 1, + key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." + }, + The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { + code: 2489, + category: 1, + key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." + }, + The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { + code: 2490, + category: 1, + key: "The type returned by the 'next()' method of an iterator must have a 'value' property." + }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { + code: 2491, + category: 1, + key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." + }, + Cannot_redeclare_identifier_0_in_catch_clause: { + code: 2492, + category: 1, + key: "Cannot redeclare identifier '{0}' in catch clause" + }, + Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { + code: 2493, + category: 1, + key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." + }, + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { + code: 2494, + category: 1, + key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." + }, + Type_0_is_not_an_array_type_or_a_string_type: { + code: 2461, + category: 1, + key: "Type '{0}' is not an array type or a string type." + }, + Import_declaration_0_is_using_private_name_1: { + code: 4000, + category: 1, + key: "Import declaration '{0}' is using private name '{1}'." + }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4002, + category: 1, + key: "Type parameter '{0}' of exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { + code: 4004, + category: 1, + key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4006, + category: 1, + key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4008, + category: 1, + key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4010, + category: 1, + key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4012, + category: 1, + key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { + code: 4014, + category: 1, + key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { + code: 4016, + category: 1, + key: "Type parameter '{0}' of exported function has or is using private name '{1}'." + }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { + code: 4019, + category: 1, + key: "Implements clause of exported class '{0}' has or is using private name '{1}'." + }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { + code: 4020, + category: 1, + key: "Extends clause of exported class '{0}' has or is using private name '{1}'." + }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { + code: 4022, + category: 1, + key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." + }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4023, + category: 1, + key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." + }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { + code: 4024, + category: 1, + key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." + }, + Exported_variable_0_has_or_is_using_private_name_1: { + code: 4025, + category: 1, + key: "Exported variable '{0}' has or is using private name '{1}'." + }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4026, + category: 1, + key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4027, + category: 1, + key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." + }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4028, + category: 1, + key: "Public static property '{0}' of exported class has or is using private name '{1}'." + }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4029, + category: 1, + key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4030, + category: 1, + key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." + }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4031, + category: 1, + key: "Public property '{0}' of exported class has or is using private name '{1}'." + }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4032, + category: 1, + key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." + }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { + code: 4033, + category: 1, + key: "Property '{0}' of exported interface has or is using private name '{1}'." + }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4034, + category: 1, + key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { + code: 4035, + category: 1, + key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." + }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4036, + category: 1, + key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { + code: 4037, + category: 1, + key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4038, + category: 1, + key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4039, + category: 1, + key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { + code: 4040, + category: 1, + key: "Return type of public static property getter from exported class has or is using private name '{0}'." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4041, + category: 1, + key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4042, + category: 1, + key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { + code: 4043, + category: 1, + key: "Return type of public property getter from exported class has or is using private name '{0}'." + }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4044, + category: 1, + key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4045, + category: 1, + key: "Return type of constructor signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4046, + category: 1, + key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4047, + category: 1, + key: "Return type of call signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4048, + category: 1, + key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4049, + category: 1, + key: "Return type of index signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4050, + category: 1, + key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4051, + category: 1, + key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { + code: 4052, + category: 1, + key: "Return type of public static method from exported class has or is using private name '{0}'." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4053, + category: 1, + key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4054, + category: 1, + key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { + code: 4055, + category: 1, + key: "Return type of public method from exported class has or is using private name '{0}'." + }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4056, + category: 1, + key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { + code: 4057, + category: 1, + key: "Return type of method from exported interface has or is using private name '{0}'." + }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4058, + category: 1, + key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { + code: 4059, + category: 1, + key: "Return type of exported function has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { + code: 4060, + category: 1, + key: "Return type of exported function has or is using private name '{0}'." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4061, + category: 1, + key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4062, + category: 1, + key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { + code: 4063, + category: 1, + key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." + }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4064, + category: 1, + key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4065, + category: 1, + key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4066, + category: 1, + key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4067, + category: 1, + key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4068, + category: 1, + key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4069, + category: 1, + key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4070, + category: 1, + key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4071, + category: 1, + key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4072, + category: 1, + key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4073, + category: 1, + key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." + }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4074, + category: 1, + key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { + code: 4075, + category: 1, + key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4076, + category: 1, + key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { + code: 4077, + category: 1, + key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { + code: 4078, + category: 1, + key: "Parameter '{0}' of exported function has or is using private name '{1}'." + }, + Exported_type_alias_0_has_or_is_using_private_name_1: { + code: 4081, + category: 1, + key: "Exported type alias '{0}' has or is using private name '{1}'." + }, + Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { + code: 4091, + category: 1, + key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." + }, + The_current_host_does_not_support_the_0_option: { + code: 5001, + category: 1, + key: "The current host does not support the '{0}' option." + }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { + code: 5009, + category: 1, + key: "Cannot find the common subdirectory path for the input files." + }, + Cannot_read_file_0_Colon_1: { + code: 5012, + category: 1, + key: "Cannot read file '{0}': {1}" + }, + Unsupported_file_encoding: { + code: 5013, + category: 1, + key: "Unsupported file encoding." + }, + Unknown_compiler_option_0: { + code: 5023, + category: 1, + key: "Unknown compiler option '{0}'." + }, + Compiler_option_0_requires_a_value_of_type_1: { + code: 5024, + category: 1, + key: "Compiler option '{0}' requires a value of type {1}." + }, + Could_not_write_file_0_Colon_1: { + code: 5033, + category: 1, + key: "Could not write file '{0}': {1}" + }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { + code: 5038, + category: 1, + key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." + }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { + code: 5039, + category: 1, + key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." + }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { + code: 5040, + category: 1, + key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." + }, + Option_noEmit_cannot_be_specified_with_option_declaration: { + code: 5041, + category: 1, + key: "Option 'noEmit' cannot be specified with option 'declaration'." + }, + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { + code: 5042, + category: 1, + key: "Option 'project' cannot be mixed with source files on a command line." + }, + Concatenate_and_emit_output_to_single_file: { + code: 6001, + category: 2, + key: "Concatenate and emit output to single file." + }, + Generates_corresponding_d_ts_file: { + code: 6002, + category: 2, + key: "Generates corresponding '.d.ts' file." + }, + Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { + code: 6003, + category: 2, + key: "Specifies the location where debugger should locate map files instead of generated locations." + }, + Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { + code: 6004, + category: 2, + key: "Specifies the location where debugger should locate TypeScript files instead of source locations." + }, + Watch_input_files: { + code: 6005, + category: 2, + key: "Watch input files." + }, + Redirect_output_structure_to_the_directory: { + code: 6006, + category: 2, + key: "Redirect output structure to the directory." + }, + Do_not_erase_const_enum_declarations_in_generated_code: { + code: 6007, + category: 2, + key: "Do not erase const enum declarations in generated code." + }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { + code: 6008, + category: 2, + key: "Do not emit outputs if any type checking errors were reported." + }, + Do_not_emit_comments_to_output: { + code: 6009, + category: 2, + key: "Do not emit comments to output." + }, + Do_not_emit_outputs: { + code: 6010, + category: 2, + key: "Do not emit outputs." + }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { + code: 6015, + category: 2, + key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" + }, + Specify_module_code_generation_Colon_commonjs_or_amd: { + code: 6016, + category: 2, + key: "Specify module code generation: 'commonjs' or 'amd'" + }, + Print_this_message: { + code: 6017, + category: 2, + key: "Print this message." + }, + Print_the_compiler_s_version: { + code: 6019, + category: 2, + key: "Print the compiler's version." + }, + Compile_the_project_in_the_given_directory: { + code: 6020, + category: 2, + key: "Compile the project in the given directory." + }, + Syntax_Colon_0: { + code: 6023, + category: 2, + key: "Syntax: {0}" + }, + options: { + code: 6024, + category: 2, + key: "options" + }, + file: { + code: 6025, + category: 2, + key: "file" + }, + Examples_Colon_0: { + code: 6026, + category: 2, + key: "Examples: {0}" + }, + Options_Colon: { + code: 6027, + category: 2, + key: "Options:" + }, + Version_0: { + code: 6029, + category: 2, + key: "Version {0}" + }, + Insert_command_line_options_and_files_from_a_file: { + code: 6030, + category: 2, + key: "Insert command line options and files from a file." + }, + File_change_detected_Starting_incremental_compilation: { + code: 6032, + category: 2, + key: "File change detected. Starting incremental compilation..." + }, + KIND: { + code: 6034, + category: 2, + key: "KIND" + }, + FILE: { + code: 6035, + category: 2, + key: "FILE" + }, + VERSION: { + code: 6036, + category: 2, + key: "VERSION" + }, + LOCATION: { + code: 6037, + category: 2, + key: "LOCATION" + }, + DIRECTORY: { + code: 6038, + category: 2, + key: "DIRECTORY" + }, + Compilation_complete_Watching_for_file_changes: { + code: 6042, + category: 2, + key: "Compilation complete. Watching for file changes." + }, + Generates_corresponding_map_file: { + code: 6043, + category: 2, + key: "Generates corresponding '.map' file." + }, + Compiler_option_0_expects_an_argument: { + code: 6044, + category: 1, + key: "Compiler option '{0}' expects an argument." + }, + Unterminated_quoted_string_in_response_file_0: { + code: 6045, + category: 1, + key: "Unterminated quoted string in response file '{0}'." + }, + Argument_for_module_option_must_be_commonjs_or_amd: { + code: 6046, + category: 1, + key: "Argument for '--module' option must be 'commonjs' or 'amd'." + }, + Argument_for_target_option_must_be_es3_es5_or_es6: { + code: 6047, + category: 1, + key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." + }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { + code: 6048, + category: 1, + key: "Locale must be of the form or -. For example '{0}' or '{1}'." + }, + Unsupported_locale_0: { + code: 6049, + category: 1, + key: "Unsupported locale '{0}'." + }, + Unable_to_open_file_0: { + code: 6050, + category: 1, + key: "Unable to open file '{0}'." + }, + Corrupted_locale_file_0: { + code: 6051, + category: 1, + key: "Corrupted locale file {0}." + }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { + code: 6052, + category: 2, + key: "Raise error on expressions and declarations with an implied 'any' type." + }, + File_0_not_found: { + code: 6053, + category: 1, + key: "File '{0}' not found." + }, + File_0_must_have_extension_ts_or_d_ts: { + code: 6054, + category: 1, + key: "File '{0}' must have extension '.ts' or '.d.ts'." + }, + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { + code: 6055, + category: 2, + key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." + }, + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { + code: 6056, + category: 2, + key: "Do not emit declarations for code that has an '@internal' annotation." + }, + Preserve_new_lines_when_emitting_code: { + code: 6057, + category: 2, + key: "Preserve new-lines when emitting code." + }, + Variable_0_implicitly_has_an_1_type: { + code: 7005, + category: 1, + key: "Variable '{0}' implicitly has an '{1}' type." + }, + Parameter_0_implicitly_has_an_1_type: { + code: 7006, + category: 1, + key: "Parameter '{0}' implicitly has an '{1}' type." + }, + Member_0_implicitly_has_an_1_type: { + code: 7008, + category: 1, + key: "Member '{0}' implicitly has an '{1}' type." + }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { + code: 7009, + category: 1, + key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." + }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { + code: 7010, + category: 1, + key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." + }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { + code: 7011, + category: 1, + key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." + }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { + code: 7013, + category: 1, + key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." + }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { + code: 7016, + category: 1, + key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." + }, + Index_signature_of_object_type_implicitly_has_an_any_type: { + code: 7017, + category: 1, + key: "Index signature of object type implicitly has an 'any' type." + }, + Object_literal_s_property_0_implicitly_has_an_1_type: { + code: 7018, + category: 1, + key: "Object literal's property '{0}' implicitly has an '{1}' type." + }, + Rest_parameter_0_implicitly_has_an_any_type: { + code: 7019, + category: 1, + key: "Rest parameter '{0}' implicitly has an 'any[]' type." + }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { + code: 7020, + category: 1, + key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." + }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { + code: 7021, + category: 1, + key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." + }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { + code: 7022, + category: 1, + key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." + }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { + code: 7023, + category: 1, + key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." + }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { + code: 7024, + category: 1, + key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." + }, + You_cannot_rename_this_element: { + code: 8000, + category: 1, + key: "You cannot rename this element." + }, + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { + code: 8001, + category: 1, + key: "You cannot rename elements that are defined in the standard TypeScript library." + }, + yield_expressions_are_not_currently_supported: { + code: 9000, + category: 1, + key: "'yield' expressions are not currently supported." + }, + Generators_are_not_currently_supported: { + code: 9001, + category: 1, + key: "Generators are not currently supported." + }, + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { + code: 9002, + category: 1, + key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." + } }; })(ts || (ts = {})); var ts; @@ -2048,10 +4013,2806 @@ var ts; "|=": 62, "^=": 63 }; - var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierStart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 543, + 546, + 563, + 592, + 685, + 688, + 696, + 699, + 705, + 720, + 721, + 736, + 740, + 750, + 750, + 890, + 890, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 974, + 976, + 983, + 986, + 1011, + 1024, + 1153, + 1164, + 1220, + 1223, + 1224, + 1227, + 1228, + 1232, + 1269, + 1272, + 1273, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1488, + 1514, + 1520, + 1522, + 1569, + 1594, + 1600, + 1610, + 1649, + 1747, + 1749, + 1749, + 1765, + 1766, + 1786, + 1788, + 1808, + 1808, + 1810, + 1836, + 1920, + 1957, + 2309, + 2361, + 2365, + 2365, + 2384, + 2384, + 2392, + 2401, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2524, + 2525, + 2527, + 2529, + 2544, + 2545, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2649, + 2652, + 2654, + 2654, + 2674, + 2676, + 2693, + 2699, + 2701, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2749, + 2749, + 2768, + 2768, + 2784, + 2784, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2870, + 2873, + 2877, + 2877, + 2908, + 2909, + 2911, + 2913, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 2997, + 2999, + 3001, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3168, + 3169, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3294, + 3294, + 3296, + 3297, + 3333, + 3340, + 3342, + 3344, + 3346, + 3368, + 3370, + 3385, + 3424, + 3425, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3585, + 3632, + 3634, + 3635, + 3648, + 3654, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3760, + 3762, + 3763, + 3773, + 3773, + 3776, + 3780, + 3782, + 3782, + 3804, + 3805, + 3840, + 3840, + 3904, + 3911, + 3913, + 3946, + 3976, + 3979, + 4096, + 4129, + 4131, + 4135, + 4137, + 4138, + 4176, + 4181, + 4256, + 4293, + 4304, + 4342, + 4352, + 4441, + 4447, + 4514, + 4520, + 4601, + 4608, + 4614, + 4616, + 4678, + 4680, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4742, + 4744, + 4744, + 4746, + 4749, + 4752, + 4782, + 4784, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4814, + 4816, + 4822, + 4824, + 4846, + 4848, + 4878, + 4880, + 4880, + 4882, + 4885, + 4888, + 4894, + 4896, + 4934, + 4936, + 4954, + 5024, + 5108, + 5121, + 5740, + 5743, + 5750, + 5761, + 5786, + 5792, + 5866, + 6016, + 6067, + 6176, + 6263, + 6272, + 6312, + 7680, + 7835, + 7840, + 7929, + 7936, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8319, + 8319, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8497, + 8499, + 8505, + 8544, + 8579, + 12293, + 12295, + 12321, + 12329, + 12337, + 12341, + 12344, + 12346, + 12353, + 12436, + 12445, + 12446, + 12449, + 12538, + 12540, + 12542, + 12549, + 12588, + 12593, + 12686, + 12704, + 12727, + 13312, + 19893, + 19968, + 40869, + 40960, + 42124, + 44032, + 55203, + 63744, + 64045, + 64256, + 64262, + 64275, + 64279, + 64285, + 64285, + 64287, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65136, + 65138, + 65140, + 65140, + 65142, + 65276, + 65313, + 65338, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES3IdentifierPart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 543, + 546, + 563, + 592, + 685, + 688, + 696, + 699, + 705, + 720, + 721, + 736, + 740, + 750, + 750, + 768, + 846, + 864, + 866, + 890, + 890, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 974, + 976, + 983, + 986, + 1011, + 1024, + 1153, + 1155, + 1158, + 1164, + 1220, + 1223, + 1224, + 1227, + 1228, + 1232, + 1269, + 1272, + 1273, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1425, + 1441, + 1443, + 1465, + 1467, + 1469, + 1471, + 1471, + 1473, + 1474, + 1476, + 1476, + 1488, + 1514, + 1520, + 1522, + 1569, + 1594, + 1600, + 1621, + 1632, + 1641, + 1648, + 1747, + 1749, + 1756, + 1759, + 1768, + 1770, + 1773, + 1776, + 1788, + 1808, + 1836, + 1840, + 1866, + 1920, + 1968, + 2305, + 2307, + 2309, + 2361, + 2364, + 2381, + 2384, + 2388, + 2392, + 2403, + 2406, + 2415, + 2433, + 2435, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2492, + 2492, + 2494, + 2500, + 2503, + 2504, + 2507, + 2509, + 2519, + 2519, + 2524, + 2525, + 2527, + 2531, + 2534, + 2545, + 2562, + 2562, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2620, + 2620, + 2622, + 2626, + 2631, + 2632, + 2635, + 2637, + 2649, + 2652, + 2654, + 2654, + 2662, + 2676, + 2689, + 2691, + 2693, + 2699, + 2701, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2748, + 2757, + 2759, + 2761, + 2763, + 2765, + 2768, + 2768, + 2784, + 2784, + 2790, + 2799, + 2817, + 2819, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2870, + 2873, + 2876, + 2883, + 2887, + 2888, + 2891, + 2893, + 2902, + 2903, + 2908, + 2909, + 2911, + 2913, + 2918, + 2927, + 2946, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 2997, + 2999, + 3001, + 3006, + 3010, + 3014, + 3016, + 3018, + 3021, + 3031, + 3031, + 3047, + 3055, + 3073, + 3075, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3134, + 3140, + 3142, + 3144, + 3146, + 3149, + 3157, + 3158, + 3168, + 3169, + 3174, + 3183, + 3202, + 3203, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3262, + 3268, + 3270, + 3272, + 3274, + 3277, + 3285, + 3286, + 3294, + 3294, + 3296, + 3297, + 3302, + 3311, + 3330, + 3331, + 3333, + 3340, + 3342, + 3344, + 3346, + 3368, + 3370, + 3385, + 3390, + 3395, + 3398, + 3400, + 3402, + 3405, + 3415, + 3415, + 3424, + 3425, + 3430, + 3439, + 3458, + 3459, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3530, + 3530, + 3535, + 3540, + 3542, + 3542, + 3544, + 3551, + 3570, + 3571, + 3585, + 3642, + 3648, + 3662, + 3664, + 3673, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3769, + 3771, + 3773, + 3776, + 3780, + 3782, + 3782, + 3784, + 3789, + 3792, + 3801, + 3804, + 3805, + 3840, + 3840, + 3864, + 3865, + 3872, + 3881, + 3893, + 3893, + 3895, + 3895, + 3897, + 3897, + 3902, + 3911, + 3913, + 3946, + 3953, + 3972, + 3974, + 3979, + 3984, + 3991, + 3993, + 4028, + 4038, + 4038, + 4096, + 4129, + 4131, + 4135, + 4137, + 4138, + 4140, + 4146, + 4150, + 4153, + 4160, + 4169, + 4176, + 4185, + 4256, + 4293, + 4304, + 4342, + 4352, + 4441, + 4447, + 4514, + 4520, + 4601, + 4608, + 4614, + 4616, + 4678, + 4680, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4742, + 4744, + 4744, + 4746, + 4749, + 4752, + 4782, + 4784, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4814, + 4816, + 4822, + 4824, + 4846, + 4848, + 4878, + 4880, + 4880, + 4882, + 4885, + 4888, + 4894, + 4896, + 4934, + 4936, + 4954, + 4969, + 4977, + 5024, + 5108, + 5121, + 5740, + 5743, + 5750, + 5761, + 5786, + 5792, + 5866, + 6016, + 6099, + 6112, + 6121, + 6160, + 6169, + 6176, + 6263, + 6272, + 6313, + 7680, + 7835, + 7840, + 7929, + 7936, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8255, + 8256, + 8319, + 8319, + 8400, + 8412, + 8417, + 8417, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8497, + 8499, + 8505, + 8544, + 8579, + 12293, + 12295, + 12321, + 12335, + 12337, + 12341, + 12344, + 12346, + 12353, + 12436, + 12441, + 12442, + 12445, + 12446, + 12449, + 12542, + 12549, + 12588, + 12593, + 12686, + 12704, + 12727, + 13312, + 19893, + 19968, + 40869, + 40960, + 42124, + 44032, + 55203, + 63744, + 64045, + 64256, + 64262, + 64275, + 64279, + 64285, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65056, + 65059, + 65075, + 65076, + 65101, + 65103, + 65136, + 65138, + 65140, + 65140, + 65142, + 65276, + 65296, + 65305, + 65313, + 65338, + 65343, + 65343, + 65345, + 65370, + 65381, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES5IdentifierStart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 705, + 710, + 721, + 736, + 740, + 748, + 748, + 750, + 750, + 880, + 884, + 886, + 887, + 890, + 893, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 1013, + 1015, + 1153, + 1162, + 1319, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1488, + 1514, + 1520, + 1522, + 1568, + 1610, + 1646, + 1647, + 1649, + 1747, + 1749, + 1749, + 1765, + 1766, + 1774, + 1775, + 1786, + 1788, + 1791, + 1791, + 1808, + 1808, + 1810, + 1839, + 1869, + 1957, + 1969, + 1969, + 1994, + 2026, + 2036, + 2037, + 2042, + 2042, + 2048, + 2069, + 2074, + 2074, + 2084, + 2084, + 2088, + 2088, + 2112, + 2136, + 2208, + 2208, + 2210, + 2220, + 2308, + 2361, + 2365, + 2365, + 2384, + 2384, + 2392, + 2401, + 2417, + 2423, + 2425, + 2431, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2493, + 2493, + 2510, + 2510, + 2524, + 2525, + 2527, + 2529, + 2544, + 2545, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2649, + 2652, + 2654, + 2654, + 2674, + 2676, + 2693, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2749, + 2749, + 2768, + 2768, + 2784, + 2785, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2869, + 2873, + 2877, + 2877, + 2908, + 2909, + 2911, + 2913, + 2929, + 2929, + 2947, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 3001, + 3024, + 3024, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3133, + 3133, + 3160, + 3161, + 3168, + 3169, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3261, + 3261, + 3294, + 3294, + 3296, + 3297, + 3313, + 3314, + 3333, + 3340, + 3342, + 3344, + 3346, + 3386, + 3389, + 3389, + 3406, + 3406, + 3424, + 3425, + 3450, + 3455, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3585, + 3632, + 3634, + 3635, + 3648, + 3654, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3760, + 3762, + 3763, + 3773, + 3773, + 3776, + 3780, + 3782, + 3782, + 3804, + 3807, + 3840, + 3840, + 3904, + 3911, + 3913, + 3948, + 3976, + 3980, + 4096, + 4138, + 4159, + 4159, + 4176, + 4181, + 4186, + 4189, + 4193, + 4193, + 4197, + 4198, + 4206, + 4208, + 4213, + 4225, + 4238, + 4238, + 4256, + 4293, + 4295, + 4295, + 4301, + 4301, + 4304, + 4346, + 4348, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4744, + 4746, + 4749, + 4752, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4822, + 4824, + 4880, + 4882, + 4885, + 4888, + 4954, + 4992, + 5007, + 5024, + 5108, + 5121, + 5740, + 5743, + 5759, + 5761, + 5786, + 5792, + 5866, + 5870, + 5872, + 5888, + 5900, + 5902, + 5905, + 5920, + 5937, + 5952, + 5969, + 5984, + 5996, + 5998, + 6000, + 6016, + 6067, + 6103, + 6103, + 6108, + 6108, + 6176, + 6263, + 6272, + 6312, + 6314, + 6314, + 6320, + 6389, + 6400, + 6428, + 6480, + 6509, + 6512, + 6516, + 6528, + 6571, + 6593, + 6599, + 6656, + 6678, + 6688, + 6740, + 6823, + 6823, + 6917, + 6963, + 6981, + 6987, + 7043, + 7072, + 7086, + 7087, + 7098, + 7141, + 7168, + 7203, + 7245, + 7247, + 7258, + 7293, + 7401, + 7404, + 7406, + 7409, + 7413, + 7414, + 7424, + 7615, + 7680, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8305, + 8305, + 8319, + 8319, + 8336, + 8348, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8505, + 8508, + 8511, + 8517, + 8521, + 8526, + 8526, + 8544, + 8584, + 11264, + 11310, + 11312, + 11358, + 11360, + 11492, + 11499, + 11502, + 11506, + 11507, + 11520, + 11557, + 11559, + 11559, + 11565, + 11565, + 11568, + 11623, + 11631, + 11631, + 11648, + 11670, + 11680, + 11686, + 11688, + 11694, + 11696, + 11702, + 11704, + 11710, + 11712, + 11718, + 11720, + 11726, + 11728, + 11734, + 11736, + 11742, + 11823, + 11823, + 12293, + 12295, + 12321, + 12329, + 12337, + 12341, + 12344, + 12348, + 12353, + 12438, + 12445, + 12447, + 12449, + 12538, + 12540, + 12543, + 12549, + 12589, + 12593, + 12686, + 12704, + 12730, + 12784, + 12799, + 13312, + 19893, + 19968, + 40908, + 40960, + 42124, + 42192, + 42237, + 42240, + 42508, + 42512, + 42527, + 42538, + 42539, + 42560, + 42606, + 42623, + 42647, + 42656, + 42735, + 42775, + 42783, + 42786, + 42888, + 42891, + 42894, + 42896, + 42899, + 42912, + 42922, + 43000, + 43009, + 43011, + 43013, + 43015, + 43018, + 43020, + 43042, + 43072, + 43123, + 43138, + 43187, + 43250, + 43255, + 43259, + 43259, + 43274, + 43301, + 43312, + 43334, + 43360, + 43388, + 43396, + 43442, + 43471, + 43471, + 43520, + 43560, + 43584, + 43586, + 43588, + 43595, + 43616, + 43638, + 43642, + 43642, + 43648, + 43695, + 43697, + 43697, + 43701, + 43702, + 43705, + 43709, + 43712, + 43712, + 43714, + 43714, + 43739, + 43741, + 43744, + 43754, + 43762, + 43764, + 43777, + 43782, + 43785, + 43790, + 43793, + 43798, + 43808, + 43814, + 43816, + 43822, + 43968, + 44002, + 44032, + 55203, + 55216, + 55238, + 55243, + 55291, + 63744, + 64109, + 64112, + 64217, + 64256, + 64262, + 64275, + 64279, + 64285, + 64285, + 64287, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65136, + 65140, + 65142, + 65276, + 65313, + 65338, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES5IdentifierPart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 705, + 710, + 721, + 736, + 740, + 748, + 748, + 750, + 750, + 768, + 884, + 886, + 887, + 890, + 893, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 1013, + 1015, + 1153, + 1155, + 1159, + 1162, + 1319, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1425, + 1469, + 1471, + 1471, + 1473, + 1474, + 1476, + 1477, + 1479, + 1479, + 1488, + 1514, + 1520, + 1522, + 1552, + 1562, + 1568, + 1641, + 1646, + 1747, + 1749, + 1756, + 1759, + 1768, + 1770, + 1788, + 1791, + 1791, + 1808, + 1866, + 1869, + 1969, + 1984, + 2037, + 2042, + 2042, + 2048, + 2093, + 2112, + 2139, + 2208, + 2208, + 2210, + 2220, + 2276, + 2302, + 2304, + 2403, + 2406, + 2415, + 2417, + 2423, + 2425, + 2431, + 2433, + 2435, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2492, + 2500, + 2503, + 2504, + 2507, + 2510, + 2519, + 2519, + 2524, + 2525, + 2527, + 2531, + 2534, + 2545, + 2561, + 2563, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2620, + 2620, + 2622, + 2626, + 2631, + 2632, + 2635, + 2637, + 2641, + 2641, + 2649, + 2652, + 2654, + 2654, + 2662, + 2677, + 2689, + 2691, + 2693, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2748, + 2757, + 2759, + 2761, + 2763, + 2765, + 2768, + 2768, + 2784, + 2787, + 2790, + 2799, + 2817, + 2819, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2869, + 2873, + 2876, + 2884, + 2887, + 2888, + 2891, + 2893, + 2902, + 2903, + 2908, + 2909, + 2911, + 2915, + 2918, + 2927, + 2929, + 2929, + 2946, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 3001, + 3006, + 3010, + 3014, + 3016, + 3018, + 3021, + 3024, + 3024, + 3031, + 3031, + 3046, + 3055, + 3073, + 3075, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3133, + 3140, + 3142, + 3144, + 3146, + 3149, + 3157, + 3158, + 3160, + 3161, + 3168, + 3171, + 3174, + 3183, + 3202, + 3203, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3260, + 3268, + 3270, + 3272, + 3274, + 3277, + 3285, + 3286, + 3294, + 3294, + 3296, + 3299, + 3302, + 3311, + 3313, + 3314, + 3330, + 3331, + 3333, + 3340, + 3342, + 3344, + 3346, + 3386, + 3389, + 3396, + 3398, + 3400, + 3402, + 3406, + 3415, + 3415, + 3424, + 3427, + 3430, + 3439, + 3450, + 3455, + 3458, + 3459, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3530, + 3530, + 3535, + 3540, + 3542, + 3542, + 3544, + 3551, + 3570, + 3571, + 3585, + 3642, + 3648, + 3662, + 3664, + 3673, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3769, + 3771, + 3773, + 3776, + 3780, + 3782, + 3782, + 3784, + 3789, + 3792, + 3801, + 3804, + 3807, + 3840, + 3840, + 3864, + 3865, + 3872, + 3881, + 3893, + 3893, + 3895, + 3895, + 3897, + 3897, + 3902, + 3911, + 3913, + 3948, + 3953, + 3972, + 3974, + 3991, + 3993, + 4028, + 4038, + 4038, + 4096, + 4169, + 4176, + 4253, + 4256, + 4293, + 4295, + 4295, + 4301, + 4301, + 4304, + 4346, + 4348, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4744, + 4746, + 4749, + 4752, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4822, + 4824, + 4880, + 4882, + 4885, + 4888, + 4954, + 4957, + 4959, + 4992, + 5007, + 5024, + 5108, + 5121, + 5740, + 5743, + 5759, + 5761, + 5786, + 5792, + 5866, + 5870, + 5872, + 5888, + 5900, + 5902, + 5908, + 5920, + 5940, + 5952, + 5971, + 5984, + 5996, + 5998, + 6000, + 6002, + 6003, + 6016, + 6099, + 6103, + 6103, + 6108, + 6109, + 6112, + 6121, + 6155, + 6157, + 6160, + 6169, + 6176, + 6263, + 6272, + 6314, + 6320, + 6389, + 6400, + 6428, + 6432, + 6443, + 6448, + 6459, + 6470, + 6509, + 6512, + 6516, + 6528, + 6571, + 6576, + 6601, + 6608, + 6617, + 6656, + 6683, + 6688, + 6750, + 6752, + 6780, + 6783, + 6793, + 6800, + 6809, + 6823, + 6823, + 6912, + 6987, + 6992, + 7001, + 7019, + 7027, + 7040, + 7155, + 7168, + 7223, + 7232, + 7241, + 7245, + 7293, + 7376, + 7378, + 7380, + 7414, + 7424, + 7654, + 7676, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8204, + 8205, + 8255, + 8256, + 8276, + 8276, + 8305, + 8305, + 8319, + 8319, + 8336, + 8348, + 8400, + 8412, + 8417, + 8417, + 8421, + 8432, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8505, + 8508, + 8511, + 8517, + 8521, + 8526, + 8526, + 8544, + 8584, + 11264, + 11310, + 11312, + 11358, + 11360, + 11492, + 11499, + 11507, + 11520, + 11557, + 11559, + 11559, + 11565, + 11565, + 11568, + 11623, + 11631, + 11631, + 11647, + 11670, + 11680, + 11686, + 11688, + 11694, + 11696, + 11702, + 11704, + 11710, + 11712, + 11718, + 11720, + 11726, + 11728, + 11734, + 11736, + 11742, + 11744, + 11775, + 11823, + 11823, + 12293, + 12295, + 12321, + 12335, + 12337, + 12341, + 12344, + 12348, + 12353, + 12438, + 12441, + 12442, + 12445, + 12447, + 12449, + 12538, + 12540, + 12543, + 12549, + 12589, + 12593, + 12686, + 12704, + 12730, + 12784, + 12799, + 13312, + 19893, + 19968, + 40908, + 40960, + 42124, + 42192, + 42237, + 42240, + 42508, + 42512, + 42539, + 42560, + 42607, + 42612, + 42621, + 42623, + 42647, + 42655, + 42737, + 42775, + 42783, + 42786, + 42888, + 42891, + 42894, + 42896, + 42899, + 42912, + 42922, + 43000, + 43047, + 43072, + 43123, + 43136, + 43204, + 43216, + 43225, + 43232, + 43255, + 43259, + 43259, + 43264, + 43309, + 43312, + 43347, + 43360, + 43388, + 43392, + 43456, + 43471, + 43481, + 43520, + 43574, + 43584, + 43597, + 43600, + 43609, + 43616, + 43638, + 43642, + 43643, + 43648, + 43714, + 43739, + 43741, + 43744, + 43759, + 43762, + 43766, + 43777, + 43782, + 43785, + 43790, + 43793, + 43798, + 43808, + 43814, + 43816, + 43822, + 43968, + 44010, + 44012, + 44013, + 44016, + 44025, + 44032, + 55203, + 55216, + 55238, + 55243, + 55291, + 63744, + 64109, + 64112, + 64217, + 64256, + 64262, + 64275, + 64279, + 64285, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65024, + 65039, + 65056, + 65062, + 65075, + 65076, + 65101, + 65103, + 65136, + 65140, + 65142, + 65276, + 65296, + 65305, + 65313, + 65338, + 65343, + 65343, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; function lookupInUnicodeMap(code, map) { if (code < map[0]) { return false; @@ -2075,15 +6836,11 @@ var ts; return false; } function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierStart) : - lookupInUnicodeMap(code, unicodeES3IdentifierStart); + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); } ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierPart) : - lookupInUnicodeMap(code, unicodeES3IdentifierPart); + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); } function makeReverseMap(source) { var result = []; @@ -2156,9 +6913,7 @@ var ts; ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { - return ch === 32 || ch === 9 || ch === 11 || ch === 12 || - ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || - ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { @@ -2245,8 +7000,7 @@ var ts; return false; } } - return ch === 61 || - text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + return ch === 61 || text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } return false; @@ -2326,7 +7080,11 @@ var ts; if (collecting) { if (!result) result = []; - result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); + result.push({ + pos: startPos, + end: pos, + hasTrailingNewLine: hasTrailingNewLine + }); } continue; } @@ -2353,15 +7111,11 @@ var ts; } ts.getTrailingCommentRanges = getTrailingCommentRanges; function isIdentifierStart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } ts.isIdentifierStart = isIdentifierStart; function isIdentifierPart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; function createScanner(languageVersion, skipTrivia, text, onError) { @@ -2380,14 +7134,10 @@ var ts; } } function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } function isIdentifierPart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } function scanNumber() { var start = pos; @@ -3110,17 +7860,39 @@ var ts; } setText(text); return { - getStartPos: function () { return startPos; }, - getTextPos: function () { return pos; }, - getToken: function () { return token; }, - getTokenPos: function () { return tokenPos; }, - getTokenText: function () { return text.substring(tokenPos, pos); }, - getTokenValue: function () { return tokenValue; }, - hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, - hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 64 || token > 100; }, - isReservedWord: function () { return token >= 65 && token <= 100; }, - isUnterminated: function () { return tokenIsUnterminated; }, + getStartPos: function () { + return startPos; + }, + getTextPos: function () { + return pos; + }, + getToken: function () { + return token; + }, + getTokenPos: function () { + return tokenPos; + }, + getTokenText: function () { + return text.substring(tokenPos, pos); + }, + getTokenValue: function () { + return tokenValue; + }, + hasExtendedUnicodeEscape: function () { + return hasExtendedUnicodeEscape; + }, + hasPrecedingLineBreak: function () { + return precedingLineBreak; + }, + isIdentifier: function () { + return token === 64 || token > 100; + }, + isReservedWord: function () { + return token >= 65 && token <= 100; + }, + isUnterminated: function () { + return tokenIsUnterminated; + }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, @@ -3150,9 +7922,13 @@ var ts; function getSingleLineStringWriter() { if (stringWriters.length == 0) { var str = ""; - var writeText = function (text) { return str += text; }; + var writeText = function (text) { + return str += text; + }; return { - string: function () { return str; }, + string: function () { + return str; + }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -3160,11 +7936,18 @@ var ts; writeStringLiteral: writeText, writeParameter: writeText, writeSymbol: writeText, - writeLine: function () { return str += " "; }, - increaseIndent: function () { }, - decreaseIndent: function () { }, - clear: function () { return str = ""; }, - trackSymbol: function () { } + writeLine: function () { + return str += " "; + }, + increaseIndent: function () { + }, + decreaseIndent: function () { + }, + clear: function () { + return str = ""; + }, + trackSymbol: function () { + } }; } return stringWriters.pop(); @@ -3186,8 +7969,7 @@ var ts; ts.containsParseError = containsParseError; function aggregateChildData(node) { if (!(node.parserContextFlags & 64)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || - ts.forEachChild(node, containsParseError); + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { node.parserContextFlags |= 32; } @@ -3195,7 +7977,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 220) { + while (node && node.kind !== 221) { node = node.parent; } return node; @@ -3266,15 +8048,35 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 12288) !== 0 || - isCatchClauseVariableDeclaration(declaration); + return (getCombinedNodeFlags(declaration) & 12288) !== 0 || isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; + function getEnclosingBlockScopeContainer(node) { + var current = node; + while (current) { + if (isFunctionLike(current)) { + return current; + } + switch (current.kind) { + case 221: + case 202: + case 217: + case 200: + case 181: + case 182: + case 183: + return current; + case 174: + if (!isFunctionLike(current.parent)) { + return current; + } + } + current = current.parent; + } + } + ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { - return declaration && - declaration.kind === 193 && - declaration.parent && - declaration.parent.kind === 216; + return declaration && declaration.kind === 193 && declaration.parent && declaration.parent.kind === 217; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3317,7 +8119,7 @@ var ts; case 197: case 200: case 199: - case 219: + case 220: case 195: case 160: errorNode = node.name; @@ -3326,9 +8128,7 @@ var ts; if (errorNode === undefined) { return getSpanOfTokenAtPosition(sourceFile, node.pos); } - var pos = nodeIsMissing(errorNode) - ? errorNode.pos - : ts.skipTrivia(sourceFile.text, errorNode.pos); + var pos = nodeIsMissing(errorNode) ? errorNode.pos : ts.skipTrivia(sourceFile.text, errorNode.pos); return createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; @@ -3391,9 +8191,7 @@ var ts; function getJsDocComments(node, sourceFileOfNode) { return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); function isJsDocComment(comment) { - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; + return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; } } ts.getJsDocComments = getJsDocComments; @@ -3404,6 +8202,7 @@ var ts; switch (node.kind) { case 186: return visitor(node); + case 202: case 174: case 178: case 179: @@ -3413,11 +8212,11 @@ var ts; case 183: case 187: case 188: - case 213: case 214: + case 215: case 189: case 191: - case 216: + case 217: return ts.forEachChild(node, traverse); } } @@ -3427,12 +8226,12 @@ var ts; if (node) { switch (node.kind) { case 150: - case 219: + case 220: case 128: - case 217: + case 218: case 130: case 129: - case 218: + case 219: case 193: return true; } @@ -3510,7 +8309,7 @@ var ts; case 134: case 135: case 199: - case 220: + case 221: return node; } } @@ -3601,8 +8400,8 @@ var ts; case 128: case 130: case 129: - case 219: - case 217: + case 220: + case 218: case 150: return parent.initializer === node; case 177: @@ -3612,20 +8411,17 @@ var ts; case 186: case 187: case 188: - case 213: + case 214: case 190: case 188: return parent.expression === node; case 181: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || - forStatement.condition === node || - forStatement.iterator === node; + return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || forStatement.condition === node || forStatement.iterator === node; case 182: case 183: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || - forInStatement.expression === node; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || forInStatement.expression === node; case 158: return node === parent.expression; case 173: @@ -3643,12 +8439,11 @@ var ts; ts.isExpression = isExpression; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 || - (preserveConstEnums && moduleState === 2); + return moduleState === 1 || (preserveConstEnums && moduleState === 2); } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 202 && node.moduleReference.kind === 212; + return node.kind === 203 && node.moduleReference.kind === 213; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -3657,20 +8452,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 202 && node.moduleReference.kind !== 212; + return node.kind === 203 && node.moduleReference.kind !== 213; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 203) { + if (node.kind === 204) { return node.moduleSpecifier; } - if (node.kind === 202) { + if (node.kind === 203) { var reference = node.moduleReference; - if (reference.kind === 212) { + if (reference.kind === 213) { return reference.expression; } } - if (node.kind === 209) { + if (node.kind === 210) { return node.moduleSpecifier; } } @@ -3687,8 +8482,8 @@ var ts; case 132: case 131: return node.questionToken !== undefined; + case 219: case 218: - case 217: case 130: case 129: return node.questionToken !== undefined; @@ -3734,25 +8529,25 @@ var ts; case 196: case 133: case 199: - case 219: - case 211: + case 220: + case 212: case 195: case 160: case 134: - case 204: - case 202: - case 207: + case 205: + case 203: + case 208: case 197: case 132: case 131: case 200: - case 205: + case 206: case 128: - case 217: + case 218: case 130: case 129: case 135: - case 218: + case 219: case 198: case 127: case 193: @@ -3781,7 +8576,7 @@ var ts; case 175: case 180: case 187: - case 208: + case 209: return true; default: return false; @@ -3793,7 +8588,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 207 || parent.kind === 211) { + if (parent.kind === 208 || parent.kind === 212) { if (parent.propertyName) { return true; } @@ -3891,9 +8686,7 @@ var ts; } ts.isTrivia = isTrivia; function hasDynamicName(declaration) { - return declaration.name && - declaration.name.kind === 126 && - !isWellKnownSymbolSyntactically(declaration.name.expression); + return declaration.name && declaration.name.kind === 126 && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { @@ -3997,7 +8790,10 @@ var ts; if (length < 0) { throw new Error("length < 0"); } - return { start: start, length: length }; + return { + start: start, + length: length + }; } ts.createTextSpan = createTextSpan; function createTextSpanFromBounds(start, end) { @@ -4016,7 +8812,10 @@ var ts; if (newLength < 0) { throw new Error("newLength < 0"); } - return { span: span, newLength: newLength }; + return { + span: span, + newLength: newLength + }; } ts.createTextChangeRange = createTextChangeRange; ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); @@ -4047,11 +8846,11 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 200 || n.kind === 220; + return isFunctionLike(n) || n.kind === 200 || n.kind === 221; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { - return node.pos === -1 && node.end === -1; + return node.pos === -1; } ts.nodeIsSynthesized = nodeIsSynthesized; function createSynthesizedNode(kind, startsOnNewLine) { @@ -4177,15 +8976,15 @@ var ts; } var nonAsciiCharacters = /[^\u0000-\u007F]/g; function escapeNonAsciiCharacters(s) { - return nonAsciiCharacters.test(s) ? - s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) : - s; + return nonAsciiCharacters.test(s) ? s.replace(nonAsciiCharacters, function (c) { + return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + }) : s; } ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters; })(ts || (ts = {})); var ts; (function (ts) { - var nodeConstructors = new Array(222); + var nodeConstructors = new Array(223); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -4223,35 +9022,23 @@ var ts; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { case 125: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); case 127: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); case 128: case 130: case 129: - case 217: case 218: + case 219: case 193: case 150: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 140: case 141: case 136: case 137: case 138: - return visitNodes(cbNodes, node.modifiers) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); case 132: case 131: case 133: @@ -4260,17 +9047,9 @@ var ts; case 160: case 195: case 161: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); case 139: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNodes, node.typeArguments); + return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); case 142: return visitNode(cbNode, node.exprName); case 143: @@ -4291,23 +9070,16 @@ var ts; case 152: return visitNodes(cbNodes, node.properties); case 153: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.dotToken) || - visitNode(cbNode, node.name); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); case 154: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.argumentExpression); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); case 155: case 156: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.typeArguments) || - visitNodes(cbNodes, node.arguments); + return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); case 157: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.template); + return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); case 158: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); case 159: return visitNode(cbNode, node.expression); case 162: @@ -4319,149 +9091,100 @@ var ts; case 165: return visitNode(cbNode, node.operand); case 170: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); case 166: return visitNode(cbNode, node.operand); case 167: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); case 168: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); + return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); case 171: return visitNode(cbNode, node.expression); case 174: case 201: return visitNodes(cbNodes, node.statements); - case 220: - return visitNodes(cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); + case 221: + return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 175: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); case 194: return visitNodes(cbNodes, node.declarations); case 177: return visitNode(cbNode, node.expression); case 178: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); case 179: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); case 180: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 181: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.iterator) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); case 182: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 183: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 184: case 185: return visitNode(cbNode, node.label); case 186: return visitNode(cbNode, node.expression); case 187: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 188: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.clauses); - case 213: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.statements); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); + case 202: + return visitNodes(cbNodes, node.clauses); case 214: + return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); + case 215: return visitNodes(cbNodes, node.statements); case 189: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); case 190: return visitNode(cbNode, node.expression); case 191: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 216: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); + return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); + case 217: + return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 196: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); case 197: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); case 198: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); case 199: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.members); - case 219: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); + case 220: + return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 200: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 202: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); case 203: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); case 204: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); case 205: - return visitNode(cbNode, node.name); + return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); case 206: - case 210: - return visitNodes(cbNodes, node.elements); - case 209: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier); + return visitNode(cbNode, node.name); case 207: case 211: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); + return visitNodes(cbNodes, node.elements); + case 210: + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); case 208: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); + case 212: + return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); + case 209: + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 169: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); case 173: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 126: return visitNode(cbNode, node.expression); - case 215: + case 216: return visitNodes(cbNodes, node.types); - case 212: + case 213: return visitNode(cbNode, node.expression); } } @@ -4499,40 +9222,69 @@ var ts; })(Tristate || (Tristate = {})); function parsingContextErrors(context) { switch (context) { - case 0: return ts.Diagnostics.Declaration_or_statement_expected; - case 1: return ts.Diagnostics.Declaration_or_statement_expected; - case 2: return ts.Diagnostics.Statement_expected; - case 3: return ts.Diagnostics.case_or_default_expected; - case 4: return ts.Diagnostics.Statement_expected; - case 5: return ts.Diagnostics.Property_or_signature_expected; - case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; - case 7: return ts.Diagnostics.Enum_member_expected; - case 8: return ts.Diagnostics.Type_reference_expected; - case 9: return ts.Diagnostics.Variable_declaration_expected; - case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; - case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; - case 12: return ts.Diagnostics.Argument_expression_expected; - case 13: return ts.Diagnostics.Property_assignment_expected; - case 14: return ts.Diagnostics.Expression_or_comma_expected; - case 15: return ts.Diagnostics.Parameter_declaration_expected; - case 16: return ts.Diagnostics.Type_parameter_declaration_expected; - case 17: return ts.Diagnostics.Type_argument_expected; - case 18: return ts.Diagnostics.Type_expected; - case 19: return ts.Diagnostics.Unexpected_token_expected; - case 20: return ts.Diagnostics.Identifier_expected; + case 0: + return ts.Diagnostics.Declaration_or_statement_expected; + case 1: + return ts.Diagnostics.Declaration_or_statement_expected; + case 2: + return ts.Diagnostics.Statement_expected; + case 3: + return ts.Diagnostics.case_or_default_expected; + case 4: + return ts.Diagnostics.Statement_expected; + case 5: + return ts.Diagnostics.Property_or_signature_expected; + case 6: + return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7: + return ts.Diagnostics.Enum_member_expected; + case 8: + return ts.Diagnostics.Type_reference_expected; + case 9: + return ts.Diagnostics.Variable_declaration_expected; + case 10: + return ts.Diagnostics.Property_destructuring_pattern_expected; + case 11: + return ts.Diagnostics.Array_element_destructuring_pattern_expected; + case 12: + return ts.Diagnostics.Argument_expression_expected; + case 13: + return ts.Diagnostics.Property_assignment_expected; + case 14: + return ts.Diagnostics.Expression_or_comma_expected; + case 15: + return ts.Diagnostics.Parameter_declaration_expected; + case 16: + return ts.Diagnostics.Type_parameter_declaration_expected; + case 17: + return ts.Diagnostics.Type_argument_expected; + case 18: + return ts.Diagnostics.Type_expected; + case 19: + return ts.Diagnostics.Unexpected_token_expected; + case 20: + return ts.Diagnostics.Identifier_expected; } } ; function modifierToFlag(token) { switch (token) { - case 109: return 128; - case 108: return 16; - case 107: return 64; - case 106: return 32; - case 77: return 1; - case 114: return 2; - case 69: return 8192; - case 72: return 256; + case 109: + return 128; + case 108: + return 16; + case 107: + return 64; + case 106: + return 32; + case 77: + return 1; + case 114: + return 2; + case 69: + return 8192; + case 72: + return 256; } return 0; } @@ -4763,8 +9515,7 @@ var ts; } ts.updateSourceFile = updateSourceFile; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 64 && - (node.text === "eval" || node.text === "arguments"); + return node.kind === 64 && (node.text === "eval" || node.text === "arguments"); } ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; function isUseStrictPrologueDirective(sourceFile, node) { @@ -4850,7 +9601,7 @@ var ts; var identifierCount = 0; var nodeCount = 0; var token; - var sourceFile = createNode(220, 0); + var sourceFile = createNode(221, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -4986,9 +9737,7 @@ var ts; var saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; var saveContextFlags = contextFlags; - var result = isLookAhead - ? scanner.lookAhead(callback) - : scanner.tryScan(callback); + var result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); ts.Debug.assert(saveContextFlags === contextFlags); if (!result || isLookAhead) { token = saveToken; @@ -5039,8 +9788,7 @@ var ts; return undefined; } function parseExpectedToken(t, reportAtCurrentPosition, diagnosticMessage, arg0) { - return parseOptionalToken(t) || - createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); + return parseOptionalToken(t) || createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); } function parseTokenNode() { var node = createNode(token); @@ -5117,9 +9865,7 @@ var ts; return createIdentifier(isIdentifierOrKeyword()); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || - token === 8 || - token === 7; + return isIdentifierOrKeyword() || token === 8 || token === 7; } function parsePropertyName() { if (token === 8 || token === 7) { @@ -5172,10 +9918,7 @@ var ts; return canFollowModifier(); } function canFollowModifier() { - return token === 18 - || token === 14 - || token === 35 - || isLiteralPropertyName(); + return token === 18 || token === 14 || token === 35 || isLiteralPropertyName(); } function nextTokenIsClassOrFunction() { nextToken(); @@ -5233,8 +9976,7 @@ var ts; return isIdentifier(); } function isNotHeritageClauseTypeName() { - if (token === 102 || - token === 78) { + if (token === 102 || token === 78) { return lookAhead(nextTokenIsIdentifier); } return false; @@ -5400,10 +10142,10 @@ var ts; function isReusableModuleElement(node) { if (node) { switch (node.kind) { + case 204: case 203: - case 202: + case 210: case 209: - case 208: case 196: case 197: case 200: @@ -5431,8 +10173,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 213: case 214: + case 215: return true; } } @@ -5467,7 +10209,7 @@ var ts; return false; } function isReusableEnumMember(node) { - return node.kind === 219; + return node.kind === 220; } function isReusableTypeMember(node) { if (node) { @@ -5615,9 +10357,7 @@ var ts; var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - if (node.kind === 7 - && sourceText.charCodeAt(tokenPos) === 48 - && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + if (node.kind === 7 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { node.flags |= 16384; } return node; @@ -5656,9 +10396,7 @@ var ts; } function parseParameterType() { if (parseOptional(51)) { - return token === 8 - ? parseLiteralNode(true) - : parseType(); + return token === 8 ? parseLiteralNode(true) : parseType(); } return undefined; } @@ -5816,11 +10554,7 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 || - token === 24 || - token === 50 || - token === 51 || - canParseSemicolon(); + return token === 16 || token === 24 || token === 50 || token === 51 || canParseSemicolon(); } function parseTypeMember() { switch (token) { @@ -5828,9 +10562,7 @@ var ts; case 24: return parseSignatureMember(136); case 18: - return isIndexSignature() - ? parseIndexSignatureDeclaration(undefined) - : parsePropertyOrMethodSignature(); + return isIndexSignature() ? parseIndexSignatureDeclaration(undefined) : parsePropertyOrMethodSignature(); case 87: if (lookAhead(isStartOfConstructSignature)) { return parseSignatureMember(137); @@ -5852,9 +10584,7 @@ var ts; } function parseIndexSignatureWithModifiers() { var modifiers = parseModifiers(); - return isIndexSignature() - ? parseIndexSignatureDeclaration(modifiers) - : undefined; + return isIndexSignature() ? parseIndexSignatureDeclaration(modifiers) : undefined; } function isStartOfConstructSignature() { nextToken(); @@ -5960,7 +10690,9 @@ var ts; function parseUnionTypeOrHigher() { var type = parseArrayTypeOrHigher(); if (token === 44) { - var types = [type]; + var types = [ + type + ]; types.pos = type.pos; while (parseOptional(44)) { types.push(parseArrayTypeOrHigher()); @@ -5985,9 +10717,7 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 51 || token === 23 || - token === 50 || token === 52 || - isIdentifier() || ts.isModifier(token)) { + if (token === 51 || token === 23 || token === 50 || token === 52 || isIdentifier() || ts.isModifier(token)) { return true; } if (token === 17) { @@ -6115,8 +10845,7 @@ var ts; function parseYieldExpression() { var node = createNode(170); nextToken(); - if (!scanner.hasPrecedingLineBreak() && - (token === 35 || isStartOfExpression())) { + if (!scanner.hasPrecedingLineBreak() && (token === 35 || isStartOfExpression())) { node.asteriskToken = parseOptionalToken(35); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); @@ -6131,7 +10860,9 @@ var ts; var parameter = createNode(128, identifier.pos); parameter.name = identifier; finishNode(parameter); - node.parameters = [parameter]; + node.parameters = [ + parameter + ]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; parseExpected(32); @@ -6143,9 +10874,7 @@ var ts; if (triState === 0) { return undefined; } - var arrowFunction = triState === 1 - ? parseParenthesizedArrowFunctionExpressionHead(true) - : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + var arrowFunction = triState === 1 ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); if (!arrowFunction) { return undefined; } @@ -6367,9 +11096,7 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 90 - ? parseSuperExpression() - : parseMemberExpressionOrHigher(); + var expression = token === 90 ? parseSuperExpression() : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); } function parseMemberExpressionOrHigher() { @@ -6423,9 +11150,7 @@ var ts; if (token === 10 || token === 11) { var tagExpression = createNode(157, expression.pos); tagExpression.tag = expression; - tagExpression.template = token === 10 - ? parseLiteralNode() - : parseTemplateExpression(); + tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); expression = finishNode(tagExpression); continue; } @@ -6471,9 +11196,7 @@ var ts; if (!parseExpected(25)) { return undefined; } - return typeArguments && canFollowTypeArgumentsInExpression() - ? typeArguments - : undefined; + return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; } function canFollowTypeArgumentsInExpression() { switch (token) { @@ -6548,9 +11271,7 @@ var ts; return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(172) : - parseAssignmentExpressionOrHigher(); + return token === 21 ? parseSpreadElement() : token === 23 ? createNode(172) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return allowInAnd(parseArgumentOrArrayLiteralElement); @@ -6589,13 +11310,13 @@ var ts; return parseMethodDeclaration(fullStart, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(218, fullStart); + var shorthandDeclaration = createNode(219, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(217, fullStart); + var propertyAssignment = createNode(218, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -6761,7 +11482,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(213); + var node = createNode(214); parseExpected(66); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -6769,7 +11490,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(214); + var node = createNode(215); parseExpected(72); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -6784,9 +11505,11 @@ var ts; parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); + var caseBlock = createNode(202, scanner.getStartPos()); parseExpected(14); - node.clauses = parseList(3, false, parseCaseOrDefaultClause); + caseBlock.clauses = parseList(3, false, parseCaseOrDefaultClause); parseExpected(15); + node.caseBlock = finishNode(caseBlock); return finishNode(node); } function parseThrowStatement() { @@ -6808,7 +11531,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(216); + var result = createNode(217); parseExpected(67); if (parseExpected(16)) { result.variableDeclaration = parseVariableDeclaration(); @@ -7198,11 +11921,7 @@ var ts; if (isIndexSignature()) { return parseIndexSignatureDeclaration(modifiers); } - if (isIdentifierOrKeyword() || - token === 8 || - token === 7 || - token === 35 || - token === 18) { + if (isIdentifierOrKeyword() || token === 8 || token === 7 || token === 35 || token === 18) { return parsePropertyOrMethodDeclaration(fullStart, modifiers); } ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -7215,9 +11934,7 @@ var ts; node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); if (parseExpected(14)) { - node.members = inGeneratorParameterContext() - ? doOutsideOfYieldContext(parseClassMembers) - : parseClassMembers(); + node.members = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); parseExpected(15); } else { @@ -7227,9 +11944,7 @@ var ts; } function parseHeritageClauses(isClassHeritageClause) { if (isHeritageClause()) { - return isClassHeritageClause && inGeneratorParameterContext() - ? doOutsideOfYieldContext(parseHeritageClausesWorker) - : parseHeritageClausesWorker(); + return isClassHeritageClause && inGeneratorParameterContext() ? doOutsideOfYieldContext(parseHeritageClausesWorker) : parseHeritageClausesWorker(); } return undefined; } @@ -7238,7 +11953,7 @@ var ts; } function parseHeritageClause() { if (token === 78 || token === 102) { - var node = createNode(215); + var node = createNode(216); node.token = token; nextToken(); node.types = parseDelimitedList(8, parseTypeReference); @@ -7273,7 +11988,7 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(219, scanner.getStartPos()); + var node = createNode(220, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); @@ -7308,9 +12023,7 @@ var ts; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(20) - ? parseInternalModuleTail(getNodePos(), undefined, 1) - : parseModuleBlock(); + node.body = parseOptional(20) ? parseInternalModuleTail(getNodePos(), undefined, 1) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { @@ -7322,21 +12035,17 @@ var ts; } function parseModuleDeclaration(fullStart, modifiers) { parseExpected(116); - return token === 8 - ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) - : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); + return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); } function isExternalModuleReference() { - return token === 117 && - lookAhead(nextTokenIsOpenParen); + return token === 117 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 16; } function nextTokenIsCommaOrFromKeyword() { nextToken(); - return token === 23 || - token === 123; + return token === 23 || token === 123; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, modifiers) { parseExpected(84); @@ -7345,7 +12054,7 @@ var ts; if (isIdentifier()) { identifier = parseIdentifier(); if (token !== 23 && token !== 123) { - var importEqualsDeclaration = createNode(202, fullStart); + var importEqualsDeclaration = createNode(203, fullStart); setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; parseExpected(52); @@ -7354,11 +12063,9 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(203, fullStart); + var importDeclaration = createNode(204, fullStart); setModifiers(importDeclaration, modifiers); - if (identifier || - token === 35 || - token === 14) { + if (identifier || token === 35 || token === 14) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); parseExpected(123); } @@ -7367,23 +12074,20 @@ var ts; return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(204, fullStart); + var importClause = createNode(205, fullStart); if (identifier) { importClause.name = identifier; } - if (!importClause.name || - parseOptional(23)) { - importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(206); + if (!importClause.name || parseOptional(23)) { + importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(207); } return finishNode(importClause); } function parseModuleReference() { - return isExternalModuleReference() - ? parseExternalModuleReference() - : parseEntityName(false); + return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(212); + var node = createNode(213); parseExpected(117); parseExpected(16); node.expression = parseModuleSpecifier(); @@ -7398,7 +12102,7 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(205); + var namespaceImport = createNode(206); parseExpected(35); parseExpected(101); namespaceImport.name = parseIdentifier(); @@ -7406,14 +12110,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(20, kind === 206 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(20, kind === 207 ? parseImportSpecifier : parseExportSpecifier, 14, 15); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(211); + return parseImportOrExportSpecifier(212); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(207); + return parseImportOrExportSpecifier(208); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -7439,14 +12143,14 @@ var ts; return finishNode(node); } function parseExportDeclaration(fullStart, modifiers) { - var node = createNode(209, fullStart); + var node = createNode(210, fullStart); setModifiers(node, modifiers); if (parseOptional(35)) { parseExpected(123); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(210); + node.exportClause = parseNamedImportsOrExports(211); if (parseOptional(123)) { node.moduleSpecifier = parseModuleSpecifier(); } @@ -7455,7 +12159,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, modifiers) { - var node = createNode(208, fullStart); + var node = createNode(209, fullStart); setModifiers(node, modifiers); if (parseOptional(52)) { node.isExportEquals = true; @@ -7510,13 +12214,11 @@ var ts; } function nextTokenCanFollowImportKeyword() { nextToken(); - return isIdentifierOrKeyword() || token === 8 || - token === 35 || token === 14; + return isIdentifierOrKeyword() || token === 8 || token === 35 || token === 14; } function nextTokenCanFollowExportKeyword() { nextToken(); - return token === 52 || token === 35 || - token === 14 || token === 72 || isDeclarationStart(); + return token === 52 || token === 35 || token === 14 || token === 72 || isDeclarationStart(); } function nextTokenIsDeclarationStart() { nextToken(); @@ -7570,9 +12272,7 @@ var ts; return parseSourceElementOrModuleElement(); } function parseSourceElementOrModuleElement() { - return isDeclarationStart() - ? parseDeclaration() - : parseStatement(); + return isDeclarationStart() ? parseDeclaration() : parseStatement(); } function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, sourceText); @@ -7587,7 +12287,10 @@ var ts; if (kind !== 2) { break; } - var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; + var range = { + pos: triviaScanner.getTokenPos(), + end: triviaScanner.getTextPos() + }; var comment = sourceText.substring(range.pos, range.end); var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { @@ -7618,7 +12321,10 @@ var ts; var pathMatchResult = pathRegex.exec(comment); var nameMatchResult = nameRegex.exec(comment); if (pathMatchResult) { - var amdDependency = { path: pathMatchResult[2], name: nameMatchResult ? nameMatchResult[2] : undefined }; + var amdDependency = { + path: pathMatchResult[2], + name: nameMatchResult ? nameMatchResult[2] : undefined + }; amdDependencies.push(amdDependency); } } @@ -7630,13 +12336,7 @@ var ts; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 1 - || node.kind === 202 && node.moduleReference.kind === 212 - || node.kind === 203 - || node.kind === 208 - || node.kind === 209 - ? node - : undefined; + return node.flags & 1 || node.kind === 203 && node.moduleReference.kind === 213 || node.kind === 204 || node.kind === 209 || node.kind === 210 ? node : undefined; }); } } @@ -7690,7 +12390,7 @@ var ts; else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 203 || node.kind === 202) && !(node.flags & 1)) { + else if ((node.kind === 204 || node.kind === 203) && !(node.flags & 1)) { return 0; } else if (node.kind === 201) { @@ -7783,9 +12483,9 @@ var ts; return "__new"; case 138: return "__index"; - case 209: + case 210: return "__export"; - case 208: + case 209: return "default"; case 195: case 196: @@ -7804,9 +12504,7 @@ var ts; if (node.name) { node.name.parent = node; } - var message = symbol.flags & 2 - ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 - : ts.Diagnostics.Duplicate_identifier_0; + var message = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); @@ -7843,7 +12541,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolKind & 8388608) { - if (node.kind === 211 || (node.kind === 202 && hasExportModifier)) { + if (node.kind === 212 || (node.kind === 203 && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -7852,9 +12550,7 @@ var ts; } else { if (hasExportModifier || isAmbientContext(container)) { - var exportKind = (symbolKind & 107455 ? 1048576 : 0) | - (symbolKind & 793056 ? 2097152 : 0) | - (symbolKind & 1536 ? 4194304 : 0); + var exportKind = (symbolKind & 107455 ? 1048576 : 0) | (symbolKind & 793056 ? 2097152 : 0) | (symbolKind & 1536 ? 4194304 : 0); var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); node.localSymbol = local; @@ -7880,7 +12576,7 @@ var ts; lastContainer = container; } if (isBlockScopeContainer) { - setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 220); + setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 221); } ts.forEachChild(node, bind); container = saveContainer; @@ -7892,7 +12588,7 @@ var ts; case 200: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 220: + case 221: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -7970,7 +12666,7 @@ var ts; case 200: declareModuleMember(node, 2, 107455); break; - case 220: + case 221: if (ts.isExternalModule(container)) { declareModuleMember(node, 2, 107455); break; @@ -8011,11 +12707,11 @@ var ts; case 129: bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 217: case 218: + case 219: bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 219: + case 220: bindPropertyOrMethodOrAccessor(node, 8, 107455, false); break; case 136: @@ -8053,7 +12749,7 @@ var ts; case 161: bindAnonymousDeclaration(node, 16, "__function", true); break; - case 216: + case 217: bindCatchVariableDeclaration(node); break; case 196: @@ -8076,13 +12772,13 @@ var ts; case 200: bindModuleDeclaration(node); break; - case 202: - case 205: - case 207: - case 211: + case 203: + case 206: + case 208: + case 212: bindDeclaration(node, 8388608, 8388608, false); break; - case 204: + case 205: if (node.name) { bindDeclaration(node, 8388608, 8388608, false); } @@ -8090,13 +12786,13 @@ var ts; bindChildren(node, 0, false); } break; - case 209: + case 210: if (!node.exportClause) { declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); } bindChildren(node, 0, false); break; - case 208: + case 209: if (node.expression.kind === 64) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 8388608); } @@ -8105,7 +12801,7 @@ var ts; } bindChildren(node, 0, false); break; - case 220: + case 221: if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; @@ -8113,11 +12809,11 @@ var ts; case 174: bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 216: + case 217: case 181: case 182: case 183: - case 188: + case 202: bindChildren(node, 0, true); break; default: @@ -8134,9 +12830,7 @@ var ts; else { bindDeclaration(node, 1, 107455, false); } - if (node.flags & 112 && - node.parent.kind === 133 && - node.parent.parent.kind === 196) { + if (node.flags & 112 && node.parent.kind === 133 && node.parent.parent.kind === 196) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -8168,12 +12862,24 @@ var ts; var languageVersion = compilerOptions.target || 0; var emitResolver = createResolver(); var checker = { - getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, - getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, - getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, - getTypeCount: function () { return typeCount; }, - isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, - isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + getNodeCount: function () { + return ts.sum(host.getSourceFiles(), "nodeCount"); + }, + getIdentifierCount: function () { + return ts.sum(host.getSourceFiles(), "identifierCount"); + }, + getSymbolCount: function () { + return ts.sum(host.getSourceFiles(), "symbolCount"); + }, + getTypeCount: function () { + return typeCount; + }, + isUndefinedSymbol: function (symbol) { + return symbol === undefinedSymbol; + }, + isArgumentsSymbol: function (symbol) { + return symbol === argumentsSymbol; + }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, @@ -8269,9 +12975,7 @@ var ts; return emitResolver; } function error(location, message, arg0, arg1, arg2) { - var diagnostic = location - ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) - : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); + var diagnostic = location ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); diagnostics.add(diagnostic); } function createSymbol(flags, name) { @@ -8357,8 +13061,7 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 || source.flags & 2 - ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { error(node.name ? node.name : node, message, symbolToString(source)); }); @@ -8405,10 +13108,10 @@ var ts; return nodeLinks[node.id] || (nodeLinks[node.id] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 220); + return ts.getAncestor(node, 221); } function isGlobalSourceFile(node) { - return node.kind === 220 && !ts.isExternalModule(node); + return node.kind === 221 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -8449,12 +13152,12 @@ var ts; } } switch (location.kind) { - case 220: + case 221: if (!ts.isExternalModule(location)) break; case 200: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { - if (!(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 211)) { + if (!(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 212)) { break loop; } result = undefined; @@ -8538,28 +13241,54 @@ var ts; return undefined; } if (result.flags & 2) { - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); - ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!isDefinedBefore(declaration, errorLocation)) { - error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); - } + checkResolvedBlockScopedVariable(result, errorLocation); } } return result; } + function checkResolvedBlockScopedVariable(result, errorLocation) { + ts.Debug.assert((result.flags & 2) !== 0); + var declaration = ts.forEach(result.declarations, function (d) { + return ts.isBlockOrCatchScoped(d) ? d : undefined; + }); + ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); + var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); + if (!isUsedBeforeDeclaration) { + var variableDeclaration = ts.getAncestor(declaration, 193); + var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); + if (variableDeclaration.parent.parent.kind === 175 || variableDeclaration.parent.parent.kind === 181) { + isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); + } + else if (variableDeclaration.parent.parent.kind === 183 || variableDeclaration.parent.parent.kind === 182) { + var expression = variableDeclaration.parent.parent.expression; + isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); + } + } + if (isUsedBeforeDeclaration) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + } + function isSameScopeDescendentOf(initial, parent, stopAt) { + if (!parent) { + return false; + } + for (var current = initial; current && current !== stopAt && !ts.isFunctionLike(current); current = current.parent) { + if (current === parent) { + return true; + } + } + return false; + } function isAliasSymbolDeclaration(node) { - return node.kind === 202 || - node.kind === 204 && !!node.name || - node.kind === 205 || - node.kind === 207 || - node.kind === 211 || - node.kind === 208; + return node.kind === 203 || node.kind === 205 && !!node.name || node.kind === 206 || node.kind === 208 || node.kind === 212 || node.kind === 209; } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.forEach(symbol.declarations, function (d) { + return isAliasSymbolDeclaration(d) ? d : undefined; + }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 212) { + if (node.moduleReference.kind === 213) { var moduleSymbol = resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)); var exportAssignmentSymbol = moduleSymbol && getResolvedExportAssignmentSymbol(moduleSymbol); return exportAssignmentSymbol || moduleSymbol; @@ -8597,26 +13326,24 @@ var ts; return getExternalModuleMember(node.parent.parent.parent, node); } function getTargetOfExportSpecifier(node) { - return node.parent.parent.moduleSpecifier ? - getExternalModuleMember(node.parent.parent, node) : - resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); + return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); } function getTargetOfExportAssignment(node) { return resolveEntityName(node.expression, 107455 | 793056 | 1536); } function getTargetOfImportDeclaration(node) { switch (node.kind) { - case 202: + case 203: return getTargetOfImportEqualsDeclaration(node); - case 204: - return getTargetOfImportClause(node); case 205: + return getTargetOfImportClause(node); + case 206: return getTargetOfNamespaceImport(node); - case 207: - return getTargetOfImportSpecifier(node); - case 211: - return getTargetOfExportSpecifier(node); case 208: + return getTargetOfImportSpecifier(node); + case 212: + return getTargetOfExportSpecifier(node); + case 209: return getTargetOfExportAssignment(node); } } @@ -8651,10 +13378,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 208) { + if (node.kind === 209) { checkExpressionCached(node.expression); } - else if (node.kind === 211) { + else if (node.kind === 212) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -8664,7 +13391,7 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 202); + importDeclaration = ts.getAncestor(entityName, 203); ts.Debug.assert(importDeclaration !== undefined); } if (entityName.kind === 64 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { @@ -8674,7 +13401,7 @@ var ts; return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 202); + ts.Debug.assert(entityName.parent.kind === 203); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -8814,9 +13541,7 @@ var ts; return getMergedSymbol(symbol.parent); } function getExportSymbolOfValueSymbolIfExported(symbol) { - return symbol && (symbol.flags & 1048576) !== 0 - ? getMergedSymbol(symbol.exportSymbol) - : symbol; + return symbol && (symbol.flags & 1048576) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; } function symbolIsValue(symbol) { if (symbol.flags & 16777216) { @@ -8855,10 +13580,7 @@ var ts; return type; } function isReservedMemberName(name) { - return name.charCodeAt(0) === 95 && - name.charCodeAt(1) === 95 && - name.charCodeAt(2) !== 95 && - name.charCodeAt(2) !== 64; + return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && name.charCodeAt(2) !== 95 && name.charCodeAt(2) !== 64; } function getNamedMembers(members) { var result; @@ -8899,7 +13621,7 @@ var ts; } } switch (location.kind) { - case 220: + case 221: if (!ts.isExternalModule(location)) { break; } @@ -8932,24 +13654,28 @@ var ts; } function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { - return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && - canQualifySymbol(symbolFromSymbolTable, meaning); + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); } } if (isAccessible(ts.lookUp(symbols, symbol.name))) { - return [symbol]; + return [ + symbol + ]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608) { - if (!useOnlyExternalAliasing || - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; + return [ + symbolFromSymbolTable + ]; } var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + return [ + symbolFromSymbolTable + ].concat(accessibleSymbolsFromExports); } } } @@ -9014,7 +13740,9 @@ var ts; errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) }; } - return { accessibility: 0 }; + return { + accessibility: 0 + }; function getExternalModuleContainer(declaration) { for (; declaration; declaration = declaration.parent) { if (hasExternalModuleSymbol(declaration)) { @@ -9024,20 +13752,22 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 200 && declaration.name.kind === 8) || - (declaration.kind === 220 && ts.isExternalModule(declaration)); + return (declaration.kind === 200 && declaration.name.kind === 8) || (declaration.kind === 221 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; - if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { + if (ts.forEach(symbol.declarations, function (declaration) { + return !getIsDeclarationVisible(declaration); + })) { return undefined; } - return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; + return { + accessibility: 0, + aliasesToMakeVisible: aliasesToMakeVisible + }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 202 && - !(declaration.flags & 1) && - isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 203 && !(declaration.flags & 1) && isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -9045,7 +13775,9 @@ var ts; } } else { - aliasesToMakeVisible = [declaration]; + aliasesToMakeVisible = [ + declaration + ]; } return true; } @@ -9059,8 +13791,7 @@ var ts; if (entityName.parent.kind === 142) { meaning = 107455 | 1048576; } - else if (entityName.kind === 125 || - entityName.parent.kind === 202) { + else if (entityName.kind === 125 || entityName.parent.kind === 203) { meaning = 1536; } else { @@ -9146,8 +13877,7 @@ var ts; function walkSymbol(symbol, meaning) { if (symbol) { var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); - if (!accessibleSymbolChain || - needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { @@ -9179,8 +13909,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { if (type.flags & 1048703) { - writer.writeKeyword(!(globalFlags & 16) && - (type.flags & 1) ? "any" : type.intrinsicName); + writer.writeKeyword(!(globalFlags & 16) && (type.flags & 1) ? "any" : type.intrinsicName); } else if (type.flags & 4096) { writeTypeReference(type, flags); @@ -9273,16 +14002,14 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && - ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && - (type.symbol.parent || - ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 220 || declaration.parent.kind === 201; - })); + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.flags & 128; + })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.parent.kind === 221 || declaration.parent.kind === 201; + })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { - return !!(flags & 2) || - (typeStack && ts.contains(typeStack, type)); + return !!(flags & 2) || (typeStack && ts.contains(typeStack, type)); } } } @@ -9512,7 +14239,7 @@ var ts; return node; } } - else if (node.kind === 220) { + else if (node.kind === 221) { return ts.isExternalModule(node) ? node : undefined; } } @@ -9562,10 +14289,9 @@ var ts; case 198: case 195: case 199: - case 202: + case 203: var parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 202 && parent.kind !== 220 && ts.isInAmbientContext(parent))) { + if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 203 && parent.kind !== 221 && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(parent); @@ -9594,7 +14320,7 @@ var ts; case 147: return isDeclarationVisible(node.parent); case 127: - case 220: + case 221: return true; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -9620,7 +14346,9 @@ var ts; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); - return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; + return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { + return anyType; + })) : classType; } function getTypeOfPropertyOfType(type, name) { var prop = getPropertyOfType(type, name); @@ -9640,9 +14368,7 @@ var ts; } if (pattern.kind === 148) { var name = declaration.propertyName || declaration.name; - var type = getTypeOfPropertyOfType(parentType, name.text) || - isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || - getIndexTypeOfType(parentType, 0); + var type = getTypeOfPropertyOfType(parentType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; @@ -9657,7 +14383,12 @@ var ts; var propName = "" + ts.indexOf(pattern.elements, declaration); var type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1); if (!type) { - error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName); + if (isTupleType(parentType)) { + error(declaration, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), parentType.elementTypes.length, pattern.elements.length); + } + else { + error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName); + } return unknownType; } } @@ -9672,7 +14403,7 @@ var ts; return anyType; } if (declaration.parent.parent.kind === 183) { - return getTypeForVariableDeclarationInForOfStatement(declaration.parent.parent); + return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); @@ -9696,7 +14427,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 218) { + if (declaration.kind === 219) { return checkIdentifier(declaration.name); } return undefined; @@ -9733,9 +14464,7 @@ var ts; return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 148 - ? getTypeFromObjectBindingPattern(pattern) - : getTypeFromArrayBindingPattern(pattern); + return pattern.kind === 148 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -9743,7 +14472,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 217 ? getWidenedType(type) : type; + return declaration.kind !== 218 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -9764,10 +14493,10 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 216) { + if (declaration.parent.kind === 217) { return links.type = anyType; } - if (declaration.kind === 208) { + if (declaration.kind === 209) { return links.type = checkExpression(declaration.expression); } links.type = resolvingType; @@ -9779,9 +14508,7 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); } } @@ -9915,7 +14642,9 @@ var ts; ts.forEach(declaration.typeParameters, function (node) { var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); if (!result) { - result = [tp]; + result = [ + tp + ]; } else if (!ts.contains(result, tp)) { result.push(tp); @@ -10161,14 +14890,15 @@ var ts; var baseType = classType.baseTypes[0]; var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1); return ts.map(baseSignatures, function (baseSignature) { - var signature = baseType.flags & 4096 ? - getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); + var signature = baseType.flags & 4096 ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); signature.typeParameters = classType.typeParameters; signature.resolvedReturnType = classType; return signature; }); } - return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; + return [ + createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false) + ]; } function createTupleTypeMemberSymbols(memberTypes) { var members = {}; @@ -10197,7 +14927,9 @@ var ts; return true; } function getUnionSignatures(types, kind) { - var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); + var signatureLists = ts.map(types, function (t) { + return getSignaturesOfType(t, kind); + }); var signatures = signatureLists[0]; for (var i = 0; i < signatures.length; i++) { if (signatures[i].typeParameters) { @@ -10213,7 +14945,9 @@ var ts; for (var i = 0; i < result.length; i++) { var s = result[i]; s.resolvedReturnType = undefined; - s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); + s.unionSignatures = ts.map(signatureLists, function (signatures) { + return signatures[i]; + }); } return result; } @@ -10357,7 +15091,9 @@ var ts; return undefined; } if (!props) { - props = [prop]; + props = [ + prop + ]; } else { props.push(prop); @@ -10457,8 +15193,7 @@ var ts; var links = getNodeLinks(declaration); if (!links.resolvedSignature) { var classType = declaration.kind === 133 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; - var typeParameters = classType ? classType.typeParameters : - declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; + var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; @@ -10589,8 +15324,12 @@ var ts; var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; - type.callSignatures = !isConstructor ? [signature] : emptyArray; - type.constructSignatures = isConstructor ? [signature] : emptyArray; + type.callSignatures = !isConstructor ? [ + signature + ] : emptyArray; + type.constructSignatures = isConstructor ? [ + signature + ] : emptyArray; signature.isolatedSignatureType = type; } return signature.isolatedSignatureType; @@ -10617,9 +15356,7 @@ var ts; } function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); - return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType - : undefined; + return declaration ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType : undefined; } function getConstraintOfTypeParameter(type) { if (!type.constraint) { @@ -10673,7 +15410,9 @@ var ts; return links.isIllegalTypeReferenceInConstraint; } var currentNode = typeReferenceNode; - while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { + while (!ts.forEach(typeParameterSymbol.declarations, function (d) { + return d.parent === currentNode.parent; + })) { currentNode = currentNode.parent; } links.isIllegalTypeReferenceInConstraint = currentNode.kind === 127; @@ -10687,7 +15426,9 @@ var ts; if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); if (symbol && (symbol.flags & 262144)) { - links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); + links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { + return d.parent == typeParameter.parent; + }); } } if (links.isIllegalTypeReferenceInConstraint) { @@ -10786,7 +15527,9 @@ var ts; } function createArrayType(elementType) { var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); - return arrayType !== emptyObjectType ? createTypeReference(arrayType, [elementType]) : emptyObjectType; + return arrayType !== emptyObjectType ? createTypeReference(arrayType, [ + elementType + ]) : emptyObjectType; } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); @@ -10972,15 +15715,21 @@ var ts; return items; } function createUnaryTypeMapper(source, target) { - return function (t) { return t === source ? target : t; }; + return function (t) { + return t === source ? target : t; + }; } function createBinaryTypeMapper(source1, target1, source2, target2) { - return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; + return function (t) { + return t === source1 ? target1 : t === source2 ? target2 : t; + }; } function createTypeMapper(sources, targets) { switch (sources.length) { - case 1: return createUnaryTypeMapper(sources[0], targets[0]); - case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); + case 1: + return createUnaryTypeMapper(sources[0], targets[0]); + case 2: + return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); } return function (t) { for (var i = 0; i < sources.length; i++) { @@ -10991,15 +15740,21 @@ var ts; }; } function createUnaryTypeEraser(source) { - return function (t) { return t === source ? anyType : t; }; + return function (t) { + return t === source ? anyType : t; + }; } function createBinaryTypeEraser(source1, source2) { - return function (t) { return t === source1 || t === source2 ? anyType : t; }; + return function (t) { + return t === source1 || t === source2 ? anyType : t; + }; } function createTypeEraser(sources) { switch (sources.length) { - case 1: return createUnaryTypeEraser(sources[0]); - case 2: return createBinaryTypeEraser(sources[0], sources[1]); + case 1: + return createUnaryTypeEraser(sources[0]); + case 2: + return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { for (var i = 0; i < sources.length; i++) { @@ -11023,7 +15778,9 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return mapper2(mapper1(t)); }; + return function (t) { + return mapper2(mapper1(t)); + }; } function instantiateTypeParameter(typeParameter, mapper) { var result = createType(512); @@ -11083,8 +15840,7 @@ var ts; return mapper(type); } if (type.flags & 32768) { - return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? - instantiateAnonymousType(type, mapper) : type; + return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096) { return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); @@ -11109,12 +15865,10 @@ var ts; case 151: return ts.forEach(node.elements, isContextSensitive); case 168: - return isContextSensitive(node.whenTrue) || - isContextSensitive(node.whenFalse); + return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); case 167: - return node.operatorToken.kind === 49 && - (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 217: + return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 218: return isContextSensitive(node.initializer); case 132: case 131: @@ -11125,7 +15879,9 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { + return p.type; + }); } function getTypeWithoutConstructors(type) { if (type.flags & 48128) { @@ -11264,8 +16020,7 @@ var ts; } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && - (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; return result; } @@ -11722,9 +16477,7 @@ var ts; if (source === target) { return -1; } - if (source.parameters.length !== target.parameters.length || - source.minArgumentCount !== target.minArgumentCount || - source.hasRestParameter !== target.hasRestParameter) { + if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { return 0; } var result = -1; @@ -11767,7 +16520,9 @@ var ts; return true; } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + return ts.forEach(types, function (t) { + return isSupertypeOfEach(t, types) ? t : undefined; + }); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { var bestSupertype; @@ -11804,6 +16559,9 @@ var ts; function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); } + function isTupleType(type) { + return (type.flags & 8192) && !!type.elementTypes; + } function getWidenedTypeOfObjectLiteral(type) { var properties = getPropertiesOfObjectType(type); var members = {}; @@ -11883,9 +16641,7 @@ var ts; var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; case 128: - var diagnostic = declaration.dotDotDotToken ? - ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : - ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + var diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; case 195: case 132: @@ -11941,7 +16697,10 @@ var ts; function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; for (var i = 0; i < typeParameters.length; i++) { - inferences.push({ primary: undefined, secondary: undefined }); + inferences.push({ + primary: undefined, + secondary: undefined + }); } return { typeParameters: typeParameters, @@ -11986,9 +16745,7 @@ var ts; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { var inferences = context.inferences[i]; - var candidates = inferiority ? - inferences.secondary || (inferences.secondary = []) : - inferences.primary || (inferences.primary = []); + var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); if (!ts.contains(candidates, source)) candidates.push(source); break; @@ -12028,8 +16785,7 @@ var ts; inferFromTypes(sourceTypes[i], target); } } - else if (source.flags & 48128 && (target.flags & (4096 | 8192) || - (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -12136,16 +16892,23 @@ var ts; } ts.Debug.fail("should not get here"); } - function removeTypesFromUnionType(type, typeKind, isOfTypeKind) { + function removeTypesFromUnionType(type, typeKind, isOfTypeKind, allowEmptyUnionResult) { if (type.flags & 16384) { var types = type.types; - if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { - var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); - if (narrowedType !== emptyObjectType) { + if (ts.forEach(types, function (t) { + return !!(t.flags & typeKind) === isOfTypeKind; + })) { + var narrowedType = getUnionType(ts.filter(types, function (t) { + return !(t.flags & typeKind) === isOfTypeKind; + })); + if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { return narrowedType; } } } + else if (allowEmptyUnionResult && !!(type.flags & typeKind) === isOfTypeKind) { + return getUnionType(emptyArray); + } return type; } function hasInitializer(node) { @@ -12217,12 +16980,12 @@ var ts; case 186: case 187: case 188: - case 213: case 214: + case 215: case 189: case 190: case 191: - case 216: + case 217: return ts.forEachChild(node, isAssignedIn); } return false; @@ -12231,12 +16994,13 @@ var ts; function resolveLocation(node) { var containerNodes = []; for (var parent = node.parent; parent; parent = parent.parent) { - if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && - isContextSensitive(parent)) { + if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(parent)) { containerNodes.unshift(parent); } } - ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); + ts.forEach(containerNodes, function (node) { + getTypeOfNode(node); + }); } function getSymbolAtLocation(node) { resolveLocation(node); @@ -12278,7 +17042,7 @@ var ts; } } break; - case 220: + case 221: case 200: case 195: case 132: @@ -12312,16 +17076,16 @@ var ts; } if (assumeTrue) { if (!typeInfo) { - return removeTypesFromUnionType(type, 258 | 132 | 8 | 1048576, true); + return removeTypesFromUnionType(type, 258 | 132 | 8 | 1048576, true, false); } if (isTypeSubtypeOf(typeInfo.type, type)) { return typeInfo.type; } - return removeTypesFromUnionType(type, typeInfo.flags, false); + return removeTypesFromUnionType(type, typeInfo.flags, false, false); } else { if (typeInfo) { - return removeTypesFromUnionType(type, typeInfo.flags, true); + return removeTypesFromUnionType(type, typeInfo.flags, true, false); } return type; } @@ -12365,7 +17129,9 @@ var ts; return targetType; } if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + return getUnionType(ts.filter(type.types, function (t) { + return isTypeSubtypeOf(t, targetType); + })); } return type; } @@ -12421,9 +17187,7 @@ var ts; return false; } function checkBlockScopedBindingCapturedInLoop(node, symbol) { - if (languageVersion >= 2 || - (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 216) { + if (languageVersion >= 2 || (symbol.flags & 2) === 0 || symbol.valueDeclaration.parent.kind === 217) { return; } var container = symbol.valueDeclaration; @@ -12530,21 +17294,10 @@ var ts; } if (container && container.parent && container.parent.kind === 196) { if (container.flags & 128) { - canUseSuperExpression = - container.kind === 132 || - container.kind === 131 || - container.kind === 134 || - container.kind === 135; + canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135; } else { - canUseSuperExpression = - container.kind === 132 || - container.kind === 131 || - container.kind === 134 || - container.kind === 135 || - container.kind === 130 || - container.kind === 129 || - container.kind === 133; + canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135 || container.kind === 130 || container.kind === 129 || container.kind === 133; } } } @@ -12591,8 +17344,7 @@ var ts; if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } - if (indexOfParameter === (func.parameters.length - 1) && - funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); } } @@ -12677,7 +17429,10 @@ var ts; mappedType = t; } else if (!mappedTypes) { - mappedTypes = [mappedType, t]; + mappedTypes = [ + mappedType, + t + ]; } else { mappedTypes.push(t); @@ -12693,13 +17448,17 @@ var ts; }); } function getIndexTypeOfContextualType(type, kind) { - return applyToContextualType(type, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }); + return applyToContextualType(type, function (t) { + return getIndexTypeOfObjectOrUnionType(t, kind); + }); } function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } function contextualTypeHasIndexSignature(type, kind) { - return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); + return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { + return getIndexTypeOfObjectOrUnionType(t, kind); + }) : getIndexTypeOfObjectOrUnionType(type, kind)); } function getContextualTypeForObjectLiteralMethod(node) { ts.Debug.assert(ts.isObjectLiteralMethod(node)); @@ -12719,8 +17478,7 @@ var ts; return propertyType; } } - return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || - getIndexTypeOfContextualType(type, 0); + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || getIndexTypeOfContextualType(type, 0); } return undefined; } @@ -12729,9 +17487,7 @@ var ts; var type = getContextualType(arrayLiteral); if (type) { var index = ts.indexOf(arrayLiteral.elements, node); - return getTypeOfPropertyOfContextualType(type, "" + index) - || getIndexTypeOfContextualType(type, 1) - || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); + return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1) || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); } return undefined; } @@ -12764,7 +17520,7 @@ var ts; return getTypeFromTypeNode(parent.type); case 167: return getContextualTypeForBinaryOperand(node); - case 217: + case 218: return getContextualTypeForObjectLiteralElement(parent); case 151: return getContextualTypeForElementExpression(node); @@ -12795,9 +17551,7 @@ var ts; } function getContextualSignature(node) { ts.Debug.assert(node.kind !== 132 || ts.isObjectLiteralMethod(node)); - var type = ts.isObjectLiteralMethod(node) - ? getContextualTypeForObjectLiteralMethod(node) - : getContextualType(node); + var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); if (!type) { return undefined; } @@ -12807,14 +17561,15 @@ var ts; var signatureList; var types = type.types; for (var i = 0; i < types.length; i++) { - if (signatureList && - getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { + if (signatureList && getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { return undefined; } var signature = getNonGenericSignature(types[i]); if (signature) { if (!signatureList) { - signatureList = [signature]; + signatureList = [ + signature + ]; } else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { return undefined; @@ -12840,7 +17595,7 @@ var ts; if (parent.kind === 167 && parent.operatorToken.kind === 52 && parent.left === node) { return true; } - if (parent.kind === 217) { + if (parent.kind === 218) { return isAssignmentTarget(parent.parent); } if (parent.kind === 151) { @@ -12912,20 +17667,16 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 217 || - memberDecl.kind === 218 || - ts.isObjectLiteralMethod(memberDecl)) { - if (memberDecl.kind === 217) { + if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 218) { var type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 132) { var type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 218); - var type = memberDecl.name.kind === 126 - ? unknownType - : checkExpression(memberDecl.name, contextualMapper); + ts.Debug.assert(memberDecl.kind === 219); + var type = memberDecl.name.kind === 126 ? unknownType : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -13041,9 +17792,7 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 153 - ? node.expression - : node.left; + var left = node.kind === 153 ? node.expression : node.left; var type = checkExpressionOrQualifiedName(left); if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); @@ -13080,8 +17829,7 @@ var ts; return unknownType; } var isConstEnum = isConstEnumObjectType(objectType); - if (isConstEnum && - (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } @@ -13248,8 +17996,7 @@ var ts; callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; } - var hasRightNumberOfTypeArgs = !typeArguments || - (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); if (!hasRightNumberOfTypeArgs) { return false; } @@ -13266,8 +18013,7 @@ var ts; function getSingleCallSignature(type) { if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); - if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && - resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { return resolved.callSignatures[0]; } } @@ -13337,9 +18083,7 @@ var ts; var arg = args[i]; if (arg.kind !== 172) { var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); - var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : - arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : - checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { return false; } @@ -13351,7 +18095,9 @@ var ts; var args; if (node.kind === 157) { var template = node.template; - args = [template]; + args = [ + template + ]; if (template.kind === 169) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); @@ -13603,10 +18349,7 @@ var ts; } if (node.kind === 156) { var declaration = signature.declaration; - if (declaration && - declaration.kind !== 133 && - declaration.kind !== 137 && - declaration.kind !== 141) { + if (declaration && declaration.kind !== 133 && declaration.kind !== 137 && declaration.kind !== 141) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -13631,13 +18374,9 @@ var ts; } function getTypeAtPosition(signature, pos) { if (pos >= 0) { - return signature.hasRestParameter ? - pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : - pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; } - return signature.hasRestParameter ? - getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : - anyArrayType; + return signature.hasRestParameter ? getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : anyArrayType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -13937,12 +18676,9 @@ var ts; var properties = node.properties; for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 217 || p.kind === 218) { + if (p.kind === 218 || p.kind === 219) { var name = p.name; - var type = sourceType.flags & 1 ? sourceType : - getTypeOfPropertyOfType(sourceType, name.text) || - isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || - getIndexTypeOfType(sourceType, 0); + var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { checkDestructuringAssignment(p.initializer || name, type); } @@ -13967,14 +18703,17 @@ var ts; if (e.kind !== 172) { if (e.kind !== 171) { var propName = "" + i; - var type = sourceType.flags & 1 ? sourceType : - isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : - getIndexTypeOfType(sourceType, 1); + var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); if (type) { checkDestructuringAssignment(e, type, contextualMapper); } else { - error(e, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + if (isTupleType(sourceType)) { + error(e, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), sourceType.elementTypes.length, elements.length); + } + else { + error(e, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + } } } else { @@ -14045,9 +18784,7 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var suggestedOperator; - if ((leftType.flags & 8) && - (rightType.flags & 8) && - (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { @@ -14109,7 +18846,10 @@ var ts; case 48: return rightType; case 49: - return getUnionType([leftType, rightType]); + return getUnionType([ + leftType, + rightType + ]); case 52: checkAssignmentOperator(rightType); return rightType; @@ -14117,9 +18857,7 @@ var ts; return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : - someConstituentTypeHasKind(rightType, 1048576) ? node.right : - undefined; + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); return false; @@ -14165,7 +18903,10 @@ var ts; checkExpression(node.condition); var type1 = checkExpression(node.whenTrue, contextualMapper); var type2 = checkExpression(node.whenFalse, contextualMapper); - return getUnionType([type1, type2]); + return getUnionType([ + type1, + type2 + ]); } function checkTemplateExpression(node) { ts.forEach(node.templateSpans, function (templateSpan) { @@ -14229,9 +18970,7 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 153 && node.parent.expression === node) || - (node.parent.kind === 154 && node.parent.expression === node) || - ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 153 && node.parent.expression === node) || (node.parent.kind === 154 && node.parent.expression === node) || ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -14341,9 +19080,7 @@ var ts; if (node.kind === 138) { checkGrammarIndexSignature(node); } - else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || - node.kind === 136 || node.kind === 133 || - node.kind === 137) { + else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || node.kind === 136 || node.kind === 133 || node.kind === 137) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -14436,8 +19173,10 @@ var ts; case 160: case 195: case 161: - case 152: return false; - default: return ts.forEachChild(n, containsSuperCall); + case 152: + return false; + default: + return ts.forEachChild(n, containsSuperCall); } } function markThisReferencesAsErrors(n) { @@ -14449,14 +19188,13 @@ var ts; } } function isInstancePropertyWithInitializer(n) { - return n.kind === 130 && - !(n.flags & 128) && - !!n.initializer; + return n.kind === 130 && !(n.flags & 128) && !!n.initializer; } if (ts.getClassBaseTypeNode(node.parent)) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { + return p.flags & (16 | 32 | 64); + }); if (superCallShouldBeFirst) { var statements = node.body.statements; if (!statements.length || statements[0].kind !== 177 || !isSuperCallExpression(statements[0].expression)) { @@ -14778,16 +19516,16 @@ var ts; case 197: return 2097152; case 200: - return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 - ? 4194304 | 1048576 - : 4194304; + return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; case 196: case 199: return 2097152 | 1048576; - case 202: + case 203: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); + ts.forEach(target.declarations, function (d) { + result |= getDeclarationSpaces(d); + }); return result; default: return 1048576; @@ -14796,10 +19534,7 @@ var ts; } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || - checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || - checkGrammarFunctionName(node.name) || - checkGrammarForGenerator(node); + checkFunctionLikeDeclaration(node) || checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -14854,12 +19589,7 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 130 || - node.kind === 129 || - node.kind === 132 || - node.kind === 131 || - node.kind === 134 || - node.kind === 135) { + if (node.kind === 130 || node.kind === 129 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135) { return false; } if (ts.isInAmbientContext(node)) { @@ -14918,7 +19648,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 220 && ts.isExternalModule(parent)) { + if (parent.kind === 221 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -14927,17 +19657,11 @@ var ts; var symbol = getSymbolOfNode(node); if (symbol.flags & 1) { var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); - if (localDeclarationSymbol && - localDeclarationSymbol !== symbol && - localDeclarationSymbol.flags & 2) { + if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 194); - var container = varDeclList.parent.kind === 175 && - varDeclList.parent.parent; - var namesShareScope = container && - (container.kind === 174 && ts.isFunctionLike(container.parent) || - (container.kind === 201 && container.kind === 200) || - container.kind === 220); + var container = varDeclList.parent.kind === 175 && varDeclList.parent.parent; + var namesShareScope = container && (container.kind === 174 && ts.isFunctionLike(container.parent) || (container.kind === 201 && container.kind === 200) || container.kind === 221); if (!namesShareScope) { var name = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); @@ -15096,18 +19820,13 @@ var ts; checkSourceElement(node.statement); } function checkForOfStatement(node) { - if (languageVersion < 2) { - grammarErrorOnFirstToken(node, ts.Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); - return; - } checkGrammarForInOrForOfStatement(node); if (node.initializer.kind === 194) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; - var rightType = checkExpression(node.expression); - var iteratedType = checkIteratedType(rightType, node.expression); + var iteratedType = checkRightHandSideOfForOf(node.expression); if (varExpr.kind === 151 || varExpr.kind === 152) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } @@ -15156,20 +19875,17 @@ var ts; checkVariableDeclaration(decl); } } - function getTypeForVariableDeclarationInForOfStatement(forOfStatement) { - if (languageVersion < 2) { - return anyType; - } - var expressionType = getTypeOfExpression(forOfStatement.expression); - return checkIteratedType(expressionType, forOfStatement.expression) || anyType; + function checkRightHandSideOfForOf(rhsExpression) { + var expressionType = getTypeOfExpression(rhsExpression); + return languageVersion >= 2 ? checkIteratedType(expressionType, rhsExpression) : checkElementTypeOfArrayOrString(expressionType, rhsExpression); } function checkIteratedType(iterable, expressionForError) { ts.Debug.assert(languageVersion >= 2); var iteratedType = getIteratedType(iterable, expressionForError); if (expressionForError && iteratedType) { - var completeIterableType = globalIterableType !== emptyObjectType - ? createTypeReference(globalIterableType, [iteratedType]) - : emptyObjectType; + var completeIterableType = globalIterableType !== emptyObjectType ? createTypeReference(globalIterableType, [ + iteratedType + ]) : emptyObjectType; checkTypeAssignableTo(iterable, completeIterableType, expressionForError); } return iteratedType; @@ -15217,6 +19933,39 @@ var ts; return iteratorNextValue; } } + function checkElementTypeOfArrayOrString(arrayOrStringType, expressionForError) { + ts.Debug.assert(languageVersion < 2); + var arrayType = removeTypesFromUnionType(arrayOrStringType, 258, true, true); + var hasStringConstituent = arrayOrStringType !== arrayType; + var reportedError = false; + if (hasStringConstituent) { + if (languageVersion < 1) { + error(expressionForError, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); + reportedError = true; + } + if (arrayType === emptyObjectType) { + return stringType; + } + } + if (!isArrayLikeType(arrayType)) { + if (!reportedError) { + var diagnostic = hasStringConstituent ? ts.Diagnostics.Type_0_is_not_an_array_type : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + error(expressionForError, diagnostic, typeToString(arrayType)); + } + return hasStringConstituent ? stringType : unknownType; + } + var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType; + if (hasStringConstituent) { + if (arrayElementType.flags & 258) { + return stringType; + } + return getUnionType([ + arrayElementType, + stringType + ]); + } + return arrayElementType; + } function checkBreakOrContinueStatement(node) { checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } @@ -15265,8 +20014,8 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); - ts.forEach(node.clauses, function (clause) { - if (clause.kind === 214 && !hasDuplicateDefaultClause) { + ts.forEach(node.caseBlock.clauses, function (clause) { + if (clause.kind === 215 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -15278,7 +20027,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 213) { + if (produceDiagnostics && clause.kind === 214) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -15375,7 +20124,9 @@ var ts; if (stringIndexType && numberIndexType) { errorNode = declaredNumberIndexer || declaredStringIndexer; if (!errorNode && (type.flags & 2048)) { - var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); }); + var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { + return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); + }); errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; } } @@ -15397,13 +20148,13 @@ var ts; errorNode = indexDeclaration; } else if (containingType.flags & 2048) { - var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { + return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); + }); errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { - var errorMessage = indexKind === 0 - ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 - : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); } } @@ -15567,7 +20318,12 @@ var ts; return true; } var seen = {}; - ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(type.declaredProperties, function (p) { + seen[p.name] = { + prop: p, + containingType: type + }; + }); var ok = true; for (var i = 0, len = type.baseTypes.length; i < len; ++i) { var base = type.baseTypes[i]; @@ -15575,7 +20331,10 @@ var ts; for (var j = 0, proplen = properties.length; j < proplen; ++j) { var prop = properties[j]; if (!ts.hasProperty(seen, prop.name)) { - seen[prop.name] = { prop: prop, containingType: base }; + seen[prop.name] = { + prop: prop, + containingType: base + }; } else { var existing = seen[prop.name]; @@ -15678,9 +20437,12 @@ var ts; return undefined; } switch (e.operator) { - case 33: return value; - case 34: return -value; - case 47: return enumIsConst ? ~value : undefined; + case 33: + return value; + case 34: + return -value; + case 47: + return enumIsConst ? ~value : undefined; } return undefined; case 167: @@ -15696,17 +20458,28 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 44: return left | right; - case 43: return left & right; - case 41: return left >> right; - case 42: return left >>> right; - case 40: return left << right; - case 45: return left ^ right; - case 35: return left * right; - case 36: return left / right; - case 33: return left + right; - case 34: return left - right; - case 37: return left % right; + case 44: + return left | right; + case 43: + return left & right; + case 41: + return left >> right; + case 42: + return left >>> right; + case 40: + return left << right; + case 45: + return left ^ right; + case 35: + return left * right; + case 36: + return left / right; + case 33: + return left + right; + case 34: + return left - right; + case 37: + return left % right; } return undefined; case 7: @@ -15729,8 +20502,7 @@ var ts; } else { if (e.kind === 154) { - if (e.argumentExpression === undefined || - e.argumentExpression.kind !== 8) { + if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { return undefined; } var enumType = getTypeOfNode(e.expression); @@ -15826,10 +20598,7 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - if (symbol.flags & 512 - && symbol.declarations.length > 1 - && !ts.isInAmbientContext(node) - && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -15864,10 +20633,8 @@ var ts; return false; } var inAmbientExternalModule = node.parent.kind === 201 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 220 && !inAmbientExternalModule) { - error(moduleName, node.kind === 209 ? - ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : - ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + if (node.parent.kind !== 221 && !inAmbientExternalModule) { + error(moduleName, node.kind === 210 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { @@ -15880,13 +20647,9 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | - (symbol.flags & 793056 ? 793056 : 0) | - (symbol.flags & 1536 ? 1536 : 0); + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 211 ? - ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : - ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; + var message = node.kind === 212 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); } } @@ -15907,7 +20670,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 205) { + if (importClause.namedBindings.kind === 206) { checkImportBinding(importClause.namedBindings); } else { @@ -15957,7 +20720,7 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 220 ? node.parent : node.parent.parent; + var container = node.parent.kind === 221 ? node.parent : node.parent.parent; if (container.kind === 200 && container.name.kind === 64) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); return; @@ -15974,7 +20737,7 @@ var ts; checkExternalModuleExports(container); } function getModuleStatements(node) { - if (node.kind === 220) { + if (node.kind === 221) { return node.statements; } if (node.kind === 200 && node.body.kind === 201) { @@ -15988,7 +20751,7 @@ var ts; var statements = getModuleStatements(declarations[i]); for (var j = 0; j < statements.length; j++) { var node = statements[j]; - if (node.kind === 209) { + if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; @@ -16001,7 +20764,7 @@ var ts; } } } - else if (node.kind !== 208 && node.flags & 1 && !(node.flags & 256)) { + else if (node.kind !== 209 && node.flags & 1 && !(node.flags & 256)) { return true; } } @@ -16111,13 +20874,13 @@ var ts; return checkEnumDeclaration(node); case 200: return checkModuleDeclaration(node); - case 203: + case 204: return checkImportDeclaration(node); - case 202: + case 203: return checkImportEqualsDeclaration(node); - case 209: + case 210: return checkExportDeclaration(node); - case 208: + case 209: return checkExportAssignment(node); case 176: checkGrammarStatementInAmbientContext(node); @@ -16158,7 +20921,7 @@ var ts; case 150: case 151: case 152: - case 217: + case 218: case 153: case 154: case 155: @@ -16190,19 +20953,20 @@ var ts; case 185: case 186: case 188: - case 213: + case 202: case 214: + case 215: case 189: case 190: case 191: - case 216: + case 217: case 193: case 194: case 196: case 199: - case 219: - case 208: case 220: + case 209: + case 221: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -16290,7 +21054,7 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 220: + case 221: if (!ts.isExternalModule(location)) break; case 200: @@ -16318,9 +21082,7 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 64 && - isTypeDeclaration(name.parent) && - name.parent.name === name; + return name.kind == 64 && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { @@ -16402,10 +21164,10 @@ var ts; while (nodeOnRightSide.parent.kind === 125) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 202) { + if (nodeOnRightSide.parent.kind === 203) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 208) { + if (nodeOnRightSide.parent.kind === 209) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -16414,14 +21176,13 @@ var ts; return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 125 && node.parent.right === node) || - (node.parent.kind === 153 && node.parent.name === node); + return (node.parent.kind === 125 && node.parent.right === node) || (node.parent.kind === 153 && node.parent.name === node); } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 208) { + if (entityName.parent.kind === 209) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } if (entityName.kind !== 153) { @@ -16470,9 +21231,7 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 64 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 208 - ? getSymbolOfEntityNameOrPropertyAccessExpression(node) - : getSymbolOfPartOfRightHandSideOfImportEquals(node); + return node.parent.kind === 209 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } switch (node.kind) { case 64: @@ -16491,10 +21250,7 @@ var ts; return undefined; case 8: var moduleName; - if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && - ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 203 || node.parent.kind === 209) && - node.parent.moduleSpecifier === node)) { + if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || ((node.parent.kind === 204 || node.parent.kind === 210) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 7: @@ -16512,7 +21268,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 218) { + if (location && location.kind === 219) { return resolveEntityName(location.name, 107455); } return undefined; @@ -16580,13 +21336,17 @@ var ts; else if (symbol.flags & 67108864) { var target = getSymbolLinks(symbol).target; if (target) { - return [target]; + return [ + target + ]; } } - return [symbol]; + return [ + symbol + ]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 220; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 221; } function isNodeDescendentOf(node, ancestor) { while (node) { @@ -16627,16 +21387,16 @@ var ts; case 199: generateNameForModuleOrEnum(node); break; - case 203: + case 204: generateNameForImportDeclaration(node); break; - case 209: + case 210: generateNameForExportDeclaration(node); break; - case 208: + case 209: generateNameForExportAssignment(node); break; - case 220: + case 221: case 201: ts.forEach(node.statements, generateNames); break; @@ -16665,12 +21425,11 @@ var ts; } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 8 ? - ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + var baseName = expr.kind === 8 ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; assignGeneratedName(node, makeUniqueName(baseName)); } function generateNameForImportDeclaration(node) { - if (node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 206) { + if (node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 207) { generateNameForImportOrExportDeclaration(node); } } @@ -16700,7 +21459,7 @@ var ts; } function getAliasNameSubstitution(symbol) { var declaration = getDeclarationOfAliasSymbol(symbol); - if (declaration && declaration.kind === 207) { + if (declaration && declaration.kind === 208) { var moduleName = getGeneratedNameForNode(declaration.parent.parent.parent); var propertyName = declaration.propertyName || declaration.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -16739,7 +21498,7 @@ var ts; return symbol && symbol !== unknownSymbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol); } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 220 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 221 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } return isAliasResolvedToValue(getSymbolOfNode(node)); @@ -16764,8 +21523,7 @@ var ts; if (ts.nodeIsPresent(node.body)) { var symbol = getSymbolOfNode(node); var signaturesOfSymbol = getSignaturesOfSymbol(symbol); - return signaturesOfSymbol.length > 1 || - (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); } return false; } @@ -16777,14 +21535,14 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 219) { + if (node.kind === 220) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; if (symbol && (symbol.flags & 8)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 219) { + if (declaration.kind === 220) { return getEnumMemberValue(declaration); } } @@ -16792,9 +21550,7 @@ var ts; } function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { var symbol = getSymbolOfNode(declaration); - var type = symbol && !(symbol.flags & (2048 | 131072)) - ? getTypeOfSymbol(symbol) - : unknownType; + var type = symbol && !(symbol.flags & (2048 | 131072)) ? getTypeOfSymbol(symbol) : unknownType; getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -16802,29 +21558,20 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function isUnknownIdentifier(location, name) { - return !resolveName(location, name, 107455, undefined, undefined) && - !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); + ts.Debug.assert(!ts.nodeIsSynthesized(location), "isUnknownIdentifier called with a synthesized location"); + return !resolveName(location, name, 107455, undefined, undefined) && !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - if (n.parent.kind === 153 && - n.parent.name === n) { + if (n.parent.kind === 153 && n.parent.name === n) { return undefined; } - if (n.parent.kind === 150 && - n.parent.propertyName === n) { + if (n.parent.kind === 150 && n.parent.propertyName === n) { return undefined; } - var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || - n.parent.kind === 150 - ? getSymbolOfNode(n.parent) - : undefined; - var symbol = declarationSymbol || - getNodeLinks(n).resolvedSymbol || - resolveName(n, n.text, 2 | 8388608, undefined, undefined); - var isLetOrConst = symbol && - (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 216; + var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || n.parent.kind === 150 ? getSymbolOfNode(n.parent) : undefined; + var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 2 | 8388608, undefined, undefined); + var isLetOrConst = symbol && (symbol.flags & 2) && symbol.valueDeclaration.parent.kind !== 217; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -16901,10 +21648,10 @@ var ts; case 175: case 195: case 198: + case 204: case 203: - case 202: + case 210: case 209: - case 208: case 128: break; default: @@ -16939,7 +21686,7 @@ var ts; else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 201 || node.parent.kind === 220) { + else if (node.parent.kind === 201 || node.parent.kind === 221) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -16948,7 +21695,7 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 201 || node.parent.kind === 220) { + else if (node.parent.kind === 201 || node.parent.kind === 221) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } else if (node.kind === 128) { @@ -17001,7 +21748,7 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 203 || node.kind === 202) && flags & 2) { + else if ((node.kind === 204 || node.kind === 203) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } else if (node.kind === 197 && flags & 2) { @@ -17114,8 +21861,7 @@ var ts; } } function checkGrammarTypeArguments(node, typeArguments) { - return checkGrammarForDisallowedTrailingComma(typeArguments) || - checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { @@ -17129,8 +21875,7 @@ var ts; } } function checkGrammarArguments(node, arguments) { - return checkGrammarForDisallowedTrailingComma(arguments) || - checkGrammarForOmittedArgument(node, arguments); + return checkGrammarForDisallowedTrailingComma(arguments) || checkGrammarForOmittedArgument(node, arguments); } function checkGrammarHeritageClause(node) { var types = node.types; @@ -17226,13 +21971,12 @@ var ts; for (var i = 0, n = node.properties.length; i < n; i++) { var prop = node.properties[i]; var name = prop.name; - if (prop.kind === 172 || - name.kind === 126) { + if (prop.kind === 172 || name.kind === 126) { checkGrammarComputedPropertyName(name); continue; } var currentKind; - if (prop.kind === 217 || prop.kind === 218) { + if (prop.kind === 218 || prop.kind === 219) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 7) { checkGrammarNumbericLiteral(name); @@ -17283,22 +22027,16 @@ var ts; var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 182 - ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement - : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 182 - ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer - : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 182 - ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation - : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); } } @@ -17352,9 +22090,7 @@ var ts; } } function checkGrammarMethod(node) { - if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || - checkGrammarFunctionLikeDeclaration(node) || - checkGrammarForGenerator(node)) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarForGenerator(node)) { return true; } if (node.parent.kind === 152) { @@ -17405,8 +22141,7 @@ var ts; switch (current.kind) { case 189: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 184 - && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 184 && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } @@ -17427,15 +22162,11 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 185 - ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement - : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + var message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 185 - ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement - : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + var message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } } @@ -17472,8 +22203,7 @@ var ts; } } var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); - return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || - checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 64) { @@ -17605,8 +22335,7 @@ var ts; } function checkGrammarProperty(node) { if (node.parent.kind === 196) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } @@ -17625,12 +22354,7 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 197 || - node.kind === 203 || - node.kind === 202 || - node.kind === 209 || - node.kind === 208 || - (node.flags & 2)) { + if (node.kind === 197 || node.kind === 204 || node.kind === 203 || node.kind === 210 || node.kind === 209 || (node.flags & 2)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -17657,7 +22381,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 174 || node.parent.kind === 201 || node.parent.kind === 220) { + if (node.parent.kind === 174 || node.parent.kind === 201 || node.parent.kind === 221) { var links = getNodeLinks(node.parent); if (!links.hasReportedStatementInAmbientContext) { return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -17692,7 +22416,10 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var indentStrings = ["", " "]; + var indentStrings = [ + "", + " " + ]; function getIndentString(level) { if (indentStrings[level] === undefined) { indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; @@ -17767,21 +22494,34 @@ var ts; writeTextOfNode: writeTextOfNode, writeLiteral: writeLiteral, writeLine: writeLine, - increaseIndent: function () { return indent++; }, - decreaseIndent: function () { return indent--; }, - getIndent: function () { return indent; }, - getTextPos: function () { return output.length; }, - getLine: function () { return lineCount + 1; }, - getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, - getText: function () { return output; } + increaseIndent: function () { + return indent++; + }, + decreaseIndent: function () { + return indent--; + }, + getIndent: function () { + return indent; + }, + getTextPos: function () { + return output.length; + }, + getLine: function () { + return lineCount + 1; + }, + getColumn: function () { + return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; + }, + getText: function () { + return output; + } }; } function getLineOfLocalPosition(currentSourceFile, pos) { return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { - if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -17810,9 +22550,7 @@ var ts; var lineCount = ts.getLineStarts(currentSourceFile).length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = (currentLine + 1) === lineCount - ? currentSourceFile.text.length + 1 - : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); + var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { firstCommentLineIndent = calculateIndent(ts.getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); @@ -17890,8 +22628,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 134 || member.kind === 135) - && (member.flags & 128) === (accessor.flags & 128)) { + if ((member.kind === 134 || member.kind === 135) && (member.flags & 128) === (accessor.flags & 128)) { var memberName = ts.getPropertyNameForPropertyNameNode(member.name); var accessorName = ts.getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -17947,7 +22684,8 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { + } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var aliasDeclarationEmitInfo = []; var referencePathsOutput = ""; @@ -17956,9 +22694,7 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 2048) || - shouldEmitToOwnFile(referencedFile, compilerOptions) || - !addedGlobalFileReference)) { + if (referencedFile && ((referencedFile.flags & 2048) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { writeReferencePath(referencedFile); if (!isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -17975,8 +22711,7 @@ var ts; if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && - !ts.contains(emittedReferencedFiles, referencedFile))) { + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } @@ -18030,7 +22765,9 @@ var ts; function writeAsychronousImportEqualsDeclarations(importEqualsDeclarations) { var oldWriter = writer; ts.forEach(importEqualsDeclarations, function (aliasToWrite) { - var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; }); + var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { + return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; + }); if (aliasEmitInfo) { createAndSetNewTextWriterWithSymbolWriter(); for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { @@ -18148,7 +22885,7 @@ var ts; ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 202 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 203 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -18355,15 +23092,8 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 140 || - node.parent.kind === 141 || - (node.parent.parent && node.parent.parent.kind === 143)) { - ts.Debug.assert(node.parent.kind === 132 || - node.parent.kind === 131 || - node.parent.kind === 140 || - node.parent.kind === 141 || - node.parent.kind === 136 || - node.parent.kind === 137); + if (node.parent.kind === 140 || node.parent.kind === 141 || (node.parent.parent && node.parent.parent.kind === 143)) { + ts.Debug.assert(node.parent.kind === 132 || node.parent.kind === 131 || node.parent.kind === 140 || node.parent.kind === 141 || node.parent.kind === 136 || node.parent.kind === 137); emitType(node.constraint); } else { @@ -18426,9 +23156,7 @@ var ts; function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.parent.parent.kind === 196) { - diagnosticMessage = isImplementsList ? - ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : - ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; @@ -18461,7 +23189,9 @@ var ts; emitTypeParameters(node.typeParameters); var baseTypeNode = ts.getClassBaseTypeNode(node); if (baseTypeNode) { - emitHeritageClause([baseTypeNode], false); + emitHeritageClause([ + baseTypeNode + ], false); } emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); write(" {"); @@ -18521,31 +23251,17 @@ var ts; function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.kind === 193) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } else if (node.kind === 130 || node.kind === 129) { if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } return diagnosticMessage !== undefined ? { @@ -18562,7 +23278,9 @@ var ts; } } function emitVariableStatement(node) { - var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); + var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { + return resolver.isDeclarationVisible(varDeclaration); + }); if (hasDeclarationWithEmit) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); @@ -18607,25 +23325,17 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 134 - ? accessor.type - : accessor.parameters.length > 0 - ? accessor.parameters[0].type - : undefined; + return accessor.kind === 134 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; } } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (accessorWithTypeAnnotation.kind === 135) { if (accessorWithTypeAnnotation.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } return { diagnosticMessage: diagnosticMessage, @@ -18635,18 +23345,10 @@ var ts; } else { if (accessorWithTypeAnnotation.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; } return { diagnosticMessage: diagnosticMessage, @@ -18660,8 +23362,7 @@ var ts; if (ts.hasDynamicName(node)) { return; } - if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && - !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); if (node.kind === 195) { emitModuleElementDeclarationFlags(node); @@ -18728,48 +23429,28 @@ var ts; var diagnosticMessage; switch (node.kind) { case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 132: case 131: if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: ts.Debug.fail("This is unknown kind for signature: " + node.kind); @@ -18796,9 +23477,7 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 140 || - node.parent.kind === 141 || - node.parent.parent.kind === 143) { + if (node.parent.kind === 140 || node.parent.kind === 141 || node.parent.parent.kind === 143) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -18808,50 +23487,28 @@ var ts; var diagnosticMessage; switch (node.parent.kind) { case 133: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; break; case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 132: case 131: if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } else if (node.parent.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); @@ -18888,26 +23545,22 @@ var ts; return emitClassDeclaration(node); case 198: return emitTypeAliasDeclaration(node); - case 219: + case 220: return emitEnumMemberDeclaration(node); case 199: return emitEnumDeclaration(node); case 200: return emitModuleDeclaration(node); - case 202: + case 203: return emitImportEqualsDeclaration(node); - case 208: + case 209: return emitExportAssignment(node); - case 220: + case 221: return emitSourceFile(node); } } function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 2048 - ? referencedFile.fileName - : shouldEmitToOwnFile(referencedFile, compilerOptions) - ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") - : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + var declFileName = referencedFile.flags & 2048 ? referencedFile.fileName : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencePathsOutput += "/// " + newLine; } @@ -18958,6 +23611,7 @@ var ts; var writeLine = writer.writeLine; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; + var preserveNewLines = compilerOptions.preserveNewLines || false; var currentSourceFile; var lastFrame; var currentScopeNames; @@ -18970,41 +23624,57 @@ var ts; var exportSpecifiers; var exportDefault; var writeEmittedFiles = writeJavaScriptFile; - var emitLeadingComments = compilerOptions.removeComments ? function (node) { } : emitLeadingDeclarationComments; - var emitTrailingComments = compilerOptions.removeComments ? function (node) { } : emitTrailingDeclarationComments; - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfLocalPosition; + var emitLeadingComments = compilerOptions.removeComments ? function (node) { + } : emitLeadingDeclarationComments; + var emitTrailingComments = compilerOptions.removeComments ? function (node) { + } : emitTrailingDeclarationComments; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { + } : emitLeadingCommentsOfLocalPosition; var detachedCommentsInfo; - var emitDetachedComments = compilerOptions.removeComments ? function (node) { } : emitDetachedCommentsAtPosition; - var emitPinnedOrTripleSlashComments = compilerOptions.removeComments ? function (node) { } : emitPinnedOrTripleSlashCommentsOfNode; + var emitDetachedComments = compilerOptions.removeComments ? function (node) { + } : emitDetachedCommentsAtPosition; var writeComment = writeCommentRange; - var emit = emitNode; - var emitStart = function (node) { }; - var emitEnd = function (node) { }; + var emitNodeWithoutSourceMap = compilerOptions.removeComments ? emitNodeWithoutSourceMapWithoutComments : emitNodeWithoutSourceMapWithComments; + var emit = emitNodeWithoutSourceMap; + var emitWithoutComments = emitNodeWithoutSourceMapWithoutComments; + var emitStart = function (node) { + }; + var emitEnd = function (node) { + }; var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { }; - var scopeEmitEnd = function () { }; + var scopeEmitStart = function (scopeDeclaration, scopeName) { + }; + var scopeEmitEnd = function () { + }; var sourceMapData; if (compilerOptions.sourceMap) { initializeEmitterWithSourceMaps(); } if (root) { - emit(root); + emitSourceFile(root); } else { ts.forEach(host.getSourceFiles(), function (sourceFile) { if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emit(sourceFile); + emitSourceFile(sourceFile); } }); } writeLine(); writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); return; + function emitSourceFile(sourceFile) { + currentSourceFile = sourceFile; + emit(sourceFile); + } function enterNameScope() { var names = currentScopeNames; currentScopeNames = undefined; if (names) { - lastFrame = { names: names, previous: lastFrame }; + lastFrame = { + names: names, + previous: lastFrame + }; return true; } return false; @@ -19024,8 +23694,13 @@ var ts; name = baseName; } else { - name = ts.generateUniqueName(baseName, function (n) { return isExistingName(location, n); }); + name = ts.generateUniqueName(baseName, function (n) { + return isExistingName(location, n); + }); } + return recordNameInCurrentScope(name); + } + function recordNameInCurrentScope(name) { if (!currentScopeNames) { currentScopeNames = {}; } @@ -19121,12 +23796,7 @@ var ts; sourceLinePos.character++; var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || - lastRecordedSourceMapSpan.emittedLine != emittedLine || - lastRecordedSourceMapSpan.emittedColumn != emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { encodeLastRecordedSourceMapSpan(); lastRecordedSourceMapSpan = { emittedLine: emittedLine, @@ -19189,20 +23859,10 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 195 || - node.kind === 160 || - node.kind === 132 || - node.kind === 131 || - node.kind === 134 || - node.kind === 135 || - node.kind === 200 || - node.kind === 196 || - node.kind === 199) { + else if (node.kind === 195 || node.kind === 160 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135 || node.kind === 200 || node.kind === 196 || node.kind === 199) { if (node.name) { var name = node.name; - scopeName = name.kind === 126 - ? ts.getTextOfNode(name) - : node.name.text; + scopeName = name.kind === 126 ? ts.getTextOfNode(name) : node.name.text; } recordScopeNameStart(scopeName); } @@ -19280,21 +23940,32 @@ var ts; else { sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); } - function emitNodeWithMap(node) { + function emitNodeWithSourceMap(node) { if (node) { - if (node.kind != 220) { + if (ts.nodeIsSynthesized(node)) { + return emitNodeWithoutSourceMap(node); + } + if (node.kind != 221) { recordEmitNodeStartSpan(node); - emitNode(node); + emitNodeWithoutSourceMap(node); recordEmitNodeEndSpan(node); } else { recordNewSourceFileStart(node); - emitNode(node); + emitNodeWithoutSourceMap(node); } } } + function emitNodeWithSourceMapWithoutComments(node) { + if (node) { + recordEmitNodeStartSpan(node); + emitNodeWithoutSourceMapWithoutComments(node); + recordEmitNodeEndSpan(node); + } + } writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithMap; + emit = emitNodeWithSourceMap; + emitWithoutComments = emitNodeWithSourceMapWithoutComments; emitStart = recordEmitNodeStartSpan; emitEnd = recordEmitNodeEndSpan; emitToken = writeTextWithSpanRecord; @@ -19314,6 +23985,7 @@ var ts; name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); tempCount++; } + recordNameInCurrentScope(name); var result = ts.createSynthesizedNode(64); result.text = name; return result; @@ -19375,7 +24047,7 @@ var ts; function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); - if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (preserveNewLines && nodeStartPositionsAreOnSameLine(parent, nodes[0])) { if (spacesBetweenBraces) { write(" "); } @@ -19385,7 +24057,7 @@ var ts; } for (var i = 0, n = nodes.length; i < n; i++) { if (i) { - if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + if (preserveNewLines && nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { write(", "); } else { @@ -19395,12 +24067,11 @@ var ts; } emit(nodes[i]); } - var closeTokenIsOnSameLineAsLastElement = nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes)); if (nodes.hasTrailingComma && allowTrailingComma) { write(","); } decreaseIndent(); - if (closeTokenIsOnSameLineAsLastElement) { + if (preserveNewLines && nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { if (spacesBetweenBraces) { write(" "); } @@ -19534,8 +24205,7 @@ var ts; if (node.template.kind === 169) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 167 - && templateSpan.expression.operatorToken.kind === 23; + var needsParens = templateSpan.expression.kind === 167 && templateSpan.expression.operatorToken.kind === 23; emitParenthesizedIf(templateSpan.expression, needsParens); }); } @@ -19546,8 +24216,7 @@ var ts; ts.forEachChild(node, emit); return; } - var emitOuterParens = ts.isExpression(node.parent) - && templateNeedsParens(node, node.parent); + var emitOuterParens = ts.isExpression(node.parent) && templateNeedsParens(node, node.parent); if (emitOuterParens) { write("("); } @@ -19558,8 +24227,7 @@ var ts; } for (var i = 0; i < node.templateSpans.length; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 159 - && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + var needsParens = templateSpan.expression.kind !== 159 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); } @@ -19640,9 +24308,9 @@ var ts; case 150: case 130: case 129: - case 217: case 218: case 219: + case 220: case 132: case 131: case 195: @@ -19653,11 +24321,11 @@ var ts; case 197: case 199: case 200: - case 202: + case 203: return parent.name === node; case 185: case 184: - case 208: + case 209: return false; case 189: return node.parent.label === node; @@ -19845,9 +24513,9 @@ var ts; } function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { switch (property.kind) { - case 217: - return property.initializer; case 218: + return property.initializer; + case 219: return createIdentifier(resolver.getExpressionNameSubstitution(property.name)); case 132: return createFunctionExpression(property.parameters, property.body); @@ -19901,6 +24569,11 @@ var ts; result.right = right; return result; } + function createExpressionStatement(expression) { + var result = ts.createSynthesizedNode(177); + result.expression = expression; + return result; + } function createMemberAccessForPropertyName(expression, memberName) { if (memberName.kind === 64) { return createPropertyAccessExpression(expression, memberName); @@ -19916,7 +24589,7 @@ var ts; } } function createPropertyAssignment(name, initializer) { - var result = ts.createSynthesizedNode(217); + var result = ts.createSynthesizedNode(218); result.name = name; result.initializer = initializer; return result; @@ -20011,29 +24684,31 @@ var ts; } return false; } - function indentIfOnDifferentLines(parent, node1, node2) { - var isSynthesized = ts.nodeIsSynthesized(parent); - var realNodesAreOnDifferentLines = !isSynthesized && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { + var realNodesAreOnDifferentLines = preserveNewLines && !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { increaseIndent(); writeLine(); return true; } - return false; + else { + if (valueToWriteWhenNotIndenting) { + write(valueToWriteWhenNotIndenting); + } + return false; + } } function emitPropertyAccess(node) { if (tryEmitConstantValue(node)) { return; } emit(node.expression); - var indented = indentIfOnDifferentLines(node, node.expression, node.dotToken); + var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); write("."); - indented = indented || indentIfOnDifferentLines(node, node.dotToken, node.name); + var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); emit(node.name); - if (indented) { - decreaseIndent(); - } + decreaseIndentIf(indentedBeforeDot, indentedAfterDot); } function emitQualifiedName(node) { emit(node.left); @@ -20050,7 +24725,9 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 171; }); + return ts.forEach(elements, function (e) { + return e.kind === 171; + }); } function skipParentheses(node) { while (node.kind === 159 || node.kind === 158) { @@ -20163,14 +24840,7 @@ var ts; while (operand.kind == 158) { operand = operand.expression; } - if (operand.kind !== 165 && - operand.kind !== 164 && - operand.kind !== 163 && - operand.kind !== 162 && - operand.kind !== 166 && - operand.kind !== 156 && - !(operand.kind === 155 && node.parent.kind === 156) && - !(operand.kind === 160 && node.parent.kind === 155)) { + if (operand.kind !== 165 && operand.kind !== 164 && operand.kind !== 163 && operand.kind !== 162 && operand.kind !== 166 && operand.kind !== 156 && !(operand.kind === 155 && node.parent.kind === 156) && !(operand.kind === 160 && node.parent.kind === 155)) { emit(operand); return; } @@ -20213,27 +24883,16 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operatorToken.kind === 52 && - (node.left.kind === 152 || node.left.kind === 151)) { - emitDestructuring(node); + if (languageVersion < 2 && node.operatorToken.kind === 52 && (node.left.kind === 152 || node.left.kind === 151)) { + emitDestructuring(node, node.parent.kind === 177); } else { emit(node.left); - var indented1 = indentIfOnDifferentLines(node, node.left, node.operatorToken); - if (!indented1 && node.operatorToken.kind !== 23) { - write(" "); - } + var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 23 ? " " : undefined); write(ts.tokenToString(node.operatorToken.kind)); - if (!indented1) { - var indented2 = indentIfOnDifferentLines(node, node.operatorToken, node.right); - } - if (!indented2) { - write(" "); - } + var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); emit(node.right); - if (indented1 || indented2) { - decreaseIndent(); - } + decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); } } function synthesizedNodeStartsOnNewLine(node) { @@ -20241,34 +24900,22 @@ var ts; } function emitConditionalExpression(node) { emit(node.condition); - var indent1 = indentIfOnDifferentLines(node, node.condition, node.questionToken); - if (!indent1) { - write(" "); - } + var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); write("?"); - if (!indent1) { - var indent2 = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue); - } - if (!indent2) { - write(" "); - } + var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); emit(node.whenTrue); - if (indent1 || indent2) { + decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); + var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); + write(":"); + var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); + emit(node.whenFalse); + decreaseIndentIf(indentedBeforeColon, indentedAfterColon); + } + function decreaseIndentIf(value1, value2) { + if (value1) { decreaseIndent(); } - var indent3 = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken); - if (!indent3) { - write(" "); - } - write(":"); - if (!indent3) { - var indent4 = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse); - } - if (!indent4) { - write(" "); - } - emit(node.whenFalse); - if (indent3 || indent4) { + if (value2) { decreaseIndent(); } } @@ -20279,7 +24926,7 @@ var ts; } } function emitBlock(node) { - if (isSingleLineEmptyBlock(node)) { + if (preserveNewLines && isSingleLineEmptyBlock(node)) { emitToken(14, node.pos); write(" "); emitToken(15, node.statements.end); @@ -20401,6 +25048,9 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { + if (languageVersion < 2 && node.kind === 183) { + return emitDownLevelForOfStatement(node); + } var endPos = emitToken(81, node.pos); write(" "); endPos = emitToken(16, endPos); @@ -20426,6 +25076,86 @@ var ts; emitToken(17, node.expression.end); emitEmbeddedStatement(node.statement); } + function emitDownLevelForOfStatement(node) { + var endPos = emitToken(81, node.pos); + write(" "); + endPos = emitToken(16, endPos); + var rhsIsIdentifier = node.expression.kind === 64; + var counter = createTempVariable(node, true); + var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, false); + emitStart(node.expression); + write("var "); + emitNodeWithoutSourceMap(counter); + write(" = 0"); + emitEnd(node.expression); + if (!rhsIsIdentifier) { + write(", "); + emitStart(node.expression); + emitNodeWithoutSourceMap(rhsReference); + write(" = "); + emitNodeWithoutSourceMap(node.expression); + emitEnd(node.expression); + } + write("; "); + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write(" < "); + emitNodeWithoutSourceMap(rhsReference); + write(".length"); + emitEnd(node.initializer); + write("; "); + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write("++"); + emitEnd(node.initializer); + emitToken(17, node.expression.end); + write(" {"); + writeLine(); + increaseIndent(); + var rhsIterationValue = createElementAccessExpression(rhsReference, counter); + emitStart(node.initializer); + if (node.initializer.kind === 194) { + write("var "); + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length > 0) { + var declaration = variableDeclarationList.declarations[0]; + if (ts.isBindingPattern(declaration.name)) { + emitDestructuring(declaration, false, rhsIterationValue); + } + else { + emitNodeWithoutSourceMap(declaration); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + emitNodeWithoutSourceMap(createTempVariable(node, false)); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + var assignmentExpression = createBinaryExpression(node.initializer, 52, rhsIterationValue, false); + if (node.initializer.kind === 151 || node.initializer.kind === 152) { + emitDestructuring(assignmentExpression, true, undefined, node); + } + else { + emitNodeWithoutSourceMap(assignmentExpression); + } + } + emitEnd(node.initializer); + write(";"); + if (node.statement.kind === 174) { + emitLines(node.statement.statements); + } + else { + writeLine(); + emit(node.statement); + } + writeLine(); + decreaseIndent(); + write("}"); + } function emitBreakOrContinueStatement(node) { emitToken(node.kind === 185 ? 65 : 70, node.pos); emitOptional(" ", node.label); @@ -20449,7 +25179,10 @@ var ts; emit(node.expression); endPos = emitToken(17, node.expression.end); write(" "); - emitToken(14, endPos); + emitCaseBlock(node.caseBlock, endPos); + } + function emitCaseBlock(node, startPos) { + emitToken(14, startPos); increaseIndent(); emitLines(node.clauses); decreaseIndent(); @@ -20457,19 +25190,16 @@ var ts; emitToken(15, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === - getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function nodeEndPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === - getLineOfLocalPosition(currentSourceFile, node2.end); + return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === - getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 213) { + if (node.kind === 214) { write("case "); emit(node.expression); write(":"); @@ -20477,7 +25207,7 @@ var ts; else { write("default:"); } - if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + if (preserveNewLines && node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -20537,7 +25267,7 @@ var ts; emitContainingModuleName(node); write("."); } - emitNode(node.name); + emitNodeWithoutSourceMap(node.name); emitEnd(node.name); } function createVoidZero() { @@ -20554,21 +25284,22 @@ var ts; emitStart(specifier.name); emitContainingModuleName(specifier); write("."); - emitNode(specifier.name); + emitNodeWithoutSourceMap(specifier.name); emitEnd(specifier.name); write(" = "); - emitNode(name); + emitNodeWithoutSourceMap(name); write(";"); }); } } - function emitDestructuring(root, value) { + function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; var isDeclaration = (root.kind === 193 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 128; if (root.kind === 167) { emitAssignmentExpression(root); } else { + ts.Debug.assert(!isAssignmentExpressionStatement); emitBindingElement(root, value); } function emitAssignment(name, value) { @@ -20587,7 +25318,7 @@ var ts; } function ensureIdentifier(expr) { if (expr.kind !== 64) { - var identifier = createTempVariable(root); + var identifier = createTempVariable(lowestNonSynthesizedAncestor || root); if (!isDeclaration) { recordTempDeclaration(identifier); } @@ -20645,7 +25376,7 @@ var ts; } for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 217 || p.kind === 218) { + if (p.kind === 218 || p.kind === 219) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -20690,7 +25421,7 @@ var ts; function emitAssignmentExpression(root) { var target = root.left; var value = root.right; - if (root.parent.kind === 177) { + if (isAssignmentExpressionStatement) { emitDestructuringAssignment(target, value); } else { @@ -20747,7 +25478,7 @@ var ts; function emitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { if (languageVersion < 2) { - emitDestructuring(node); + emitDestructuring(node, false); } else { emit(node.name); @@ -20755,15 +25486,12 @@ var ts; } } else { - var isLet = renameNonTopLevelLetAndConst(node.name); + renameNonTopLevelLetAndConst(node.name); emitModuleMemberName(node); var initializer = node.initializer; if (!initializer && languageVersion < 2) { - var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && - (getCombinedFlagsForIdentifier(node.name) & 4096); - if (isUninitializedLet && - node.parent.parent.kind !== 182 && - node.parent.parent.kind !== 183) { + var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); + if (isUninitializedLet && node.parent.parent.kind !== 182 && node.parent.parent.kind !== 183) { initializer = createVoidZero(); } } @@ -20779,29 +25507,6 @@ var ts; ts.forEach(name.elements, emitExportVariableAssignments); } } - function getEnclosingBlockScopeContainer(node) { - var current = node; - while (current) { - if (ts.isFunctionLike(current)) { - return current; - } - switch (current.kind) { - case 220: - case 91: - case 216: - case 200: - case 181: - case 182: - case 183: - return current; - case 174: - if (!ts.isFunctionLike(current.parent)) { - return current; - } - } - current = current.parent; - } - } function getCombinedFlagsForIdentifier(node) { if (!node.parent || (node.parent.kind !== 193 && node.parent.kind !== 150)) { return 0; @@ -20809,10 +25514,7 @@ var ts; return ts.getCombinedNodeFlags(node.parent); } function renameNonTopLevelLetAndConst(node) { - if (languageVersion >= 2 || - ts.nodeIsSynthesized(node) || - node.kind !== 64 || - (node.parent.kind !== 193 && node.parent.kind !== 150)) { + if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 64 || (node.parent.kind !== 193 && node.parent.kind !== 150)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); @@ -20820,13 +25522,11 @@ var ts; return; } var list = ts.getAncestor(node, 194); - if (list.parent.kind === 175 && list.parent.parent.kind === 220) { + if (list.parent.kind === 175 && list.parent.parent.kind === 221) { return; } - var blockScopeContainer = getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 220 - ? blockScopeContainer - : blockScopeContainer.parent; + var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); + var parent = blockScopeContainer.kind === 221 ? blockScopeContainer : blockScopeContainer.parent; var generatedName = generateUniqueNameForLocation(parent, node.text); var variableId = resolver.getBlockScopedVariableId(node); if (!generatedBlockScopeNames) { @@ -20873,7 +25573,7 @@ var ts; if (ts.isBindingPattern(p.name)) { writeLine(); write("var "); - emitDestructuring(p, tempParameters[tempIndex]); + emitDestructuring(p, false, tempParameters[tempIndex]); write(";"); tempIndex++; } @@ -20881,14 +25581,14 @@ var ts; writeLine(); emitStart(p); write("if ("); - emitNode(p.name); + emitNodeWithoutSourceMap(p.name); write(" === void 0)"); emitEnd(p); write(" { "); emitStart(p); - emitNode(p.name); + emitNodeWithoutSourceMap(p.name); write(" = "); - emitNode(p.initializer); + emitNodeWithoutSourceMap(p.initializer); emitEnd(p); write("; }"); } @@ -20904,7 +25604,7 @@ var ts; emitLeadingComments(restParam); emitStart(restParam); write("var "); - emitNode(restParam.name); + emitNodeWithoutSourceMap(restParam.name); write(" = [];"); emitEnd(restParam); emitTrailingComments(restParam); @@ -20925,7 +25625,7 @@ var ts; increaseIndent(); writeLine(); emitStart(restParam); - emitNode(restParam.name); + emitNodeWithoutSourceMap(restParam.name); write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); emitEnd(restParam); decreaseIndent(); @@ -20943,7 +25643,7 @@ var ts; } function emitDeclarationName(node) { if (node.name) { - emitNode(node.name); + emitNodeWithoutSourceMap(node.name); } else { write(resolver.getGeneratedNameForNode(node)); @@ -21060,11 +25760,11 @@ var ts; emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); - if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + if (preserveNewLines && !preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { write(" "); emitStart(body); write("return "); - emitNode(body, true); + emitWithoutComments(body); emitEnd(body); write(";"); emitTempDeclarations(false); @@ -21075,7 +25775,7 @@ var ts; writeLine(); emitLeadingComments(node.body); write("return "); - emit(node.body, true); + emitWithoutComments(node.body); write(";"); emitTrailingComments(node.body); emitTempDeclarations(true); @@ -21097,7 +25797,7 @@ var ts; emitFunctionBodyPreamble(node); decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { for (var i = 0, n = body.statements.length; i < n; i++) { write(" "); emit(body.statements[i]); @@ -21138,7 +25838,7 @@ var ts; emitStart(param); emitStart(param.name); write("this."); - emitNode(param.name); + emitNodeWithoutSourceMap(param.name); emitEnd(param.name); write(" = "); emit(param.name); @@ -21150,7 +25850,7 @@ var ts; function emitMemberAccessForPropertyName(memberName) { if (memberName.kind === 8 || memberName.kind === 7) { write("["); - emitNode(memberName); + emitNodeWithoutSourceMap(memberName); write("]"); } else if (memberName.kind === 126) { @@ -21158,7 +25858,7 @@ var ts; } else { write("."); - emitNode(memberName); + emitNodeWithoutSourceMap(memberName); } } function emitMemberAssignments(node, staticFlag) { @@ -21587,8 +26287,7 @@ var ts; emitImportDeclaration(node); return; } - if (resolver.isReferencedAliasDeclaration(node) || - (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + if (resolver.isReferencedAliasDeclaration(node) || (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); if (!(node.flags & 1)) @@ -21617,11 +26316,11 @@ var ts; emitStart(specifier); emitContainingModuleName(specifier); write("."); - emitNode(specifier.name); + emitNodeWithoutSourceMap(specifier.name); write(" = "); write(generatedName); write("."); - emitNode(specifier.propertyName || specifier.name); + emitNodeWithoutSourceMap(specifier.propertyName || specifier.name); write(";"); emitEnd(specifier); }); @@ -21639,15 +26338,15 @@ var ts; } } function createExternalImportInfo(node) { - if (node.kind === 202) { - if (node.moduleReference.kind === 212) { + if (node.kind === 203) { + if (node.moduleReference.kind === 213) { return { rootNode: node, declarationNode: node }; } } - else if (node.kind === 203) { + else if (node.kind === 204) { var importClause = node.importClause; if (importClause) { if (importClause.name) { @@ -21656,7 +26355,7 @@ var ts; declarationNode: importClause }; } - if (importClause.namedBindings.kind === 205) { + if (importClause.namedBindings.kind === 206) { return { rootNode: node, declarationNode: importClause.namedBindings @@ -21672,7 +26371,7 @@ var ts; rootNode: node }; } - else if (node.kind === 209) { + else if (node.kind === 210) { if (node.moduleSpecifier) { return { rootNode: node @@ -21685,7 +26384,7 @@ var ts; exportSpecifiers = {}; exportDefault = undefined; ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 209 && !node.moduleSpecifier) { + if (node.kind === 210 && !node.moduleSpecifier) { ts.forEach(node.exportClause.elements, function (specifier) { if (specifier.name.text === "default") { exportDefault = exportDefault || specifier; @@ -21694,7 +26393,7 @@ var ts; (exportSpecifiers[name] || (exportSpecifiers[name] = [])).push(specifier); }); } - else if (node.kind === 208) { + else if (node.kind === 209) { exportDefault = exportDefault || node; } else if (node.kind === 195 || node.kind === 196) { @@ -21724,7 +26423,7 @@ var ts; } function getFirstExportAssignment(sourceFile) { return ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 208) { + if (node.kind === 209) { return node; } }); @@ -21802,10 +26501,10 @@ var ts; writeLine(); emitStart(exportDefault); write(emitAsReturn ? "return " : "module.exports = "); - if (exportDefault.kind === 208) { + if (exportDefault.kind === 209) { emit(exportDefault.expression); } - else if (exportDefault.kind === 211) { + else if (exportDefault.kind === 212) { emit(exportDefault.propertyName); } else { @@ -21829,8 +26528,7 @@ var ts; } return statements.length; } - function emitSourceFile(node) { - currentSourceFile = node; + function emitSourceFileNode(node) { writeLine(); emitDetachedComments(node); var startIndex = emitDirectivePrologues(node.statements, false); @@ -21870,14 +26568,14 @@ var ts; } emitLeadingComments(node.endOfFileToken); } - function emitNode(node, disableComments) { + function emitNodeWithoutSourceMapWithComments(node) { if (!node) { return; } if (node.flags & 2) { return emitPinnedOrTripleSlashComments(node); } - var emitComments = !disableComments && shouldEmitLeadingAndTrailingComments(node); + var emitComments = shouldEmitLeadingAndTrailingComments(node); if (emitComments) { emitLeadingComments(node); } @@ -21886,14 +26584,23 @@ var ts; emitTrailingComments(node); } } + function emitNodeWithoutSourceMapWithoutComments(node) { + if (!node) { + return; + } + if (node.flags & 2) { + return emitPinnedOrTripleSlashComments(node); + } + emitJavaScriptWorker(node); + } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { case 197: case 195: + case 204: case 203: - case 202: case 198: - case 208: + case 209: return false; case 200: return shouldEmitModuleDeclaration(node); @@ -21948,9 +26655,9 @@ var ts; return emitArrayLiteral(node); case 152: return emitObjectLiteral(node); - case 217: - return emitPropertyAssignment(node); case 218: + return emitPropertyAssignment(node); + case 219: return emitShorthandPropertyAssignment(node); case 126: return emitComputedPropertyName(node); @@ -22019,8 +26726,8 @@ var ts; return emitWithStatement(node); case 188: return emitSwitchStatement(node); - case 213: case 214: + case 215: return emitCaseOrDefaultClause(node); case 189: return emitLabelledStatement(node); @@ -22028,7 +26735,7 @@ var ts; return emitThrowStatement(node); case 191: return emitTryStatement(node); - case 216: + case 217: return emitCatchClause(node); case 192: return emitDebuggerStatement(node); @@ -22040,18 +26747,18 @@ var ts; return emitInterfaceDeclaration(node); case 199: return emitEnumDeclaration(node); - case 219: + case 220: return emitEnumMember(node); case 200: return emitModuleDeclaration(node); - case 203: + case 204: return emitImportDeclaration(node); - case 202: + case 203: return emitImportEqualsDeclaration(node); - case 209: + case 210: return emitExportDeclaration(node); - case 220: - return emitSourceFile(node); + case 221: + return emitSourceFileNode(node); } } function hasDetachedComments(pos) { @@ -22069,7 +26776,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 220 || node.pos !== node.parent.pos) { + if (node.parent.kind === 221 || node.pos !== node.parent.pos) { var leadingComments; if (hasDetachedComments(node.pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -22088,7 +26795,7 @@ var ts; } function emitTrailingDeclarationComments(node) { if (node.parent) { - if (node.parent.kind === 220 || node.end !== node.parent.end) { + if (node.parent.kind === 221 || node.end !== node.parent.end) { var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); } @@ -22102,7 +26809,10 @@ var ts; else { leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); } - emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, { + pos: pos, + end: pos + }, leadingComments); emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitDetachedCommentsAtPosition(node) { @@ -22127,27 +26837,29 @@ var ts; if (nodeLine >= lastCommentLine + 2) { emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; + var currentDetachedCommentInfo = { + nodePos: node.pos, + detachedCommentEndPos: detachedComments[detachedComments.length - 1].end + }; if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); } else { - detachedCommentsInfo = [currentDetachedCommentInfo]; + detachedCommentsInfo = [ + currentDetachedCommentInfo + ]; } } } } } - function emitPinnedOrTripleSlashCommentsOfNode(node) { + function emitPinnedOrTripleSlashComments(node) { var pinnedComments = ts.filter(getLeadingCommentsToEmit(node), isPinnedOrTripleSlashComment); function isPinnedOrTripleSlashComment(comment) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && - currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { return true; } } @@ -22184,6 +26896,7 @@ var ts; (function (ts) { ts.emitTime = 0; ts.ioReadTime = 0; + ts.version = "1.5.0.0"; function createCompilerHost(options) { var currentDirectory; var existingDirectories = {}; @@ -22199,9 +26912,7 @@ var ts; } catch (e) { if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode - ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText - : e.message); + onError(e.number === unsupportedFileEncodingErrorCode ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText : e.message); } text = ""; } @@ -22237,12 +26948,20 @@ var ts; } return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + getDefaultLibFileName: function (options) { + return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); + }, writeFile: writeFile, - getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, - useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, + getCurrentDirectory: function () { + return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); + }, + useCaseSensitiveFileNames: function () { + return ts.sys.useCaseSensitiveFileNames; + }, getCanonicalFileName: getCanonicalFileName, - getNewLine: function () { return ts.sys.newLine; } + getNewLine: function () { + return ts.sys.newLine; + } }; } ts.createCompilerHost = createCompilerHost; @@ -22282,7 +27001,9 @@ var ts; var seenNoDefaultLib = options.noLib; var commonSourceDirectory; host = host || createCompilerHost(options); - ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + ts.forEach(rootNames, function (name) { + return processRootFile(name, false); + }); if (!seenNoDefaultLib) { processRootFile(host.getDefaultLibFileName(options), true); } @@ -22291,21 +27012,35 @@ var ts; var noDiagnosticsTypeChecker; program = { getSourceFile: getSourceFile, - getSourceFiles: function () { return files; }, - getCompilerOptions: function () { return options; }, + getSourceFiles: function () { + return files; + }, + getCompilerOptions: function () { + return options; + }, getSyntacticDiagnostics: getSyntacticDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, getDeclarationDiagnostics: getDeclarationDiagnostics, getTypeChecker: getTypeChecker, getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, - getCommonSourceDirectory: function () { return commonSourceDirectory; }, + getCommonSourceDirectory: function () { + return commonSourceDirectory; + }, emit: emit, getCurrentDirectory: host.getCurrentDirectory, - getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, - getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, - getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, - getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } + getNodeCount: function () { + return getDiagnosticsProducingTypeChecker().getNodeCount(); + }, + getIdentifierCount: function () { + return getDiagnosticsProducingTypeChecker().getIdentifierCount(); + }, + getSymbolCount: function () { + return getDiagnosticsProducingTypeChecker().getSymbolCount(); + }, + getTypeCount: function () { + return getDiagnosticsProducingTypeChecker().getTypeCount(); + } }; return program; function getEmitHost(writeFileCallback) { @@ -22332,7 +27067,11 @@ var ts; } function emit(sourceFile, writeFileCallback) { if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { - return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; + return { + diagnostics: [], + sourceMaps: undefined, + emitSkipped: true + }; } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); var start = new Date().getTime(); @@ -22474,7 +27213,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 203 || node.kind === 202 || node.kind === 209) { + if (node.kind === 204 || node.kind === 203 || node.kind === 210) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8) { var moduleNameText = moduleNameExpr.text; @@ -22496,8 +27235,7 @@ var ts; } else if (node.kind === 200 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && - ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { @@ -22525,19 +27263,17 @@ var ts; } return; } - var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); + var firstExternalModuleSourceFile = ts.forEach(files, function (f) { + return ts.isExternalModule(f) ? f : undefined; + }); if (firstExternalModuleSourceFile && !options.module) { var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } - if (options.outDir || - options.sourceRoot || - (options.mapRoot && - (!options.out || firstExternalModuleSourceFile !== undefined))) { + if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModuleSourceFile !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { - if (!(sourceFile.flags & 2048) - && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { + if (!(sourceFile.flags & 2048) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); sourcePathComponents.pop(); if (commonPathComponents) { @@ -22715,10 +27451,20 @@ var ts; description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, experimental: true }, + { + name: "preserveNewLines", + type: "boolean", + description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, + experimental: true + }, { name: "target", shortName: "t", - type: { "es3": 0, "es5": 1, "es6": 2 }, + type: { + "es3": 0, + "es5": 1, + "es6": 2 + }, description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, paramType: ts.Diagnostics.VERSION, error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6 @@ -22898,7 +27644,9 @@ var ts; var files = []; if (ts.hasProperty(json, "files")) { if (json["files"] instanceof Array) { - var files = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); + var files = ts.map(json["files"], function (s) { + return ts.combinePaths(basePath, s); + }); } } else { @@ -22948,14 +27696,7 @@ var ts; var parent = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent.kind === 179 || - parent.kind === 182 || - parent.kind === 183 || - parent.kind === 181 || - parent.kind === 178 || - parent.kind === 180 || - parent.kind === 187 || - parent.kind === 216) { + if (parent.kind === 179 || parent.kind === 182 || parent.kind === 183 || parent.kind === 181 || parent.kind === 178 || parent.kind === 180 || parent.kind === 187 || parent.kind === 217) { addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } @@ -22991,7 +27732,7 @@ var ts; case 197: case 199: case 152: - case 188: + case 202: var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); @@ -23042,7 +27783,13 @@ var ts; } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ + name: name, + fileName: fileName, + matchKind: matchKind, + isCaseSensitive: allMatchesAreCaseSensitive(matches), + declaration: declaration + }); } } }); @@ -23076,9 +27823,7 @@ var ts; return undefined; } function getTextOfIdentifierOrLiteral(node) { - if (node.kind === 64 || - node.kind === 8 || - node.kind === 7) { + if (node.kind === 64 || node.kind === 8 || node.kind === 7) { return node.text; } return undefined; @@ -23142,11 +27887,11 @@ var ts; } return bestMatchKind; } - var baseSensitivity = { sensitivity: "base" }; + var baseSensitivity = { + sensitivity: "base" + }; function compareNavigateToItems(i1, i2) { - return i1.matchKind - i2.matchKind || - i1.name.localeCompare(i2.name, undefined, baseSensitivity) || - i1.name.localeCompare(i2.name); + return i1.matchKind - i2.matchKind || i1.name.localeCompare(i2.name, undefined, baseSensitivity) || i1.name.localeCompare(i2.name); } function createNavigateToItem(rawItem) { var declaration = rawItem.declaration; @@ -23204,19 +27949,19 @@ var ts; case 149: ts.forEach(node.elements, visit); break; - case 209: + case 210: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 203: + case 204: var importClause = node.importClause; if (importClause) { if (importClause.name) { childNodes.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 205) { + if (importClause.namedBindings.kind === 206) { childNodes.push(importClause.namedBindings); } else { @@ -23236,9 +27981,9 @@ var ts; case 197: case 200: case 195: - case 202: - case 207: - case 211: + case 203: + case 208: + case 212: childNodes.push(node); break; } @@ -23296,7 +28041,9 @@ var ts; function isTopLevelFunctionDeclaration(functionDeclaration) { if (functionDeclaration.kind === 195) { if (functionDeclaration.body && functionDeclaration.body.kind === 174) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 195 && !isEmpty(s.name.text); })) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { + return s.kind === 195 && !isEmpty(s.name.text); + })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -23366,7 +28113,7 @@ var ts; return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); case 138: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 219: + case 220: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); case 136: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); @@ -23405,16 +28152,18 @@ var ts; } case 133: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 211: - case 207: - case 202: - case 204: + case 212: + case 208: + case 203: case 205: + case 206: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; function createItem(node, name, scriptElementKind) { - return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)]); + return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ]); } } function isEmpty(text) { @@ -23439,7 +28188,7 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 220: + case 221: return createSourceFileItem(node); case 196: return createClassItem(node); @@ -23468,12 +28217,16 @@ var ts; function createModuleItem(node) { var moduleName = getModuleName(node); var childItems = getItemsWorker(getChildNodes(getInnermostModule(node).body.statements), createChildItem); - return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ], childItems, getIndent(node)); } function createFunctionItem(node) { if (node.name && node.body && node.body.kind === 174) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ], childItems, getIndent(node)); } return undefined; } @@ -23483,10 +28236,10 @@ var ts; return undefined; } hasGlobalNode = true; - var rootName = ts.isExternalModule(node) - ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(node.fileName)))) + "\"" - : ""; - return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [getNodeSpan(node)], childItems); + var rootName = ts.isExternalModule(node) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(node.fileName)))) + "\"" : ""; + return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [ + getNodeSpan(node) + ], childItems); } function createClassItem(node) { if (!node.name) { @@ -23499,26 +28252,38 @@ var ts; }); var nodes = removeDynamicallyNamedProperties(node); if (constructor) { - nodes.push.apply(nodes, ts.filter(constructor.parameters, function (p) { return !ts.isBindingPattern(p.name); })); + nodes.push.apply(nodes, ts.filter(constructor.parameters, function (p) { + return !ts.isBindingPattern(p.name); + })); } var childItems = getItemsWorker(sortNodes(nodes), createChildItem); } - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ], childItems, getIndent(node)); } function createEnumItem(node) { var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ], childItems, getIndent(node)); } function createIterfaceItem(node) { var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ], childItems, getIndent(node)); } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 126; }); + return ts.filter(node.members, function (member) { + return member.name === undefined || member.name.kind !== 126; + }); } function removeDynamicallyNamedProperties(node) { - return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); + return ts.filter(node.members, function (member) { + return !ts.hasDynamicName(member); + }); } function getInnermostModule(node) { while (node.body.kind === 200) { @@ -23527,9 +28292,7 @@ var ts; return node; } function getNodeSpan(node) { - return node.kind === 220 - ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) - : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + return node.kind === 221 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } function getTextOfNode(node) { return ts.getTextOfNodeFromSourceText(sourceFile.text, node); @@ -23559,7 +28322,9 @@ var ts; var stringToWordSpans = {}; pattern = pattern.trim(); var fullPatternSegment = createSegment(pattern); - var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); + var dotSeparatedSegments = pattern.split(".").map(function (p) { + return createSegment(p.trim()); + }); var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); return { getMatches: getMatches, @@ -23667,7 +28432,9 @@ var ts; if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { var match = matchTextChunk(candidate, segment.totalTextChunk, false); if (match) { - return [match]; + return [ + match + ]; } } var subWordTextChunks = segment.subWordTextChunks; @@ -23734,8 +28501,7 @@ var ts; for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; if (gotOneMatchThisCandidate) { - if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || - !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { break; } } @@ -23756,10 +28522,7 @@ var ts; } ts.createPatternMatcher = createPatternMatcher; function patternMatchCompareTo(match1, match2) { - return compareType(match1, match2) || - compareCamelCase(match1, match2) || - compareCase(match1, match2) || - comparePunctuation(match1, match2); + return compareType(match1, match2) || compareCamelCase(match1, match2) || compareCase(match1, match2) || comparePunctuation(match1, match2); } function comparePunctuation(result1, result2) { if (result1.punctuationStripped !== result2.punctuationStripped) { @@ -23908,11 +28671,7 @@ var ts; var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); - if (charIsPunctuation(identifier.charCodeAt(i - 1)) || - charIsPunctuation(identifier.charCodeAt(i)) || - lastIsDigit != currentIsDigit || - hasTransitionFromLowerToUpper || - hasTransitionFromUpperToLower) { + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || charIsPunctuation(identifier.charCodeAt(i)) || lastIsDigit != currentIsDigit || hasTransitionFromLowerToUpper || hasTransitionFromUpperToLower) { if (!isAllPunctuation(identifier, wordStart, i)) { result.push(ts.createTextSpan(wordStart, i - wordStart)); } @@ -23964,8 +28723,7 @@ var ts; } function transitionFromUpperToLower(identifier, word, index, wordStart) { if (word) { - if (index != wordStart && - index + 1 < identifier.length) { + if (index != wordStart && index + 1 < identifier.length) { var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); if (currentIsUpper && nextIsLower) { @@ -23983,9 +28741,7 @@ var ts; function transitionFromLowerToUpper(identifier, word, index) { var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); - var transition = word - ? (currentIsUpper && !lastIsUpper) - : currentIsUpper; + var transition = word ? (currentIsUpper && !lastIsUpper) : currentIsUpper; return transition; } })(ts || (ts = {})); @@ -24021,8 +28777,7 @@ var ts; function getImmediatelyContainingArgumentInfo(node) { if (node.parent.kind === 155 || node.parent.kind === 156) { var callExpression = node.parent; - if (node.kind === 24 || - node.kind === 16) { + if (node.kind === 24 || node.kind === 16) { var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; ts.Debug.assert(list !== undefined); @@ -24031,15 +28786,15 @@ var ts; invocation: callExpression, argumentsSpan: getApplicableSpanForArguments(list), argumentIndex: 0, - argumentCount: getCommaBasedArgCount(list) + argumentCount: getArgumentCount(list) }; } var listItemInfo = ts.findListItemInfo(node); if (listItemInfo) { var list = listItemInfo.list; var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; - var argumentIndex = (listItemInfo.listItemIndex + 1) >> 1; - var argumentCount = getCommaBasedArgCount(list); + var argumentIndex = getArgumentIndex(list, node); + var argumentCount = getArgumentCount(list); ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); return { kind: isTypeArgList ? 0 : 1, @@ -24076,10 +28831,29 @@ var ts; } return undefined; } - function getCommaBasedArgCount(argumentsList) { - return argumentsList.getChildCount() === 0 - ? 0 - : 1 + ts.countWhere(argumentsList.getChildren(), function (arg) { return arg.kind === 23; }); + function getArgumentIndex(argumentsList, node) { + var argumentIndex = 0; + var listChildren = argumentsList.getChildren(); + for (var i = 0, n = listChildren.length; i < n; i++) { + var child = listChildren[i]; + if (child === node) { + break; + } + if (child.kind !== 23) { + argumentIndex++; + } + } + return argumentIndex; + } + function getArgumentCount(argumentsList) { + var listChildren = argumentsList.getChildren(); + var argumentCount = ts.countWhere(listChildren, function (arg) { + return arg.kind !== 23; + }); + if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 23) { + argumentCount++; + } + return argumentCount; } function getArgumentIndexForTemplatePiece(spanIndex, node) { ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); @@ -24092,9 +28866,7 @@ var ts; return spanIndex + 1; } function getArgumentListInfoForTemplate(tagExpression, argumentIndex) { - var argumentCount = tagExpression.template.kind === 10 - ? 1 - : tagExpression.template.templateSpans.length + 1; + var argumentCount = tagExpression.template.kind === 10 ? 1 : tagExpression.template.templateSpans.length + 1; ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); return { kind: 2, @@ -24122,7 +28894,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 220; n = n.parent) { + for (var n = node; n.kind !== 221; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -24199,7 +28971,10 @@ var ts; isVariadic: candidateSignature.hasRestParameter, prefixDisplayParts: prefixDisplayParts, suffixDisplayParts: suffixDisplayParts, - separatorDisplayParts: [ts.punctuationPart(23), ts.spacePart()], + separatorDisplayParts: [ + ts.punctuationPart(23), + ts.spacePart() + ], parameters: signatureHelpParameters, documentation: candidateSignature.getDocumentationComment() }; @@ -24308,24 +29083,31 @@ var ts; } ts.findListItemInfo = findListItemInfo; function findChildOfKind(n, kind, sourceFile) { - return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; }); + return ts.forEach(n.getChildren(sourceFile), function (c) { + return c.kind === kind && c; + }); } ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 221 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 222 && c.pos <= node.pos && c.end >= node.end) { return c; } }); + ts.Debug.assert(!syntaxList || ts.contains(syntaxList.getChildren(), node)); return syntaxList; } ts.findContainingList = findContainingList; function getTouchingWord(sourceFile, position) { - return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }); + return getTouchingToken(sourceFile, position, function (n) { + return isWord(n.kind); + }); } ts.getTouchingWord = getTouchingWord; function getTouchingPropertyName(sourceFile, position) { - return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }); + return getTouchingToken(sourceFile, position, function (n) { + return isPropertyName(n.kind); + }); } ts.getTouchingPropertyName = getTouchingPropertyName; function getTouchingToken(sourceFile, position, includeItemAtEndPosition) { @@ -24379,8 +29161,7 @@ var ts; var children = n.getChildren(); for (var i = 0, len = children.length; i < len; ++i) { var child = children[i]; - var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || - (child.pos === previousToken.end); + var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { return find(child); } @@ -24418,7 +29199,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 220); + ts.Debug.assert(startNode !== undefined || n.kind === 221); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -24483,8 +29264,7 @@ var ts; } ts.isPunctuation = isPunctuation; function isInsideTemplateLiteral(node, position) { - return ts.isTemplateLiteralKind(node.kind) - && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); + return ts.isTemplateLiteralKind(node.kind) && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); } ts.isInsideTemplateLiteral = isInsideTemplateLiteral; function compareDataObjects(dst, src) { @@ -24517,19 +29297,38 @@ var ts; var indent; resetWriter(); return { - displayParts: function () { return displayParts; }, - writeKeyword: function (text) { return writeKind(text, 5); }, - writeOperator: function (text) { return writeKind(text, 12); }, - writePunctuation: function (text) { return writeKind(text, 15); }, - writeSpace: function (text) { return writeKind(text, 16); }, - writeStringLiteral: function (text) { return writeKind(text, 8); }, - writeParameter: function (text) { return writeKind(text, 13); }, + displayParts: function () { + return displayParts; + }, + writeKeyword: function (text) { + return writeKind(text, 5); + }, + writeOperator: function (text) { + return writeKind(text, 12); + }, + writePunctuation: function (text) { + return writeKind(text, 15); + }, + writeSpace: function (text) { + return writeKind(text, 16); + }, + writeStringLiteral: function (text) { + return writeKind(text, 8); + }, + writeParameter: function (text) { + return writeKind(text, 13); + }, writeSymbol: writeSymbol, writeLine: writeLine, - increaseIndent: function () { indent++; }, - decreaseIndent: function () { indent--; }, + increaseIndent: function () { + indent++; + }, + decreaseIndent: function () { + indent--; + }, clear: resetWriter, - trackSymbol: function () { } + trackSymbol: function () { + } }; function writeIndent() { if (lineStart) { @@ -24690,7 +29489,9 @@ var ts; advance: advance, readTokenInfo: readTokenInfo, isOnToken: isOnToken, - lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, + lastTrailingTriviaWasNewLine: function () { + return wasNewLine; + }, close: function () { lastTokenInfo = undefined; scanner.setText(undefined); @@ -24751,8 +29552,7 @@ var ts; return container.kind === 9; } function shouldRescanTemplateToken(container) { - return container.kind === 12 || - container.kind === 13; + return container.kind === 12 || container.kind === 13; } function startsWithSlashToken(t) { return t === 36 || t === 56; @@ -24765,13 +29565,7 @@ var ts; token: undefined }; } - var expectedScanAction = shouldRescanGreaterThanToken(n) - ? 1 - : shouldRescanSlashToken(n) - ? 2 - : shouldRescanTemplateToken(n) - ? 3 - : 0; + var expectedScanAction = shouldRescanGreaterThanToken(n) ? 1 : shouldRescanSlashToken(n) ? 2 : shouldRescanTemplateToken(n) ? 3 : 0; if (lastTokenInfo && expectedScanAction === lastScanAction) { return fixTokenKind(lastTokenInfo, n); } @@ -24951,9 +29745,7 @@ var ts; this.Flag = Flag; } Rule.prototype.toString = function () { - return "[desc=" + this.Descriptor + "," + - "operation=" + this.Operation + "," + - "flag=" + this.Flag + "]"; + return "[desc=" + this.Descriptor + "," + "operation=" + this.Operation + "," + "flag=" + this.Flag + "]"; }; return Rule; })(); @@ -24983,8 +29775,7 @@ var ts; this.RightTokenRange = RightTokenRange; } RuleDescriptor.prototype.toString = function () { - return "[leftRange=" + this.LeftTokenRange + "," + - "rightRange=" + this.RightTokenRange + "]"; + return "[leftRange=" + this.LeftTokenRange + "," + "rightRange=" + this.RightTokenRange + "]"; }; RuleDescriptor.create1 = function (left, right) { return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right)); @@ -25024,8 +29815,7 @@ var ts; this.Action = null; } RuleOperation.prototype.toString = function () { - return "[context=" + this.Context + "," + - "action=" + this.Action + "]"; + return "[context=" + this.Context + "," + "action=" + this.Action + "]"; }; RuleOperation.create1 = function (action) { return RuleOperation.create2(formatting.RuleOperationContext.Any, action); @@ -25091,7 +29881,12 @@ var ts; this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(15, 75), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(15, 99), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.FromTokens([17, 19, 23, 22])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.FromTokens([ + 17, + 19, + 23, + 22 + ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); @@ -25100,9 +29895,19 @@ var ts; this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([64, 3]); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([ + 64, + 3 + ]); this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([17, 3, 74, 95, 80, 75]); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([ + 17, + 3, + 74, + 95, + 80, + 75 + ]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(14, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); @@ -25121,79 +29926,151 @@ var ts; this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(34, 34), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(34, 39), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([97, 93, 87, 73, 89, 96]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([104, 69]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ + 97, + 93, + 87, + 73, + 89, + 96 + ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ + 104, + 69 + ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(82, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(98, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2)); this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(89, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([17, 74, 75, 66]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([95, 80]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([115, 119]), 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ + 17, + 74, + 75, + 66 + ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ + 95, + 80 + ]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ + 115, + 119 + ]), 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(113, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([116, 117]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([68, 114, 76, 77, 78, 115, 102, 84, 103, 116, 106, 108, 119, 109]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([78, 102])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ + 116, + 117 + ]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ + 68, + 114, + 76, + 77, + 78, + 115, + 102, + 84, + 103, + 116, + 106, + 108, + 119, + 109 + ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([ + 78, + 102 + ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(8, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(32, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(21, 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.FromTokens([17, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.FromTokens([ + 17, + 23 + ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(17, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.TypeNames), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); - this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([16, 18, 25, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([ + 16, + 18, + 25, + 23 + ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8)); - this.HighPriorityCommonRules = - [ - this.IgnoreBeforeComment, this.IgnoreAfterLineComment, - this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, - this.NoSpaceAfterQuestionMark, - this.NoSpaceBeforeDot, this.NoSpaceAfterDot, - this.NoSpaceAfterUnaryPrefixOperator, - this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, - this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, - this.SpaceAfterPostincrementWhenFollowedByAdd, - this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, - this.SpaceAfterPostdecrementWhenFollowedBySubtract, - this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, - this.NoSpaceAfterCloseBrace, - this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, - this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, - this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, - this.NoSpaceBetweenReturnAndSemicolon, - this.SpaceAfterCertainKeywords, - this.SpaceAfterLetConstInVariableDeclaration, - this.NoSpaceBeforeOpenParenInFuncCall, - this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, - this.SpaceAfterVoidOperator, - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, - this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, - this.SpaceAfterModuleName, - this.SpaceAfterArrow, - this.NoSpaceAfterEllipsis, - this.NoSpaceAfterOptionalParameters, - this.NoSpaceBetweenEmptyInterfaceBraceBrackets, - this.NoSpaceBeforeOpenAngularBracket, - this.NoSpaceBetweenCloseParenAndAngularBracket, - this.NoSpaceAfterOpenAngularBracket, - this.NoSpaceBeforeCloseAngularBracket, - this.NoSpaceAfterCloseAngularBracket - ]; - this.LowPriorityCommonRules = - [ - this.NoSpaceBeforeSemicolon, - this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, - this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket, - this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket, - this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, - this.SpaceBetweenStatements, this.SpaceAfterTryFinally - ]; + this.HighPriorityCommonRules = [ + this.IgnoreBeforeComment, + this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, + this.SpaceAfterColon, + this.NoSpaceBeforeQuestionMark, + this.SpaceAfterQuestionMarkInConditionalOperator, + this.NoSpaceAfterQuestionMark, + this.NoSpaceBeforeDot, + this.NoSpaceAfterDot, + this.NoSpaceAfterUnaryPrefixOperator, + this.NoSpaceAfterUnaryPreincrementOperator, + this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, + this.NoSpaceBeforeUnaryPostdecrementOperator, + this.SpaceAfterPostincrementWhenFollowedByAdd, + this.SpaceAfterAddWhenFollowedByUnaryPlus, + this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterPostdecrementWhenFollowedBySubtract, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, + this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.NoSpaceAfterCloseBrace, + this.SpaceAfterOpenBrace, + this.SpaceBeforeCloseBrace, + this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, + this.SpaceBetweenCloseBraceAndElse, + this.SpaceBetweenCloseBraceAndWhile, + this.NoSpaceBetweenEmptyBraceBrackets, + this.SpaceAfterFunctionInFuncDecl, + this.NewLineAfterOpenBraceInBlockContext, + this.SpaceAfterGetSetInMember, + this.NoSpaceBetweenReturnAndSemicolon, + this.SpaceAfterCertainKeywords, + this.SpaceAfterLetConstInVariableDeclaration, + this.NoSpaceBeforeOpenParenInFuncCall, + this.SpaceBeforeBinaryKeywordOperator, + this.SpaceAfterBinaryKeywordOperator, + this.SpaceAfterVoidOperator, + this.NoSpaceAfterConstructor, + this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, + this.SpaceBeforeCertainTypeScriptKeywords, + this.SpaceAfterModuleName, + this.SpaceAfterArrow, + this.NoSpaceAfterEllipsis, + this.NoSpaceAfterOptionalParameters, + this.NoSpaceBetweenEmptyInterfaceBraceBrackets, + this.NoSpaceBeforeOpenAngularBracket, + this.NoSpaceBetweenCloseParenAndAngularBracket, + this.NoSpaceAfterOpenAngularBracket, + this.NoSpaceBeforeCloseAngularBracket, + this.NoSpaceAfterCloseAngularBracket + ]; + this.LowPriorityCommonRules = [ + this.NoSpaceBeforeSemicolon, + this.SpaceBeforeOpenBraceInControl, + this.SpaceBeforeOpenBraceInFunction, + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.NoSpaceBeforeComma, + this.NoSpaceBeforeOpenBracket, + this.NoSpaceAfterOpenBracket, + this.NoSpaceBeforeCloseBracket, + this.NoSpaceAfterCloseBracket, + this.SpaceAfterSemicolon, + this.NoSpaceBeforeOpenParenInFuncDecl, + this.SpaceBetweenStatements, + this.SpaceAfterTryFinally + ]; this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); @@ -25235,10 +30112,10 @@ var ts; case 167: case 168: return true; - case 202: + case 203: case 193: case 128: - case 219: + case 220: case 130: case 129: return context.currentTokenSpan.kind === 52 || context.nextTokenSpan.kind === 52; @@ -25281,7 +30158,7 @@ var ts; } switch (node.kind) { case 174: - case 188: + case 202: case 152: case 201: return true; @@ -25324,7 +30201,7 @@ var ts; case 200: case 199: case 174: - case 216: + case 217: case 201: case 188: return true; @@ -25342,7 +30219,7 @@ var ts; case 191: case 179: case 187: - case 216: + case 217: return true; default: return false; @@ -25367,8 +30244,7 @@ var ts; return context.TokensAreOnSameLine(); }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 194 && - context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; + return context.currentTokenParent.kind === 194 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind != 2; @@ -25402,8 +30278,7 @@ var ts; } }; Rules.IsTypeArgumentOrParameterContext = function (context) { - return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || - Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); + return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsVoidOpContext = function (context) { return context.currentTokenSpan.kind === 98 && context.currentTokenParent.kind === 164; @@ -25446,8 +30321,7 @@ var ts; }; RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) { var _this = this; - var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && - rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; + var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) { rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) { var rulesBucketIndex = _this.GetRuleBucketIndex(left, right); @@ -25521,19 +30395,13 @@ var ts; RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) { var position; if (rule.Operation.Action == 1) { - position = specificTokens ? - 0 : - RulesPosition.IgnoreRulesAny; + position = specificTokens ? 0 : RulesPosition.IgnoreRulesAny; } else if (!rule.Operation.Context.IsAny()) { - position = specificTokens ? - RulesPosition.ContextRulesSpecific : - RulesPosition.ContextRulesAny; + position = specificTokens ? RulesPosition.ContextRulesSpecific : RulesPosition.ContextRulesAny; } else { - position = specificTokens ? - RulesPosition.NoContextRulesSpecific : - RulesPosition.NoContextRulesAny; + position = specificTokens ? RulesPosition.NoContextRulesSpecific : RulesPosition.NoContextRulesAny; } var state = constructionState[rulesBucketIndex]; if (state === undefined) { @@ -25590,7 +30458,9 @@ var ts; this.token = token; } TokenSingleValueAccess.prototype.GetTokens = function () { - return [this.token]; + return [ + this.token + ]; }; TokenSingleValueAccess.prototype.Contains = function (tokenValue) { return tokenValue == this.token; @@ -25644,18 +30514,68 @@ var ts; return this.tokenAccess.toString(); }; TokenRange.Any = TokenRange.AllTokens(); - TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); + TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([ + 3 + ])); TokenRange.Keywords = TokenRange.FromRange(65, 124); TokenRange.BinaryOperators = TokenRange.FromRange(24, 63); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([85, 86, 124]); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([38, 39, 47, 46]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7, 64, 16, 18, 14, 92, 87]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); - TokenRange.Comments = TokenRange.FromTokens([2, 3]); - TokenRange.TypeNames = TokenRange.FromTokens([64, 118, 120, 112, 121, 98, 111]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([ + 85, + 86, + 124 + ]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([ + 38, + 39, + 47, + 46 + ]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([ + 7, + 64, + 16, + 18, + 14, + 92, + 87 + ]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([ + 64, + 16, + 92, + 87 + ]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([ + 64, + 17, + 19, + 87 + ]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([ + 64, + 16, + 92, + 87 + ]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([ + 64, + 17, + 19, + 87 + ]); + TokenRange.Comments = TokenRange.FromTokens([ + 2, + 3 + ]); + TokenRange.TypeNames = TokenRange.FromTokens([ + 64, + 118, + 120, + 112, + 121, + 98, + 111 + ]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -25804,16 +30724,11 @@ var ts; } function findOutermostParent(position, expectedTokenKind, sourceFile) { var precedingToken = ts.findPrecedingToken(position, sourceFile); - if (!precedingToken || - precedingToken.kind !== expectedTokenKind || - position !== precedingToken.getEnd()) { + if (!precedingToken || precedingToken.kind !== expectedTokenKind || position !== precedingToken.getEnd()) { return undefined; } var current = precedingToken; - while (current && - current.parent && - current.parent.end === precedingToken.end && - !isListElement(current.parent, current)) { + while (current && current.parent && current.parent.end === precedingToken.end && !isListElement(current.parent, current)) { current = current.parent; } return current; @@ -25826,11 +30741,11 @@ var ts; case 200: var body = parent.body; return body && body.kind === 174 && ts.rangeContainsRange(body.statements, node); - case 220: + case 221: case 174: case 201: return ts.rangeContainsRange(parent.statements, node); - case 216: + case 217: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -25838,7 +30753,9 @@ var ts; function findEnclosingNode(range, sourceFile) { return find(sourceFile); function find(n) { - var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; }); + var candidate = ts.forEachChild(n, function (c) { + return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; + }); if (candidate) { var result = find(candidate); if (result) { @@ -25852,9 +30769,11 @@ var ts; if (!errors.length) { return rangeHasNoErrors; } - var sorted = errors - .filter(function (d) { return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); }) - .sort(function (e1, e2) { return e1.start - e2.start; }); + var sorted = errors.filter(function (d) { + return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); + }).sort(function (e1, e2) { + return e1.start - e2.start; + }); if (!sorted.length) { return rangeHasNoErrors; } @@ -25948,10 +30867,7 @@ var ts; var indentation = inheritedIndentation; if (indentation === -1) { if (isSomeBlock(node.kind)) { - if (isSomeBlock(parent.kind) || - parent.kind === 220 || - parent.kind === 213 || - parent.kind === 214) { + if (isSomeBlock(parent.kind) || parent.kind === 221 || parent.kind === 214 || parent.kind === 215) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -26000,8 +30916,12 @@ var ts; return nodeStartLine !== line ? indentation + delta : indentation; } }, - getIndentation: function () { return indentation; }, - getDelta: function () { return delta; }, + getIndentation: function () { + return indentation; + }, + getDelta: function () { + return delta; + }, recomputeIndentation: function (lineAdded) { if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent.kind, node.kind)) { if (lineAdded) { @@ -26194,8 +31114,7 @@ var ts; trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { - lineAdded = - processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); + lineAdded = processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); } } previousRange = range; @@ -26223,9 +31142,7 @@ var ts; dynamicIndentation.recomputeIndentation(true); } } - trimTrailingWhitespaces = - (rule.Operation.Action & (4 | 2)) && - rule.Flag !== 1; + trimTrailingWhitespaces = (rule.Operation.Action & (4 | 2)) && rule.Flag !== 1; } else { trimTrailingWhitespaces = true; @@ -26262,10 +31179,16 @@ var ts; var startPos = commentRange.pos; for (var line = startLine; line < endLine; ++line) { var endOfLine = ts.getEndLinePosition(line, sourceFile); - parts.push({ pos: startPos, end: endOfLine }); + parts.push({ + pos: startPos, + end: endOfLine + }); startPos = ts.getStartPositionOfLine(line + 1, sourceFile); } - parts.push({ pos: startPos, end: commentRange.end }); + parts.push({ + pos: startPos, + end: commentRange.end + }); } var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options); @@ -26280,9 +31203,7 @@ var ts; var delta = indentation - nonWhitespaceColumnInFirstPart.column; for (var i = startIndex, len = parts.length; i < len; ++i, ++startLine) { var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); - var nonWhitespaceCharacterAndColumn = i === 0 - ? nonWhitespaceColumnInFirstPart - : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); + var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); var newIndentation = nonWhitespaceCharacterAndColumn.column + delta; if (newIndentation > 0) { var indentationString = getIndentationString(newIndentation, options); @@ -26311,7 +31232,10 @@ var ts; } } function newTextChange(start, len, newText) { - return { span: ts.createTextSpan(start, len), newText: newText }; + return { + span: ts.createTextSpan(start, len), + newText: newText + }; } function recordDelete(start, len) { if (len) { @@ -26465,12 +31389,7 @@ var ts; if (!precedingToken) { return 0; } - var precedingTokenIsLiteral = precedingToken.kind === 8 || - precedingToken.kind === 9 || - precedingToken.kind === 10 || - precedingToken.kind === 11 || - precedingToken.kind === 12 || - precedingToken.kind === 13; + var precedingTokenIsLiteral = precedingToken.kind === 8 || precedingToken.kind === 9 || precedingToken.kind === 10 || precedingToken.kind === 11 || precedingToken.kind === 12 || precedingToken.kind === 13; if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } @@ -26530,8 +31449,7 @@ var ts; } } parentStart = getParentStart(parent, current, sourceFile); - var parentAndChildShareLine = parentStart.line === currentStart.line || - childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); + var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); if (useActualIndentation) { var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); if (actualIndentation !== -1) { @@ -26564,8 +31482,7 @@ var ts; } } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { - var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 220 || !parentAndChildShareLine); + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && (parent.kind === 221 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -26605,8 +31522,7 @@ var ts; if (node.parent) { switch (node.parent.kind) { case 139: - if (node.parent.typeArguments && - ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { + if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; @@ -26622,8 +31538,7 @@ var ts; case 136: case 137: var start = node.getStart(sourceFile); - if (node.parent.typeParameters && - ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { + if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { return node.parent.typeParameters; } if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { @@ -26633,12 +31548,10 @@ var ts; case 156: case 155: var start = node.getStart(sourceFile); - if (node.parent.typeArguments && - ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { + if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { return node.parent.typeArguments; } - if (node.parent.arguments && - ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { + if (node.parent.arguments && ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { return node.parent.arguments; } break; @@ -26690,7 +31603,10 @@ var ts; } character++; } - return { column: column, character: character }; + return { + column: column, + character: character + }; } SmartIndenter.findFirstNonWhitespaceCharacterAndColumn = findFirstNonWhitespaceCharacterAndColumn; function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { @@ -26707,15 +31623,15 @@ var ts; case 201: case 152: case 143: - case 188: + case 202: + case 215: case 214: - case 213: case 159: case 155: case 156: case 175: case 193: - case 208: + case 209: case 186: case 168: return true; @@ -26771,9 +31687,9 @@ var ts; case 152: case 174: case 201: - case 188: + case 202: return nodeEndsWith(n, 15, sourceFile); - case 216: + case 217: return isCompletedNode(n.block, sourceFile); case 159: case 136: @@ -26797,9 +31713,15 @@ var ts; return isCompletedNode(n.expression, sourceFile); case 151: return nodeEndsWith(n, 19, sourceFile); - case 213: case 214: + case 215: return false; + case 181: + return isCompletedNode(n.statement, sourceFile); + case 182: + return isCompletedNode(n.statement, sourceFile); + case 183: + return isCompletedNode(n.statement, sourceFile); case 180: return isCompletedNode(n.statement, sourceFile); case 179: @@ -26898,7 +31820,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(221, nodes.pos, nodes.end, 1024, this); + var list = createNode(222, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; for (var i = 0, len = nodes.length; i < len; i++) { @@ -27067,10 +31989,7 @@ var ts; return pos; } function isName(pos, end, sourceFile, name) { - return pos + name.length < end && - sourceFile.text.substr(pos, name.length) === name && - (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || - ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); + return pos + name.length < end && sourceFile.text.substr(pos, name.length) === name && (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); } function isParamTag(pos, end, sourceFile) { return isName(pos, end, sourceFile, paramTag); @@ -27286,7 +32205,9 @@ var ts; }; SignatureObject.prototype.getDocumentationComment = function () { if (this.documentationComment === undefined) { - this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration], undefined, false) : []; + this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([ + this.declaration + ], undefined, false) : []; } return this.documentationComment; }; @@ -27320,9 +32241,7 @@ var ts; case 131: var functionDeclaration = node; if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) { - var lastDeclaration = namedDeclarations.length > 0 ? - namedDeclarations[namedDeclarations.length - 1] : - undefined; + var lastDeclaration = namedDeclarations.length > 0 ? namedDeclarations[namedDeclarations.length - 1] : undefined; if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) { if (functionDeclaration.body && !lastDeclaration.body) { namedDeclarations[namedDeclarations.length - 1] = functionDeclaration; @@ -27339,12 +32258,12 @@ var ts; case 198: case 199: case 200: - case 202: - case 211: - case 207: - case 202: - case 204: + case 203: + case 212: + case 208: + case 203: case 205: + case 206: case 134: case 135: case 143: @@ -27374,24 +32293,24 @@ var ts; ts.forEachChild(node.name, visit); break; } - case 219: + case 220: case 130: case 129: namedDeclarations.push(node); break; - case 209: + case 210: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 203: + case 204: var importClause = node.importClause; if (importClause) { if (importClause.name) { namedDeclarations.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 205) { + if (importClause.namedBindings.kind === 206) { namedDeclarations.push(importClause.namedBindings); } else { @@ -27536,7 +32455,9 @@ var ts; ts.ClassificationTypeNames = ClassificationTypeNames; function displayPartsToString(displayParts) { if (displayParts) { - return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(""); + return ts.map(displayParts, function (displayPart) { + return displayPart.text; + }).join(""); } return ""; } @@ -27553,7 +32474,7 @@ var ts; return false; } for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { - if (parent.kind === 220 || parent.kind === 201) { + if (parent.kind === 221 || parent.kind === 201) { return false; } } @@ -27713,7 +32634,9 @@ var ts; return bucket; } function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === '_'; }).map(function (name) { + var bucketInfoArray = Object.keys(buckets).filter(function (name) { + return name && name.charAt(0) === '_'; + }).map(function (name) { var entries = ts.lookUp(buckets, name); var sourceFiles = []; for (var i in entries) { @@ -27724,7 +32647,9 @@ var ts; references: entry.owners.slice(0) }); } - sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); + sourceFiles.sort(function (x, y) { + return y.refCount - x.refCount; + }); return { bucket: name, sourceFiles: sourceFiles @@ -27913,7 +32838,11 @@ var ts; processImport(); } processTripleSlashDirectives(); - return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib }; + return { + referencedFiles: referencedFiles, + importedFiles: importedFiles, + isLibFile: isNoDefaultLib + }; } ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { @@ -27926,14 +32855,10 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 64 && - (node.parent.kind === 185 || node.parent.kind === 184) && - node.parent.label === node; + return node.kind === 64 && (node.parent.kind === 185 || node.parent.kind === 184) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 64 && - node.parent.kind === 189 && - node.parent.label === node; + return node.kind === 64 && node.parent.kind === 189 && node.parent.label === node; } function isLabeledBy(node, labelName) { for (var owner = node.parent; owner.kind === 189; owner = owner.parent) { @@ -27968,20 +32893,18 @@ var ts; return node.parent.kind === 200 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 64 && - ts.isFunctionLike(node.parent) && node.parent.name === node; + return node.kind === 64 && ts.isFunctionLike(node.parent) && node.parent.name === node; } function isNameOfPropertyAssignment(node) { - return (node.kind === 64 || node.kind === 8 || node.kind === 7) && - (node.parent.kind === 217 || node.parent.kind === 218) && node.parent.name === node; + return (node.kind === 64 || node.kind === 8 || node.kind === 7) && (node.parent.kind === 218 || node.parent.kind === 219) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 || node.kind === 7) { switch (node.parent.kind) { case 130: case 129: - case 217: - case 219: + case 218: + case 220: case 132: case 131: case 134: @@ -27996,15 +32919,12 @@ var ts; } function isNameOfExternalModuleImportOrDeclaration(node) { if (node.kind === 8) { - return isNameOfModuleDeclaration(node) || - (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); + return isNameOfModuleDeclaration(node) || (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); } return false; } function isInsideComment(sourceFile, token, position) { - return position <= token.getStart(sourceFile) && - (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || - isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); + return position <= token.getStart(sourceFile) && (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); function isInsideCommentRange(comments) { return ts.forEach(comments, function (comment) { if (comment.pos < position && position < comment.end) { @@ -28017,8 +32937,7 @@ var ts; return true; } else { - return !(text.charCodeAt(comment.end - 1) === 47 && - text.charCodeAt(comment.end - 2) === 42); + return !(text.charCodeAt(comment.end - 1) === 47 && text.charCodeAt(comment.end - 2) === 42); } } return false; @@ -28055,7 +32974,7 @@ var ts; return undefined; } switch (node.kind) { - case 220: + case 221: case 132: case 131: case 195: @@ -28073,38 +32992,49 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 200: return ScriptElementKind.moduleElement; - case 196: return ScriptElementKind.classElement; - case 197: return ScriptElementKind.interfaceElement; - case 198: return ScriptElementKind.typeElement; - case 199: return ScriptElementKind.enumElement; + case 200: + return ScriptElementKind.moduleElement; + case 196: + return ScriptElementKind.classElement; + case 197: + return ScriptElementKind.interfaceElement; + case 198: + return ScriptElementKind.typeElement; + case 199: + return ScriptElementKind.enumElement; case 193: - return ts.isConst(node) - ? ScriptElementKind.constElement - : ts.isLet(node) - ? ScriptElementKind.letElement - : ScriptElementKind.variableElement; - case 195: return ScriptElementKind.functionElement; - case 134: return ScriptElementKind.memberGetAccessorElement; - case 135: return ScriptElementKind.memberSetAccessorElement; + return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; + case 195: + return ScriptElementKind.functionElement; + case 134: + return ScriptElementKind.memberGetAccessorElement; + case 135: + return ScriptElementKind.memberSetAccessorElement; case 132: case 131: return ScriptElementKind.memberFunctionElement; case 130: case 129: return ScriptElementKind.memberVariableElement; - case 138: return ScriptElementKind.indexSignatureElement; - case 137: return ScriptElementKind.constructSignatureElement; - case 136: return ScriptElementKind.callSignatureElement; - case 133: return ScriptElementKind.constructorImplementationElement; - case 127: return ScriptElementKind.typeParameterElement; - case 219: return ScriptElementKind.variableElement; - case 128: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 202: - case 207: - case 204: - case 211: + case 138: + return ScriptElementKind.indexSignatureElement; + case 137: + return ScriptElementKind.constructSignatureElement; + case 136: + return ScriptElementKind.callSignatureElement; + case 133: + return ScriptElementKind.constructorImplementationElement; + case 127: + return ScriptElementKind.typeParameterElement; + case 220: + return ScriptElementKind.variableElement; + case 128: + return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 203: + case 208: case 205: + case 212: + case 206: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -28155,13 +33085,26 @@ var ts; var changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { getSourceFile: getOrCreateSourceFile, - getCancellationToken: function () { return cancellationToken; }, - getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); }, - useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, - getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, - getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, - writeFile: function (fileName, data, writeByteOrderMark) { }, - getCurrentDirectory: function () { return host.getCurrentDirectory(); } + getCancellationToken: function () { + return cancellationToken; + }, + getCanonicalFileName: function (fileName) { + return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); + }, + useCaseSensitiveFileNames: function () { + return useCaseSensitivefileNames; + }, + getNewLine: function () { + return host.getNewLine ? host.getNewLine() : "\r\n"; + }, + getDefaultLibFileName: function (options) { + return host.getDefaultLibFileName(options); + }, + writeFile: function (fileName, data, writeByteOrderMark) { + }, + getCurrentDirectory: function () { + return host.getCurrentDirectory(); + } }); if (program) { var oldSourceFiles = program.getSourceFiles(); @@ -28248,8 +33191,7 @@ var ts; if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { return undefined; } - if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && - (firstCharCode === 39 || firstCharCode === 34)) { + if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && (firstCharCode === 39 || firstCharCode === 34)) { displayName = displayName.substring(1, displayName.length - 1); } var isValid = ts.isIdentifierStart(displayName.charCodeAt(0), target); @@ -28365,11 +33307,11 @@ var ts; getCompletionEntriesFromSymbols(filteredMembers, activeCompletionSession); } } - else if (ts.getAncestor(previousToken, 204)) { + else if (ts.getAncestor(previousToken, 205)) { isMemberCompletion = true; isNewIdentifierLocation = true; if (showCompletionsInImportsClause(previousToken)) { - var importDeclaration = ts.getAncestor(previousToken, 203); + var importDeclaration = ts.getAncestor(previousToken, 204); ts.Debug.assert(importDeclaration !== undefined); var exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); var filteredExports = filterModuleExports(exports, importDeclaration); @@ -28410,16 +33352,14 @@ var ts; } function isCompletionListBlocker(previousToken) { var start = new Date().getTime(); - var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || - isIdentifierDefinitionLocation(previousToken) || - isRightOfIllegalDot(previousToken); + var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); return result; } function showCompletionsInImportsClause(node) { if (node) { if (node.kind === 14 || node.kind === 23) { - return node.parent.kind === 206; + return node.parent.kind === 207; } } return false; @@ -28429,16 +33369,9 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 155 - || containingNodeKind === 133 - || containingNodeKind === 156 - || containingNodeKind === 151 - || containingNodeKind === 167; + return containingNodeKind === 155 || containingNodeKind === 133 || containingNodeKind === 156 || containingNodeKind === 151 || containingNodeKind === 167; case 16: - return containingNodeKind === 155 - || containingNodeKind === 133 - || containingNodeKind === 156 - || containingNodeKind === 159; + return containingNodeKind === 155 || containingNodeKind === 133 || containingNodeKind === 156 || containingNodeKind === 159; case 18: return containingNodeKind === 151; case 116: @@ -28448,8 +33381,7 @@ var ts; case 14: return containingNodeKind === 196; case 52: - return containingNodeKind === 193 - || containingNodeKind === 167; + return containingNodeKind === 193 || containingNodeKind === 167; case 11: return containingNodeKind === 169; case 12: @@ -28469,9 +33401,7 @@ var ts; return false; } function isInStringOrRegularExpressionOrTemplateLiteral(previousToken) { - if (previousToken.kind === 8 - || previousToken.kind === 9 - || ts.isTemplateLiteralKind(previousToken.kind)) { + if (previousToken.kind === 8 || previousToken.kind === 9 || ts.isTemplateLiteralKind(previousToken.kind)) { var start = previousToken.getStart(); var end = previousToken.getEnd(); if (start < position && position < end) { @@ -28518,43 +33448,23 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 193 || - containingNodeKind === 194 || - containingNodeKind === 175 || - containingNodeKind === 199 || - isFunction(containingNodeKind) || - containingNodeKind === 196 || - containingNodeKind === 195 || - containingNodeKind === 197 || - containingNodeKind === 149 || - containingNodeKind === 148; + return containingNodeKind === 193 || containingNodeKind === 194 || containingNodeKind === 175 || containingNodeKind === 199 || isFunction(containingNodeKind) || containingNodeKind === 196 || containingNodeKind === 195 || containingNodeKind === 197 || containingNodeKind === 149 || containingNodeKind === 148; case 20: return containingNodeKind === 149; case 18: return containingNodeKind === 149; case 16: - return containingNodeKind === 216 || - isFunction(containingNodeKind); + return containingNodeKind === 217 || isFunction(containingNodeKind); case 14: - return containingNodeKind === 199 || - containingNodeKind === 197 || - containingNodeKind === 143 || - containingNodeKind === 148; + return containingNodeKind === 199 || containingNodeKind === 197 || containingNodeKind === 143 || containingNodeKind === 148; case 22: - return containingNodeKind === 129 && - (previousToken.parent.parent.kind === 197 || - previousToken.parent.parent.kind === 143); + return containingNodeKind === 129 && (previousToken.parent.parent.kind === 197 || previousToken.parent.parent.kind === 143); case 24: - return containingNodeKind === 196 || - containingNodeKind === 195 || - containingNodeKind === 197 || - isFunction(containingNodeKind); + return containingNodeKind === 196 || containingNodeKind === 195 || containingNodeKind === 197 || isFunction(containingNodeKind); case 109: return containingNodeKind === 130; case 21: - return containingNodeKind === 128 || - containingNodeKind === 133 || - (previousToken.parent.parent.kind === 149); + return containingNodeKind === 128 || containingNodeKind === 133 || (previousToken.parent.parent.kind === 149); case 108: case 106: case 107: @@ -28599,8 +33509,7 @@ var ts; if (!importDeclaration.importClause) { return exports; } - if (importDeclaration.importClause.namedBindings && - importDeclaration.importClause.namedBindings.kind === 206) { + if (importDeclaration.importClause.namedBindings && importDeclaration.importClause.namedBindings.kind === 207) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { var name = el.propertyName || el.name; exisingImports[name.text] = true; @@ -28609,7 +33518,9 @@ var ts; if (ts.isEmpty(exisingImports)) { return exports; } - return ts.filter(exports, function (e) { return !ts.lookUp(exisingImports, e.name); }); + return ts.filter(exports, function (e) { + return !ts.lookUp(exisingImports, e.name); + }); } function filterContextualMembersList(contextualMemberSymbols, existingMembers) { if (!existingMembers || existingMembers.length === 0) { @@ -28617,7 +33528,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 217 && m.kind !== 218) { + if (m.kind !== 218 && m.kind !== 219) { return; } if (m.getStart() <= position && position <= m.getEnd()) { @@ -28659,7 +33570,9 @@ var ts; name: entryName, kind: ScriptElementKind.keyword, kindModifiers: ScriptElementKindModifier.none, - displayParts: [ts.displayPart(entryName, 5)], + displayParts: [ + ts.displayPart(entryName, 5) + ], documentation: undefined }; } @@ -28757,9 +33670,7 @@ var ts; return ScriptElementKind.unknown; } function getSymbolModifiers(symbol) { - return symbol && symbol.declarations && symbol.declarations.length > 0 - ? ts.getNodeModifiers(symbol.declarations[0]) - : ScriptElementKindModifier.none; + return symbol && symbol.declarations && symbol.declarations.length > 0 ? ts.getNodeModifiers(symbol.declarations[0]) : ScriptElementKindModifier.none; } function getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, enclosingDeclaration, typeResolver, location, semanticMeaning) { if (semanticMeaning === void 0) { semanticMeaning = getMeaningFromLocation(location); } @@ -28842,8 +33753,7 @@ var ts; hasAddedSymbolInfo = true; } } - else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || - (location.kind === 113 && location.parent.kind === 133)) { + else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || (location.kind === 113 && location.parent.kind === 133)) { var signature; var functionDeclaration = location.parent; var allSignatures = functionDeclaration.kind === 133 ? type.getConstructSignatures() : type.getCallSignatures(); @@ -28858,8 +33768,7 @@ var ts; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 136 && - !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 136 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); hasAddedSymbolInfo = true; @@ -28935,7 +33844,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 219) { + if (declaration.kind === 220) { var constantValue = typeResolver.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -28951,7 +33860,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 202) { + if (declaration.kind === 203) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -28979,9 +33888,7 @@ var ts; if (symbolKind !== ScriptElementKind.unknown) { if (type) { addPrefixForAnyFunctionOrVar(symbol, symbolKind); - if (symbolKind === ScriptElementKind.memberVariableElement || - symbolFlags & 3 || - symbolKind === ScriptElementKind.localVariableElement) { + if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 || symbolKind === ScriptElementKind.localVariableElement) { displayParts.push(ts.punctuationPart(51)); displayParts.push(ts.spacePart()); if (type.symbol && type.symbol.flags & 262144) { @@ -28994,12 +33901,7 @@ var ts; displayParts.push.apply(displayParts, ts.typeToDisplayParts(typeResolver, type, enclosingDeclaration)); } } - else if (symbolFlags & 16 || - symbolFlags & 8192 || - symbolFlags & 16384 || - symbolFlags & 131072 || - symbolFlags & 98304 || - symbolKind === ScriptElementKind.memberFunctionElement) { + else if (symbolFlags & 16 || symbolFlags & 8192 || symbolFlags & 16384 || symbolFlags & 131072 || symbolFlags & 98304 || symbolKind === ScriptElementKind.memberFunctionElement) { var allSignatures = type.getCallSignatures(); addSignatureDisplayParts(allSignatures[0], allSignatures); } @@ -29012,7 +33914,11 @@ var ts; if (!documentation) { documentation = symbol.getDocumentationComment(); } - return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; + return { + displayParts: displayParts, + documentation: documentation, + symbolKind: symbolKind + }; function addNewLineIfDisplayPartsExist() { if (displayParts.length) { displayParts.push(ts.lineBreakPart()); @@ -29099,20 +34005,26 @@ var ts; if (isJumpStatementTarget(node)) { var labelName = node.text; var label = getTargetLabel(node.parent, node.text); - return label ? [getDefinitionInfo(label, ScriptElementKind.label, labelName, undefined)] : undefined; + return label ? [ + getDefinitionInfo(label, ScriptElementKind.label, labelName, undefined) + ] : undefined; } - var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); + var comment = ts.forEach(sourceFile.referencedFiles, function (r) { + return (r.pos <= position && position < r.end) ? r : undefined; + }); if (comment) { var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); if (referenceFile) { - return [{ + return [ + { fileName: referenceFile.fileName, textSpan: ts.createTextSpanFromBounds(0, 0), kind: ScriptElementKind.scriptElement, name: comment.fileName, containerName: undefined, containerKind: undefined - }]; + } + ]; } return undefined; } @@ -29127,7 +34039,7 @@ var ts; } } var result = []; - if (node.parent.kind === 218) { + if (node.parent.kind === 219) { var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); var shorthandDeclarations = shorthandSymbol.getDeclarations(); var shorthandSymbolKind = getSymbolKind(shorthandSymbol, typeInfoResolver, node); @@ -29143,8 +34055,7 @@ var ts; var symbolKind = getSymbolKind(symbol, typeInfoResolver, node); var containerSymbol = symbol.parent; var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : ""; - if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && - !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { + if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { ts.forEach(declarations, function (declaration) { result.push(getDefinitionInfo(declaration, symbolKind, symbolName, containerName)); }); @@ -29164,8 +34075,7 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 133) || - (!selectConstructors && (d.kind === 195 || d.kind === 132 || d.kind === 131))) { + if ((selectConstructors && d.kind === 133) || (!selectConstructors && (d.kind === 195 || d.kind === 132 || d.kind === 131))) { declarations.push(d); if (d.body) definition = d; @@ -29205,9 +34115,10 @@ var ts; if (!node) { return undefined; } - if (node.kind === 64 || node.kind === 92 || node.kind === 90 || - isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { - return getReferencesForNode(node, [sourceFile], true, false, false); + if (node.kind === 64 || node.kind === 92 || node.kind === 90 || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + return getReferencesForNode(node, [ + sourceFile + ], true, false, false); } switch (node.kind) { case 83: @@ -29244,8 +34155,8 @@ var ts; break; case 66: case 72: - if (hasKind(parent(parent(node)), 188)) { - return getSwitchCaseDefaultOccurrences(node.parent.parent); + if (hasKind(parent(parent(parent(node))), 188)) { + return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 65: @@ -29255,9 +34166,7 @@ var ts; } break; case 81: - if (hasKind(node.parent, 181) || - hasKind(node.parent, 182) || - hasKind(node.parent, 183)) { + if (hasKind(node.parent, 181) || hasKind(node.parent, 182) || hasKind(node.parent, 183)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -29278,8 +34187,7 @@ var ts; return getGetAndSetOccurrences(node.parent); } default: - if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 175)) { + if (ts.isModifier(node.kind) && node.parent && (ts.isDeclaration(node.parent) || node.parent.kind === 175)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -29388,7 +34296,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 220) { + if (ts.isFunctionBlock(parent) || parent.kind === 221) { return parent; } if (parent.kind === 191) { @@ -29436,7 +34344,7 @@ var ts; function getSwitchCaseDefaultOccurrences(switchStatement) { var keywords = []; pushKeywordIf(keywords, switchStatement.getFirstToken(), 91); - ts.forEach(switchStatement.clauses, function (clause) { + ts.forEach(switchStatement.caseBlock.clauses, function (clause) { pushKeywordIf(keywords, clause.getFirstToken(), 66, 72); var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); ts.forEach(breaksAndContinues, function (statement) { @@ -29524,15 +34432,16 @@ var ts; function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 115, 119); }); + ts.forEach(accessor.getChildren(), function (child) { + return pushKeywordIf(keywords, child, 115, 119); + }); } } } function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (declaration.flags & 112) { - if (!(container.kind === 196 || - (declaration.kind === 128 && hasKind(container, 133)))) { + if (!(container.kind === 196 || (declaration.kind === 128 && hasKind(container, 133)))) { return undefined; } } @@ -29542,7 +34451,7 @@ var ts; } } else if (declaration.flags & (1 | 2)) { - if (!(container.kind === 201 || container.kind === 220)) { + if (!(container.kind === 201 || container.kind === 221)) { return undefined; } } @@ -29554,7 +34463,7 @@ var ts; var nodes; switch (container.kind) { case 201: - case 220: + case 221: nodes = container.statements; break; case 133: @@ -29576,7 +34485,9 @@ var ts; } ts.forEach(nodes, function (node) { if (node.modifiers && node.flags & modifierFlag) { - ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); + ts.forEach(node.modifiers, function (child) { + return pushKeywordIf(keywords, child, modifier); + }); } }); return ts.map(keywords, getReferenceEntryFromNode); @@ -29630,9 +34541,7 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 64 && - !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && - !isNameOfExternalModuleImportOrDeclaration(node)) { + if (node.kind !== 64 && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } ts.Debug.assert(node.kind === 64 || node.kind === 7 || node.kind === 8); @@ -29642,7 +34551,9 @@ var ts; if (isLabelName(node)) { if (isJumpStatementTarget(node)) { var labelDefinition = getTargetLabel(node.parent, node.text); - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [getReferenceEntryFromNode(node)]; + return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [ + getReferenceEntryFromNode(node) + ]; } else { return getLabelReferencesInNode(node.parent, node); @@ -29656,7 +34567,9 @@ var ts; } var symbol = typeInfoResolver.getSymbolAtLocation(node); if (!symbol) { - return [getReferenceEntryFromNode(node)]; + return [ + getReferenceEntryFromNode(node) + ]; } var declarations = symbol.declarations; if (!declarations || !declarations.length) { @@ -29690,17 +34603,17 @@ var ts; } return result; function isImportOrExportSpecifierName(location) { - return location.parent && - (location.parent.kind === 207 || location.parent.kind === 211) && - location.parent.propertyName === location; + return location.parent && (location.parent.kind === 208 || location.parent.kind === 212) && location.parent.propertyName === location; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 207 || declaration.kind === 211; + return declaration.kind === 208 || declaration.kind === 212; }); } function getDeclaredName(symbol, location) { - var functionExpression = ts.forEach(symbol.declarations, function (d) { return d.kind === 160 ? d : undefined; }); + var functionExpression = ts.forEach(symbol.declarations, function (d) { + return d.kind === 160 ? d : undefined; + }); if (functionExpression && functionExpression.name) { var name = functionExpression.name.text; } @@ -29714,7 +34627,9 @@ var ts; if (isImportOrExportSpecifierName(location)) { return location.getText(); } - var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 160 ? d : undefined; }); + var functionExpression = ts.forEach(declarations, function (d) { + return d.kind === 160 ? d : undefined; + }); if (functionExpression && functionExpression.name) { var name = functionExpression.name.text; } @@ -29733,7 +34648,9 @@ var ts; } function getSymbolScope(symbol) { if (symbol.flags & (4 | 8192)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { + return (d.flags & 32) ? d : undefined; + }); if (privateDeclaration) { return ts.getAncestor(privateDeclaration, 196); } @@ -29755,7 +34672,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 220 && !ts.isExternalModule(container)) { + if (container.kind === 221 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -29777,8 +34694,7 @@ var ts; if (position > end) break; var endPosition = position + symbolNameLength; - if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && - (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { positions.push(position); } position = text.indexOf(symbolName, position + symbolNameLength + 1); @@ -29796,8 +34712,7 @@ var ts; if (!node || node.getWidth() !== labelName.length) { return; } - if (node === targetLabel || - (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { + if (node === targetLabel || (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { result.push(getReferenceEntryFromNode(node)); } }); @@ -29809,8 +34724,7 @@ var ts; case 64: return node.getWidth() === searchSymbolName.length; case 8: - if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { return node.getWidth() === searchSymbolName.length + 2; } break; @@ -29833,8 +34747,7 @@ var ts; cancellationToken.throwIfCancellationRequested(); var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); if (!isValidReferencePosition(referenceLocation, searchText)) { - if ((findInStrings && isInString(position)) || - (findInComments && isInComment(position))) { + if ((findInStrings && isInString(position)) || (findInComments && isInComment(position))) { result.push({ fileName: sourceFile.fileName, textSpan: ts.createTextSpan(position, searchText.length), @@ -29932,7 +34845,7 @@ var ts; staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 220: + case 221: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } @@ -29943,7 +34856,7 @@ var ts; return undefined; } var result = []; - if (searchSpaceNode.kind === 220) { + if (searchSpaceNode.kind === 221) { ts.forEach(sourceFiles, function (sourceFile) { var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, result); @@ -29981,8 +34894,8 @@ var ts; result.push(getReferenceEntryFromNode(node)); } break; - case 220: - if (container.kind === 220 && !ts.isExternalModule(container)) { + case 221: + if (container.kind === 221 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -29991,7 +34904,9 @@ var ts; } } function populateSearchSymbolSet(symbol, location) { - var result = [symbol]; + var result = [ + symbol + ]; if (isImportOrExportSpecifierImportSymbol(symbol)) { result.push(typeInfoResolver.getAliasedSymbol(symbol)); } @@ -30044,13 +34959,14 @@ var ts; if (searchSymbols.indexOf(referenceSymbol) >= 0) { return true; } - if (isImportOrExportSpecifierImportSymbol(referenceSymbol) && - searchSymbols.indexOf(typeInfoResolver.getAliasedSymbol(referenceSymbol)) >= 0) { + if (isImportOrExportSpecifierImportSymbol(referenceSymbol) && searchSymbols.indexOf(typeInfoResolver.getAliasedSymbol(referenceSymbol)) >= 0) { return true; } if (isNameOfPropertyAssignment(referenceLocation)) { return ts.forEach(getPropertySymbolsFromContextualType(referenceLocation), function (contextualSymbol) { - return ts.forEach(typeInfoResolver.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0; }); + return ts.forEach(typeInfoResolver.getRootSymbols(contextualSymbol), function (s) { + return searchSymbols.indexOf(s) >= 0; + }); }); } return ts.forEach(typeInfoResolver.getRootSymbols(referenceSymbol), function (rootSymbol) { @@ -30060,7 +34976,9 @@ var ts; if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { var result = []; getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); - return ts.forEach(result, function (s) { return searchSymbols.indexOf(s) >= 0; }); + return ts.forEach(result, function (s) { + return searchSymbols.indexOf(s) >= 0; + }); } return false; }); @@ -30074,7 +34992,9 @@ var ts; if (contextualType.flags & 16384) { var unionProperty = contextualType.getProperty(name); if (unionProperty) { - return [unionProperty]; + return [ + unionProperty + ]; } else { var result = []; @@ -30090,7 +35010,9 @@ var ts; else { var symbol = contextualType.getProperty(name); if (symbol) { - return [symbol]; + return [ + symbol + ]; } } } @@ -30146,7 +35068,9 @@ var ts; return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); } function containErrors(diagnostics) { - return ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1; }); + return ts.forEach(diagnostics, function (diagnostic) { + return diagnostic.category === 1; + }); } function getEmitOutput(fileName) { synchronizeHostData(); @@ -30172,9 +35096,9 @@ var ts; case 150: case 130: case 129: - case 217: case 218: case 219: + case 220: case 132: case 131: case 133: @@ -30183,7 +35107,7 @@ var ts; case 195: case 160: case 161: - case 216: + case 217: return 1; case 127: case 197: @@ -30203,14 +35127,14 @@ var ts; else { return 4; } - case 206: case 207: - case 202: - case 203: case 208: + case 203: + case 204: case 209: + case 210: return 1 | 2 | 4; - case 220: + case 221: return 4 | 1; } return 1 | 2 | 4; @@ -30240,15 +35164,13 @@ var ts; } function getMeaningFromRightHandSideOfImportEquals(node) { ts.Debug.assert(node.kind === 64); - if (node.parent.kind === 125 && - node.parent.right === node && - node.parent.parent.kind === 202) { + if (node.parent.kind === 125 && node.parent.right === node && node.parent.parent.kind === 203) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 208) { + if (node.parent.kind === 209) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -30301,8 +35223,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 200 && - nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + if (nodeForStartPos.parent.parent.kind === 200 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } else { @@ -30349,8 +35270,7 @@ var ts; } } else if (flags & 1536) { - if (meaningAtPosition & 4 || - (meaningAtPosition & 1 && hasValueSideModule(symbol))) { + if (meaningAtPosition & 4 || (meaningAtPosition & 1 && hasValueSideModule(symbol))) { return ClassificationTypeNames.moduleName; } } @@ -30475,16 +35395,11 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 52) { - if (token.parent.kind === 193 || - token.parent.kind === 130 || - token.parent.kind === 128) { + if (token.parent.kind === 193 || token.parent.kind === 130 || token.parent.kind === 128) { return ClassificationTypeNames.operator; } } - if (token.parent.kind === 167 || - token.parent.kind === 165 || - token.parent.kind === 166 || - token.parent.kind === 168) { + if (token.parent.kind === 167 || token.parent.kind === 165 || token.parent.kind === 166 || token.parent.kind === 168) { return ClassificationTypeNames.operator; } } @@ -30582,14 +35497,22 @@ var ts; return result; function getMatchingTokenKind(token) { switch (token.kind) { - case 14: return 15; - case 16: return 17; - case 18: return 19; - case 24: return 25; - case 15: return 14; - case 17: return 16; - case 19: return 18; - case 25: return 24; + case 14: + return 15; + case 16: + return 17; + case 18: + return 19; + case 24: + return 25; + case 15: + return 14; + case 17: + return 16; + case 19: + return 18; + case 25: + return 24; } return undefined; } @@ -30670,7 +35593,9 @@ var ts; var multiLineCommentStart = /(?:\/\*+\s*)/.source; var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; - var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; + var literals = "(?:" + ts.map(descriptors, function (d) { + return "(" + escapeRegExp(d.text) + ")"; + }).join("|") + ")"; var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; var messageRemainder = /(?:.*?)/.source; var messagePortion = "(" + literals + messageRemainder + ")"; @@ -30678,9 +35603,7 @@ var ts; return new RegExp(regExpString, "gim"); } function isLetterOrDigit(char) { - return (char >= 97 && char <= 122) || - (char >= 65 && char <= 90) || - (char >= 48 && char <= 57); + return (char >= 97 && char <= 122) || (char >= 65 && char <= 90) || (char >= 48 && char <= 57); } } function getRenameInfo(fileName, position) { @@ -30781,9 +35704,7 @@ var ts; break; case 8: case 7: - if (ts.isDeclarationName(node) || - node.parent.kind === 212 || - isArgumentOfElementAccessExpression(node)) { + if (ts.isDeclarationName(node) || node.parent.kind === 213 || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } break; @@ -30793,10 +35714,7 @@ var ts; } } function isArgumentOfElementAccessExpression(node) { - return node && - node.parent && - node.parent.kind === 154 && - node.parent.argumentExpression === node; + return node && node.parent && node.parent.kind === 154 && node.parent.argumentExpression === node; } function createClassifier() { var scanner = ts.createScanner(2, false); @@ -30825,10 +35743,7 @@ var ts; } function canFollow(keyword1, keyword2) { if (isAccessibilityModifier(keyword1)) { - if (keyword2 === 115 || - keyword2 === 119 || - keyword2 === 113 || - keyword2 === 109) { + if (keyword2 === 115 || keyword2 === 119 || keyword2 === 113 || keyword2 === 109) { return true; } return false; @@ -30886,18 +35801,13 @@ var ts; else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { token = 64; } - else if (lastNonTriviaToken === 64 && - token === 24) { + else if (lastNonTriviaToken === 64 && token === 24) { angleBracketStack++; } else if (token === 25 && angleBracketStack > 0) { angleBracketStack--; } - else if (token === 111 || - token === 120 || - token === 118 || - token === 112 || - token === 121) { + else if (token === 111 || token === 120 || token === 118 || token === 112 || token === 121) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { token = 64; } @@ -30948,9 +35858,7 @@ var ts; } if (numBackslashes & 1) { var quoteChar = tokenText.charCodeAt(0); - result.finalLexState = quoteChar === 34 - ? 3 - : 2; + result.finalLexState = quoteChar === 34 ? 3 : 2; } } } @@ -30982,7 +35890,10 @@ var ts; if (result.entries.length === 0) { length -= offset; } - result.entries.push({ length: length, classification: classification }); + result.entries.push({ + length: length, + classification: classification + }); } } } @@ -31077,7 +35988,9 @@ var ts; return 5; } } - return { getClassificationsForLine: getClassificationsForLine }; + return { + getClassificationsForLine: getClassificationsForLine + }; } ts.createClassifier = createClassifier; function getDefaultLibFilePath(options) { @@ -31092,7 +36005,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 220 ? new SourceFileObject() : new NodeObject(); + var proto = kind === 221 ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; @@ -31101,9 +36014,15 @@ var ts; Node.prototype = proto; return Node; }, - getSymbolConstructor: function () { return SymbolObject; }, - getTypeConstructor: function () { return TypeObject; }, - getSignatureConstructor: function () { return SignatureObject; } + getSymbolConstructor: function () { + return SymbolObject; + }, + getTypeConstructor: function () { + return TypeObject; + }, + getSignatureConstructor: function () { + return SignatureObject; + } }; } initializeServices(); @@ -31183,7 +36102,7 @@ var ts; } case 201: return spanInBlock(node); - case 216: + case 217: return spanInBlock(node.block); case 177: return textSpan(node.expression); @@ -31209,20 +36128,20 @@ var ts; return textSpan(node, ts.findNextToken(node.expression, node)); case 188: return textSpan(node, ts.findNextToken(node.expression, node)); - case 213: case 214: + case 215: return spanInNode(node.statements[0]); case 191: return spanInBlock(node.tryBlock); case 190: return textSpan(node, node.expression); - case 208: - return textSpan(node, node.expression); - case 202: - return textSpan(node, node.moduleReference); - case 203: - return textSpan(node, node.moduleSpecifier); case 209: + return textSpan(node, node.expression); + case 203: + return textSpan(node, node.moduleReference); + case 204: + return textSpan(node, node.moduleSpecifier); + case 210: return textSpan(node, node.moduleSpecifier); case 200: if (ts.getModuleInstanceState(node) !== 1) { @@ -31230,7 +36149,7 @@ var ts; } case 196: case 199: - case 219: + case 220: case 155: case 156: return textSpan(node); @@ -31264,7 +36183,7 @@ var ts; case 80: return spanInNextNode(node); default: - if (node.parent.kind === 217 && node.parent.name === node) { + if (node.parent.kind === 218 && node.parent.name === node) { return spanInNode(node.parent.initializer); } if (node.parent.kind === 158 && node.parent.type === node) { @@ -31277,17 +36196,12 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 182 || - variableDeclaration.parent.parent.kind === 183) { + if (variableDeclaration.parent.parent.kind === 182 || variableDeclaration.parent.parent.kind === 183) { return spanInNode(variableDeclaration.parent.parent); } var isParentVariableStatement = variableDeclaration.parent.parent.kind === 175; var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 181 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); - var declarations = isParentVariableStatement - ? variableDeclaration.parent.parent.declarationList.declarations - : isDeclarationOfForStatement - ? variableDeclaration.parent.parent.initializer.declarations - : undefined; + var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement ? variableDeclaration.parent.parent.initializer.declarations : undefined; if (variableDeclaration.initializer || (variableDeclaration.flags & 1)) { if (declarations && declarations[0] === variableDeclaration) { if (isParentVariableStatement) { @@ -31308,8 +36222,7 @@ var ts; } } function canHaveSpanInParameterDeclaration(parameter) { - return !!parameter.initializer || parameter.dotDotDotToken !== undefined || - !!(parameter.flags & 16) || !!(parameter.flags & 32); + return !!parameter.initializer || parameter.dotDotDotToken !== undefined || !!(parameter.flags & 16) || !!(parameter.flags & 32); } function spanInParameterDeclaration(parameter) { if (canHaveSpanInParameterDeclaration(parameter)) { @@ -31327,8 +36240,7 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 1) || - (functionDeclaration.parent.kind === 196 && functionDeclaration.kind !== 133); + return !!(functionDeclaration.flags & 1) || (functionDeclaration.parent.kind === 196 && functionDeclaration.kind !== 133); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -31389,8 +36301,8 @@ var ts; case 196: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 188: - return spanInNodeIfStartsOnSameLine(node.parent, node.parent.clauses[0]); + case 202: + return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } @@ -31407,12 +36319,12 @@ var ts; if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 216: + case 217: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 188: - var switchStatement = node.parent; - var lastClause = switchStatement.clauses[switchStatement.clauses.length - 1]; + case 202: + var caseBlock = node.parent; + var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; if (lastClause) { return spanInNode(lastClause.statements[lastClause.statements.length - 1]); } @@ -31447,7 +36359,7 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isFunctionLike(node.parent) || node.parent.kind === 217) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 218) { return spanInPreviousNode(node); } return spanInNode(node.parent); @@ -31580,15 +36492,21 @@ var ts; function forwardJSONCall(logger, actionDescription, action) { try { var result = simpleForwardCall(logger, actionDescription, action); - return JSON.stringify({ result: result }); + return JSON.stringify({ + result: result + }); } catch (err) { if (err instanceof ts.OperationCanceledException) { - return JSON.stringify({ canceled: true }); + return JSON.stringify({ + canceled: true + }); } logInternalError(logger, err); err.description = actionDescription; - return JSON.stringify({ error: err }); + return JSON.stringify({ + error: err + }); } } var ShimBase = (function () { @@ -31638,7 +36556,9 @@ var ts; LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) { var _this = this; var newLine = this.getNewLine(); - return diagnostics.map(function (d) { return _this.realizeDiagnostic(d, newLine); }); + return diagnostics.map(function (d) { + return _this.realizeDiagnostic(d, newLine); + }); }; LanguageServiceShimObject.prototype.realizeDiagnostic = function (diagnostic, newLine) { return { diff --git a/bin/typescriptServices.d.ts b/bin/typescriptServices.d.ts index bffa14b5875..c0800ecbd77 100644 --- a/bin/typescriptServices.d.ts +++ b/bin/typescriptServices.d.ts @@ -224,27 +224,28 @@ declare module ts { EnumDeclaration = 199, ModuleDeclaration = 200, ModuleBlock = 201, - ImportEqualsDeclaration = 202, - ImportDeclaration = 203, - ImportClause = 204, - NamespaceImport = 205, - NamedImports = 206, - ImportSpecifier = 207, - ExportAssignment = 208, - ExportDeclaration = 209, - NamedExports = 210, - ExportSpecifier = 211, - ExternalModuleReference = 212, - CaseClause = 213, - DefaultClause = 214, - HeritageClause = 215, - CatchClause = 216, - PropertyAssignment = 217, - ShorthandPropertyAssignment = 218, - EnumMember = 219, - SourceFile = 220, - SyntaxList = 221, - Count = 222, + CaseBlock = 202, + ImportEqualsDeclaration = 203, + ImportDeclaration = 204, + ImportClause = 205, + NamespaceImport = 206, + NamedImports = 207, + ImportSpecifier = 208, + ExportAssignment = 209, + ExportDeclaration = 210, + NamedExports = 211, + ExportSpecifier = 212, + ExternalModuleReference = 213, + CaseClause = 214, + DefaultClause = 215, + HeritageClause = 216, + CatchClause = 217, + PropertyAssignment = 218, + ShorthandPropertyAssignment = 219, + EnumMember = 220, + SourceFile = 221, + SyntaxList = 222, + Count = 223, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, @@ -619,6 +620,9 @@ declare module ts { } interface SwitchStatement extends Statement { expression: Expression; + caseBlock: CaseBlock; + } + interface CaseBlock extends Node { clauses: NodeArray; } interface CaseClause extends Node { @@ -1197,6 +1201,7 @@ declare module ts { version?: boolean; watch?: boolean; stripInternal?: boolean; + preserveNewLines?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { @@ -1437,12 +1442,15 @@ declare module ts { function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; } declare module ts { + /** The version of the TypeScript compiler release */ + var version: string; function createCompilerHost(options: CompilerOptions): CompilerHost; function getPreEmitDiagnostics(program: Program): Diagnostic[]; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } declare module ts { + /** The version of the language service API */ var servicesVersion: string; interface Node { getSourceFile(): SourceFile; diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index f3c487b2079..0fb345eea1b 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -218,27 +218,28 @@ var ts; SyntaxKind[SyntaxKind["EnumDeclaration"] = 199] = "EnumDeclaration"; SyntaxKind[SyntaxKind["ModuleDeclaration"] = 200] = "ModuleDeclaration"; SyntaxKind[SyntaxKind["ModuleBlock"] = 201] = "ModuleBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 202] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 203] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 204] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 205] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 206] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 207] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 208] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 209] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 210] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 211] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 212] = "ExternalModuleReference"; - SyntaxKind[SyntaxKind["CaseClause"] = 213] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 214] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 215] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 216] = "CatchClause"; - SyntaxKind[SyntaxKind["PropertyAssignment"] = 217] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 218] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["EnumMember"] = 219] = "EnumMember"; - SyntaxKind[SyntaxKind["SourceFile"] = 220] = "SourceFile"; - SyntaxKind[SyntaxKind["SyntaxList"] = 221] = "SyntaxList"; - SyntaxKind[SyntaxKind["Count"] = 222] = "Count"; + SyntaxKind[SyntaxKind["CaseBlock"] = 202] = "CaseBlock"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 203] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 204] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 205] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 206] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 207] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 208] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 209] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 210] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 211] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 212] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 213] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["CaseClause"] = 214] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 215] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 216] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 217] = "CatchClause"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 218] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 219] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 220] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 221] = "SourceFile"; + SyntaxKind[SyntaxKind["SyntaxList"] = 222] = "SyntaxList"; + SyntaxKind[SyntaxKind["Count"] = 223] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = 52] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 63] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = 65] = "FirstReservedWord"; @@ -824,18 +825,21 @@ var ts; ts.arrayToMap = arrayToMap; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); + return text.replace(/{(\d+)}/g, function (match, index) { + return args[+index + baseIndex]; + }); } ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { - return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] - ? ts.localizedDiagnosticMessages[message] - : message; + return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] ? ts.localizedDiagnosticMessages[message] : message; } ts.getLocaleSpecificMessage = getLocaleSpecificMessage; function createFileDiagnostic(file, start, length, message) { + var end = start + length; Debug.assert(start >= 0, "start must be non-negative, is " + start); Debug.assert(length >= 0, "length must be non-negative, is " + length); + Debug.assert(start <= file.text.length, "start must be within the bounds of the file. " + start + " > " + file.text.length); + Debug.assert(end <= file.text.length, "end must be the bounds of the file. " + end + " > " + file.text.length); var text = getLocaleSpecificMessage(message.key); if (arguments.length > 4) { text = formatStringFromArgs(text, arguments, 4); @@ -898,12 +902,7 @@ var ts; return diagnostic.file ? diagnostic.file.fileName : undefined; } function compareDiagnostics(d1, d2) { - return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || - compareValues(d1.start, d2.start) || - compareValues(d1.length, d2.length) || - compareValues(d1.code, d2.code) || - compareMessageText(d1.messageText, d2.messageText) || - 0; + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0; } ts.compareDiagnostics = compareDiagnostics; function compareMessageText(text1, text2) { @@ -930,7 +929,9 @@ var ts; if (diagnostics.length < 2) { return diagnostics; } - var newDiagnostics = [diagnostics[0]]; + var newDiagnostics = [ + diagnostics[0] + ]; var previousDiagnostic = diagnostics[0]; for (var i = 1; i < diagnostics.length; i++) { var currentDiagnostic = diagnostics[i]; @@ -1007,7 +1008,9 @@ var ts; ts.isRootedDiskPath = isRootedDiskPath; function normalizedPathComponents(path, rootLength) { var normalizedParts = getNormalizedParts(path, rootLength); - return [path.substr(0, rootLength)].concat(normalizedParts); + return [ + path.substr(0, rootLength) + ].concat(normalizedParts); } function getNormalizedPathComponents(path, currentDirectory) { var path = normalizeSlashes(path); @@ -1041,7 +1044,9 @@ var ts; } } if (rootLength === urlLength) { - return [url]; + return [ + url + ]; } var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); if (indexOfNextSlash !== -1) { @@ -1049,7 +1054,9 @@ var ts; return normalizedPathComponents(url, rootLength); } else { - return [url + ts.directorySeparator]; + return [ + url + ts.directorySeparator + ]; } } function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { @@ -1111,7 +1118,11 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [".d.ts", ".ts", ".js"]; + var supportedExtensions = [ + ".d.ts", + ".ts", + ".js" + ]; function removeFileExtension(path) { for (var i = 0; i < supportedExtensions.length; i++) { var ext = supportedExtensions[i]; @@ -1165,9 +1176,15 @@ var ts; }; return Node; }, - getSymbolConstructor: function () { return Symbol; }, - getTypeConstructor: function () { return Type; }, - getSignatureConstructor: function () { return Signature; } + getSymbolConstructor: function () { + return Symbol; + }, + getTypeConstructor: function () { + return Type; + }, + getSignatureConstructor: function () { + return Signature; + } }; (function (AssertionLevel) { AssertionLevel[AssertionLevel["None"] = 0] = "None"; @@ -1392,9 +1409,14 @@ var ts; readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { - _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + _fs.watchFile(fileName, { + persistent: true, + interval: 250 + }, fileChanged); return { - close: function () { _fs.unwatchFile(fileName, fileChanged); } + close: function () { + _fs.unwatchFile(fileName, fileChanged); + } }; function fileChanged(curr, prev) { if (+curr.mtime <= +prev.mtime) { @@ -1450,488 +1472,2431 @@ var ts; var ts; (function (ts) { ts.Diagnostics = { - Unterminated_string_literal: { code: 1002, category: 1, key: "Unterminated string literal." }, - Identifier_expected: { code: 1003, category: 1, key: "Identifier expected." }, - _0_expected: { code: 1005, category: 1, key: "'{0}' expected." }, - A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1, key: "A file cannot have a reference to itself." }, - Trailing_comma_not_allowed: { code: 1009, category: 1, key: "Trailing comma not allowed." }, - Asterisk_Slash_expected: { code: 1010, category: 1, key: "'*/' expected." }, - Unexpected_token: { code: 1012, category: 1, key: "Unexpected token." }, - A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1, key: "A rest parameter must be last in a parameter list." }, - Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1, key: "Parameter cannot have question mark and initializer." }, - A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1, key: "A required parameter cannot follow an optional parameter." }, - An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1, key: "An index signature cannot have a rest parameter." }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1, key: "An index signature parameter cannot have an accessibility modifier." }, - An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1, key: "An index signature parameter cannot have a question mark." }, - An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1, key: "An index signature parameter cannot have an initializer." }, - An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1, key: "An index signature must have a type annotation." }, - An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1, key: "An index signature parameter must have a type annotation." }, - An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1, key: "An index signature parameter type must be 'string' or 'number'." }, - A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1, key: "A class or interface declaration can only have one 'extends' clause." }, - An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1, key: "An 'extends' clause must precede an 'implements' clause." }, - A_class_can_only_extend_a_single_class: { code: 1026, category: 1, key: "A class can only extend a single class." }, - A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1, key: "A class declaration can only have one 'implements' clause." }, - Accessibility_modifier_already_seen: { code: 1028, category: 1, key: "Accessibility modifier already seen." }, - _0_modifier_must_precede_1_modifier: { code: 1029, category: 1, key: "'{0}' modifier must precede '{1}' modifier." }, - _0_modifier_already_seen: { code: 1030, category: 1, key: "'{0}' modifier already seen." }, - _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1, key: "'{0}' modifier cannot appear on a class element." }, - An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1, key: "An interface declaration cannot have an 'implements' clause." }, - super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1, key: "'super' must be followed by an argument list or member access." }, - Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1, key: "Only ambient modules can use quoted names." }, - Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1, key: "Statements are not allowed in ambient contexts." }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1, key: "A 'declare' modifier cannot be used in an already ambient context." }, - Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1, key: "Initializers are not allowed in ambient contexts." }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1, key: "'{0}' modifier cannot appear on a module element." }, - A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1, key: "A 'declare' modifier cannot be used with an interface declaration." }, - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, - A_rest_parameter_cannot_be_optional: { code: 1047, category: 1, key: "A rest parameter cannot be optional." }, - A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1, key: "A rest parameter cannot have an initializer." }, - A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1, key: "A 'set' accessor must have exactly one parameter." }, - A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1, key: "A 'set' accessor cannot have an optional parameter." }, - A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1, key: "A 'set' accessor parameter cannot have an initializer." }, - A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1, key: "A 'set' accessor cannot have rest parameter." }, - A_get_accessor_cannot_have_parameters: { code: 1054, category: 1, key: "A 'get' accessor cannot have parameters." }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, - Enum_member_must_have_initializer: { code: 1061, category: 1, key: "Enum member must have initializer." }, - An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1, key: "An export assignment cannot be used in an internal module." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1, key: "Ambient enum elements can only have integer literal initializers." }, - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, - A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1, key: "A 'declare' modifier cannot be used with an import declaration." }, - Invalid_reference_directive_syntax: { code: 1084, category: 1, key: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, - An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1, key: "An accessor cannot be declared in an ambient context." }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1, key: "'{0}' modifier cannot appear on a constructor declaration." }, - _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1, key: "'{0}' modifier cannot appear on a parameter." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1, key: "Type parameters cannot appear on a constructor declaration." }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1, key: "Type annotation cannot appear on a constructor declaration." }, - An_accessor_cannot_have_type_parameters: { code: 1094, category: 1, key: "An accessor cannot have type parameters." }, - A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1, key: "A 'set' accessor cannot have a return type annotation." }, - An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1, key: "An index signature must have exactly one parameter." }, - _0_list_cannot_be_empty: { code: 1097, category: 1, key: "'{0}' list cannot be empty." }, - Type_parameter_list_cannot_be_empty: { code: 1098, category: 1, key: "Type parameter list cannot be empty." }, - Type_argument_list_cannot_be_empty: { code: 1099, category: 1, key: "Type argument list cannot be empty." }, - Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1, key: "Invalid use of '{0}' in strict mode." }, - with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1, key: "'with' statements are not allowed in strict mode." }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1, key: "'delete' cannot be called on an identifier in strict mode." }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, - Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1, key: "Jump target cannot cross function boundary." }, - A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1, key: "A 'return' statement can only be used within a function body." }, - Expression_expected: { code: 1109, category: 1, key: "Expression expected." }, - Type_expected: { code: 1110, category: 1, key: "Type expected." }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: 1, key: "A class member cannot be declared optional." }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: 1, key: "Duplicate label '{0}'" }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1, key: "A 'break' statement can only jump to a label of an enclosing statement." }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1, key: "An object literal cannot have multiple properties with the same name in strict mode." }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1, key: "An object literal cannot have multiple get/set accessors with the same name." }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1, key: "An object literal cannot have property and accessor with the same name." }, - An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1, key: "An export assignment cannot have modifiers." }, - Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1, key: "Octal literals are not allowed in strict mode." }, - A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1, key: "A tuple type element list cannot be empty." }, - Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1, key: "Variable declaration list cannot be empty." }, - Digit_expected: { code: 1124, category: 1, key: "Digit expected." }, - Hexadecimal_digit_expected: { code: 1125, category: 1, key: "Hexadecimal digit expected." }, - Unexpected_end_of_text: { code: 1126, category: 1, key: "Unexpected end of text." }, - Invalid_character: { code: 1127, category: 1, key: "Invalid character." }, - Declaration_or_statement_expected: { code: 1128, category: 1, key: "Declaration or statement expected." }, - Statement_expected: { code: 1129, category: 1, key: "Statement expected." }, - case_or_default_expected: { code: 1130, category: 1, key: "'case' or 'default' expected." }, - Property_or_signature_expected: { code: 1131, category: 1, key: "Property or signature expected." }, - Enum_member_expected: { code: 1132, category: 1, key: "Enum member expected." }, - Type_reference_expected: { code: 1133, category: 1, key: "Type reference expected." }, - Variable_declaration_expected: { code: 1134, category: 1, key: "Variable declaration expected." }, - Argument_expression_expected: { code: 1135, category: 1, key: "Argument expression expected." }, - Property_assignment_expected: { code: 1136, category: 1, key: "Property assignment expected." }, - Expression_or_comma_expected: { code: 1137, category: 1, key: "Expression or comma expected." }, - Parameter_declaration_expected: { code: 1138, category: 1, key: "Parameter declaration expected." }, - Type_parameter_declaration_expected: { code: 1139, category: 1, key: "Type parameter declaration expected." }, - Type_argument_expected: { code: 1140, category: 1, key: "Type argument expected." }, - String_literal_expected: { code: 1141, category: 1, key: "String literal expected." }, - Line_break_not_permitted_here: { code: 1142, category: 1, key: "Line break not permitted here." }, - or_expected: { code: 1144, category: 1, key: "'{' or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1, key: "Modifiers not permitted on index signature members." }, - Declaration_expected: { code: 1146, category: 1, key: "Declaration expected." }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1, key: "Import declarations in an internal module cannot reference an external module." }, - Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1, key: "Cannot compile external modules unless the '--module' flag is provided." }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: 1, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - var_let_or_const_expected: { code: 1152, category: 1, key: "'var', 'let' or 'const' expected." }, - let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_must_be_initialized: { code: 1155, category: 1, key: "'const' declarations must be initialized" }, - const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1, key: "'const' declarations can only be declared inside a block." }, - let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1, key: "'let' declarations can only be declared inside a block." }, - Unterminated_template_literal: { code: 1160, category: 1, key: "Unterminated template literal." }, - Unterminated_regular_expression_literal: { code: 1161, category: 1, key: "Unterminated regular expression literal." }, - An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, - yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, - Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, - A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, - Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, - A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, - A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, - extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, - extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, - Classes_can_only_extend_a_single_class: { code: 1174, category: 1, key: "Classes can only extend a single class." }, - implements_clause_already_seen: { code: 1175, category: 1, key: "'implements' clause already seen." }, - Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1, key: "Interface declaration cannot have 'implements' clause." }, - Binary_digit_expected: { code: 1177, category: 1, key: "Binary digit expected." }, - Octal_digit_expected: { code: 1178, category: 1, key: "Octal digit expected." }, - Unexpected_token_expected: { code: 1179, category: 1, key: "Unexpected token. '{' expected." }, - Property_destructuring_pattern_expected: { code: 1180, category: 1, key: "Property destructuring pattern expected." }, - Array_element_destructuring_pattern_expected: { code: 1181, category: 1, key: "Array element destructuring pattern expected." }, - A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: 1, key: "A destructuring declaration must have an initializer." }, - Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: 1, key: "Destructuring declarations are not allowed in ambient contexts." }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: 1, key: "An implementation cannot be declared in ambient contexts." }, - Modifiers_cannot_appear_here: { code: 1184, category: 1, key: "Modifiers cannot appear here." }, - Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, - A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, - A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, - The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, - The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, - An_import_declaration_cannot_have_modifiers: { code: 1191, category: 1, key: "An import declaration cannot have modifiers." }, - External_module_0_has_no_default_export_or_export_assignment: { code: 1192, category: 1, key: "External module '{0}' has no default export or export assignment." }, - An_export_declaration_cannot_have_modifiers: { code: 1193, category: 1, key: "An export declaration cannot have modifiers." }, - Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: 1, key: "Export declarations are not permitted in an internal module." }, - Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: 1, key: "Catch clause variable name must be an identifier." }, - Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: 1, key: "Catch clause variable cannot have a type annotation." }, - Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: 1, key: "Catch clause variable cannot have an initializer." }, - An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: 1, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, - Unterminated_Unicode_escape_sequence: { code: 1199, category: 1, key: "Unterminated Unicode escape sequence." }, - Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, - Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1, key: "Static members cannot reference class type parameters." }, - Circular_definition_of_import_alias_0: { code: 2303, category: 1, key: "Circular definition of import alias '{0}'." }, - Cannot_find_name_0: { code: 2304, category: 1, key: "Cannot find name '{0}'." }, - Module_0_has_no_exported_member_1: { code: 2305, category: 1, key: "Module '{0}' has no exported member '{1}'." }, - File_0_is_not_an_external_module: { code: 2306, category: 1, key: "File '{0}' is not an external module." }, - Cannot_find_external_module_0: { code: 2307, category: 1, key: "Cannot find external module '{0}'." }, - A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1, key: "A module cannot have more than one export assignment." }, - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1, key: "An export assignment cannot be used in a module with other exported elements." }, - Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1, key: "Type '{0}' recursively references itself as a base type." }, - A_class_may_only_extend_another_class: { code: 2311, category: 1, key: "A class may only extend another class." }, - An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1, key: "An interface may only extend a class or another interface." }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, - Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1, key: "Generic type '{0}' requires {1} type argument(s)." }, - Type_0_is_not_generic: { code: 2315, category: 1, key: "Type '{0}' is not generic." }, - Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, - Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, - Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, - Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, - Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, - Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, - Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, - Property_0_is_missing_in_type_1: { code: 2324, category: 1, key: "Property '{0}' is missing in type '{1}'." }, - Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, - Types_of_property_0_are_incompatible: { code: 2326, category: 1, key: "Types of property '{0}' are incompatible." }, - Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, - Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1, key: "Types of parameters '{0}' and '{1}' are incompatible." }, - Index_signature_is_missing_in_type_0: { code: 2329, category: 1, key: "Index signature is missing in type '{0}'." }, - Index_signatures_are_incompatible: { code: 2330, category: 1, key: "Index signatures are incompatible." }, - this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1, key: "'this' cannot be referenced in a module body." }, - this_cannot_be_referenced_in_current_location: { code: 2332, category: 1, key: "'this' cannot be referenced in current location." }, - this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1, key: "'this' cannot be referenced in constructor arguments." }, - this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1, key: "'this' cannot be referenced in a static property initializer." }, - super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1, key: "'super' can only be referenced in a derived class." }, - super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1, key: "'super' cannot be referenced in constructor arguments." }, - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, - Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, - Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, - Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, - Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, - Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1, key: "Untyped function calls may not accept type arguments." }, - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1, key: "Cannot invoke an expression whose type lacks a call signature." }, - Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1, key: "Only a void function can be called with the 'new' keyword." }, - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, - No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1, key: "No best common type exists among return expressions." }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1, key: "Invalid left-hand side of assignment expression." }, - Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: 1, key: "Type parameter name cannot be '{0}'" }, - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1, key: "A parameter property is only allowed in a constructor implementation." }, - A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1, key: "A rest parameter must be of an array type." }, - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1, key: "A parameter initializer is only allowed in a function or constructor implementation." }, - Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1, key: "Parameter '{0}' cannot be referenced in its initializer." }, - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, - Duplicate_string_index_signature: { code: 2374, category: 1, key: "Duplicate string index signature." }, - Duplicate_number_index_signature: { code: 2375, category: 1, key: "Duplicate number index signature." }, - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, - Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1, key: "Constructors for derived classes must contain a 'super' call." }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, - Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1, key: "Getter and setter accessors do not agree in visibility." }, - get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1, key: "'get' and 'set' accessor must have the same type." }, - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1, key: "A signature with an implementation cannot use a string literal type." }, - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1, key: "Specialized overload signature is not assignable to any non-specialized signature." }, - Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1, key: "Overload signatures must all be exported or not exported." }, - Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1, key: "Overload signatures must all be ambient or non-ambient." }, - Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1, key: "Overload signatures must all be public, private or protected." }, - Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1, key: "Overload signatures must all be optional or required." }, - Function_overload_must_be_static: { code: 2387, category: 1, key: "Function overload must be static." }, - Function_overload_must_not_be_static: { code: 2388, category: 1, key: "Function overload must not be static." }, - Function_implementation_name_must_be_0: { code: 2389, category: 1, key: "Function implementation name must be '{0}'." }, - Constructor_implementation_is_missing: { code: 2390, category: 1, key: "Constructor implementation is missing." }, - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1, key: "Function implementation is missing or not immediately following the declaration." }, - Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1, key: "Multiple constructor implementations are not allowed." }, - Duplicate_function_implementation: { code: 2393, category: 1, key: "Duplicate function implementation." }, - Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1, key: "Overload signature is not compatible with function implementation." }, - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, - Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1, key: "Invalid left-hand side in 'for...in' statement." }, - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, - Setters_cannot_return_a_value: { code: 2408, category: 1, key: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1, key: "Return type of constructor signature must be assignable to the instance type of the class" }, - All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1, key: "All symbols within a 'with' block will be resolved to 'any'." }, - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: 1, key: "Class name cannot be '{0}'" }, - Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1, key: "Class '{0}' incorrectly extends base class '{1}'." }, - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, - Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1, key: "Class '{0}' incorrectly implements interface '{1}'." }, - A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1, key: "A class may only implement another class or interface." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: 1, key: "Interface name cannot be '{0}'" }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1, key: "All declarations of an interface must have identical type parameters." }, - Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1, key: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: 1, key: "Enum name cannot be '{0}'" }, - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, - A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, - Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1, key: "Ambient external modules cannot be nested in other modules." }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1, key: "Ambient external module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1, key: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: 1, key: "Import name cannot be '{0}'" }, - Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1, key: "Import declaration conflicts with local declaration of '{0}'" }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, - Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1, key: "Types have separate declarations of a private property '{0}'." }, - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, - Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, - Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1, key: "Block-scoped variable '{0}' used before its declaration." }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1, key: "The operand of an increment or decrement operator cannot be a constant." }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1, key: "Left-hand side of assignment expression cannot be a constant." }, - Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1, key: "Cannot redeclare block-scoped variable '{0}'." }, - An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1, key: "An enum member cannot have a numeric name." }, - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, - Type_alias_0_circularly_references_itself: { code: 2456, category: 1, key: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: 1, key: "Type alias name cannot be '{0}'" }, - An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1, key: "An AMD module cannot have multiple name assignments." }, - Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: 1, key: "Type '{0}' has no property '{1}' and no string index signature." }, - Type_0_has_no_property_1: { code: 2460, category: 1, key: "Type '{0}' has no property '{1}'." }, - Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, - this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, - super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, - Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, - The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, - Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, - A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, - for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: 1, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, - The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, - Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: 1, key: "Export declaration conflicts with exported declaration of '{0}'" }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: 1, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, - Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: 1, key: "Invalid left-hand side in 'for...of' statement." }, - The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: 1, key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." }, - The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { code: 2489, category: 1, key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." }, - The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: 1, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, - Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: 1, key: "Cannot redeclare identifier '{0}' in catch clause" }, - Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, - Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1, key: "Exported variable '{0}' has or is using private name '{1}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, - Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1, key: "Return type of public static method from exported class has or is using private name '{0}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1, key: "Return type of public method from exported class has or is using private name '{0}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1, key: "Return type of method from exported interface has or is using private name '{0}'." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, - Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1, key: "Return type of exported function has or is using private name '{0}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, - Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { code: 4091, category: 1, key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." }, - The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, - Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: 1, key: "Unsupported file encoding." }, - Unknown_compiler_option_0: { code: 5023, category: 1, key: "Unknown compiler option '{0}'." }, - Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1, key: "Compiler option '{0}' requires a value of type {1}." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: 1, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: 1, key: "Option 'project' cannot be mixed with source files on a command line." }, - Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2, key: "Concatenate and emit output to single file." }, - Generates_corresponding_d_ts_file: { code: 6002, category: 2, key: "Generates corresponding '.d.ts' file." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2, key: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, - Watch_input_files: { code: 6005, category: 2, key: "Watch input files." }, - Redirect_output_structure_to_the_directory: { code: 6006, category: 2, key: "Redirect output structure to the directory." }, - Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2, key: "Do not emit outputs if any type checking errors were reported." }, - Do_not_emit_comments_to_output: { code: 6009, category: 2, key: "Do not emit comments to output." }, - Do_not_emit_outputs: { code: 6010, category: 2, key: "Do not emit outputs." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2, key: "Specify module code generation: 'commonjs' or 'amd'" }, - Print_this_message: { code: 6017, category: 2, key: "Print this message." }, - Print_the_compiler_s_version: { code: 6019, category: 2, key: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: 2, key: "Compile the project in the given directory." }, - Syntax_Colon_0: { code: 6023, category: 2, key: "Syntax: {0}" }, - options: { code: 6024, category: 2, key: "options" }, - file: { code: 6025, category: 2, key: "file" }, - Examples_Colon_0: { code: 6026, category: 2, key: "Examples: {0}" }, - Options_Colon: { code: 6027, category: 2, key: "Options:" }, - Version_0: { code: 6029, category: 2, key: "Version {0}" }, - Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2, key: "Insert command line options and files from a file." }, - File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2, key: "File change detected. Starting incremental compilation..." }, - KIND: { code: 6034, category: 2, key: "KIND" }, - FILE: { code: 6035, category: 2, key: "FILE" }, - VERSION: { code: 6036, category: 2, key: "VERSION" }, - LOCATION: { code: 6037, category: 2, key: "LOCATION" }, - DIRECTORY: { code: 6038, category: 2, key: "DIRECTORY" }, - Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2, key: "Compilation complete. Watching for file changes." }, - Generates_corresponding_map_file: { code: 6043, category: 2, key: "Generates corresponding '.map' file." }, - Compiler_option_0_expects_an_argument: { code: 6044, category: 1, key: "Compiler option '{0}' expects an argument." }, - Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, - Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, - Unsupported_locale_0: { code: 6049, category: 1, key: "Unsupported locale '{0}'." }, - Unable_to_open_file_0: { code: 6050, category: 1, key: "Unable to open file '{0}'." }, - Corrupted_locale_file_0: { code: 6051, category: 1, key: "Corrupted locale file {0}." }, - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2, key: "Raise error on expressions and declarations with an implied 'any' type." }, - File_0_not_found: { code: 6053, category: 1, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: 2, key: "Do not emit declarations for code that has an '@internal' annotation." }, - Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1, key: "Variable '{0}' implicitly has an '{1}' type." }, - Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1, key: "Parameter '{0}' implicitly has an '{1}' type." }, - Member_0_implicitly_has_an_1_type: { code: 7008, category: 1, key: "Member '{0}' implicitly has an '{1}' type." }, - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, - Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1, key: "Index signature of object type implicitly has an 'any' type." }, - Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, - Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, - _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - You_cannot_rename_this_element: { code: 8000, category: 1, key: "You cannot rename this element." }, - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, - yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, - Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." } + Unterminated_string_literal: { + code: 1002, + category: 1, + key: "Unterminated string literal." + }, + Identifier_expected: { + code: 1003, + category: 1, + key: "Identifier expected." + }, + _0_expected: { + code: 1005, + category: 1, + key: "'{0}' expected." + }, + A_file_cannot_have_a_reference_to_itself: { + code: 1006, + category: 1, + key: "A file cannot have a reference to itself." + }, + Trailing_comma_not_allowed: { + code: 1009, + category: 1, + key: "Trailing comma not allowed." + }, + Asterisk_Slash_expected: { + code: 1010, + category: 1, + key: "'*/' expected." + }, + Unexpected_token: { + code: 1012, + category: 1, + key: "Unexpected token." + }, + A_rest_parameter_must_be_last_in_a_parameter_list: { + code: 1014, + category: 1, + key: "A rest parameter must be last in a parameter list." + }, + Parameter_cannot_have_question_mark_and_initializer: { + code: 1015, + category: 1, + key: "Parameter cannot have question mark and initializer." + }, + A_required_parameter_cannot_follow_an_optional_parameter: { + code: 1016, + category: 1, + key: "A required parameter cannot follow an optional parameter." + }, + An_index_signature_cannot_have_a_rest_parameter: { + code: 1017, + category: 1, + key: "An index signature cannot have a rest parameter." + }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { + code: 1018, + category: 1, + key: "An index signature parameter cannot have an accessibility modifier." + }, + An_index_signature_parameter_cannot_have_a_question_mark: { + code: 1019, + category: 1, + key: "An index signature parameter cannot have a question mark." + }, + An_index_signature_parameter_cannot_have_an_initializer: { + code: 1020, + category: 1, + key: "An index signature parameter cannot have an initializer." + }, + An_index_signature_must_have_a_type_annotation: { + code: 1021, + category: 1, + key: "An index signature must have a type annotation." + }, + An_index_signature_parameter_must_have_a_type_annotation: { + code: 1022, + category: 1, + key: "An index signature parameter must have a type annotation." + }, + An_index_signature_parameter_type_must_be_string_or_number: { + code: 1023, + category: 1, + key: "An index signature parameter type must be 'string' or 'number'." + }, + A_class_or_interface_declaration_can_only_have_one_extends_clause: { + code: 1024, + category: 1, + key: "A class or interface declaration can only have one 'extends' clause." + }, + An_extends_clause_must_precede_an_implements_clause: { + code: 1025, + category: 1, + key: "An 'extends' clause must precede an 'implements' clause." + }, + A_class_can_only_extend_a_single_class: { + code: 1026, + category: 1, + key: "A class can only extend a single class." + }, + A_class_declaration_can_only_have_one_implements_clause: { + code: 1027, + category: 1, + key: "A class declaration can only have one 'implements' clause." + }, + Accessibility_modifier_already_seen: { + code: 1028, + category: 1, + key: "Accessibility modifier already seen." + }, + _0_modifier_must_precede_1_modifier: { + code: 1029, + category: 1, + key: "'{0}' modifier must precede '{1}' modifier." + }, + _0_modifier_already_seen: { + code: 1030, + category: 1, + key: "'{0}' modifier already seen." + }, + _0_modifier_cannot_appear_on_a_class_element: { + code: 1031, + category: 1, + key: "'{0}' modifier cannot appear on a class element." + }, + An_interface_declaration_cannot_have_an_implements_clause: { + code: 1032, + category: 1, + key: "An interface declaration cannot have an 'implements' clause." + }, + super_must_be_followed_by_an_argument_list_or_member_access: { + code: 1034, + category: 1, + key: "'super' must be followed by an argument list or member access." + }, + Only_ambient_modules_can_use_quoted_names: { + code: 1035, + category: 1, + key: "Only ambient modules can use quoted names." + }, + Statements_are_not_allowed_in_ambient_contexts: { + code: 1036, + category: 1, + key: "Statements are not allowed in ambient contexts." + }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { + code: 1038, + category: 1, + key: "A 'declare' modifier cannot be used in an already ambient context." + }, + Initializers_are_not_allowed_in_ambient_contexts: { + code: 1039, + category: 1, + key: "Initializers are not allowed in ambient contexts." + }, + _0_modifier_cannot_appear_on_a_module_element: { + code: 1044, + category: 1, + key: "'{0}' modifier cannot appear on a module element." + }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { + code: 1045, + category: 1, + key: "A 'declare' modifier cannot be used with an interface declaration." + }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { + code: 1046, + category: 1, + key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." + }, + A_rest_parameter_cannot_be_optional: { + code: 1047, + category: 1, + key: "A rest parameter cannot be optional." + }, + A_rest_parameter_cannot_have_an_initializer: { + code: 1048, + category: 1, + key: "A rest parameter cannot have an initializer." + }, + A_set_accessor_must_have_exactly_one_parameter: { + code: 1049, + category: 1, + key: "A 'set' accessor must have exactly one parameter." + }, + A_set_accessor_cannot_have_an_optional_parameter: { + code: 1051, + category: 1, + key: "A 'set' accessor cannot have an optional parameter." + }, + A_set_accessor_parameter_cannot_have_an_initializer: { + code: 1052, + category: 1, + key: "A 'set' accessor parameter cannot have an initializer." + }, + A_set_accessor_cannot_have_rest_parameter: { + code: 1053, + category: 1, + key: "A 'set' accessor cannot have rest parameter." + }, + A_get_accessor_cannot_have_parameters: { + code: 1054, + category: 1, + key: "A 'get' accessor cannot have parameters." + }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { + code: 1056, + category: 1, + key: "Accessors are only available when targeting ECMAScript 5 and higher." + }, + Enum_member_must_have_initializer: { + code: 1061, + category: 1, + key: "Enum member must have initializer." + }, + An_export_assignment_cannot_be_used_in_an_internal_module: { + code: 1063, + category: 1, + key: "An export assignment cannot be used in an internal module." + }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { + code: 1066, + category: 1, + key: "Ambient enum elements can only have integer literal initializers." + }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { + code: 1068, + category: 1, + key: "Unexpected token. A constructor, method, accessor, or property was expected." + }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { + code: 1079, + category: 1, + key: "A 'declare' modifier cannot be used with an import declaration." + }, + Invalid_reference_directive_syntax: { + code: 1084, + category: 1, + key: "Invalid 'reference' directive syntax." + }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { + code: 1085, + category: 1, + key: "Octal literals are not available when targeting ECMAScript 5 and higher." + }, + An_accessor_cannot_be_declared_in_an_ambient_context: { + code: 1086, + category: 1, + key: "An accessor cannot be declared in an ambient context." + }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { + code: 1089, + category: 1, + key: "'{0}' modifier cannot appear on a constructor declaration." + }, + _0_modifier_cannot_appear_on_a_parameter: { + code: 1090, + category: 1, + key: "'{0}' modifier cannot appear on a parameter." + }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { + code: 1091, + category: 1, + key: "Only a single variable declaration is allowed in a 'for...in' statement." + }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { + code: 1092, + category: 1, + key: "Type parameters cannot appear on a constructor declaration." + }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { + code: 1093, + category: 1, + key: "Type annotation cannot appear on a constructor declaration." + }, + An_accessor_cannot_have_type_parameters: { + code: 1094, + category: 1, + key: "An accessor cannot have type parameters." + }, + A_set_accessor_cannot_have_a_return_type_annotation: { + code: 1095, + category: 1, + key: "A 'set' accessor cannot have a return type annotation." + }, + An_index_signature_must_have_exactly_one_parameter: { + code: 1096, + category: 1, + key: "An index signature must have exactly one parameter." + }, + _0_list_cannot_be_empty: { + code: 1097, + category: 1, + key: "'{0}' list cannot be empty." + }, + Type_parameter_list_cannot_be_empty: { + code: 1098, + category: 1, + key: "Type parameter list cannot be empty." + }, + Type_argument_list_cannot_be_empty: { + code: 1099, + category: 1, + key: "Type argument list cannot be empty." + }, + Invalid_use_of_0_in_strict_mode: { + code: 1100, + category: 1, + key: "Invalid use of '{0}' in strict mode." + }, + with_statements_are_not_allowed_in_strict_mode: { + code: 1101, + category: 1, + key: "'with' statements are not allowed in strict mode." + }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { + code: 1102, + category: 1, + key: "'delete' cannot be called on an identifier in strict mode." + }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { + code: 1104, + category: 1, + key: "A 'continue' statement can only be used within an enclosing iteration statement." + }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { + code: 1105, + category: 1, + key: "A 'break' statement can only be used within an enclosing iteration or switch statement." + }, + Jump_target_cannot_cross_function_boundary: { + code: 1107, + category: 1, + key: "Jump target cannot cross function boundary." + }, + A_return_statement_can_only_be_used_within_a_function_body: { + code: 1108, + category: 1, + key: "A 'return' statement can only be used within a function body." + }, + Expression_expected: { + code: 1109, + category: 1, + key: "Expression expected." + }, + Type_expected: { + code: 1110, + category: 1, + key: "Type expected." + }, + A_class_member_cannot_be_declared_optional: { + code: 1112, + category: 1, + key: "A class member cannot be declared optional." + }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { + code: 1113, + category: 1, + key: "A 'default' clause cannot appear more than once in a 'switch' statement." + }, + Duplicate_label_0: { + code: 1114, + category: 1, + key: "Duplicate label '{0}'" + }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { + code: 1115, + category: 1, + key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." + }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { + code: 1116, + category: 1, + key: "A 'break' statement can only jump to a label of an enclosing statement." + }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { + code: 1117, + category: 1, + key: "An object literal cannot have multiple properties with the same name in strict mode." + }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { + code: 1118, + category: 1, + key: "An object literal cannot have multiple get/set accessors with the same name." + }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { + code: 1119, + category: 1, + key: "An object literal cannot have property and accessor with the same name." + }, + An_export_assignment_cannot_have_modifiers: { + code: 1120, + category: 1, + key: "An export assignment cannot have modifiers." + }, + Octal_literals_are_not_allowed_in_strict_mode: { + code: 1121, + category: 1, + key: "Octal literals are not allowed in strict mode." + }, + A_tuple_type_element_list_cannot_be_empty: { + code: 1122, + category: 1, + key: "A tuple type element list cannot be empty." + }, + Variable_declaration_list_cannot_be_empty: { + code: 1123, + category: 1, + key: "Variable declaration list cannot be empty." + }, + Digit_expected: { + code: 1124, + category: 1, + key: "Digit expected." + }, + Hexadecimal_digit_expected: { + code: 1125, + category: 1, + key: "Hexadecimal digit expected." + }, + Unexpected_end_of_text: { + code: 1126, + category: 1, + key: "Unexpected end of text." + }, + Invalid_character: { + code: 1127, + category: 1, + key: "Invalid character." + }, + Declaration_or_statement_expected: { + code: 1128, + category: 1, + key: "Declaration or statement expected." + }, + Statement_expected: { + code: 1129, + category: 1, + key: "Statement expected." + }, + case_or_default_expected: { + code: 1130, + category: 1, + key: "'case' or 'default' expected." + }, + Property_or_signature_expected: { + code: 1131, + category: 1, + key: "Property or signature expected." + }, + Enum_member_expected: { + code: 1132, + category: 1, + key: "Enum member expected." + }, + Type_reference_expected: { + code: 1133, + category: 1, + key: "Type reference expected." + }, + Variable_declaration_expected: { + code: 1134, + category: 1, + key: "Variable declaration expected." + }, + Argument_expression_expected: { + code: 1135, + category: 1, + key: "Argument expression expected." + }, + Property_assignment_expected: { + code: 1136, + category: 1, + key: "Property assignment expected." + }, + Expression_or_comma_expected: { + code: 1137, + category: 1, + key: "Expression or comma expected." + }, + Parameter_declaration_expected: { + code: 1138, + category: 1, + key: "Parameter declaration expected." + }, + Type_parameter_declaration_expected: { + code: 1139, + category: 1, + key: "Type parameter declaration expected." + }, + Type_argument_expected: { + code: 1140, + category: 1, + key: "Type argument expected." + }, + String_literal_expected: { + code: 1141, + category: 1, + key: "String literal expected." + }, + Line_break_not_permitted_here: { + code: 1142, + category: 1, + key: "Line break not permitted here." + }, + or_expected: { + code: 1144, + category: 1, + key: "'{' or ';' expected." + }, + Modifiers_not_permitted_on_index_signature_members: { + code: 1145, + category: 1, + key: "Modifiers not permitted on index signature members." + }, + Declaration_expected: { + code: 1146, + category: 1, + key: "Declaration expected." + }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { + code: 1147, + category: 1, + key: "Import declarations in an internal module cannot reference an external module." + }, + Cannot_compile_external_modules_unless_the_module_flag_is_provided: { + code: 1148, + category: 1, + key: "Cannot compile external modules unless the '--module' flag is provided." + }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { + code: 1149, + category: 1, + key: "File name '{0}' differs from already included file name '{1}' only in casing" + }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { + code: 1150, + category: 1, + key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." + }, + var_let_or_const_expected: { + code: 1152, + category: 1, + key: "'var', 'let' or 'const' expected." + }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1153, + category: 1, + key: "'let' declarations are only available when targeting ECMAScript 6 and higher." + }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1154, + category: 1, + key: "'const' declarations are only available when targeting ECMAScript 6 and higher." + }, + const_declarations_must_be_initialized: { + code: 1155, + category: 1, + key: "'const' declarations must be initialized" + }, + const_declarations_can_only_be_declared_inside_a_block: { + code: 1156, + category: 1, + key: "'const' declarations can only be declared inside a block." + }, + let_declarations_can_only_be_declared_inside_a_block: { + code: 1157, + category: 1, + key: "'let' declarations can only be declared inside a block." + }, + Unterminated_template_literal: { + code: 1160, + category: 1, + key: "Unterminated template literal." + }, + Unterminated_regular_expression_literal: { + code: 1161, + category: 1, + key: "Unterminated regular expression literal." + }, + An_object_member_cannot_be_declared_optional: { + code: 1162, + category: 1, + key: "An object member cannot be declared optional." + }, + yield_expression_must_be_contained_within_a_generator_declaration: { + code: 1163, + category: 1, + key: "'yield' expression must be contained_within a generator declaration." + }, + Computed_property_names_are_not_allowed_in_enums: { + code: 1164, + category: 1, + key: "Computed property names are not allowed in enums." + }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { + code: 1165, + category: 1, + key: "A computed property name in an ambient context must directly refer to a built-in symbol." + }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { + code: 1166, + category: 1, + key: "A computed property name in a class property declaration must directly refer to a built-in symbol." + }, + Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1167, + category: 1, + key: "Computed property names are only available when targeting ECMAScript 6 and higher." + }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { + code: 1168, + category: 1, + key: "A computed property name in a method overload must directly refer to a built-in symbol." + }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { + code: 1169, + category: 1, + key: "A computed property name in an interface must directly refer to a built-in symbol." + }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { + code: 1170, + category: 1, + key: "A computed property name in a type literal must directly refer to a built-in symbol." + }, + A_comma_expression_is_not_allowed_in_a_computed_property_name: { + code: 1171, + category: 1, + key: "A comma expression is not allowed in a computed property name." + }, + extends_clause_already_seen: { + code: 1172, + category: 1, + key: "'extends' clause already seen." + }, + extends_clause_must_precede_implements_clause: { + code: 1173, + category: 1, + key: "'extends' clause must precede 'implements' clause." + }, + Classes_can_only_extend_a_single_class: { + code: 1174, + category: 1, + key: "Classes can only extend a single class." + }, + implements_clause_already_seen: { + code: 1175, + category: 1, + key: "'implements' clause already seen." + }, + Interface_declaration_cannot_have_implements_clause: { + code: 1176, + category: 1, + key: "Interface declaration cannot have 'implements' clause." + }, + Binary_digit_expected: { + code: 1177, + category: 1, + key: "Binary digit expected." + }, + Octal_digit_expected: { + code: 1178, + category: 1, + key: "Octal digit expected." + }, + Unexpected_token_expected: { + code: 1179, + category: 1, + key: "Unexpected token. '{' expected." + }, + Property_destructuring_pattern_expected: { + code: 1180, + category: 1, + key: "Property destructuring pattern expected." + }, + Array_element_destructuring_pattern_expected: { + code: 1181, + category: 1, + key: "Array element destructuring pattern expected." + }, + A_destructuring_declaration_must_have_an_initializer: { + code: 1182, + category: 1, + key: "A destructuring declaration must have an initializer." + }, + Destructuring_declarations_are_not_allowed_in_ambient_contexts: { + code: 1183, + category: 1, + key: "Destructuring declarations are not allowed in ambient contexts." + }, + An_implementation_cannot_be_declared_in_ambient_contexts: { + code: 1184, + category: 1, + key: "An implementation cannot be declared in ambient contexts." + }, + Modifiers_cannot_appear_here: { + code: 1184, + category: 1, + key: "Modifiers cannot appear here." + }, + Merge_conflict_marker_encountered: { + code: 1185, + category: 1, + key: "Merge conflict marker encountered." + }, + A_rest_element_cannot_have_an_initializer: { + code: 1186, + category: 1, + key: "A rest element cannot have an initializer." + }, + A_parameter_property_may_not_be_a_binding_pattern: { + code: 1187, + category: 1, + key: "A parameter property may not be a binding pattern." + }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { + code: 1188, + category: 1, + key: "Only a single variable declaration is allowed in a 'for...of' statement." + }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { + code: 1189, + category: 1, + key: "The variable declaration of a 'for...in' statement cannot have an initializer." + }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { + code: 1190, + category: 1, + key: "The variable declaration of a 'for...of' statement cannot have an initializer." + }, + An_import_declaration_cannot_have_modifiers: { + code: 1191, + category: 1, + key: "An import declaration cannot have modifiers." + }, + External_module_0_has_no_default_export_or_export_assignment: { + code: 1192, + category: 1, + key: "External module '{0}' has no default export or export assignment." + }, + An_export_declaration_cannot_have_modifiers: { + code: 1193, + category: 1, + key: "An export declaration cannot have modifiers." + }, + Export_declarations_are_not_permitted_in_an_internal_module: { + code: 1194, + category: 1, + key: "Export declarations are not permitted in an internal module." + }, + Catch_clause_variable_name_must_be_an_identifier: { + code: 1195, + category: 1, + key: "Catch clause variable name must be an identifier." + }, + Catch_clause_variable_cannot_have_a_type_annotation: { + code: 1196, + category: 1, + key: "Catch clause variable cannot have a type annotation." + }, + Catch_clause_variable_cannot_have_an_initializer: { + code: 1197, + category: 1, + key: "Catch clause variable cannot have an initializer." + }, + An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { + code: 1198, + category: 1, + key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." + }, + Unterminated_Unicode_escape_sequence: { + code: 1199, + category: 1, + key: "Unterminated Unicode escape sequence." + }, + Duplicate_identifier_0: { + code: 2300, + category: 1, + key: "Duplicate identifier '{0}'." + }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { + code: 2301, + category: 1, + key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." + }, + Static_members_cannot_reference_class_type_parameters: { + code: 2302, + category: 1, + key: "Static members cannot reference class type parameters." + }, + Circular_definition_of_import_alias_0: { + code: 2303, + category: 1, + key: "Circular definition of import alias '{0}'." + }, + Cannot_find_name_0: { + code: 2304, + category: 1, + key: "Cannot find name '{0}'." + }, + Module_0_has_no_exported_member_1: { + code: 2305, + category: 1, + key: "Module '{0}' has no exported member '{1}'." + }, + File_0_is_not_an_external_module: { + code: 2306, + category: 1, + key: "File '{0}' is not an external module." + }, + Cannot_find_external_module_0: { + code: 2307, + category: 1, + key: "Cannot find external module '{0}'." + }, + A_module_cannot_have_more_than_one_export_assignment: { + code: 2308, + category: 1, + key: "A module cannot have more than one export assignment." + }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { + code: 2309, + category: 1, + key: "An export assignment cannot be used in a module with other exported elements." + }, + Type_0_recursively_references_itself_as_a_base_type: { + code: 2310, + category: 1, + key: "Type '{0}' recursively references itself as a base type." + }, + A_class_may_only_extend_another_class: { + code: 2311, + category: 1, + key: "A class may only extend another class." + }, + An_interface_may_only_extend_a_class_or_another_interface: { + code: 2312, + category: 1, + key: "An interface may only extend a class or another interface." + }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { + code: 2313, + category: 1, + key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." + }, + Generic_type_0_requires_1_type_argument_s: { + code: 2314, + category: 1, + key: "Generic type '{0}' requires {1} type argument(s)." + }, + Type_0_is_not_generic: { + code: 2315, + category: 1, + key: "Type '{0}' is not generic." + }, + Global_type_0_must_be_a_class_or_interface_type: { + code: 2316, + category: 1, + key: "Global type '{0}' must be a class or interface type." + }, + Global_type_0_must_have_1_type_parameter_s: { + code: 2317, + category: 1, + key: "Global type '{0}' must have {1} type parameter(s)." + }, + Cannot_find_global_type_0: { + code: 2318, + category: 1, + key: "Cannot find global type '{0}'." + }, + Named_property_0_of_types_1_and_2_are_not_identical: { + code: 2319, + category: 1, + key: "Named property '{0}' of types '{1}' and '{2}' are not identical." + }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { + code: 2320, + category: 1, + key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." + }, + Excessive_stack_depth_comparing_types_0_and_1: { + code: 2321, + category: 1, + key: "Excessive stack depth comparing types '{0}' and '{1}'." + }, + Type_0_is_not_assignable_to_type_1: { + code: 2322, + category: 1, + key: "Type '{0}' is not assignable to type '{1}'." + }, + Property_0_is_missing_in_type_1: { + code: 2324, + category: 1, + key: "Property '{0}' is missing in type '{1}'." + }, + Property_0_is_private_in_type_1_but_not_in_type_2: { + code: 2325, + category: 1, + key: "Property '{0}' is private in type '{1}' but not in type '{2}'." + }, + Types_of_property_0_are_incompatible: { + code: 2326, + category: 1, + key: "Types of property '{0}' are incompatible." + }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { + code: 2327, + category: 1, + key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." + }, + Types_of_parameters_0_and_1_are_incompatible: { + code: 2328, + category: 1, + key: "Types of parameters '{0}' and '{1}' are incompatible." + }, + Index_signature_is_missing_in_type_0: { + code: 2329, + category: 1, + key: "Index signature is missing in type '{0}'." + }, + Index_signatures_are_incompatible: { + code: 2330, + category: 1, + key: "Index signatures are incompatible." + }, + this_cannot_be_referenced_in_a_module_body: { + code: 2331, + category: 1, + key: "'this' cannot be referenced in a module body." + }, + this_cannot_be_referenced_in_current_location: { + code: 2332, + category: 1, + key: "'this' cannot be referenced in current location." + }, + this_cannot_be_referenced_in_constructor_arguments: { + code: 2333, + category: 1, + key: "'this' cannot be referenced in constructor arguments." + }, + this_cannot_be_referenced_in_a_static_property_initializer: { + code: 2334, + category: 1, + key: "'this' cannot be referenced in a static property initializer." + }, + super_can_only_be_referenced_in_a_derived_class: { + code: 2335, + category: 1, + key: "'super' can only be referenced in a derived class." + }, + super_cannot_be_referenced_in_constructor_arguments: { + code: 2336, + category: 1, + key: "'super' cannot be referenced in constructor arguments." + }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { + code: 2337, + category: 1, + key: "Super calls are not permitted outside constructors or in nested functions inside constructors" + }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { + code: 2338, + category: 1, + key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" + }, + Property_0_does_not_exist_on_type_1: { + code: 2339, + category: 1, + key: "Property '{0}' does not exist on type '{1}'." + }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { + code: 2340, + category: 1, + key: "Only public and protected methods of the base class are accessible via the 'super' keyword" + }, + Property_0_is_private_and_only_accessible_within_class_1: { + code: 2341, + category: 1, + key: "Property '{0}' is private and only accessible within class '{1}'." + }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { + code: 2342, + category: 1, + key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." + }, + Type_0_does_not_satisfy_the_constraint_1: { + code: 2344, + category: 1, + key: "Type '{0}' does not satisfy the constraint '{1}'." + }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { + code: 2345, + category: 1, + key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." + }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { + code: 2346, + category: 1, + key: "Supplied parameters do not match any signature of call target." + }, + Untyped_function_calls_may_not_accept_type_arguments: { + code: 2347, + category: 1, + key: "Untyped function calls may not accept type arguments." + }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { + code: 2348, + category: 1, + key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" + }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { + code: 2349, + category: 1, + key: "Cannot invoke an expression whose type lacks a call signature." + }, + Only_a_void_function_can_be_called_with_the_new_keyword: { + code: 2350, + category: 1, + key: "Only a void function can be called with the 'new' keyword." + }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { + code: 2351, + category: 1, + key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." + }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { + code: 2352, + category: 1, + key: "Neither type '{0}' nor type '{1}' is assignable to the other." + }, + No_best_common_type_exists_among_return_expressions: { + code: 2354, + category: 1, + key: "No best common type exists among return expressions." + }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { + code: 2355, + category: 1, + key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." + }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { + code: 2356, + category: 1, + key: "An arithmetic operand must be of type 'any', 'number' or an enum type." + }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { + code: 2357, + category: 1, + key: "The operand of an increment or decrement operator must be a variable, property or indexer." + }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2358, + category: 1, + key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." + }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { + code: 2359, + category: 1, + key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." + }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { + code: 2360, + category: 1, + key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." + }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2361, + category: 1, + key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" + }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { + code: 2362, + category: 1, + key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." + }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { + code: 2363, + category: 1, + key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." + }, + Invalid_left_hand_side_of_assignment_expression: { + code: 2364, + category: 1, + key: "Invalid left-hand side of assignment expression." + }, + Operator_0_cannot_be_applied_to_types_1_and_2: { + code: 2365, + category: 1, + key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." + }, + Type_parameter_name_cannot_be_0: { + code: 2368, + category: 1, + key: "Type parameter name cannot be '{0}'" + }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { + code: 2369, + category: 1, + key: "A parameter property is only allowed in a constructor implementation." + }, + A_rest_parameter_must_be_of_an_array_type: { + code: 2370, + category: 1, + key: "A rest parameter must be of an array type." + }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { + code: 2371, + category: 1, + key: "A parameter initializer is only allowed in a function or constructor implementation." + }, + Parameter_0_cannot_be_referenced_in_its_initializer: { + code: 2372, + category: 1, + key: "Parameter '{0}' cannot be referenced in its initializer." + }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { + code: 2373, + category: 1, + key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." + }, + Duplicate_string_index_signature: { + code: 2374, + category: 1, + key: "Duplicate string index signature." + }, + Duplicate_number_index_signature: { + code: 2375, + category: 1, + key: "Duplicate number index signature." + }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { + code: 2376, + category: 1, + key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." + }, + Constructors_for_derived_classes_must_contain_a_super_call: { + code: 2377, + category: 1, + key: "Constructors for derived classes must contain a 'super' call." + }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { + code: 2378, + category: 1, + key: "A 'get' accessor must return a value or consist of a single 'throw' statement." + }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { + code: 2379, + category: 1, + key: "Getter and setter accessors do not agree in visibility." + }, + get_and_set_accessor_must_have_the_same_type: { + code: 2380, + category: 1, + key: "'get' and 'set' accessor must have the same type." + }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { + code: 2381, + category: 1, + key: "A signature with an implementation cannot use a string literal type." + }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { + code: 2382, + category: 1, + key: "Specialized overload signature is not assignable to any non-specialized signature." + }, + Overload_signatures_must_all_be_exported_or_not_exported: { + code: 2383, + category: 1, + key: "Overload signatures must all be exported or not exported." + }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { + code: 2384, + category: 1, + key: "Overload signatures must all be ambient or non-ambient." + }, + Overload_signatures_must_all_be_public_private_or_protected: { + code: 2385, + category: 1, + key: "Overload signatures must all be public, private or protected." + }, + Overload_signatures_must_all_be_optional_or_required: { + code: 2386, + category: 1, + key: "Overload signatures must all be optional or required." + }, + Function_overload_must_be_static: { + code: 2387, + category: 1, + key: "Function overload must be static." + }, + Function_overload_must_not_be_static: { + code: 2388, + category: 1, + key: "Function overload must not be static." + }, + Function_implementation_name_must_be_0: { + code: 2389, + category: 1, + key: "Function implementation name must be '{0}'." + }, + Constructor_implementation_is_missing: { + code: 2390, + category: 1, + key: "Constructor implementation is missing." + }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { + code: 2391, + category: 1, + key: "Function implementation is missing or not immediately following the declaration." + }, + Multiple_constructor_implementations_are_not_allowed: { + code: 2392, + category: 1, + key: "Multiple constructor implementations are not allowed." + }, + Duplicate_function_implementation: { + code: 2393, + category: 1, + key: "Duplicate function implementation." + }, + Overload_signature_is_not_compatible_with_function_implementation: { + code: 2394, + category: 1, + key: "Overload signature is not compatible with function implementation." + }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { + code: 2395, + category: 1, + key: "Individual declarations in merged declaration {0} must be all exported or all local." + }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { + code: 2396, + category: 1, + key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." + }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { + code: 2399, + category: 1, + key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." + }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { + code: 2400, + category: 1, + key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." + }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { + code: 2401, + category: 1, + key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." + }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { + code: 2402, + category: 1, + key: "Expression resolves to '_super' that compiler uses to capture base class reference." + }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { + code: 2403, + category: 1, + key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." + }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { + code: 2404, + category: 1, + key: "The left-hand side of a 'for...in' statement cannot use a type annotation." + }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { + code: 2405, + category: 1, + key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." + }, + Invalid_left_hand_side_in_for_in_statement: { + code: 2406, + category: 1, + key: "Invalid left-hand side in 'for...in' statement." + }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2407, + category: 1, + key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." + }, + Setters_cannot_return_a_value: { + code: 2408, + category: 1, + key: "Setters cannot return a value." + }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { + code: 2409, + category: 1, + key: "Return type of constructor signature must be assignable to the instance type of the class" + }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { + code: 2410, + category: 1, + key: "All symbols within a 'with' block will be resolved to 'any'." + }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { + code: 2411, + category: 1, + key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." + }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { + code: 2412, + category: 1, + key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." + }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { + code: 2413, + category: 1, + key: "Numeric index type '{0}' is not assignable to string index type '{1}'." + }, + Class_name_cannot_be_0: { + code: 2414, + category: 1, + key: "Class name cannot be '{0}'" + }, + Class_0_incorrectly_extends_base_class_1: { + code: 2415, + category: 1, + key: "Class '{0}' incorrectly extends base class '{1}'." + }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { + code: 2417, + category: 1, + key: "Class static side '{0}' incorrectly extends base class static side '{1}'." + }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { + code: 2419, + category: 1, + key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." + }, + Class_0_incorrectly_implements_interface_1: { + code: 2420, + category: 1, + key: "Class '{0}' incorrectly implements interface '{1}'." + }, + A_class_may_only_implement_another_class_or_interface: { + code: 2422, + category: 1, + key: "A class may only implement another class or interface." + }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { + code: 2423, + category: 1, + key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." + }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { + code: 2424, + category: 1, + key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." + }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { + code: 2425, + category: 1, + key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." + }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { + code: 2426, + category: 1, + key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." + }, + Interface_name_cannot_be_0: { + code: 2427, + category: 1, + key: "Interface name cannot be '{0}'" + }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { + code: 2428, + category: 1, + key: "All declarations of an interface must have identical type parameters." + }, + Interface_0_incorrectly_extends_interface_1: { + code: 2430, + category: 1, + key: "Interface '{0}' incorrectly extends interface '{1}'." + }, + Enum_name_cannot_be_0: { + code: 2431, + category: 1, + key: "Enum name cannot be '{0}'" + }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { + code: 2432, + category: 1, + key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." + }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { + code: 2433, + category: 1, + key: "A module declaration cannot be in a different file from a class or function with which it is merged" + }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { + code: 2434, + category: 1, + key: "A module declaration cannot be located prior to a class or function with which it is merged" + }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { + code: 2435, + category: 1, + key: "Ambient external modules cannot be nested in other modules." + }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { + code: 2436, + category: 1, + key: "Ambient external module declaration cannot specify relative module name." + }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { + code: 2437, + category: 1, + key: "Module '{0}' is hidden by a local declaration with the same name" + }, + Import_name_cannot_be_0: { + code: 2438, + category: 1, + key: "Import name cannot be '{0}'" + }, + Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { + code: 2439, + category: 1, + key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." + }, + Import_declaration_conflicts_with_local_declaration_of_0: { + code: 2440, + category: 1, + key: "Import declaration conflicts with local declaration of '{0}'" + }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { + code: 2441, + category: 1, + key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." + }, + Types_have_separate_declarations_of_a_private_property_0: { + code: 2442, + category: 1, + key: "Types have separate declarations of a private property '{0}'." + }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { + code: 2443, + category: 1, + key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." + }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { + code: 2444, + category: 1, + key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." + }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { + code: 2445, + category: 1, + key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." + }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { + code: 2446, + category: 1, + key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." + }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { + code: 2447, + category: 1, + key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." + }, + Block_scoped_variable_0_used_before_its_declaration: { + code: 2448, + category: 1, + key: "Block-scoped variable '{0}' used before its declaration." + }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { + code: 2449, + category: 1, + key: "The operand of an increment or decrement operator cannot be a constant." + }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { + code: 2450, + category: 1, + key: "Left-hand side of assignment expression cannot be a constant." + }, + Cannot_redeclare_block_scoped_variable_0: { + code: 2451, + category: 1, + key: "Cannot redeclare block-scoped variable '{0}'." + }, + An_enum_member_cannot_have_a_numeric_name: { + code: 2452, + category: 1, + key: "An enum member cannot have a numeric name." + }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { + code: 2453, + category: 1, + key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." + }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { + code: 2455, + category: 1, + key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." + }, + Type_alias_0_circularly_references_itself: { + code: 2456, + category: 1, + key: "Type alias '{0}' circularly references itself." + }, + Type_alias_name_cannot_be_0: { + code: 2457, + category: 1, + key: "Type alias name cannot be '{0}'" + }, + An_AMD_module_cannot_have_multiple_name_assignments: { + code: 2458, + category: 1, + key: "An AMD module cannot have multiple name assignments." + }, + Type_0_has_no_property_1_and_no_string_index_signature: { + code: 2459, + category: 1, + key: "Type '{0}' has no property '{1}' and no string index signature." + }, + Type_0_has_no_property_1: { + code: 2460, + category: 1, + key: "Type '{0}' has no property '{1}'." + }, + Type_0_is_not_an_array_type: { + code: 2461, + category: 1, + key: "Type '{0}' is not an array type." + }, + A_rest_element_must_be_last_in_an_array_destructuring_pattern: { + code: 2462, + category: 1, + key: "A rest element must be last in an array destructuring pattern" + }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { + code: 2463, + category: 1, + key: "A binding pattern parameter cannot be optional in an implementation signature." + }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { + code: 2464, + category: 1, + key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." + }, + this_cannot_be_referenced_in_a_computed_property_name: { + code: 2465, + category: 1, + key: "'this' cannot be referenced in a computed property name." + }, + super_cannot_be_referenced_in_a_computed_property_name: { + code: 2466, + category: 1, + key: "'super' cannot be referenced in a computed property name." + }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { + code: 2467, + category: 1, + key: "A computed property name cannot reference a type parameter from its containing type." + }, + Cannot_find_global_value_0: { + code: 2468, + category: 1, + key: "Cannot find global value '{0}'." + }, + The_0_operator_cannot_be_applied_to_type_symbol: { + code: 2469, + category: 1, + key: "The '{0}' operator cannot be applied to type 'symbol'." + }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { + code: 2470, + category: 1, + key: "'Symbol' reference does not refer to the global Symbol constructor object." + }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { + code: 2471, + category: 1, + key: "A computed property name of the form '{0}' must be of type 'symbol'." + }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 2472, + category: 1, + key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." + }, + Enum_declarations_must_all_be_const_or_non_const: { + code: 2473, + category: 1, + key: "Enum declarations must all be const or non-const." + }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { + code: 2474, + category: 1, + key: "In 'const' enum declarations member initializer must be constant expression." + }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { + code: 2475, + category: 1, + key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." + }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { + code: 2476, + category: 1, + key: "A const enum member can only be accessed using a string literal." + }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { + code: 2477, + category: 1, + key: "'const' enum member initializer was evaluated to a non-finite value." + }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { + code: 2478, + category: 1, + key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." + }, + Property_0_does_not_exist_on_const_enum_1: { + code: 2479, + category: 1, + key: "Property '{0}' does not exist on 'const' enum '{1}'." + }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { + code: 2480, + category: 1, + key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." + }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { + code: 2481, + category: 1, + key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." + }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { + code: 2483, + category: 1, + key: "The left-hand side of a 'for...of' statement cannot use a type annotation." + }, + Export_declaration_conflicts_with_exported_declaration_of_0: { + code: 2484, + category: 1, + key: "Export declaration conflicts with exported declaration of '{0}'" + }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { + code: 2485, + category: 1, + key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." + }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { + code: 2486, + category: 1, + key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." + }, + Invalid_left_hand_side_in_for_of_statement: { + code: 2487, + category: 1, + key: "Invalid left-hand side in 'for...of' statement." + }, + The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { + code: 2488, + category: 1, + key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." + }, + The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { + code: 2489, + category: 1, + key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." + }, + The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { + code: 2490, + category: 1, + key: "The type returned by the 'next()' method of an iterator must have a 'value' property." + }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { + code: 2491, + category: 1, + key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." + }, + Cannot_redeclare_identifier_0_in_catch_clause: { + code: 2492, + category: 1, + key: "Cannot redeclare identifier '{0}' in catch clause" + }, + Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { + code: 2493, + category: 1, + key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." + }, + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { + code: 2494, + category: 1, + key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." + }, + Type_0_is_not_an_array_type_or_a_string_type: { + code: 2461, + category: 1, + key: "Type '{0}' is not an array type or a string type." + }, + Import_declaration_0_is_using_private_name_1: { + code: 4000, + category: 1, + key: "Import declaration '{0}' is using private name '{1}'." + }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4002, + category: 1, + key: "Type parameter '{0}' of exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { + code: 4004, + category: 1, + key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4006, + category: 1, + key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4008, + category: 1, + key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4010, + category: 1, + key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4012, + category: 1, + key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { + code: 4014, + category: 1, + key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { + code: 4016, + category: 1, + key: "Type parameter '{0}' of exported function has or is using private name '{1}'." + }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { + code: 4019, + category: 1, + key: "Implements clause of exported class '{0}' has or is using private name '{1}'." + }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { + code: 4020, + category: 1, + key: "Extends clause of exported class '{0}' has or is using private name '{1}'." + }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { + code: 4022, + category: 1, + key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." + }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4023, + category: 1, + key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." + }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { + code: 4024, + category: 1, + key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." + }, + Exported_variable_0_has_or_is_using_private_name_1: { + code: 4025, + category: 1, + key: "Exported variable '{0}' has or is using private name '{1}'." + }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4026, + category: 1, + key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4027, + category: 1, + key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." + }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4028, + category: 1, + key: "Public static property '{0}' of exported class has or is using private name '{1}'." + }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4029, + category: 1, + key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4030, + category: 1, + key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." + }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4031, + category: 1, + key: "Public property '{0}' of exported class has or is using private name '{1}'." + }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4032, + category: 1, + key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." + }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { + code: 4033, + category: 1, + key: "Property '{0}' of exported interface has or is using private name '{1}'." + }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4034, + category: 1, + key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { + code: 4035, + category: 1, + key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." + }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4036, + category: 1, + key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { + code: 4037, + category: 1, + key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4038, + category: 1, + key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4039, + category: 1, + key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { + code: 4040, + category: 1, + key: "Return type of public static property getter from exported class has or is using private name '{0}'." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4041, + category: 1, + key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4042, + category: 1, + key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { + code: 4043, + category: 1, + key: "Return type of public property getter from exported class has or is using private name '{0}'." + }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4044, + category: 1, + key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4045, + category: 1, + key: "Return type of constructor signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4046, + category: 1, + key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4047, + category: 1, + key: "Return type of call signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4048, + category: 1, + key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4049, + category: 1, + key: "Return type of index signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4050, + category: 1, + key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4051, + category: 1, + key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { + code: 4052, + category: 1, + key: "Return type of public static method from exported class has or is using private name '{0}'." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4053, + category: 1, + key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4054, + category: 1, + key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { + code: 4055, + category: 1, + key: "Return type of public method from exported class has or is using private name '{0}'." + }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4056, + category: 1, + key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { + code: 4057, + category: 1, + key: "Return type of method from exported interface has or is using private name '{0}'." + }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4058, + category: 1, + key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { + code: 4059, + category: 1, + key: "Return type of exported function has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { + code: 4060, + category: 1, + key: "Return type of exported function has or is using private name '{0}'." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4061, + category: 1, + key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4062, + category: 1, + key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { + code: 4063, + category: 1, + key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." + }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4064, + category: 1, + key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4065, + category: 1, + key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4066, + category: 1, + key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4067, + category: 1, + key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4068, + category: 1, + key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4069, + category: 1, + key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4070, + category: 1, + key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4071, + category: 1, + key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4072, + category: 1, + key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4073, + category: 1, + key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." + }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4074, + category: 1, + key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { + code: 4075, + category: 1, + key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4076, + category: 1, + key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { + code: 4077, + category: 1, + key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { + code: 4078, + category: 1, + key: "Parameter '{0}' of exported function has or is using private name '{1}'." + }, + Exported_type_alias_0_has_or_is_using_private_name_1: { + code: 4081, + category: 1, + key: "Exported type alias '{0}' has or is using private name '{1}'." + }, + Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { + code: 4091, + category: 1, + key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." + }, + The_current_host_does_not_support_the_0_option: { + code: 5001, + category: 1, + key: "The current host does not support the '{0}' option." + }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { + code: 5009, + category: 1, + key: "Cannot find the common subdirectory path for the input files." + }, + Cannot_read_file_0_Colon_1: { + code: 5012, + category: 1, + key: "Cannot read file '{0}': {1}" + }, + Unsupported_file_encoding: { + code: 5013, + category: 1, + key: "Unsupported file encoding." + }, + Unknown_compiler_option_0: { + code: 5023, + category: 1, + key: "Unknown compiler option '{0}'." + }, + Compiler_option_0_requires_a_value_of_type_1: { + code: 5024, + category: 1, + key: "Compiler option '{0}' requires a value of type {1}." + }, + Could_not_write_file_0_Colon_1: { + code: 5033, + category: 1, + key: "Could not write file '{0}': {1}" + }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { + code: 5038, + category: 1, + key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." + }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { + code: 5039, + category: 1, + key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." + }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { + code: 5040, + category: 1, + key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." + }, + Option_noEmit_cannot_be_specified_with_option_declaration: { + code: 5041, + category: 1, + key: "Option 'noEmit' cannot be specified with option 'declaration'." + }, + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { + code: 5042, + category: 1, + key: "Option 'project' cannot be mixed with source files on a command line." + }, + Concatenate_and_emit_output_to_single_file: { + code: 6001, + category: 2, + key: "Concatenate and emit output to single file." + }, + Generates_corresponding_d_ts_file: { + code: 6002, + category: 2, + key: "Generates corresponding '.d.ts' file." + }, + Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { + code: 6003, + category: 2, + key: "Specifies the location where debugger should locate map files instead of generated locations." + }, + Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { + code: 6004, + category: 2, + key: "Specifies the location where debugger should locate TypeScript files instead of source locations." + }, + Watch_input_files: { + code: 6005, + category: 2, + key: "Watch input files." + }, + Redirect_output_structure_to_the_directory: { + code: 6006, + category: 2, + key: "Redirect output structure to the directory." + }, + Do_not_erase_const_enum_declarations_in_generated_code: { + code: 6007, + category: 2, + key: "Do not erase const enum declarations in generated code." + }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { + code: 6008, + category: 2, + key: "Do not emit outputs if any type checking errors were reported." + }, + Do_not_emit_comments_to_output: { + code: 6009, + category: 2, + key: "Do not emit comments to output." + }, + Do_not_emit_outputs: { + code: 6010, + category: 2, + key: "Do not emit outputs." + }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { + code: 6015, + category: 2, + key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" + }, + Specify_module_code_generation_Colon_commonjs_or_amd: { + code: 6016, + category: 2, + key: "Specify module code generation: 'commonjs' or 'amd'" + }, + Print_this_message: { + code: 6017, + category: 2, + key: "Print this message." + }, + Print_the_compiler_s_version: { + code: 6019, + category: 2, + key: "Print the compiler's version." + }, + Compile_the_project_in_the_given_directory: { + code: 6020, + category: 2, + key: "Compile the project in the given directory." + }, + Syntax_Colon_0: { + code: 6023, + category: 2, + key: "Syntax: {0}" + }, + options: { + code: 6024, + category: 2, + key: "options" + }, + file: { + code: 6025, + category: 2, + key: "file" + }, + Examples_Colon_0: { + code: 6026, + category: 2, + key: "Examples: {0}" + }, + Options_Colon: { + code: 6027, + category: 2, + key: "Options:" + }, + Version_0: { + code: 6029, + category: 2, + key: "Version {0}" + }, + Insert_command_line_options_and_files_from_a_file: { + code: 6030, + category: 2, + key: "Insert command line options and files from a file." + }, + File_change_detected_Starting_incremental_compilation: { + code: 6032, + category: 2, + key: "File change detected. Starting incremental compilation..." + }, + KIND: { + code: 6034, + category: 2, + key: "KIND" + }, + FILE: { + code: 6035, + category: 2, + key: "FILE" + }, + VERSION: { + code: 6036, + category: 2, + key: "VERSION" + }, + LOCATION: { + code: 6037, + category: 2, + key: "LOCATION" + }, + DIRECTORY: { + code: 6038, + category: 2, + key: "DIRECTORY" + }, + Compilation_complete_Watching_for_file_changes: { + code: 6042, + category: 2, + key: "Compilation complete. Watching for file changes." + }, + Generates_corresponding_map_file: { + code: 6043, + category: 2, + key: "Generates corresponding '.map' file." + }, + Compiler_option_0_expects_an_argument: { + code: 6044, + category: 1, + key: "Compiler option '{0}' expects an argument." + }, + Unterminated_quoted_string_in_response_file_0: { + code: 6045, + category: 1, + key: "Unterminated quoted string in response file '{0}'." + }, + Argument_for_module_option_must_be_commonjs_or_amd: { + code: 6046, + category: 1, + key: "Argument for '--module' option must be 'commonjs' or 'amd'." + }, + Argument_for_target_option_must_be_es3_es5_or_es6: { + code: 6047, + category: 1, + key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." + }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { + code: 6048, + category: 1, + key: "Locale must be of the form or -. For example '{0}' or '{1}'." + }, + Unsupported_locale_0: { + code: 6049, + category: 1, + key: "Unsupported locale '{0}'." + }, + Unable_to_open_file_0: { + code: 6050, + category: 1, + key: "Unable to open file '{0}'." + }, + Corrupted_locale_file_0: { + code: 6051, + category: 1, + key: "Corrupted locale file {0}." + }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { + code: 6052, + category: 2, + key: "Raise error on expressions and declarations with an implied 'any' type." + }, + File_0_not_found: { + code: 6053, + category: 1, + key: "File '{0}' not found." + }, + File_0_must_have_extension_ts_or_d_ts: { + code: 6054, + category: 1, + key: "File '{0}' must have extension '.ts' or '.d.ts'." + }, + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { + code: 6055, + category: 2, + key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." + }, + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { + code: 6056, + category: 2, + key: "Do not emit declarations for code that has an '@internal' annotation." + }, + Preserve_new_lines_when_emitting_code: { + code: 6057, + category: 2, + key: "Preserve new-lines when emitting code." + }, + Variable_0_implicitly_has_an_1_type: { + code: 7005, + category: 1, + key: "Variable '{0}' implicitly has an '{1}' type." + }, + Parameter_0_implicitly_has_an_1_type: { + code: 7006, + category: 1, + key: "Parameter '{0}' implicitly has an '{1}' type." + }, + Member_0_implicitly_has_an_1_type: { + code: 7008, + category: 1, + key: "Member '{0}' implicitly has an '{1}' type." + }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { + code: 7009, + category: 1, + key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." + }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { + code: 7010, + category: 1, + key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." + }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { + code: 7011, + category: 1, + key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." + }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { + code: 7013, + category: 1, + key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." + }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { + code: 7016, + category: 1, + key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." + }, + Index_signature_of_object_type_implicitly_has_an_any_type: { + code: 7017, + category: 1, + key: "Index signature of object type implicitly has an 'any' type." + }, + Object_literal_s_property_0_implicitly_has_an_1_type: { + code: 7018, + category: 1, + key: "Object literal's property '{0}' implicitly has an '{1}' type." + }, + Rest_parameter_0_implicitly_has_an_any_type: { + code: 7019, + category: 1, + key: "Rest parameter '{0}' implicitly has an 'any[]' type." + }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { + code: 7020, + category: 1, + key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." + }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { + code: 7021, + category: 1, + key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." + }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { + code: 7022, + category: 1, + key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." + }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { + code: 7023, + category: 1, + key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." + }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { + code: 7024, + category: 1, + key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." + }, + You_cannot_rename_this_element: { + code: 8000, + category: 1, + key: "You cannot rename this element." + }, + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { + code: 8001, + category: 1, + key: "You cannot rename elements that are defined in the standard TypeScript library." + }, + yield_expressions_are_not_currently_supported: { + code: 9000, + category: 1, + key: "'yield' expressions are not currently supported." + }, + Generators_are_not_currently_supported: { + code: 9001, + category: 1, + key: "Generators are not currently supported." + }, + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { + code: 9002, + category: 1, + key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." + } }; })(ts || (ts = {})); var ts; @@ -2048,10 +4013,2806 @@ var ts; "|=": 62, "^=": 63 }; - var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierStart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 543, + 546, + 563, + 592, + 685, + 688, + 696, + 699, + 705, + 720, + 721, + 736, + 740, + 750, + 750, + 890, + 890, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 974, + 976, + 983, + 986, + 1011, + 1024, + 1153, + 1164, + 1220, + 1223, + 1224, + 1227, + 1228, + 1232, + 1269, + 1272, + 1273, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1488, + 1514, + 1520, + 1522, + 1569, + 1594, + 1600, + 1610, + 1649, + 1747, + 1749, + 1749, + 1765, + 1766, + 1786, + 1788, + 1808, + 1808, + 1810, + 1836, + 1920, + 1957, + 2309, + 2361, + 2365, + 2365, + 2384, + 2384, + 2392, + 2401, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2524, + 2525, + 2527, + 2529, + 2544, + 2545, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2649, + 2652, + 2654, + 2654, + 2674, + 2676, + 2693, + 2699, + 2701, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2749, + 2749, + 2768, + 2768, + 2784, + 2784, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2870, + 2873, + 2877, + 2877, + 2908, + 2909, + 2911, + 2913, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 2997, + 2999, + 3001, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3168, + 3169, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3294, + 3294, + 3296, + 3297, + 3333, + 3340, + 3342, + 3344, + 3346, + 3368, + 3370, + 3385, + 3424, + 3425, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3585, + 3632, + 3634, + 3635, + 3648, + 3654, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3760, + 3762, + 3763, + 3773, + 3773, + 3776, + 3780, + 3782, + 3782, + 3804, + 3805, + 3840, + 3840, + 3904, + 3911, + 3913, + 3946, + 3976, + 3979, + 4096, + 4129, + 4131, + 4135, + 4137, + 4138, + 4176, + 4181, + 4256, + 4293, + 4304, + 4342, + 4352, + 4441, + 4447, + 4514, + 4520, + 4601, + 4608, + 4614, + 4616, + 4678, + 4680, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4742, + 4744, + 4744, + 4746, + 4749, + 4752, + 4782, + 4784, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4814, + 4816, + 4822, + 4824, + 4846, + 4848, + 4878, + 4880, + 4880, + 4882, + 4885, + 4888, + 4894, + 4896, + 4934, + 4936, + 4954, + 5024, + 5108, + 5121, + 5740, + 5743, + 5750, + 5761, + 5786, + 5792, + 5866, + 6016, + 6067, + 6176, + 6263, + 6272, + 6312, + 7680, + 7835, + 7840, + 7929, + 7936, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8319, + 8319, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8497, + 8499, + 8505, + 8544, + 8579, + 12293, + 12295, + 12321, + 12329, + 12337, + 12341, + 12344, + 12346, + 12353, + 12436, + 12445, + 12446, + 12449, + 12538, + 12540, + 12542, + 12549, + 12588, + 12593, + 12686, + 12704, + 12727, + 13312, + 19893, + 19968, + 40869, + 40960, + 42124, + 44032, + 55203, + 63744, + 64045, + 64256, + 64262, + 64275, + 64279, + 64285, + 64285, + 64287, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65136, + 65138, + 65140, + 65140, + 65142, + 65276, + 65313, + 65338, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES3IdentifierPart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 543, + 546, + 563, + 592, + 685, + 688, + 696, + 699, + 705, + 720, + 721, + 736, + 740, + 750, + 750, + 768, + 846, + 864, + 866, + 890, + 890, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 974, + 976, + 983, + 986, + 1011, + 1024, + 1153, + 1155, + 1158, + 1164, + 1220, + 1223, + 1224, + 1227, + 1228, + 1232, + 1269, + 1272, + 1273, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1425, + 1441, + 1443, + 1465, + 1467, + 1469, + 1471, + 1471, + 1473, + 1474, + 1476, + 1476, + 1488, + 1514, + 1520, + 1522, + 1569, + 1594, + 1600, + 1621, + 1632, + 1641, + 1648, + 1747, + 1749, + 1756, + 1759, + 1768, + 1770, + 1773, + 1776, + 1788, + 1808, + 1836, + 1840, + 1866, + 1920, + 1968, + 2305, + 2307, + 2309, + 2361, + 2364, + 2381, + 2384, + 2388, + 2392, + 2403, + 2406, + 2415, + 2433, + 2435, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2492, + 2492, + 2494, + 2500, + 2503, + 2504, + 2507, + 2509, + 2519, + 2519, + 2524, + 2525, + 2527, + 2531, + 2534, + 2545, + 2562, + 2562, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2620, + 2620, + 2622, + 2626, + 2631, + 2632, + 2635, + 2637, + 2649, + 2652, + 2654, + 2654, + 2662, + 2676, + 2689, + 2691, + 2693, + 2699, + 2701, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2748, + 2757, + 2759, + 2761, + 2763, + 2765, + 2768, + 2768, + 2784, + 2784, + 2790, + 2799, + 2817, + 2819, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2870, + 2873, + 2876, + 2883, + 2887, + 2888, + 2891, + 2893, + 2902, + 2903, + 2908, + 2909, + 2911, + 2913, + 2918, + 2927, + 2946, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 2997, + 2999, + 3001, + 3006, + 3010, + 3014, + 3016, + 3018, + 3021, + 3031, + 3031, + 3047, + 3055, + 3073, + 3075, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3134, + 3140, + 3142, + 3144, + 3146, + 3149, + 3157, + 3158, + 3168, + 3169, + 3174, + 3183, + 3202, + 3203, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3262, + 3268, + 3270, + 3272, + 3274, + 3277, + 3285, + 3286, + 3294, + 3294, + 3296, + 3297, + 3302, + 3311, + 3330, + 3331, + 3333, + 3340, + 3342, + 3344, + 3346, + 3368, + 3370, + 3385, + 3390, + 3395, + 3398, + 3400, + 3402, + 3405, + 3415, + 3415, + 3424, + 3425, + 3430, + 3439, + 3458, + 3459, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3530, + 3530, + 3535, + 3540, + 3542, + 3542, + 3544, + 3551, + 3570, + 3571, + 3585, + 3642, + 3648, + 3662, + 3664, + 3673, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3769, + 3771, + 3773, + 3776, + 3780, + 3782, + 3782, + 3784, + 3789, + 3792, + 3801, + 3804, + 3805, + 3840, + 3840, + 3864, + 3865, + 3872, + 3881, + 3893, + 3893, + 3895, + 3895, + 3897, + 3897, + 3902, + 3911, + 3913, + 3946, + 3953, + 3972, + 3974, + 3979, + 3984, + 3991, + 3993, + 4028, + 4038, + 4038, + 4096, + 4129, + 4131, + 4135, + 4137, + 4138, + 4140, + 4146, + 4150, + 4153, + 4160, + 4169, + 4176, + 4185, + 4256, + 4293, + 4304, + 4342, + 4352, + 4441, + 4447, + 4514, + 4520, + 4601, + 4608, + 4614, + 4616, + 4678, + 4680, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4742, + 4744, + 4744, + 4746, + 4749, + 4752, + 4782, + 4784, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4814, + 4816, + 4822, + 4824, + 4846, + 4848, + 4878, + 4880, + 4880, + 4882, + 4885, + 4888, + 4894, + 4896, + 4934, + 4936, + 4954, + 4969, + 4977, + 5024, + 5108, + 5121, + 5740, + 5743, + 5750, + 5761, + 5786, + 5792, + 5866, + 6016, + 6099, + 6112, + 6121, + 6160, + 6169, + 6176, + 6263, + 6272, + 6313, + 7680, + 7835, + 7840, + 7929, + 7936, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8255, + 8256, + 8319, + 8319, + 8400, + 8412, + 8417, + 8417, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8497, + 8499, + 8505, + 8544, + 8579, + 12293, + 12295, + 12321, + 12335, + 12337, + 12341, + 12344, + 12346, + 12353, + 12436, + 12441, + 12442, + 12445, + 12446, + 12449, + 12542, + 12549, + 12588, + 12593, + 12686, + 12704, + 12727, + 13312, + 19893, + 19968, + 40869, + 40960, + 42124, + 44032, + 55203, + 63744, + 64045, + 64256, + 64262, + 64275, + 64279, + 64285, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65056, + 65059, + 65075, + 65076, + 65101, + 65103, + 65136, + 65138, + 65140, + 65140, + 65142, + 65276, + 65296, + 65305, + 65313, + 65338, + 65343, + 65343, + 65345, + 65370, + 65381, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES5IdentifierStart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 705, + 710, + 721, + 736, + 740, + 748, + 748, + 750, + 750, + 880, + 884, + 886, + 887, + 890, + 893, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 1013, + 1015, + 1153, + 1162, + 1319, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1488, + 1514, + 1520, + 1522, + 1568, + 1610, + 1646, + 1647, + 1649, + 1747, + 1749, + 1749, + 1765, + 1766, + 1774, + 1775, + 1786, + 1788, + 1791, + 1791, + 1808, + 1808, + 1810, + 1839, + 1869, + 1957, + 1969, + 1969, + 1994, + 2026, + 2036, + 2037, + 2042, + 2042, + 2048, + 2069, + 2074, + 2074, + 2084, + 2084, + 2088, + 2088, + 2112, + 2136, + 2208, + 2208, + 2210, + 2220, + 2308, + 2361, + 2365, + 2365, + 2384, + 2384, + 2392, + 2401, + 2417, + 2423, + 2425, + 2431, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2493, + 2493, + 2510, + 2510, + 2524, + 2525, + 2527, + 2529, + 2544, + 2545, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2649, + 2652, + 2654, + 2654, + 2674, + 2676, + 2693, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2749, + 2749, + 2768, + 2768, + 2784, + 2785, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2869, + 2873, + 2877, + 2877, + 2908, + 2909, + 2911, + 2913, + 2929, + 2929, + 2947, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 3001, + 3024, + 3024, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3133, + 3133, + 3160, + 3161, + 3168, + 3169, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3261, + 3261, + 3294, + 3294, + 3296, + 3297, + 3313, + 3314, + 3333, + 3340, + 3342, + 3344, + 3346, + 3386, + 3389, + 3389, + 3406, + 3406, + 3424, + 3425, + 3450, + 3455, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3585, + 3632, + 3634, + 3635, + 3648, + 3654, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3760, + 3762, + 3763, + 3773, + 3773, + 3776, + 3780, + 3782, + 3782, + 3804, + 3807, + 3840, + 3840, + 3904, + 3911, + 3913, + 3948, + 3976, + 3980, + 4096, + 4138, + 4159, + 4159, + 4176, + 4181, + 4186, + 4189, + 4193, + 4193, + 4197, + 4198, + 4206, + 4208, + 4213, + 4225, + 4238, + 4238, + 4256, + 4293, + 4295, + 4295, + 4301, + 4301, + 4304, + 4346, + 4348, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4744, + 4746, + 4749, + 4752, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4822, + 4824, + 4880, + 4882, + 4885, + 4888, + 4954, + 4992, + 5007, + 5024, + 5108, + 5121, + 5740, + 5743, + 5759, + 5761, + 5786, + 5792, + 5866, + 5870, + 5872, + 5888, + 5900, + 5902, + 5905, + 5920, + 5937, + 5952, + 5969, + 5984, + 5996, + 5998, + 6000, + 6016, + 6067, + 6103, + 6103, + 6108, + 6108, + 6176, + 6263, + 6272, + 6312, + 6314, + 6314, + 6320, + 6389, + 6400, + 6428, + 6480, + 6509, + 6512, + 6516, + 6528, + 6571, + 6593, + 6599, + 6656, + 6678, + 6688, + 6740, + 6823, + 6823, + 6917, + 6963, + 6981, + 6987, + 7043, + 7072, + 7086, + 7087, + 7098, + 7141, + 7168, + 7203, + 7245, + 7247, + 7258, + 7293, + 7401, + 7404, + 7406, + 7409, + 7413, + 7414, + 7424, + 7615, + 7680, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8305, + 8305, + 8319, + 8319, + 8336, + 8348, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8505, + 8508, + 8511, + 8517, + 8521, + 8526, + 8526, + 8544, + 8584, + 11264, + 11310, + 11312, + 11358, + 11360, + 11492, + 11499, + 11502, + 11506, + 11507, + 11520, + 11557, + 11559, + 11559, + 11565, + 11565, + 11568, + 11623, + 11631, + 11631, + 11648, + 11670, + 11680, + 11686, + 11688, + 11694, + 11696, + 11702, + 11704, + 11710, + 11712, + 11718, + 11720, + 11726, + 11728, + 11734, + 11736, + 11742, + 11823, + 11823, + 12293, + 12295, + 12321, + 12329, + 12337, + 12341, + 12344, + 12348, + 12353, + 12438, + 12445, + 12447, + 12449, + 12538, + 12540, + 12543, + 12549, + 12589, + 12593, + 12686, + 12704, + 12730, + 12784, + 12799, + 13312, + 19893, + 19968, + 40908, + 40960, + 42124, + 42192, + 42237, + 42240, + 42508, + 42512, + 42527, + 42538, + 42539, + 42560, + 42606, + 42623, + 42647, + 42656, + 42735, + 42775, + 42783, + 42786, + 42888, + 42891, + 42894, + 42896, + 42899, + 42912, + 42922, + 43000, + 43009, + 43011, + 43013, + 43015, + 43018, + 43020, + 43042, + 43072, + 43123, + 43138, + 43187, + 43250, + 43255, + 43259, + 43259, + 43274, + 43301, + 43312, + 43334, + 43360, + 43388, + 43396, + 43442, + 43471, + 43471, + 43520, + 43560, + 43584, + 43586, + 43588, + 43595, + 43616, + 43638, + 43642, + 43642, + 43648, + 43695, + 43697, + 43697, + 43701, + 43702, + 43705, + 43709, + 43712, + 43712, + 43714, + 43714, + 43739, + 43741, + 43744, + 43754, + 43762, + 43764, + 43777, + 43782, + 43785, + 43790, + 43793, + 43798, + 43808, + 43814, + 43816, + 43822, + 43968, + 44002, + 44032, + 55203, + 55216, + 55238, + 55243, + 55291, + 63744, + 64109, + 64112, + 64217, + 64256, + 64262, + 64275, + 64279, + 64285, + 64285, + 64287, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65136, + 65140, + 65142, + 65276, + 65313, + 65338, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES5IdentifierPart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 705, + 710, + 721, + 736, + 740, + 748, + 748, + 750, + 750, + 768, + 884, + 886, + 887, + 890, + 893, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 1013, + 1015, + 1153, + 1155, + 1159, + 1162, + 1319, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1425, + 1469, + 1471, + 1471, + 1473, + 1474, + 1476, + 1477, + 1479, + 1479, + 1488, + 1514, + 1520, + 1522, + 1552, + 1562, + 1568, + 1641, + 1646, + 1747, + 1749, + 1756, + 1759, + 1768, + 1770, + 1788, + 1791, + 1791, + 1808, + 1866, + 1869, + 1969, + 1984, + 2037, + 2042, + 2042, + 2048, + 2093, + 2112, + 2139, + 2208, + 2208, + 2210, + 2220, + 2276, + 2302, + 2304, + 2403, + 2406, + 2415, + 2417, + 2423, + 2425, + 2431, + 2433, + 2435, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2492, + 2500, + 2503, + 2504, + 2507, + 2510, + 2519, + 2519, + 2524, + 2525, + 2527, + 2531, + 2534, + 2545, + 2561, + 2563, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2620, + 2620, + 2622, + 2626, + 2631, + 2632, + 2635, + 2637, + 2641, + 2641, + 2649, + 2652, + 2654, + 2654, + 2662, + 2677, + 2689, + 2691, + 2693, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2748, + 2757, + 2759, + 2761, + 2763, + 2765, + 2768, + 2768, + 2784, + 2787, + 2790, + 2799, + 2817, + 2819, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2869, + 2873, + 2876, + 2884, + 2887, + 2888, + 2891, + 2893, + 2902, + 2903, + 2908, + 2909, + 2911, + 2915, + 2918, + 2927, + 2929, + 2929, + 2946, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 3001, + 3006, + 3010, + 3014, + 3016, + 3018, + 3021, + 3024, + 3024, + 3031, + 3031, + 3046, + 3055, + 3073, + 3075, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3133, + 3140, + 3142, + 3144, + 3146, + 3149, + 3157, + 3158, + 3160, + 3161, + 3168, + 3171, + 3174, + 3183, + 3202, + 3203, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3260, + 3268, + 3270, + 3272, + 3274, + 3277, + 3285, + 3286, + 3294, + 3294, + 3296, + 3299, + 3302, + 3311, + 3313, + 3314, + 3330, + 3331, + 3333, + 3340, + 3342, + 3344, + 3346, + 3386, + 3389, + 3396, + 3398, + 3400, + 3402, + 3406, + 3415, + 3415, + 3424, + 3427, + 3430, + 3439, + 3450, + 3455, + 3458, + 3459, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3530, + 3530, + 3535, + 3540, + 3542, + 3542, + 3544, + 3551, + 3570, + 3571, + 3585, + 3642, + 3648, + 3662, + 3664, + 3673, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3769, + 3771, + 3773, + 3776, + 3780, + 3782, + 3782, + 3784, + 3789, + 3792, + 3801, + 3804, + 3807, + 3840, + 3840, + 3864, + 3865, + 3872, + 3881, + 3893, + 3893, + 3895, + 3895, + 3897, + 3897, + 3902, + 3911, + 3913, + 3948, + 3953, + 3972, + 3974, + 3991, + 3993, + 4028, + 4038, + 4038, + 4096, + 4169, + 4176, + 4253, + 4256, + 4293, + 4295, + 4295, + 4301, + 4301, + 4304, + 4346, + 4348, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4744, + 4746, + 4749, + 4752, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4822, + 4824, + 4880, + 4882, + 4885, + 4888, + 4954, + 4957, + 4959, + 4992, + 5007, + 5024, + 5108, + 5121, + 5740, + 5743, + 5759, + 5761, + 5786, + 5792, + 5866, + 5870, + 5872, + 5888, + 5900, + 5902, + 5908, + 5920, + 5940, + 5952, + 5971, + 5984, + 5996, + 5998, + 6000, + 6002, + 6003, + 6016, + 6099, + 6103, + 6103, + 6108, + 6109, + 6112, + 6121, + 6155, + 6157, + 6160, + 6169, + 6176, + 6263, + 6272, + 6314, + 6320, + 6389, + 6400, + 6428, + 6432, + 6443, + 6448, + 6459, + 6470, + 6509, + 6512, + 6516, + 6528, + 6571, + 6576, + 6601, + 6608, + 6617, + 6656, + 6683, + 6688, + 6750, + 6752, + 6780, + 6783, + 6793, + 6800, + 6809, + 6823, + 6823, + 6912, + 6987, + 6992, + 7001, + 7019, + 7027, + 7040, + 7155, + 7168, + 7223, + 7232, + 7241, + 7245, + 7293, + 7376, + 7378, + 7380, + 7414, + 7424, + 7654, + 7676, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8204, + 8205, + 8255, + 8256, + 8276, + 8276, + 8305, + 8305, + 8319, + 8319, + 8336, + 8348, + 8400, + 8412, + 8417, + 8417, + 8421, + 8432, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8505, + 8508, + 8511, + 8517, + 8521, + 8526, + 8526, + 8544, + 8584, + 11264, + 11310, + 11312, + 11358, + 11360, + 11492, + 11499, + 11507, + 11520, + 11557, + 11559, + 11559, + 11565, + 11565, + 11568, + 11623, + 11631, + 11631, + 11647, + 11670, + 11680, + 11686, + 11688, + 11694, + 11696, + 11702, + 11704, + 11710, + 11712, + 11718, + 11720, + 11726, + 11728, + 11734, + 11736, + 11742, + 11744, + 11775, + 11823, + 11823, + 12293, + 12295, + 12321, + 12335, + 12337, + 12341, + 12344, + 12348, + 12353, + 12438, + 12441, + 12442, + 12445, + 12447, + 12449, + 12538, + 12540, + 12543, + 12549, + 12589, + 12593, + 12686, + 12704, + 12730, + 12784, + 12799, + 13312, + 19893, + 19968, + 40908, + 40960, + 42124, + 42192, + 42237, + 42240, + 42508, + 42512, + 42539, + 42560, + 42607, + 42612, + 42621, + 42623, + 42647, + 42655, + 42737, + 42775, + 42783, + 42786, + 42888, + 42891, + 42894, + 42896, + 42899, + 42912, + 42922, + 43000, + 43047, + 43072, + 43123, + 43136, + 43204, + 43216, + 43225, + 43232, + 43255, + 43259, + 43259, + 43264, + 43309, + 43312, + 43347, + 43360, + 43388, + 43392, + 43456, + 43471, + 43481, + 43520, + 43574, + 43584, + 43597, + 43600, + 43609, + 43616, + 43638, + 43642, + 43643, + 43648, + 43714, + 43739, + 43741, + 43744, + 43759, + 43762, + 43766, + 43777, + 43782, + 43785, + 43790, + 43793, + 43798, + 43808, + 43814, + 43816, + 43822, + 43968, + 44010, + 44012, + 44013, + 44016, + 44025, + 44032, + 55203, + 55216, + 55238, + 55243, + 55291, + 63744, + 64109, + 64112, + 64217, + 64256, + 64262, + 64275, + 64279, + 64285, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65024, + 65039, + 65056, + 65062, + 65075, + 65076, + 65101, + 65103, + 65136, + 65140, + 65142, + 65276, + 65296, + 65305, + 65313, + 65338, + 65343, + 65343, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; function lookupInUnicodeMap(code, map) { if (code < map[0]) { return false; @@ -2075,15 +6836,11 @@ var ts; return false; } function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierStart) : - lookupInUnicodeMap(code, unicodeES3IdentifierStart); + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); } ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierPart) : - lookupInUnicodeMap(code, unicodeES3IdentifierPart); + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); } function makeReverseMap(source) { var result = []; @@ -2156,9 +6913,7 @@ var ts; ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { - return ch === 32 || ch === 9 || ch === 11 || ch === 12 || - ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || - ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { @@ -2245,8 +7000,7 @@ var ts; return false; } } - return ch === 61 || - text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + return ch === 61 || text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } return false; @@ -2326,7 +7080,11 @@ var ts; if (collecting) { if (!result) result = []; - result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); + result.push({ + pos: startPos, + end: pos, + hasTrailingNewLine: hasTrailingNewLine + }); } continue; } @@ -2353,15 +7111,11 @@ var ts; } ts.getTrailingCommentRanges = getTrailingCommentRanges; function isIdentifierStart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } ts.isIdentifierStart = isIdentifierStart; function isIdentifierPart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; function createScanner(languageVersion, skipTrivia, text, onError) { @@ -2380,14 +7134,10 @@ var ts; } } function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } function isIdentifierPart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } function scanNumber() { var start = pos; @@ -3110,17 +7860,39 @@ var ts; } setText(text); return { - getStartPos: function () { return startPos; }, - getTextPos: function () { return pos; }, - getToken: function () { return token; }, - getTokenPos: function () { return tokenPos; }, - getTokenText: function () { return text.substring(tokenPos, pos); }, - getTokenValue: function () { return tokenValue; }, - hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, - hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 64 || token > 100; }, - isReservedWord: function () { return token >= 65 && token <= 100; }, - isUnterminated: function () { return tokenIsUnterminated; }, + getStartPos: function () { + return startPos; + }, + getTextPos: function () { + return pos; + }, + getToken: function () { + return token; + }, + getTokenPos: function () { + return tokenPos; + }, + getTokenText: function () { + return text.substring(tokenPos, pos); + }, + getTokenValue: function () { + return tokenValue; + }, + hasExtendedUnicodeEscape: function () { + return hasExtendedUnicodeEscape; + }, + hasPrecedingLineBreak: function () { + return precedingLineBreak; + }, + isIdentifier: function () { + return token === 64 || token > 100; + }, + isReservedWord: function () { + return token >= 65 && token <= 100; + }, + isUnterminated: function () { + return tokenIsUnterminated; + }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, @@ -3150,9 +7922,13 @@ var ts; function getSingleLineStringWriter() { if (stringWriters.length == 0) { var str = ""; - var writeText = function (text) { return str += text; }; + var writeText = function (text) { + return str += text; + }; return { - string: function () { return str; }, + string: function () { + return str; + }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -3160,11 +7936,18 @@ var ts; writeStringLiteral: writeText, writeParameter: writeText, writeSymbol: writeText, - writeLine: function () { return str += " "; }, - increaseIndent: function () { }, - decreaseIndent: function () { }, - clear: function () { return str = ""; }, - trackSymbol: function () { } + writeLine: function () { + return str += " "; + }, + increaseIndent: function () { + }, + decreaseIndent: function () { + }, + clear: function () { + return str = ""; + }, + trackSymbol: function () { + } }; } return stringWriters.pop(); @@ -3186,8 +7969,7 @@ var ts; ts.containsParseError = containsParseError; function aggregateChildData(node) { if (!(node.parserContextFlags & 64)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || - ts.forEachChild(node, containsParseError); + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { node.parserContextFlags |= 32; } @@ -3195,7 +7977,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 220) { + while (node && node.kind !== 221) { node = node.parent; } return node; @@ -3266,15 +8048,35 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 12288) !== 0 || - isCatchClauseVariableDeclaration(declaration); + return (getCombinedNodeFlags(declaration) & 12288) !== 0 || isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; + function getEnclosingBlockScopeContainer(node) { + var current = node; + while (current) { + if (isFunctionLike(current)) { + return current; + } + switch (current.kind) { + case 221: + case 202: + case 217: + case 200: + case 181: + case 182: + case 183: + return current; + case 174: + if (!isFunctionLike(current.parent)) { + return current; + } + } + current = current.parent; + } + } + ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { - return declaration && - declaration.kind === 193 && - declaration.parent && - declaration.parent.kind === 216; + return declaration && declaration.kind === 193 && declaration.parent && declaration.parent.kind === 217; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3317,7 +8119,7 @@ var ts; case 197: case 200: case 199: - case 219: + case 220: case 195: case 160: errorNode = node.name; @@ -3326,9 +8128,7 @@ var ts; if (errorNode === undefined) { return getSpanOfTokenAtPosition(sourceFile, node.pos); } - var pos = nodeIsMissing(errorNode) - ? errorNode.pos - : ts.skipTrivia(sourceFile.text, errorNode.pos); + var pos = nodeIsMissing(errorNode) ? errorNode.pos : ts.skipTrivia(sourceFile.text, errorNode.pos); return createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; @@ -3391,9 +8191,7 @@ var ts; function getJsDocComments(node, sourceFileOfNode) { return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); function isJsDocComment(comment) { - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; + return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; } } ts.getJsDocComments = getJsDocComments; @@ -3404,6 +8202,7 @@ var ts; switch (node.kind) { case 186: return visitor(node); + case 202: case 174: case 178: case 179: @@ -3413,11 +8212,11 @@ var ts; case 183: case 187: case 188: - case 213: case 214: + case 215: case 189: case 191: - case 216: + case 217: return ts.forEachChild(node, traverse); } } @@ -3427,12 +8226,12 @@ var ts; if (node) { switch (node.kind) { case 150: - case 219: + case 220: case 128: - case 217: + case 218: case 130: case 129: - case 218: + case 219: case 193: return true; } @@ -3510,7 +8309,7 @@ var ts; case 134: case 135: case 199: - case 220: + case 221: return node; } } @@ -3601,8 +8400,8 @@ var ts; case 128: case 130: case 129: - case 219: - case 217: + case 220: + case 218: case 150: return parent.initializer === node; case 177: @@ -3612,20 +8411,17 @@ var ts; case 186: case 187: case 188: - case 213: + case 214: case 190: case 188: return parent.expression === node; case 181: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || - forStatement.condition === node || - forStatement.iterator === node; + return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || forStatement.condition === node || forStatement.iterator === node; case 182: case 183: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || - forInStatement.expression === node; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || forInStatement.expression === node; case 158: return node === parent.expression; case 173: @@ -3643,12 +8439,11 @@ var ts; ts.isExpression = isExpression; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 || - (preserveConstEnums && moduleState === 2); + return moduleState === 1 || (preserveConstEnums && moduleState === 2); } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 202 && node.moduleReference.kind === 212; + return node.kind === 203 && node.moduleReference.kind === 213; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -3657,20 +8452,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 202 && node.moduleReference.kind !== 212; + return node.kind === 203 && node.moduleReference.kind !== 213; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 203) { + if (node.kind === 204) { return node.moduleSpecifier; } - if (node.kind === 202) { + if (node.kind === 203) { var reference = node.moduleReference; - if (reference.kind === 212) { + if (reference.kind === 213) { return reference.expression; } } - if (node.kind === 209) { + if (node.kind === 210) { return node.moduleSpecifier; } } @@ -3687,8 +8482,8 @@ var ts; case 132: case 131: return node.questionToken !== undefined; + case 219: case 218: - case 217: case 130: case 129: return node.questionToken !== undefined; @@ -3734,25 +8529,25 @@ var ts; case 196: case 133: case 199: - case 219: - case 211: + case 220: + case 212: case 195: case 160: case 134: - case 204: - case 202: - case 207: + case 205: + case 203: + case 208: case 197: case 132: case 131: case 200: - case 205: + case 206: case 128: - case 217: + case 218: case 130: case 129: case 135: - case 218: + case 219: case 198: case 127: case 193: @@ -3781,7 +8576,7 @@ var ts; case 175: case 180: case 187: - case 208: + case 209: return true; default: return false; @@ -3793,7 +8588,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 207 || parent.kind === 211) { + if (parent.kind === 208 || parent.kind === 212) { if (parent.propertyName) { return true; } @@ -3891,9 +8686,7 @@ var ts; } ts.isTrivia = isTrivia; function hasDynamicName(declaration) { - return declaration.name && - declaration.name.kind === 126 && - !isWellKnownSymbolSyntactically(declaration.name.expression); + return declaration.name && declaration.name.kind === 126 && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { @@ -3997,7 +8790,10 @@ var ts; if (length < 0) { throw new Error("length < 0"); } - return { start: start, length: length }; + return { + start: start, + length: length + }; } ts.createTextSpan = createTextSpan; function createTextSpanFromBounds(start, end) { @@ -4016,7 +8812,10 @@ var ts; if (newLength < 0) { throw new Error("newLength < 0"); } - return { span: span, newLength: newLength }; + return { + span: span, + newLength: newLength + }; } ts.createTextChangeRange = createTextChangeRange; ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); @@ -4047,11 +8846,11 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 200 || n.kind === 220; + return isFunctionLike(n) || n.kind === 200 || n.kind === 221; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { - return node.pos === -1 && node.end === -1; + return node.pos === -1; } ts.nodeIsSynthesized = nodeIsSynthesized; function createSynthesizedNode(kind, startsOnNewLine) { @@ -4177,15 +8976,15 @@ var ts; } var nonAsciiCharacters = /[^\u0000-\u007F]/g; function escapeNonAsciiCharacters(s) { - return nonAsciiCharacters.test(s) ? - s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) : - s; + return nonAsciiCharacters.test(s) ? s.replace(nonAsciiCharacters, function (c) { + return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + }) : s; } ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters; })(ts || (ts = {})); var ts; (function (ts) { - var nodeConstructors = new Array(222); + var nodeConstructors = new Array(223); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -4223,35 +9022,23 @@ var ts; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { case 125: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); case 127: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); case 128: case 130: case 129: - case 217: case 218: + case 219: case 193: case 150: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 140: case 141: case 136: case 137: case 138: - return visitNodes(cbNodes, node.modifiers) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); case 132: case 131: case 133: @@ -4260,17 +9047,9 @@ var ts; case 160: case 195: case 161: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); case 139: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNodes, node.typeArguments); + return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); case 142: return visitNode(cbNode, node.exprName); case 143: @@ -4291,23 +9070,16 @@ var ts; case 152: return visitNodes(cbNodes, node.properties); case 153: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.dotToken) || - visitNode(cbNode, node.name); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); case 154: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.argumentExpression); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); case 155: case 156: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.typeArguments) || - visitNodes(cbNodes, node.arguments); + return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); case 157: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.template); + return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); case 158: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); case 159: return visitNode(cbNode, node.expression); case 162: @@ -4319,149 +9091,100 @@ var ts; case 165: return visitNode(cbNode, node.operand); case 170: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); case 166: return visitNode(cbNode, node.operand); case 167: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); case 168: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); + return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); case 171: return visitNode(cbNode, node.expression); case 174: case 201: return visitNodes(cbNodes, node.statements); - case 220: - return visitNodes(cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); + case 221: + return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 175: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); case 194: return visitNodes(cbNodes, node.declarations); case 177: return visitNode(cbNode, node.expression); case 178: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); case 179: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); case 180: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 181: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.iterator) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); case 182: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 183: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 184: case 185: return visitNode(cbNode, node.label); case 186: return visitNode(cbNode, node.expression); case 187: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 188: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.clauses); - case 213: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.statements); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); + case 202: + return visitNodes(cbNodes, node.clauses); case 214: + return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); + case 215: return visitNodes(cbNodes, node.statements); case 189: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); case 190: return visitNode(cbNode, node.expression); case 191: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 216: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); + return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); + case 217: + return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 196: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); case 197: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); case 198: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); case 199: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.members); - case 219: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); + case 220: + return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 200: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 202: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); case 203: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); case 204: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); case 205: - return visitNode(cbNode, node.name); + return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); case 206: - case 210: - return visitNodes(cbNodes, node.elements); - case 209: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier); + return visitNode(cbNode, node.name); case 207: case 211: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); + return visitNodes(cbNodes, node.elements); + case 210: + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); case 208: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); + case 212: + return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); + case 209: + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 169: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); case 173: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 126: return visitNode(cbNode, node.expression); - case 215: + case 216: return visitNodes(cbNodes, node.types); - case 212: + case 213: return visitNode(cbNode, node.expression); } } @@ -4499,40 +9222,69 @@ var ts; })(Tristate || (Tristate = {})); function parsingContextErrors(context) { switch (context) { - case 0: return ts.Diagnostics.Declaration_or_statement_expected; - case 1: return ts.Diagnostics.Declaration_or_statement_expected; - case 2: return ts.Diagnostics.Statement_expected; - case 3: return ts.Diagnostics.case_or_default_expected; - case 4: return ts.Diagnostics.Statement_expected; - case 5: return ts.Diagnostics.Property_or_signature_expected; - case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; - case 7: return ts.Diagnostics.Enum_member_expected; - case 8: return ts.Diagnostics.Type_reference_expected; - case 9: return ts.Diagnostics.Variable_declaration_expected; - case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; - case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; - case 12: return ts.Diagnostics.Argument_expression_expected; - case 13: return ts.Diagnostics.Property_assignment_expected; - case 14: return ts.Diagnostics.Expression_or_comma_expected; - case 15: return ts.Diagnostics.Parameter_declaration_expected; - case 16: return ts.Diagnostics.Type_parameter_declaration_expected; - case 17: return ts.Diagnostics.Type_argument_expected; - case 18: return ts.Diagnostics.Type_expected; - case 19: return ts.Diagnostics.Unexpected_token_expected; - case 20: return ts.Diagnostics.Identifier_expected; + case 0: + return ts.Diagnostics.Declaration_or_statement_expected; + case 1: + return ts.Diagnostics.Declaration_or_statement_expected; + case 2: + return ts.Diagnostics.Statement_expected; + case 3: + return ts.Diagnostics.case_or_default_expected; + case 4: + return ts.Diagnostics.Statement_expected; + case 5: + return ts.Diagnostics.Property_or_signature_expected; + case 6: + return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7: + return ts.Diagnostics.Enum_member_expected; + case 8: + return ts.Diagnostics.Type_reference_expected; + case 9: + return ts.Diagnostics.Variable_declaration_expected; + case 10: + return ts.Diagnostics.Property_destructuring_pattern_expected; + case 11: + return ts.Diagnostics.Array_element_destructuring_pattern_expected; + case 12: + return ts.Diagnostics.Argument_expression_expected; + case 13: + return ts.Diagnostics.Property_assignment_expected; + case 14: + return ts.Diagnostics.Expression_or_comma_expected; + case 15: + return ts.Diagnostics.Parameter_declaration_expected; + case 16: + return ts.Diagnostics.Type_parameter_declaration_expected; + case 17: + return ts.Diagnostics.Type_argument_expected; + case 18: + return ts.Diagnostics.Type_expected; + case 19: + return ts.Diagnostics.Unexpected_token_expected; + case 20: + return ts.Diagnostics.Identifier_expected; } } ; function modifierToFlag(token) { switch (token) { - case 109: return 128; - case 108: return 16; - case 107: return 64; - case 106: return 32; - case 77: return 1; - case 114: return 2; - case 69: return 8192; - case 72: return 256; + case 109: + return 128; + case 108: + return 16; + case 107: + return 64; + case 106: + return 32; + case 77: + return 1; + case 114: + return 2; + case 69: + return 8192; + case 72: + return 256; } return 0; } @@ -4763,8 +9515,7 @@ var ts; } ts.updateSourceFile = updateSourceFile; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 64 && - (node.text === "eval" || node.text === "arguments"); + return node.kind === 64 && (node.text === "eval" || node.text === "arguments"); } ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; function isUseStrictPrologueDirective(sourceFile, node) { @@ -4850,7 +9601,7 @@ var ts; var identifierCount = 0; var nodeCount = 0; var token; - var sourceFile = createNode(220, 0); + var sourceFile = createNode(221, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -4986,9 +9737,7 @@ var ts; var saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; var saveContextFlags = contextFlags; - var result = isLookAhead - ? scanner.lookAhead(callback) - : scanner.tryScan(callback); + var result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); ts.Debug.assert(saveContextFlags === contextFlags); if (!result || isLookAhead) { token = saveToken; @@ -5039,8 +9788,7 @@ var ts; return undefined; } function parseExpectedToken(t, reportAtCurrentPosition, diagnosticMessage, arg0) { - return parseOptionalToken(t) || - createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); + return parseOptionalToken(t) || createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); } function parseTokenNode() { var node = createNode(token); @@ -5117,9 +9865,7 @@ var ts; return createIdentifier(isIdentifierOrKeyword()); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || - token === 8 || - token === 7; + return isIdentifierOrKeyword() || token === 8 || token === 7; } function parsePropertyName() { if (token === 8 || token === 7) { @@ -5172,10 +9918,7 @@ var ts; return canFollowModifier(); } function canFollowModifier() { - return token === 18 - || token === 14 - || token === 35 - || isLiteralPropertyName(); + return token === 18 || token === 14 || token === 35 || isLiteralPropertyName(); } function nextTokenIsClassOrFunction() { nextToken(); @@ -5233,8 +9976,7 @@ var ts; return isIdentifier(); } function isNotHeritageClauseTypeName() { - if (token === 102 || - token === 78) { + if (token === 102 || token === 78) { return lookAhead(nextTokenIsIdentifier); } return false; @@ -5400,10 +10142,10 @@ var ts; function isReusableModuleElement(node) { if (node) { switch (node.kind) { + case 204: case 203: - case 202: + case 210: case 209: - case 208: case 196: case 197: case 200: @@ -5431,8 +10173,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 213: case 214: + case 215: return true; } } @@ -5467,7 +10209,7 @@ var ts; return false; } function isReusableEnumMember(node) { - return node.kind === 219; + return node.kind === 220; } function isReusableTypeMember(node) { if (node) { @@ -5615,9 +10357,7 @@ var ts; var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - if (node.kind === 7 - && sourceText.charCodeAt(tokenPos) === 48 - && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + if (node.kind === 7 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { node.flags |= 16384; } return node; @@ -5656,9 +10396,7 @@ var ts; } function parseParameterType() { if (parseOptional(51)) { - return token === 8 - ? parseLiteralNode(true) - : parseType(); + return token === 8 ? parseLiteralNode(true) : parseType(); } return undefined; } @@ -5816,11 +10554,7 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 || - token === 24 || - token === 50 || - token === 51 || - canParseSemicolon(); + return token === 16 || token === 24 || token === 50 || token === 51 || canParseSemicolon(); } function parseTypeMember() { switch (token) { @@ -5828,9 +10562,7 @@ var ts; case 24: return parseSignatureMember(136); case 18: - return isIndexSignature() - ? parseIndexSignatureDeclaration(undefined) - : parsePropertyOrMethodSignature(); + return isIndexSignature() ? parseIndexSignatureDeclaration(undefined) : parsePropertyOrMethodSignature(); case 87: if (lookAhead(isStartOfConstructSignature)) { return parseSignatureMember(137); @@ -5852,9 +10584,7 @@ var ts; } function parseIndexSignatureWithModifiers() { var modifiers = parseModifiers(); - return isIndexSignature() - ? parseIndexSignatureDeclaration(modifiers) - : undefined; + return isIndexSignature() ? parseIndexSignatureDeclaration(modifiers) : undefined; } function isStartOfConstructSignature() { nextToken(); @@ -5960,7 +10690,9 @@ var ts; function parseUnionTypeOrHigher() { var type = parseArrayTypeOrHigher(); if (token === 44) { - var types = [type]; + var types = [ + type + ]; types.pos = type.pos; while (parseOptional(44)) { types.push(parseArrayTypeOrHigher()); @@ -5985,9 +10717,7 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 51 || token === 23 || - token === 50 || token === 52 || - isIdentifier() || ts.isModifier(token)) { + if (token === 51 || token === 23 || token === 50 || token === 52 || isIdentifier() || ts.isModifier(token)) { return true; } if (token === 17) { @@ -6115,8 +10845,7 @@ var ts; function parseYieldExpression() { var node = createNode(170); nextToken(); - if (!scanner.hasPrecedingLineBreak() && - (token === 35 || isStartOfExpression())) { + if (!scanner.hasPrecedingLineBreak() && (token === 35 || isStartOfExpression())) { node.asteriskToken = parseOptionalToken(35); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); @@ -6131,7 +10860,9 @@ var ts; var parameter = createNode(128, identifier.pos); parameter.name = identifier; finishNode(parameter); - node.parameters = [parameter]; + node.parameters = [ + parameter + ]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; parseExpected(32); @@ -6143,9 +10874,7 @@ var ts; if (triState === 0) { return undefined; } - var arrowFunction = triState === 1 - ? parseParenthesizedArrowFunctionExpressionHead(true) - : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + var arrowFunction = triState === 1 ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); if (!arrowFunction) { return undefined; } @@ -6367,9 +11096,7 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 90 - ? parseSuperExpression() - : parseMemberExpressionOrHigher(); + var expression = token === 90 ? parseSuperExpression() : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); } function parseMemberExpressionOrHigher() { @@ -6423,9 +11150,7 @@ var ts; if (token === 10 || token === 11) { var tagExpression = createNode(157, expression.pos); tagExpression.tag = expression; - tagExpression.template = token === 10 - ? parseLiteralNode() - : parseTemplateExpression(); + tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); expression = finishNode(tagExpression); continue; } @@ -6471,9 +11196,7 @@ var ts; if (!parseExpected(25)) { return undefined; } - return typeArguments && canFollowTypeArgumentsInExpression() - ? typeArguments - : undefined; + return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; } function canFollowTypeArgumentsInExpression() { switch (token) { @@ -6548,9 +11271,7 @@ var ts; return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(172) : - parseAssignmentExpressionOrHigher(); + return token === 21 ? parseSpreadElement() : token === 23 ? createNode(172) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return allowInAnd(parseArgumentOrArrayLiteralElement); @@ -6589,13 +11310,13 @@ var ts; return parseMethodDeclaration(fullStart, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(218, fullStart); + var shorthandDeclaration = createNode(219, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(217, fullStart); + var propertyAssignment = createNode(218, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -6761,7 +11482,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(213); + var node = createNode(214); parseExpected(66); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -6769,7 +11490,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(214); + var node = createNode(215); parseExpected(72); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -6784,9 +11505,11 @@ var ts; parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); + var caseBlock = createNode(202, scanner.getStartPos()); parseExpected(14); - node.clauses = parseList(3, false, parseCaseOrDefaultClause); + caseBlock.clauses = parseList(3, false, parseCaseOrDefaultClause); parseExpected(15); + node.caseBlock = finishNode(caseBlock); return finishNode(node); } function parseThrowStatement() { @@ -6808,7 +11531,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(216); + var result = createNode(217); parseExpected(67); if (parseExpected(16)) { result.variableDeclaration = parseVariableDeclaration(); @@ -7198,11 +11921,7 @@ var ts; if (isIndexSignature()) { return parseIndexSignatureDeclaration(modifiers); } - if (isIdentifierOrKeyword() || - token === 8 || - token === 7 || - token === 35 || - token === 18) { + if (isIdentifierOrKeyword() || token === 8 || token === 7 || token === 35 || token === 18) { return parsePropertyOrMethodDeclaration(fullStart, modifiers); } ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -7215,9 +11934,7 @@ var ts; node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); if (parseExpected(14)) { - node.members = inGeneratorParameterContext() - ? doOutsideOfYieldContext(parseClassMembers) - : parseClassMembers(); + node.members = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); parseExpected(15); } else { @@ -7227,9 +11944,7 @@ var ts; } function parseHeritageClauses(isClassHeritageClause) { if (isHeritageClause()) { - return isClassHeritageClause && inGeneratorParameterContext() - ? doOutsideOfYieldContext(parseHeritageClausesWorker) - : parseHeritageClausesWorker(); + return isClassHeritageClause && inGeneratorParameterContext() ? doOutsideOfYieldContext(parseHeritageClausesWorker) : parseHeritageClausesWorker(); } return undefined; } @@ -7238,7 +11953,7 @@ var ts; } function parseHeritageClause() { if (token === 78 || token === 102) { - var node = createNode(215); + var node = createNode(216); node.token = token; nextToken(); node.types = parseDelimitedList(8, parseTypeReference); @@ -7273,7 +11988,7 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(219, scanner.getStartPos()); + var node = createNode(220, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); @@ -7308,9 +12023,7 @@ var ts; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(20) - ? parseInternalModuleTail(getNodePos(), undefined, 1) - : parseModuleBlock(); + node.body = parseOptional(20) ? parseInternalModuleTail(getNodePos(), undefined, 1) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { @@ -7322,21 +12035,17 @@ var ts; } function parseModuleDeclaration(fullStart, modifiers) { parseExpected(116); - return token === 8 - ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) - : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); + return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); } function isExternalModuleReference() { - return token === 117 && - lookAhead(nextTokenIsOpenParen); + return token === 117 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 16; } function nextTokenIsCommaOrFromKeyword() { nextToken(); - return token === 23 || - token === 123; + return token === 23 || token === 123; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, modifiers) { parseExpected(84); @@ -7345,7 +12054,7 @@ var ts; if (isIdentifier()) { identifier = parseIdentifier(); if (token !== 23 && token !== 123) { - var importEqualsDeclaration = createNode(202, fullStart); + var importEqualsDeclaration = createNode(203, fullStart); setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; parseExpected(52); @@ -7354,11 +12063,9 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(203, fullStart); + var importDeclaration = createNode(204, fullStart); setModifiers(importDeclaration, modifiers); - if (identifier || - token === 35 || - token === 14) { + if (identifier || token === 35 || token === 14) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); parseExpected(123); } @@ -7367,23 +12074,20 @@ var ts; return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(204, fullStart); + var importClause = createNode(205, fullStart); if (identifier) { importClause.name = identifier; } - if (!importClause.name || - parseOptional(23)) { - importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(206); + if (!importClause.name || parseOptional(23)) { + importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(207); } return finishNode(importClause); } function parseModuleReference() { - return isExternalModuleReference() - ? parseExternalModuleReference() - : parseEntityName(false); + return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(212); + var node = createNode(213); parseExpected(117); parseExpected(16); node.expression = parseModuleSpecifier(); @@ -7398,7 +12102,7 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(205); + var namespaceImport = createNode(206); parseExpected(35); parseExpected(101); namespaceImport.name = parseIdentifier(); @@ -7406,14 +12110,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(20, kind === 206 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(20, kind === 207 ? parseImportSpecifier : parseExportSpecifier, 14, 15); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(211); + return parseImportOrExportSpecifier(212); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(207); + return parseImportOrExportSpecifier(208); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -7439,14 +12143,14 @@ var ts; return finishNode(node); } function parseExportDeclaration(fullStart, modifiers) { - var node = createNode(209, fullStart); + var node = createNode(210, fullStart); setModifiers(node, modifiers); if (parseOptional(35)) { parseExpected(123); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(210); + node.exportClause = parseNamedImportsOrExports(211); if (parseOptional(123)) { node.moduleSpecifier = parseModuleSpecifier(); } @@ -7455,7 +12159,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, modifiers) { - var node = createNode(208, fullStart); + var node = createNode(209, fullStart); setModifiers(node, modifiers); if (parseOptional(52)) { node.isExportEquals = true; @@ -7510,13 +12214,11 @@ var ts; } function nextTokenCanFollowImportKeyword() { nextToken(); - return isIdentifierOrKeyword() || token === 8 || - token === 35 || token === 14; + return isIdentifierOrKeyword() || token === 8 || token === 35 || token === 14; } function nextTokenCanFollowExportKeyword() { nextToken(); - return token === 52 || token === 35 || - token === 14 || token === 72 || isDeclarationStart(); + return token === 52 || token === 35 || token === 14 || token === 72 || isDeclarationStart(); } function nextTokenIsDeclarationStart() { nextToken(); @@ -7570,9 +12272,7 @@ var ts; return parseSourceElementOrModuleElement(); } function parseSourceElementOrModuleElement() { - return isDeclarationStart() - ? parseDeclaration() - : parseStatement(); + return isDeclarationStart() ? parseDeclaration() : parseStatement(); } function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, sourceText); @@ -7587,7 +12287,10 @@ var ts; if (kind !== 2) { break; } - var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; + var range = { + pos: triviaScanner.getTokenPos(), + end: triviaScanner.getTextPos() + }; var comment = sourceText.substring(range.pos, range.end); var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { @@ -7618,7 +12321,10 @@ var ts; var pathMatchResult = pathRegex.exec(comment); var nameMatchResult = nameRegex.exec(comment); if (pathMatchResult) { - var amdDependency = { path: pathMatchResult[2], name: nameMatchResult ? nameMatchResult[2] : undefined }; + var amdDependency = { + path: pathMatchResult[2], + name: nameMatchResult ? nameMatchResult[2] : undefined + }; amdDependencies.push(amdDependency); } } @@ -7630,13 +12336,7 @@ var ts; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 1 - || node.kind === 202 && node.moduleReference.kind === 212 - || node.kind === 203 - || node.kind === 208 - || node.kind === 209 - ? node - : undefined; + return node.flags & 1 || node.kind === 203 && node.moduleReference.kind === 213 || node.kind === 204 || node.kind === 209 || node.kind === 210 ? node : undefined; }); } } @@ -7690,7 +12390,7 @@ var ts; else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 203 || node.kind === 202) && !(node.flags & 1)) { + else if ((node.kind === 204 || node.kind === 203) && !(node.flags & 1)) { return 0; } else if (node.kind === 201) { @@ -7783,9 +12483,9 @@ var ts; return "__new"; case 138: return "__index"; - case 209: + case 210: return "__export"; - case 208: + case 209: return "default"; case 195: case 196: @@ -7804,9 +12504,7 @@ var ts; if (node.name) { node.name.parent = node; } - var message = symbol.flags & 2 - ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 - : ts.Diagnostics.Duplicate_identifier_0; + var message = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); @@ -7843,7 +12541,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolKind & 8388608) { - if (node.kind === 211 || (node.kind === 202 && hasExportModifier)) { + if (node.kind === 212 || (node.kind === 203 && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -7852,9 +12550,7 @@ var ts; } else { if (hasExportModifier || isAmbientContext(container)) { - var exportKind = (symbolKind & 107455 ? 1048576 : 0) | - (symbolKind & 793056 ? 2097152 : 0) | - (symbolKind & 1536 ? 4194304 : 0); + var exportKind = (symbolKind & 107455 ? 1048576 : 0) | (symbolKind & 793056 ? 2097152 : 0) | (symbolKind & 1536 ? 4194304 : 0); var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); node.localSymbol = local; @@ -7880,7 +12576,7 @@ var ts; lastContainer = container; } if (isBlockScopeContainer) { - setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 220); + setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 221); } ts.forEachChild(node, bind); container = saveContainer; @@ -7892,7 +12588,7 @@ var ts; case 200: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 220: + case 221: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -7970,7 +12666,7 @@ var ts; case 200: declareModuleMember(node, 2, 107455); break; - case 220: + case 221: if (ts.isExternalModule(container)) { declareModuleMember(node, 2, 107455); break; @@ -8011,11 +12707,11 @@ var ts; case 129: bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 217: case 218: + case 219: bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 219: + case 220: bindPropertyOrMethodOrAccessor(node, 8, 107455, false); break; case 136: @@ -8053,7 +12749,7 @@ var ts; case 161: bindAnonymousDeclaration(node, 16, "__function", true); break; - case 216: + case 217: bindCatchVariableDeclaration(node); break; case 196: @@ -8076,13 +12772,13 @@ var ts; case 200: bindModuleDeclaration(node); break; - case 202: - case 205: - case 207: - case 211: + case 203: + case 206: + case 208: + case 212: bindDeclaration(node, 8388608, 8388608, false); break; - case 204: + case 205: if (node.name) { bindDeclaration(node, 8388608, 8388608, false); } @@ -8090,13 +12786,13 @@ var ts; bindChildren(node, 0, false); } break; - case 209: + case 210: if (!node.exportClause) { declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); } bindChildren(node, 0, false); break; - case 208: + case 209: if (node.expression.kind === 64) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 8388608); } @@ -8105,7 +12801,7 @@ var ts; } bindChildren(node, 0, false); break; - case 220: + case 221: if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; @@ -8113,11 +12809,11 @@ var ts; case 174: bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 216: + case 217: case 181: case 182: case 183: - case 188: + case 202: bindChildren(node, 0, true); break; default: @@ -8134,9 +12830,7 @@ var ts; else { bindDeclaration(node, 1, 107455, false); } - if (node.flags & 112 && - node.parent.kind === 133 && - node.parent.parent.kind === 196) { + if (node.flags & 112 && node.parent.kind === 133 && node.parent.parent.kind === 196) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -8168,12 +12862,24 @@ var ts; var languageVersion = compilerOptions.target || 0; var emitResolver = createResolver(); var checker = { - getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, - getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, - getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, - getTypeCount: function () { return typeCount; }, - isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, - isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + getNodeCount: function () { + return ts.sum(host.getSourceFiles(), "nodeCount"); + }, + getIdentifierCount: function () { + return ts.sum(host.getSourceFiles(), "identifierCount"); + }, + getSymbolCount: function () { + return ts.sum(host.getSourceFiles(), "symbolCount"); + }, + getTypeCount: function () { + return typeCount; + }, + isUndefinedSymbol: function (symbol) { + return symbol === undefinedSymbol; + }, + isArgumentsSymbol: function (symbol) { + return symbol === argumentsSymbol; + }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, @@ -8269,9 +12975,7 @@ var ts; return emitResolver; } function error(location, message, arg0, arg1, arg2) { - var diagnostic = location - ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) - : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); + var diagnostic = location ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); diagnostics.add(diagnostic); } function createSymbol(flags, name) { @@ -8357,8 +13061,7 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 || source.flags & 2 - ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { error(node.name ? node.name : node, message, symbolToString(source)); }); @@ -8405,10 +13108,10 @@ var ts; return nodeLinks[node.id] || (nodeLinks[node.id] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 220); + return ts.getAncestor(node, 221); } function isGlobalSourceFile(node) { - return node.kind === 220 && !ts.isExternalModule(node); + return node.kind === 221 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -8449,12 +13152,12 @@ var ts; } } switch (location.kind) { - case 220: + case 221: if (!ts.isExternalModule(location)) break; case 200: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { - if (!(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 211)) { + if (!(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 212)) { break loop; } result = undefined; @@ -8538,28 +13241,54 @@ var ts; return undefined; } if (result.flags & 2) { - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); - ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - if (!isDefinedBefore(declaration, errorLocation)) { - error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); - } + checkResolvedBlockScopedVariable(result, errorLocation); } } return result; } + function checkResolvedBlockScopedVariable(result, errorLocation) { + ts.Debug.assert((result.flags & 2) !== 0); + var declaration = ts.forEach(result.declarations, function (d) { + return ts.isBlockOrCatchScoped(d) ? d : undefined; + }); + ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); + var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); + if (!isUsedBeforeDeclaration) { + var variableDeclaration = ts.getAncestor(declaration, 193); + var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); + if (variableDeclaration.parent.parent.kind === 175 || variableDeclaration.parent.parent.kind === 181) { + isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); + } + else if (variableDeclaration.parent.parent.kind === 183 || variableDeclaration.parent.parent.kind === 182) { + var expression = variableDeclaration.parent.parent.expression; + isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); + } + } + if (isUsedBeforeDeclaration) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + } + function isSameScopeDescendentOf(initial, parent, stopAt) { + if (!parent) { + return false; + } + for (var current = initial; current && current !== stopAt && !ts.isFunctionLike(current); current = current.parent) { + if (current === parent) { + return true; + } + } + return false; + } function isAliasSymbolDeclaration(node) { - return node.kind === 202 || - node.kind === 204 && !!node.name || - node.kind === 205 || - node.kind === 207 || - node.kind === 211 || - node.kind === 208; + return node.kind === 203 || node.kind === 205 && !!node.name || node.kind === 206 || node.kind === 208 || node.kind === 212 || node.kind === 209; } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.forEach(symbol.declarations, function (d) { + return isAliasSymbolDeclaration(d) ? d : undefined; + }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 212) { + if (node.moduleReference.kind === 213) { var moduleSymbol = resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)); var exportAssignmentSymbol = moduleSymbol && getResolvedExportAssignmentSymbol(moduleSymbol); return exportAssignmentSymbol || moduleSymbol; @@ -8597,26 +13326,24 @@ var ts; return getExternalModuleMember(node.parent.parent.parent, node); } function getTargetOfExportSpecifier(node) { - return node.parent.parent.moduleSpecifier ? - getExternalModuleMember(node.parent.parent, node) : - resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); + return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); } function getTargetOfExportAssignment(node) { return resolveEntityName(node.expression, 107455 | 793056 | 1536); } function getTargetOfImportDeclaration(node) { switch (node.kind) { - case 202: + case 203: return getTargetOfImportEqualsDeclaration(node); - case 204: - return getTargetOfImportClause(node); case 205: + return getTargetOfImportClause(node); + case 206: return getTargetOfNamespaceImport(node); - case 207: - return getTargetOfImportSpecifier(node); - case 211: - return getTargetOfExportSpecifier(node); case 208: + return getTargetOfImportSpecifier(node); + case 212: + return getTargetOfExportSpecifier(node); + case 209: return getTargetOfExportAssignment(node); } } @@ -8651,10 +13378,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 208) { + if (node.kind === 209) { checkExpressionCached(node.expression); } - else if (node.kind === 211) { + else if (node.kind === 212) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -8664,7 +13391,7 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 202); + importDeclaration = ts.getAncestor(entityName, 203); ts.Debug.assert(importDeclaration !== undefined); } if (entityName.kind === 64 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { @@ -8674,7 +13401,7 @@ var ts; return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 202); + ts.Debug.assert(entityName.parent.kind === 203); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -8814,9 +13541,7 @@ var ts; return getMergedSymbol(symbol.parent); } function getExportSymbolOfValueSymbolIfExported(symbol) { - return symbol && (symbol.flags & 1048576) !== 0 - ? getMergedSymbol(symbol.exportSymbol) - : symbol; + return symbol && (symbol.flags & 1048576) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; } function symbolIsValue(symbol) { if (symbol.flags & 16777216) { @@ -8855,10 +13580,7 @@ var ts; return type; } function isReservedMemberName(name) { - return name.charCodeAt(0) === 95 && - name.charCodeAt(1) === 95 && - name.charCodeAt(2) !== 95 && - name.charCodeAt(2) !== 64; + return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && name.charCodeAt(2) !== 95 && name.charCodeAt(2) !== 64; } function getNamedMembers(members) { var result; @@ -8899,7 +13621,7 @@ var ts; } } switch (location.kind) { - case 220: + case 221: if (!ts.isExternalModule(location)) { break; } @@ -8932,24 +13654,28 @@ var ts; } function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { - return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && - canQualifySymbol(symbolFromSymbolTable, meaning); + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); } } if (isAccessible(ts.lookUp(symbols, symbol.name))) { - return [symbol]; + return [ + symbol + ]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608) { - if (!useOnlyExternalAliasing || - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; + return [ + symbolFromSymbolTable + ]; } var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + return [ + symbolFromSymbolTable + ].concat(accessibleSymbolsFromExports); } } } @@ -9014,7 +13740,9 @@ var ts; errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) }; } - return { accessibility: 0 }; + return { + accessibility: 0 + }; function getExternalModuleContainer(declaration) { for (; declaration; declaration = declaration.parent) { if (hasExternalModuleSymbol(declaration)) { @@ -9024,20 +13752,22 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 200 && declaration.name.kind === 8) || - (declaration.kind === 220 && ts.isExternalModule(declaration)); + return (declaration.kind === 200 && declaration.name.kind === 8) || (declaration.kind === 221 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; - if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { + if (ts.forEach(symbol.declarations, function (declaration) { + return !getIsDeclarationVisible(declaration); + })) { return undefined; } - return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; + return { + accessibility: 0, + aliasesToMakeVisible: aliasesToMakeVisible + }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 202 && - !(declaration.flags & 1) && - isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 203 && !(declaration.flags & 1) && isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -9045,7 +13775,9 @@ var ts; } } else { - aliasesToMakeVisible = [declaration]; + aliasesToMakeVisible = [ + declaration + ]; } return true; } @@ -9059,8 +13791,7 @@ var ts; if (entityName.parent.kind === 142) { meaning = 107455 | 1048576; } - else if (entityName.kind === 125 || - entityName.parent.kind === 202) { + else if (entityName.kind === 125 || entityName.parent.kind === 203) { meaning = 1536; } else { @@ -9146,8 +13877,7 @@ var ts; function walkSymbol(symbol, meaning) { if (symbol) { var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); - if (!accessibleSymbolChain || - needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { @@ -9179,8 +13909,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { if (type.flags & 1048703) { - writer.writeKeyword(!(globalFlags & 16) && - (type.flags & 1) ? "any" : type.intrinsicName); + writer.writeKeyword(!(globalFlags & 16) && (type.flags & 1) ? "any" : type.intrinsicName); } else if (type.flags & 4096) { writeTypeReference(type, flags); @@ -9273,16 +14002,14 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && - ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && - (type.symbol.parent || - ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 220 || declaration.parent.kind === 201; - })); + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.flags & 128; + })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.parent.kind === 221 || declaration.parent.kind === 201; + })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { - return !!(flags & 2) || - (typeStack && ts.contains(typeStack, type)); + return !!(flags & 2) || (typeStack && ts.contains(typeStack, type)); } } } @@ -9512,7 +14239,7 @@ var ts; return node; } } - else if (node.kind === 220) { + else if (node.kind === 221) { return ts.isExternalModule(node) ? node : undefined; } } @@ -9562,10 +14289,9 @@ var ts; case 198: case 195: case 199: - case 202: + case 203: var parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 202 && parent.kind !== 220 && ts.isInAmbientContext(parent))) { + if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 203 && parent.kind !== 221 && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(parent); @@ -9594,7 +14320,7 @@ var ts; case 147: return isDeclarationVisible(node.parent); case 127: - case 220: + case 221: return true; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -9620,7 +14346,9 @@ var ts; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); - return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; + return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { + return anyType; + })) : classType; } function getTypeOfPropertyOfType(type, name) { var prop = getPropertyOfType(type, name); @@ -9640,9 +14368,7 @@ var ts; } if (pattern.kind === 148) { var name = declaration.propertyName || declaration.name; - var type = getTypeOfPropertyOfType(parentType, name.text) || - isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || - getIndexTypeOfType(parentType, 0); + var type = getTypeOfPropertyOfType(parentType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; @@ -9657,7 +14383,12 @@ var ts; var propName = "" + ts.indexOf(pattern.elements, declaration); var type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1); if (!type) { - error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName); + if (isTupleType(parentType)) { + error(declaration, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), parentType.elementTypes.length, pattern.elements.length); + } + else { + error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName); + } return unknownType; } } @@ -9672,7 +14403,7 @@ var ts; return anyType; } if (declaration.parent.parent.kind === 183) { - return getTypeForVariableDeclarationInForOfStatement(declaration.parent.parent); + return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); @@ -9696,7 +14427,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 218) { + if (declaration.kind === 219) { return checkIdentifier(declaration.name); } return undefined; @@ -9733,9 +14464,7 @@ var ts; return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 148 - ? getTypeFromObjectBindingPattern(pattern) - : getTypeFromArrayBindingPattern(pattern); + return pattern.kind === 148 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -9743,7 +14472,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 217 ? getWidenedType(type) : type; + return declaration.kind !== 218 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -9764,10 +14493,10 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 216) { + if (declaration.parent.kind === 217) { return links.type = anyType; } - if (declaration.kind === 208) { + if (declaration.kind === 209) { return links.type = checkExpression(declaration.expression); } links.type = resolvingType; @@ -9779,9 +14508,7 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); } } @@ -9915,7 +14642,9 @@ var ts; ts.forEach(declaration.typeParameters, function (node) { var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); if (!result) { - result = [tp]; + result = [ + tp + ]; } else if (!ts.contains(result, tp)) { result.push(tp); @@ -10161,14 +14890,15 @@ var ts; var baseType = classType.baseTypes[0]; var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1); return ts.map(baseSignatures, function (baseSignature) { - var signature = baseType.flags & 4096 ? - getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); + var signature = baseType.flags & 4096 ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); signature.typeParameters = classType.typeParameters; signature.resolvedReturnType = classType; return signature; }); } - return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; + return [ + createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false) + ]; } function createTupleTypeMemberSymbols(memberTypes) { var members = {}; @@ -10197,7 +14927,9 @@ var ts; return true; } function getUnionSignatures(types, kind) { - var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); + var signatureLists = ts.map(types, function (t) { + return getSignaturesOfType(t, kind); + }); var signatures = signatureLists[0]; for (var i = 0; i < signatures.length; i++) { if (signatures[i].typeParameters) { @@ -10213,7 +14945,9 @@ var ts; for (var i = 0; i < result.length; i++) { var s = result[i]; s.resolvedReturnType = undefined; - s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); + s.unionSignatures = ts.map(signatureLists, function (signatures) { + return signatures[i]; + }); } return result; } @@ -10357,7 +15091,9 @@ var ts; return undefined; } if (!props) { - props = [prop]; + props = [ + prop + ]; } else { props.push(prop); @@ -10457,8 +15193,7 @@ var ts; var links = getNodeLinks(declaration); if (!links.resolvedSignature) { var classType = declaration.kind === 133 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; - var typeParameters = classType ? classType.typeParameters : - declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; + var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; @@ -10589,8 +15324,12 @@ var ts; var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; - type.callSignatures = !isConstructor ? [signature] : emptyArray; - type.constructSignatures = isConstructor ? [signature] : emptyArray; + type.callSignatures = !isConstructor ? [ + signature + ] : emptyArray; + type.constructSignatures = isConstructor ? [ + signature + ] : emptyArray; signature.isolatedSignatureType = type; } return signature.isolatedSignatureType; @@ -10617,9 +15356,7 @@ var ts; } function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); - return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType - : undefined; + return declaration ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType : undefined; } function getConstraintOfTypeParameter(type) { if (!type.constraint) { @@ -10673,7 +15410,9 @@ var ts; return links.isIllegalTypeReferenceInConstraint; } var currentNode = typeReferenceNode; - while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { + while (!ts.forEach(typeParameterSymbol.declarations, function (d) { + return d.parent === currentNode.parent; + })) { currentNode = currentNode.parent; } links.isIllegalTypeReferenceInConstraint = currentNode.kind === 127; @@ -10687,7 +15426,9 @@ var ts; if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); if (symbol && (symbol.flags & 262144)) { - links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); + links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { + return d.parent == typeParameter.parent; + }); } } if (links.isIllegalTypeReferenceInConstraint) { @@ -10786,7 +15527,9 @@ var ts; } function createArrayType(elementType) { var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); - return arrayType !== emptyObjectType ? createTypeReference(arrayType, [elementType]) : emptyObjectType; + return arrayType !== emptyObjectType ? createTypeReference(arrayType, [ + elementType + ]) : emptyObjectType; } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); @@ -10972,15 +15715,21 @@ var ts; return items; } function createUnaryTypeMapper(source, target) { - return function (t) { return t === source ? target : t; }; + return function (t) { + return t === source ? target : t; + }; } function createBinaryTypeMapper(source1, target1, source2, target2) { - return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; + return function (t) { + return t === source1 ? target1 : t === source2 ? target2 : t; + }; } function createTypeMapper(sources, targets) { switch (sources.length) { - case 1: return createUnaryTypeMapper(sources[0], targets[0]); - case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); + case 1: + return createUnaryTypeMapper(sources[0], targets[0]); + case 2: + return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); } return function (t) { for (var i = 0; i < sources.length; i++) { @@ -10991,15 +15740,21 @@ var ts; }; } function createUnaryTypeEraser(source) { - return function (t) { return t === source ? anyType : t; }; + return function (t) { + return t === source ? anyType : t; + }; } function createBinaryTypeEraser(source1, source2) { - return function (t) { return t === source1 || t === source2 ? anyType : t; }; + return function (t) { + return t === source1 || t === source2 ? anyType : t; + }; } function createTypeEraser(sources) { switch (sources.length) { - case 1: return createUnaryTypeEraser(sources[0]); - case 2: return createBinaryTypeEraser(sources[0], sources[1]); + case 1: + return createUnaryTypeEraser(sources[0]); + case 2: + return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { for (var i = 0; i < sources.length; i++) { @@ -11023,7 +15778,9 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return mapper2(mapper1(t)); }; + return function (t) { + return mapper2(mapper1(t)); + }; } function instantiateTypeParameter(typeParameter, mapper) { var result = createType(512); @@ -11083,8 +15840,7 @@ var ts; return mapper(type); } if (type.flags & 32768) { - return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? - instantiateAnonymousType(type, mapper) : type; + return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096) { return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); @@ -11109,12 +15865,10 @@ var ts; case 151: return ts.forEach(node.elements, isContextSensitive); case 168: - return isContextSensitive(node.whenTrue) || - isContextSensitive(node.whenFalse); + return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); case 167: - return node.operatorToken.kind === 49 && - (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 217: + return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 218: return isContextSensitive(node.initializer); case 132: case 131: @@ -11125,7 +15879,9 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { + return p.type; + }); } function getTypeWithoutConstructors(type) { if (type.flags & 48128) { @@ -11264,8 +16020,7 @@ var ts; } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && - (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; return result; } @@ -11722,9 +16477,7 @@ var ts; if (source === target) { return -1; } - if (source.parameters.length !== target.parameters.length || - source.minArgumentCount !== target.minArgumentCount || - source.hasRestParameter !== target.hasRestParameter) { + if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { return 0; } var result = -1; @@ -11767,7 +16520,9 @@ var ts; return true; } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + return ts.forEach(types, function (t) { + return isSupertypeOfEach(t, types) ? t : undefined; + }); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { var bestSupertype; @@ -11804,6 +16559,9 @@ var ts; function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); } + function isTupleType(type) { + return (type.flags & 8192) && !!type.elementTypes; + } function getWidenedTypeOfObjectLiteral(type) { var properties = getPropertiesOfObjectType(type); var members = {}; @@ -11883,9 +16641,7 @@ var ts; var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; case 128: - var diagnostic = declaration.dotDotDotToken ? - ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : - ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + var diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; case 195: case 132: @@ -11941,7 +16697,10 @@ var ts; function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; for (var i = 0; i < typeParameters.length; i++) { - inferences.push({ primary: undefined, secondary: undefined }); + inferences.push({ + primary: undefined, + secondary: undefined + }); } return { typeParameters: typeParameters, @@ -11986,9 +16745,7 @@ var ts; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { var inferences = context.inferences[i]; - var candidates = inferiority ? - inferences.secondary || (inferences.secondary = []) : - inferences.primary || (inferences.primary = []); + var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); if (!ts.contains(candidates, source)) candidates.push(source); break; @@ -12028,8 +16785,7 @@ var ts; inferFromTypes(sourceTypes[i], target); } } - else if (source.flags & 48128 && (target.flags & (4096 | 8192) || - (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -12136,16 +16892,23 @@ var ts; } ts.Debug.fail("should not get here"); } - function removeTypesFromUnionType(type, typeKind, isOfTypeKind) { + function removeTypesFromUnionType(type, typeKind, isOfTypeKind, allowEmptyUnionResult) { if (type.flags & 16384) { var types = type.types; - if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { - var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); - if (narrowedType !== emptyObjectType) { + if (ts.forEach(types, function (t) { + return !!(t.flags & typeKind) === isOfTypeKind; + })) { + var narrowedType = getUnionType(ts.filter(types, function (t) { + return !(t.flags & typeKind) === isOfTypeKind; + })); + if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { return narrowedType; } } } + else if (allowEmptyUnionResult && !!(type.flags & typeKind) === isOfTypeKind) { + return getUnionType(emptyArray); + } return type; } function hasInitializer(node) { @@ -12217,12 +16980,12 @@ var ts; case 186: case 187: case 188: - case 213: case 214: + case 215: case 189: case 190: case 191: - case 216: + case 217: return ts.forEachChild(node, isAssignedIn); } return false; @@ -12231,12 +16994,13 @@ var ts; function resolveLocation(node) { var containerNodes = []; for (var parent = node.parent; parent; parent = parent.parent) { - if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && - isContextSensitive(parent)) { + if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(parent)) { containerNodes.unshift(parent); } } - ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); + ts.forEach(containerNodes, function (node) { + getTypeOfNode(node); + }); } function getSymbolAtLocation(node) { resolveLocation(node); @@ -12278,7 +17042,7 @@ var ts; } } break; - case 220: + case 221: case 200: case 195: case 132: @@ -12312,16 +17076,16 @@ var ts; } if (assumeTrue) { if (!typeInfo) { - return removeTypesFromUnionType(type, 258 | 132 | 8 | 1048576, true); + return removeTypesFromUnionType(type, 258 | 132 | 8 | 1048576, true, false); } if (isTypeSubtypeOf(typeInfo.type, type)) { return typeInfo.type; } - return removeTypesFromUnionType(type, typeInfo.flags, false); + return removeTypesFromUnionType(type, typeInfo.flags, false, false); } else { if (typeInfo) { - return removeTypesFromUnionType(type, typeInfo.flags, true); + return removeTypesFromUnionType(type, typeInfo.flags, true, false); } return type; } @@ -12365,7 +17129,9 @@ var ts; return targetType; } if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + return getUnionType(ts.filter(type.types, function (t) { + return isTypeSubtypeOf(t, targetType); + })); } return type; } @@ -12421,9 +17187,7 @@ var ts; return false; } function checkBlockScopedBindingCapturedInLoop(node, symbol) { - if (languageVersion >= 2 || - (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 216) { + if (languageVersion >= 2 || (symbol.flags & 2) === 0 || symbol.valueDeclaration.parent.kind === 217) { return; } var container = symbol.valueDeclaration; @@ -12530,21 +17294,10 @@ var ts; } if (container && container.parent && container.parent.kind === 196) { if (container.flags & 128) { - canUseSuperExpression = - container.kind === 132 || - container.kind === 131 || - container.kind === 134 || - container.kind === 135; + canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135; } else { - canUseSuperExpression = - container.kind === 132 || - container.kind === 131 || - container.kind === 134 || - container.kind === 135 || - container.kind === 130 || - container.kind === 129 || - container.kind === 133; + canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135 || container.kind === 130 || container.kind === 129 || container.kind === 133; } } } @@ -12591,8 +17344,7 @@ var ts; if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } - if (indexOfParameter === (func.parameters.length - 1) && - funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); } } @@ -12677,7 +17429,10 @@ var ts; mappedType = t; } else if (!mappedTypes) { - mappedTypes = [mappedType, t]; + mappedTypes = [ + mappedType, + t + ]; } else { mappedTypes.push(t); @@ -12693,13 +17448,17 @@ var ts; }); } function getIndexTypeOfContextualType(type, kind) { - return applyToContextualType(type, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }); + return applyToContextualType(type, function (t) { + return getIndexTypeOfObjectOrUnionType(t, kind); + }); } function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } function contextualTypeHasIndexSignature(type, kind) { - return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); + return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { + return getIndexTypeOfObjectOrUnionType(t, kind); + }) : getIndexTypeOfObjectOrUnionType(type, kind)); } function getContextualTypeForObjectLiteralMethod(node) { ts.Debug.assert(ts.isObjectLiteralMethod(node)); @@ -12719,8 +17478,7 @@ var ts; return propertyType; } } - return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || - getIndexTypeOfContextualType(type, 0); + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || getIndexTypeOfContextualType(type, 0); } return undefined; } @@ -12729,9 +17487,7 @@ var ts; var type = getContextualType(arrayLiteral); if (type) { var index = ts.indexOf(arrayLiteral.elements, node); - return getTypeOfPropertyOfContextualType(type, "" + index) - || getIndexTypeOfContextualType(type, 1) - || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); + return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1) || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); } return undefined; } @@ -12764,7 +17520,7 @@ var ts; return getTypeFromTypeNode(parent.type); case 167: return getContextualTypeForBinaryOperand(node); - case 217: + case 218: return getContextualTypeForObjectLiteralElement(parent); case 151: return getContextualTypeForElementExpression(node); @@ -12795,9 +17551,7 @@ var ts; } function getContextualSignature(node) { ts.Debug.assert(node.kind !== 132 || ts.isObjectLiteralMethod(node)); - var type = ts.isObjectLiteralMethod(node) - ? getContextualTypeForObjectLiteralMethod(node) - : getContextualType(node); + var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); if (!type) { return undefined; } @@ -12807,14 +17561,15 @@ var ts; var signatureList; var types = type.types; for (var i = 0; i < types.length; i++) { - if (signatureList && - getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { + if (signatureList && getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { return undefined; } var signature = getNonGenericSignature(types[i]); if (signature) { if (!signatureList) { - signatureList = [signature]; + signatureList = [ + signature + ]; } else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { return undefined; @@ -12840,7 +17595,7 @@ var ts; if (parent.kind === 167 && parent.operatorToken.kind === 52 && parent.left === node) { return true; } - if (parent.kind === 217) { + if (parent.kind === 218) { return isAssignmentTarget(parent.parent); } if (parent.kind === 151) { @@ -12912,20 +17667,16 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 217 || - memberDecl.kind === 218 || - ts.isObjectLiteralMethod(memberDecl)) { - if (memberDecl.kind === 217) { + if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 218) { var type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 132) { var type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 218); - var type = memberDecl.name.kind === 126 - ? unknownType - : checkExpression(memberDecl.name, contextualMapper); + ts.Debug.assert(memberDecl.kind === 219); + var type = memberDecl.name.kind === 126 ? unknownType : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -13041,9 +17792,7 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 153 - ? node.expression - : node.left; + var left = node.kind === 153 ? node.expression : node.left; var type = checkExpressionOrQualifiedName(left); if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); @@ -13080,8 +17829,7 @@ var ts; return unknownType; } var isConstEnum = isConstEnumObjectType(objectType); - if (isConstEnum && - (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } @@ -13248,8 +17996,7 @@ var ts; callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; } - var hasRightNumberOfTypeArgs = !typeArguments || - (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); if (!hasRightNumberOfTypeArgs) { return false; } @@ -13266,8 +18013,7 @@ var ts; function getSingleCallSignature(type) { if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); - if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && - resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { return resolved.callSignatures[0]; } } @@ -13337,9 +18083,7 @@ var ts; var arg = args[i]; if (arg.kind !== 172) { var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); - var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : - arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : - checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { return false; } @@ -13351,7 +18095,9 @@ var ts; var args; if (node.kind === 157) { var template = node.template; - args = [template]; + args = [ + template + ]; if (template.kind === 169) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); @@ -13603,10 +18349,7 @@ var ts; } if (node.kind === 156) { var declaration = signature.declaration; - if (declaration && - declaration.kind !== 133 && - declaration.kind !== 137 && - declaration.kind !== 141) { + if (declaration && declaration.kind !== 133 && declaration.kind !== 137 && declaration.kind !== 141) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -13631,13 +18374,9 @@ var ts; } function getTypeAtPosition(signature, pos) { if (pos >= 0) { - return signature.hasRestParameter ? - pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : - pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; } - return signature.hasRestParameter ? - getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : - anyArrayType; + return signature.hasRestParameter ? getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : anyArrayType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -13937,12 +18676,9 @@ var ts; var properties = node.properties; for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 217 || p.kind === 218) { + if (p.kind === 218 || p.kind === 219) { var name = p.name; - var type = sourceType.flags & 1 ? sourceType : - getTypeOfPropertyOfType(sourceType, name.text) || - isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || - getIndexTypeOfType(sourceType, 0); + var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { checkDestructuringAssignment(p.initializer || name, type); } @@ -13967,14 +18703,17 @@ var ts; if (e.kind !== 172) { if (e.kind !== 171) { var propName = "" + i; - var type = sourceType.flags & 1 ? sourceType : - isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : - getIndexTypeOfType(sourceType, 1); + var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); if (type) { checkDestructuringAssignment(e, type, contextualMapper); } else { - error(e, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + if (isTupleType(sourceType)) { + error(e, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), sourceType.elementTypes.length, elements.length); + } + else { + error(e, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + } } } else { @@ -14045,9 +18784,7 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var suggestedOperator; - if ((leftType.flags & 8) && - (rightType.flags & 8) && - (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { @@ -14109,7 +18846,10 @@ var ts; case 48: return rightType; case 49: - return getUnionType([leftType, rightType]); + return getUnionType([ + leftType, + rightType + ]); case 52: checkAssignmentOperator(rightType); return rightType; @@ -14117,9 +18857,7 @@ var ts; return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : - someConstituentTypeHasKind(rightType, 1048576) ? node.right : - undefined; + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); return false; @@ -14165,7 +18903,10 @@ var ts; checkExpression(node.condition); var type1 = checkExpression(node.whenTrue, contextualMapper); var type2 = checkExpression(node.whenFalse, contextualMapper); - return getUnionType([type1, type2]); + return getUnionType([ + type1, + type2 + ]); } function checkTemplateExpression(node) { ts.forEach(node.templateSpans, function (templateSpan) { @@ -14229,9 +18970,7 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 153 && node.parent.expression === node) || - (node.parent.kind === 154 && node.parent.expression === node) || - ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 153 && node.parent.expression === node) || (node.parent.kind === 154 && node.parent.expression === node) || ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -14341,9 +19080,7 @@ var ts; if (node.kind === 138) { checkGrammarIndexSignature(node); } - else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || - node.kind === 136 || node.kind === 133 || - node.kind === 137) { + else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || node.kind === 136 || node.kind === 133 || node.kind === 137) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -14436,8 +19173,10 @@ var ts; case 160: case 195: case 161: - case 152: return false; - default: return ts.forEachChild(n, containsSuperCall); + case 152: + return false; + default: + return ts.forEachChild(n, containsSuperCall); } } function markThisReferencesAsErrors(n) { @@ -14449,14 +19188,13 @@ var ts; } } function isInstancePropertyWithInitializer(n) { - return n.kind === 130 && - !(n.flags & 128) && - !!n.initializer; + return n.kind === 130 && !(n.flags & 128) && !!n.initializer; } if (ts.getClassBaseTypeNode(node.parent)) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { + return p.flags & (16 | 32 | 64); + }); if (superCallShouldBeFirst) { var statements = node.body.statements; if (!statements.length || statements[0].kind !== 177 || !isSuperCallExpression(statements[0].expression)) { @@ -14778,16 +19516,16 @@ var ts; case 197: return 2097152; case 200: - return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 - ? 4194304 | 1048576 - : 4194304; + return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; case 196: case 199: return 2097152 | 1048576; - case 202: + case 203: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); + ts.forEach(target.declarations, function (d) { + result |= getDeclarationSpaces(d); + }); return result; default: return 1048576; @@ -14796,10 +19534,7 @@ var ts; } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || - checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || - checkGrammarFunctionName(node.name) || - checkGrammarForGenerator(node); + checkFunctionLikeDeclaration(node) || checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -14854,12 +19589,7 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 130 || - node.kind === 129 || - node.kind === 132 || - node.kind === 131 || - node.kind === 134 || - node.kind === 135) { + if (node.kind === 130 || node.kind === 129 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135) { return false; } if (ts.isInAmbientContext(node)) { @@ -14918,7 +19648,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 220 && ts.isExternalModule(parent)) { + if (parent.kind === 221 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -14927,17 +19657,11 @@ var ts; var symbol = getSymbolOfNode(node); if (symbol.flags & 1) { var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); - if (localDeclarationSymbol && - localDeclarationSymbol !== symbol && - localDeclarationSymbol.flags & 2) { + if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 194); - var container = varDeclList.parent.kind === 175 && - varDeclList.parent.parent; - var namesShareScope = container && - (container.kind === 174 && ts.isFunctionLike(container.parent) || - (container.kind === 201 && container.kind === 200) || - container.kind === 220); + var container = varDeclList.parent.kind === 175 && varDeclList.parent.parent; + var namesShareScope = container && (container.kind === 174 && ts.isFunctionLike(container.parent) || (container.kind === 201 && container.kind === 200) || container.kind === 221); if (!namesShareScope) { var name = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); @@ -15096,18 +19820,13 @@ var ts; checkSourceElement(node.statement); } function checkForOfStatement(node) { - if (languageVersion < 2) { - grammarErrorOnFirstToken(node, ts.Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); - return; - } checkGrammarForInOrForOfStatement(node); if (node.initializer.kind === 194) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; - var rightType = checkExpression(node.expression); - var iteratedType = checkIteratedType(rightType, node.expression); + var iteratedType = checkRightHandSideOfForOf(node.expression); if (varExpr.kind === 151 || varExpr.kind === 152) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } @@ -15156,20 +19875,17 @@ var ts; checkVariableDeclaration(decl); } } - function getTypeForVariableDeclarationInForOfStatement(forOfStatement) { - if (languageVersion < 2) { - return anyType; - } - var expressionType = getTypeOfExpression(forOfStatement.expression); - return checkIteratedType(expressionType, forOfStatement.expression) || anyType; + function checkRightHandSideOfForOf(rhsExpression) { + var expressionType = getTypeOfExpression(rhsExpression); + return languageVersion >= 2 ? checkIteratedType(expressionType, rhsExpression) : checkElementTypeOfArrayOrString(expressionType, rhsExpression); } function checkIteratedType(iterable, expressionForError) { ts.Debug.assert(languageVersion >= 2); var iteratedType = getIteratedType(iterable, expressionForError); if (expressionForError && iteratedType) { - var completeIterableType = globalIterableType !== emptyObjectType - ? createTypeReference(globalIterableType, [iteratedType]) - : emptyObjectType; + var completeIterableType = globalIterableType !== emptyObjectType ? createTypeReference(globalIterableType, [ + iteratedType + ]) : emptyObjectType; checkTypeAssignableTo(iterable, completeIterableType, expressionForError); } return iteratedType; @@ -15217,6 +19933,39 @@ var ts; return iteratorNextValue; } } + function checkElementTypeOfArrayOrString(arrayOrStringType, expressionForError) { + ts.Debug.assert(languageVersion < 2); + var arrayType = removeTypesFromUnionType(arrayOrStringType, 258, true, true); + var hasStringConstituent = arrayOrStringType !== arrayType; + var reportedError = false; + if (hasStringConstituent) { + if (languageVersion < 1) { + error(expressionForError, ts.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); + reportedError = true; + } + if (arrayType === emptyObjectType) { + return stringType; + } + } + if (!isArrayLikeType(arrayType)) { + if (!reportedError) { + var diagnostic = hasStringConstituent ? ts.Diagnostics.Type_0_is_not_an_array_type : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + error(expressionForError, diagnostic, typeToString(arrayType)); + } + return hasStringConstituent ? stringType : unknownType; + } + var arrayElementType = getIndexTypeOfType(arrayType, 1) || unknownType; + if (hasStringConstituent) { + if (arrayElementType.flags & 258) { + return stringType; + } + return getUnionType([ + arrayElementType, + stringType + ]); + } + return arrayElementType; + } function checkBreakOrContinueStatement(node) { checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } @@ -15265,8 +20014,8 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); - ts.forEach(node.clauses, function (clause) { - if (clause.kind === 214 && !hasDuplicateDefaultClause) { + ts.forEach(node.caseBlock.clauses, function (clause) { + if (clause.kind === 215 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -15278,7 +20027,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 213) { + if (produceDiagnostics && clause.kind === 214) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -15375,7 +20124,9 @@ var ts; if (stringIndexType && numberIndexType) { errorNode = declaredNumberIndexer || declaredStringIndexer; if (!errorNode && (type.flags & 2048)) { - var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); }); + var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { + return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); + }); errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; } } @@ -15397,13 +20148,13 @@ var ts; errorNode = indexDeclaration; } else if (containingType.flags & 2048) { - var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { + return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); + }); errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { - var errorMessage = indexKind === 0 - ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 - : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); } } @@ -15567,7 +20318,12 @@ var ts; return true; } var seen = {}; - ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(type.declaredProperties, function (p) { + seen[p.name] = { + prop: p, + containingType: type + }; + }); var ok = true; for (var i = 0, len = type.baseTypes.length; i < len; ++i) { var base = type.baseTypes[i]; @@ -15575,7 +20331,10 @@ var ts; for (var j = 0, proplen = properties.length; j < proplen; ++j) { var prop = properties[j]; if (!ts.hasProperty(seen, prop.name)) { - seen[prop.name] = { prop: prop, containingType: base }; + seen[prop.name] = { + prop: prop, + containingType: base + }; } else { var existing = seen[prop.name]; @@ -15678,9 +20437,12 @@ var ts; return undefined; } switch (e.operator) { - case 33: return value; - case 34: return -value; - case 47: return enumIsConst ? ~value : undefined; + case 33: + return value; + case 34: + return -value; + case 47: + return enumIsConst ? ~value : undefined; } return undefined; case 167: @@ -15696,17 +20458,28 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 44: return left | right; - case 43: return left & right; - case 41: return left >> right; - case 42: return left >>> right; - case 40: return left << right; - case 45: return left ^ right; - case 35: return left * right; - case 36: return left / right; - case 33: return left + right; - case 34: return left - right; - case 37: return left % right; + case 44: + return left | right; + case 43: + return left & right; + case 41: + return left >> right; + case 42: + return left >>> right; + case 40: + return left << right; + case 45: + return left ^ right; + case 35: + return left * right; + case 36: + return left / right; + case 33: + return left + right; + case 34: + return left - right; + case 37: + return left % right; } return undefined; case 7: @@ -15729,8 +20502,7 @@ var ts; } else { if (e.kind === 154) { - if (e.argumentExpression === undefined || - e.argumentExpression.kind !== 8) { + if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { return undefined; } var enumType = getTypeOfNode(e.expression); @@ -15826,10 +20598,7 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - if (symbol.flags & 512 - && symbol.declarations.length > 1 - && !ts.isInAmbientContext(node) - && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -15864,10 +20633,8 @@ var ts; return false; } var inAmbientExternalModule = node.parent.kind === 201 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 220 && !inAmbientExternalModule) { - error(moduleName, node.kind === 209 ? - ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : - ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + if (node.parent.kind !== 221 && !inAmbientExternalModule) { + error(moduleName, node.kind === 210 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { @@ -15880,13 +20647,9 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | - (symbol.flags & 793056 ? 793056 : 0) | - (symbol.flags & 1536 ? 1536 : 0); + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 211 ? - ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : - ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; + var message = node.kind === 212 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); } } @@ -15907,7 +20670,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 205) { + if (importClause.namedBindings.kind === 206) { checkImportBinding(importClause.namedBindings); } else { @@ -15957,7 +20720,7 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 220 ? node.parent : node.parent.parent; + var container = node.parent.kind === 221 ? node.parent : node.parent.parent; if (container.kind === 200 && container.name.kind === 64) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); return; @@ -15974,7 +20737,7 @@ var ts; checkExternalModuleExports(container); } function getModuleStatements(node) { - if (node.kind === 220) { + if (node.kind === 221) { return node.statements; } if (node.kind === 200 && node.body.kind === 201) { @@ -15988,7 +20751,7 @@ var ts; var statements = getModuleStatements(declarations[i]); for (var j = 0; j < statements.length; j++) { var node = statements[j]; - if (node.kind === 209) { + if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; @@ -16001,7 +20764,7 @@ var ts; } } } - else if (node.kind !== 208 && node.flags & 1 && !(node.flags & 256)) { + else if (node.kind !== 209 && node.flags & 1 && !(node.flags & 256)) { return true; } } @@ -16111,13 +20874,13 @@ var ts; return checkEnumDeclaration(node); case 200: return checkModuleDeclaration(node); - case 203: + case 204: return checkImportDeclaration(node); - case 202: + case 203: return checkImportEqualsDeclaration(node); - case 209: + case 210: return checkExportDeclaration(node); - case 208: + case 209: return checkExportAssignment(node); case 176: checkGrammarStatementInAmbientContext(node); @@ -16158,7 +20921,7 @@ var ts; case 150: case 151: case 152: - case 217: + case 218: case 153: case 154: case 155: @@ -16190,19 +20953,20 @@ var ts; case 185: case 186: case 188: - case 213: + case 202: case 214: + case 215: case 189: case 190: case 191: - case 216: + case 217: case 193: case 194: case 196: case 199: - case 219: - case 208: case 220: + case 209: + case 221: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -16290,7 +21054,7 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 220: + case 221: if (!ts.isExternalModule(location)) break; case 200: @@ -16318,9 +21082,7 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 64 && - isTypeDeclaration(name.parent) && - name.parent.name === name; + return name.kind == 64 && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { @@ -16402,10 +21164,10 @@ var ts; while (nodeOnRightSide.parent.kind === 125) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 202) { + if (nodeOnRightSide.parent.kind === 203) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 208) { + if (nodeOnRightSide.parent.kind === 209) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -16414,14 +21176,13 @@ var ts; return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 125 && node.parent.right === node) || - (node.parent.kind === 153 && node.parent.name === node); + return (node.parent.kind === 125 && node.parent.right === node) || (node.parent.kind === 153 && node.parent.name === node); } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 208) { + if (entityName.parent.kind === 209) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } if (entityName.kind !== 153) { @@ -16470,9 +21231,7 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 64 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 208 - ? getSymbolOfEntityNameOrPropertyAccessExpression(node) - : getSymbolOfPartOfRightHandSideOfImportEquals(node); + return node.parent.kind === 209 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } switch (node.kind) { case 64: @@ -16491,10 +21250,7 @@ var ts; return undefined; case 8: var moduleName; - if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && - ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 203 || node.parent.kind === 209) && - node.parent.moduleSpecifier === node)) { + if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || ((node.parent.kind === 204 || node.parent.kind === 210) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 7: @@ -16512,7 +21268,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 218) { + if (location && location.kind === 219) { return resolveEntityName(location.name, 107455); } return undefined; @@ -16580,13 +21336,17 @@ var ts; else if (symbol.flags & 67108864) { var target = getSymbolLinks(symbol).target; if (target) { - return [target]; + return [ + target + ]; } } - return [symbol]; + return [ + symbol + ]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 220; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 221; } function isNodeDescendentOf(node, ancestor) { while (node) { @@ -16627,16 +21387,16 @@ var ts; case 199: generateNameForModuleOrEnum(node); break; - case 203: + case 204: generateNameForImportDeclaration(node); break; - case 209: + case 210: generateNameForExportDeclaration(node); break; - case 208: + case 209: generateNameForExportAssignment(node); break; - case 220: + case 221: case 201: ts.forEach(node.statements, generateNames); break; @@ -16665,12 +21425,11 @@ var ts; } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 8 ? - ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + var baseName = expr.kind === 8 ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; assignGeneratedName(node, makeUniqueName(baseName)); } function generateNameForImportDeclaration(node) { - if (node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 206) { + if (node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 207) { generateNameForImportOrExportDeclaration(node); } } @@ -16700,7 +21459,7 @@ var ts; } function getAliasNameSubstitution(symbol) { var declaration = getDeclarationOfAliasSymbol(symbol); - if (declaration && declaration.kind === 207) { + if (declaration && declaration.kind === 208) { var moduleName = getGeneratedNameForNode(declaration.parent.parent.parent); var propertyName = declaration.propertyName || declaration.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -16739,7 +21498,7 @@ var ts; return symbol && symbol !== unknownSymbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol); } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 220 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 221 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } return isAliasResolvedToValue(getSymbolOfNode(node)); @@ -16764,8 +21523,7 @@ var ts; if (ts.nodeIsPresent(node.body)) { var symbol = getSymbolOfNode(node); var signaturesOfSymbol = getSignaturesOfSymbol(symbol); - return signaturesOfSymbol.length > 1 || - (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); } return false; } @@ -16777,14 +21535,14 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 219) { + if (node.kind === 220) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; if (symbol && (symbol.flags & 8)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 219) { + if (declaration.kind === 220) { return getEnumMemberValue(declaration); } } @@ -16792,9 +21550,7 @@ var ts; } function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { var symbol = getSymbolOfNode(declaration); - var type = symbol && !(symbol.flags & (2048 | 131072)) - ? getTypeOfSymbol(symbol) - : unknownType; + var type = symbol && !(symbol.flags & (2048 | 131072)) ? getTypeOfSymbol(symbol) : unknownType; getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -16802,29 +21558,20 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function isUnknownIdentifier(location, name) { - return !resolveName(location, name, 107455, undefined, undefined) && - !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); + ts.Debug.assert(!ts.nodeIsSynthesized(location), "isUnknownIdentifier called with a synthesized location"); + return !resolveName(location, name, 107455, undefined, undefined) && !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - if (n.parent.kind === 153 && - n.parent.name === n) { + if (n.parent.kind === 153 && n.parent.name === n) { return undefined; } - if (n.parent.kind === 150 && - n.parent.propertyName === n) { + if (n.parent.kind === 150 && n.parent.propertyName === n) { return undefined; } - var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || - n.parent.kind === 150 - ? getSymbolOfNode(n.parent) - : undefined; - var symbol = declarationSymbol || - getNodeLinks(n).resolvedSymbol || - resolveName(n, n.text, 2 | 8388608, undefined, undefined); - var isLetOrConst = symbol && - (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 216; + var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || n.parent.kind === 150 ? getSymbolOfNode(n.parent) : undefined; + var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 2 | 8388608, undefined, undefined); + var isLetOrConst = symbol && (symbol.flags & 2) && symbol.valueDeclaration.parent.kind !== 217; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -16901,10 +21648,10 @@ var ts; case 175: case 195: case 198: + case 204: case 203: - case 202: + case 210: case 209: - case 208: case 128: break; default: @@ -16939,7 +21686,7 @@ var ts; else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 201 || node.parent.kind === 220) { + else if (node.parent.kind === 201 || node.parent.kind === 221) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -16948,7 +21695,7 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 201 || node.parent.kind === 220) { + else if (node.parent.kind === 201 || node.parent.kind === 221) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } else if (node.kind === 128) { @@ -17001,7 +21748,7 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 203 || node.kind === 202) && flags & 2) { + else if ((node.kind === 204 || node.kind === 203) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } else if (node.kind === 197 && flags & 2) { @@ -17114,8 +21861,7 @@ var ts; } } function checkGrammarTypeArguments(node, typeArguments) { - return checkGrammarForDisallowedTrailingComma(typeArguments) || - checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { @@ -17129,8 +21875,7 @@ var ts; } } function checkGrammarArguments(node, arguments) { - return checkGrammarForDisallowedTrailingComma(arguments) || - checkGrammarForOmittedArgument(node, arguments); + return checkGrammarForDisallowedTrailingComma(arguments) || checkGrammarForOmittedArgument(node, arguments); } function checkGrammarHeritageClause(node) { var types = node.types; @@ -17226,13 +21971,12 @@ var ts; for (var i = 0, n = node.properties.length; i < n; i++) { var prop = node.properties[i]; var name = prop.name; - if (prop.kind === 172 || - name.kind === 126) { + if (prop.kind === 172 || name.kind === 126) { checkGrammarComputedPropertyName(name); continue; } var currentKind; - if (prop.kind === 217 || prop.kind === 218) { + if (prop.kind === 218 || prop.kind === 219) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 7) { checkGrammarNumbericLiteral(name); @@ -17283,22 +22027,16 @@ var ts; var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 182 - ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement - : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 182 - ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer - : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 182 - ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation - : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); } } @@ -17352,9 +22090,7 @@ var ts; } } function checkGrammarMethod(node) { - if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || - checkGrammarFunctionLikeDeclaration(node) || - checkGrammarForGenerator(node)) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarForGenerator(node)) { return true; } if (node.parent.kind === 152) { @@ -17405,8 +22141,7 @@ var ts; switch (current.kind) { case 189: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 184 - && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 184 && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } @@ -17427,15 +22162,11 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 185 - ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement - : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + var message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 185 - ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement - : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + var message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } } @@ -17472,8 +22203,7 @@ var ts; } } var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); - return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || - checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 64) { @@ -17605,8 +22335,7 @@ var ts; } function checkGrammarProperty(node) { if (node.parent.kind === 196) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } @@ -17625,12 +22354,7 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 197 || - node.kind === 203 || - node.kind === 202 || - node.kind === 209 || - node.kind === 208 || - (node.flags & 2)) { + if (node.kind === 197 || node.kind === 204 || node.kind === 203 || node.kind === 210 || node.kind === 209 || (node.flags & 2)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -17657,7 +22381,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 174 || node.parent.kind === 201 || node.parent.kind === 220) { + if (node.parent.kind === 174 || node.parent.kind === 201 || node.parent.kind === 221) { var links = getNodeLinks(node.parent); if (!links.hasReportedStatementInAmbientContext) { return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -17692,7 +22416,10 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var indentStrings = ["", " "]; + var indentStrings = [ + "", + " " + ]; function getIndentString(level) { if (indentStrings[level] === undefined) { indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; @@ -17767,21 +22494,34 @@ var ts; writeTextOfNode: writeTextOfNode, writeLiteral: writeLiteral, writeLine: writeLine, - increaseIndent: function () { return indent++; }, - decreaseIndent: function () { return indent--; }, - getIndent: function () { return indent; }, - getTextPos: function () { return output.length; }, - getLine: function () { return lineCount + 1; }, - getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, - getText: function () { return output; } + increaseIndent: function () { + return indent++; + }, + decreaseIndent: function () { + return indent--; + }, + getIndent: function () { + return indent; + }, + getTextPos: function () { + return output.length; + }, + getLine: function () { + return lineCount + 1; + }, + getColumn: function () { + return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; + }, + getText: function () { + return output; + } }; } function getLineOfLocalPosition(currentSourceFile, pos) { return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { - if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -17810,9 +22550,7 @@ var ts; var lineCount = ts.getLineStarts(currentSourceFile).length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = (currentLine + 1) === lineCount - ? currentSourceFile.text.length + 1 - : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); + var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { firstCommentLineIndent = calculateIndent(ts.getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); @@ -17890,8 +22628,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 134 || member.kind === 135) - && (member.flags & 128) === (accessor.flags & 128)) { + if ((member.kind === 134 || member.kind === 135) && (member.flags & 128) === (accessor.flags & 128)) { var memberName = ts.getPropertyNameForPropertyNameNode(member.name); var accessorName = ts.getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -17947,7 +22684,8 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { + } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var aliasDeclarationEmitInfo = []; var referencePathsOutput = ""; @@ -17956,9 +22694,7 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 2048) || - shouldEmitToOwnFile(referencedFile, compilerOptions) || - !addedGlobalFileReference)) { + if (referencedFile && ((referencedFile.flags & 2048) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { writeReferencePath(referencedFile); if (!isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -17975,8 +22711,7 @@ var ts; if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && - !ts.contains(emittedReferencedFiles, referencedFile))) { + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } @@ -18030,7 +22765,9 @@ var ts; function writeAsychronousImportEqualsDeclarations(importEqualsDeclarations) { var oldWriter = writer; ts.forEach(importEqualsDeclarations, function (aliasToWrite) { - var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; }); + var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { + return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; + }); if (aliasEmitInfo) { createAndSetNewTextWriterWithSymbolWriter(); for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { @@ -18148,7 +22885,7 @@ var ts; ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 202 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 203 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -18355,15 +23092,8 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 140 || - node.parent.kind === 141 || - (node.parent.parent && node.parent.parent.kind === 143)) { - ts.Debug.assert(node.parent.kind === 132 || - node.parent.kind === 131 || - node.parent.kind === 140 || - node.parent.kind === 141 || - node.parent.kind === 136 || - node.parent.kind === 137); + if (node.parent.kind === 140 || node.parent.kind === 141 || (node.parent.parent && node.parent.parent.kind === 143)) { + ts.Debug.assert(node.parent.kind === 132 || node.parent.kind === 131 || node.parent.kind === 140 || node.parent.kind === 141 || node.parent.kind === 136 || node.parent.kind === 137); emitType(node.constraint); } else { @@ -18426,9 +23156,7 @@ var ts; function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.parent.parent.kind === 196) { - diagnosticMessage = isImplementsList ? - ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : - ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; @@ -18461,7 +23189,9 @@ var ts; emitTypeParameters(node.typeParameters); var baseTypeNode = ts.getClassBaseTypeNode(node); if (baseTypeNode) { - emitHeritageClause([baseTypeNode], false); + emitHeritageClause([ + baseTypeNode + ], false); } emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); write(" {"); @@ -18521,31 +23251,17 @@ var ts; function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.kind === 193) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } else if (node.kind === 130 || node.kind === 129) { if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } return diagnosticMessage !== undefined ? { @@ -18562,7 +23278,9 @@ var ts; } } function emitVariableStatement(node) { - var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); + var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { + return resolver.isDeclarationVisible(varDeclaration); + }); if (hasDeclarationWithEmit) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); @@ -18607,25 +23325,17 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 134 - ? accessor.type - : accessor.parameters.length > 0 - ? accessor.parameters[0].type - : undefined; + return accessor.kind === 134 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; } } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (accessorWithTypeAnnotation.kind === 135) { if (accessorWithTypeAnnotation.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } return { diagnosticMessage: diagnosticMessage, @@ -18635,18 +23345,10 @@ var ts; } else { if (accessorWithTypeAnnotation.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; } return { diagnosticMessage: diagnosticMessage, @@ -18660,8 +23362,7 @@ var ts; if (ts.hasDynamicName(node)) { return; } - if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && - !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); if (node.kind === 195) { emitModuleElementDeclarationFlags(node); @@ -18728,48 +23429,28 @@ var ts; var diagnosticMessage; switch (node.kind) { case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 132: case 131: if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: ts.Debug.fail("This is unknown kind for signature: " + node.kind); @@ -18796,9 +23477,7 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 140 || - node.parent.kind === 141 || - node.parent.parent.kind === 143) { + if (node.parent.kind === 140 || node.parent.kind === 141 || node.parent.parent.kind === 143) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -18808,50 +23487,28 @@ var ts; var diagnosticMessage; switch (node.parent.kind) { case 133: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; break; case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 132: case 131: if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } else if (node.parent.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); @@ -18888,26 +23545,22 @@ var ts; return emitClassDeclaration(node); case 198: return emitTypeAliasDeclaration(node); - case 219: + case 220: return emitEnumMemberDeclaration(node); case 199: return emitEnumDeclaration(node); case 200: return emitModuleDeclaration(node); - case 202: + case 203: return emitImportEqualsDeclaration(node); - case 208: + case 209: return emitExportAssignment(node); - case 220: + case 221: return emitSourceFile(node); } } function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 2048 - ? referencedFile.fileName - : shouldEmitToOwnFile(referencedFile, compilerOptions) - ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") - : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + var declFileName = referencedFile.flags & 2048 ? referencedFile.fileName : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencePathsOutput += "/// " + newLine; } @@ -18958,6 +23611,7 @@ var ts; var writeLine = writer.writeLine; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; + var preserveNewLines = compilerOptions.preserveNewLines || false; var currentSourceFile; var lastFrame; var currentScopeNames; @@ -18970,41 +23624,57 @@ var ts; var exportSpecifiers; var exportDefault; var writeEmittedFiles = writeJavaScriptFile; - var emitLeadingComments = compilerOptions.removeComments ? function (node) { } : emitLeadingDeclarationComments; - var emitTrailingComments = compilerOptions.removeComments ? function (node) { } : emitTrailingDeclarationComments; - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfLocalPosition; + var emitLeadingComments = compilerOptions.removeComments ? function (node) { + } : emitLeadingDeclarationComments; + var emitTrailingComments = compilerOptions.removeComments ? function (node) { + } : emitTrailingDeclarationComments; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { + } : emitLeadingCommentsOfLocalPosition; var detachedCommentsInfo; - var emitDetachedComments = compilerOptions.removeComments ? function (node) { } : emitDetachedCommentsAtPosition; - var emitPinnedOrTripleSlashComments = compilerOptions.removeComments ? function (node) { } : emitPinnedOrTripleSlashCommentsOfNode; + var emitDetachedComments = compilerOptions.removeComments ? function (node) { + } : emitDetachedCommentsAtPosition; var writeComment = writeCommentRange; - var emit = emitNode; - var emitStart = function (node) { }; - var emitEnd = function (node) { }; + var emitNodeWithoutSourceMap = compilerOptions.removeComments ? emitNodeWithoutSourceMapWithoutComments : emitNodeWithoutSourceMapWithComments; + var emit = emitNodeWithoutSourceMap; + var emitWithoutComments = emitNodeWithoutSourceMapWithoutComments; + var emitStart = function (node) { + }; + var emitEnd = function (node) { + }; var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { }; - var scopeEmitEnd = function () { }; + var scopeEmitStart = function (scopeDeclaration, scopeName) { + }; + var scopeEmitEnd = function () { + }; var sourceMapData; if (compilerOptions.sourceMap) { initializeEmitterWithSourceMaps(); } if (root) { - emit(root); + emitSourceFile(root); } else { ts.forEach(host.getSourceFiles(), function (sourceFile) { if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emit(sourceFile); + emitSourceFile(sourceFile); } }); } writeLine(); writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); return; + function emitSourceFile(sourceFile) { + currentSourceFile = sourceFile; + emit(sourceFile); + } function enterNameScope() { var names = currentScopeNames; currentScopeNames = undefined; if (names) { - lastFrame = { names: names, previous: lastFrame }; + lastFrame = { + names: names, + previous: lastFrame + }; return true; } return false; @@ -19024,8 +23694,13 @@ var ts; name = baseName; } else { - name = ts.generateUniqueName(baseName, function (n) { return isExistingName(location, n); }); + name = ts.generateUniqueName(baseName, function (n) { + return isExistingName(location, n); + }); } + return recordNameInCurrentScope(name); + } + function recordNameInCurrentScope(name) { if (!currentScopeNames) { currentScopeNames = {}; } @@ -19121,12 +23796,7 @@ var ts; sourceLinePos.character++; var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || - lastRecordedSourceMapSpan.emittedLine != emittedLine || - lastRecordedSourceMapSpan.emittedColumn != emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { encodeLastRecordedSourceMapSpan(); lastRecordedSourceMapSpan = { emittedLine: emittedLine, @@ -19189,20 +23859,10 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 195 || - node.kind === 160 || - node.kind === 132 || - node.kind === 131 || - node.kind === 134 || - node.kind === 135 || - node.kind === 200 || - node.kind === 196 || - node.kind === 199) { + else if (node.kind === 195 || node.kind === 160 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135 || node.kind === 200 || node.kind === 196 || node.kind === 199) { if (node.name) { var name = node.name; - scopeName = name.kind === 126 - ? ts.getTextOfNode(name) - : node.name.text; + scopeName = name.kind === 126 ? ts.getTextOfNode(name) : node.name.text; } recordScopeNameStart(scopeName); } @@ -19280,21 +23940,32 @@ var ts; else { sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); } - function emitNodeWithMap(node) { + function emitNodeWithSourceMap(node) { if (node) { - if (node.kind != 220) { + if (ts.nodeIsSynthesized(node)) { + return emitNodeWithoutSourceMap(node); + } + if (node.kind != 221) { recordEmitNodeStartSpan(node); - emitNode(node); + emitNodeWithoutSourceMap(node); recordEmitNodeEndSpan(node); } else { recordNewSourceFileStart(node); - emitNode(node); + emitNodeWithoutSourceMap(node); } } } + function emitNodeWithSourceMapWithoutComments(node) { + if (node) { + recordEmitNodeStartSpan(node); + emitNodeWithoutSourceMapWithoutComments(node); + recordEmitNodeEndSpan(node); + } + } writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithMap; + emit = emitNodeWithSourceMap; + emitWithoutComments = emitNodeWithSourceMapWithoutComments; emitStart = recordEmitNodeStartSpan; emitEnd = recordEmitNodeEndSpan; emitToken = writeTextWithSpanRecord; @@ -19314,6 +23985,7 @@ var ts; name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); tempCount++; } + recordNameInCurrentScope(name); var result = ts.createSynthesizedNode(64); result.text = name; return result; @@ -19375,7 +24047,7 @@ var ts; function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { ts.Debug.assert(nodes.length > 0); increaseIndent(); - if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (preserveNewLines && nodeStartPositionsAreOnSameLine(parent, nodes[0])) { if (spacesBetweenBraces) { write(" "); } @@ -19385,7 +24057,7 @@ var ts; } for (var i = 0, n = nodes.length; i < n; i++) { if (i) { - if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + if (preserveNewLines && nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { write(", "); } else { @@ -19395,12 +24067,11 @@ var ts; } emit(nodes[i]); } - var closeTokenIsOnSameLineAsLastElement = nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes)); if (nodes.hasTrailingComma && allowTrailingComma) { write(","); } decreaseIndent(); - if (closeTokenIsOnSameLineAsLastElement) { + if (preserveNewLines && nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes))) { if (spacesBetweenBraces) { write(" "); } @@ -19534,8 +24205,7 @@ var ts; if (node.template.kind === 169) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 167 - && templateSpan.expression.operatorToken.kind === 23; + var needsParens = templateSpan.expression.kind === 167 && templateSpan.expression.operatorToken.kind === 23; emitParenthesizedIf(templateSpan.expression, needsParens); }); } @@ -19546,8 +24216,7 @@ var ts; ts.forEachChild(node, emit); return; } - var emitOuterParens = ts.isExpression(node.parent) - && templateNeedsParens(node, node.parent); + var emitOuterParens = ts.isExpression(node.parent) && templateNeedsParens(node, node.parent); if (emitOuterParens) { write("("); } @@ -19558,8 +24227,7 @@ var ts; } for (var i = 0; i < node.templateSpans.length; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 159 - && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + var needsParens = templateSpan.expression.kind !== 159 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); } @@ -19640,9 +24308,9 @@ var ts; case 150: case 130: case 129: - case 217: case 218: case 219: + case 220: case 132: case 131: case 195: @@ -19653,11 +24321,11 @@ var ts; case 197: case 199: case 200: - case 202: + case 203: return parent.name === node; case 185: case 184: - case 208: + case 209: return false; case 189: return node.parent.label === node; @@ -19845,9 +24513,9 @@ var ts; } function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { switch (property.kind) { - case 217: - return property.initializer; case 218: + return property.initializer; + case 219: return createIdentifier(resolver.getExpressionNameSubstitution(property.name)); case 132: return createFunctionExpression(property.parameters, property.body); @@ -19901,6 +24569,11 @@ var ts; result.right = right; return result; } + function createExpressionStatement(expression) { + var result = ts.createSynthesizedNode(177); + result.expression = expression; + return result; + } function createMemberAccessForPropertyName(expression, memberName) { if (memberName.kind === 64) { return createPropertyAccessExpression(expression, memberName); @@ -19916,7 +24589,7 @@ var ts; } } function createPropertyAssignment(name, initializer) { - var result = ts.createSynthesizedNode(217); + var result = ts.createSynthesizedNode(218); result.name = name; result.initializer = initializer; return result; @@ -20011,29 +24684,31 @@ var ts; } return false; } - function indentIfOnDifferentLines(parent, node1, node2) { - var isSynthesized = ts.nodeIsSynthesized(parent); - var realNodesAreOnDifferentLines = !isSynthesized && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { + var realNodesAreOnDifferentLines = preserveNewLines && !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { increaseIndent(); writeLine(); return true; } - return false; + else { + if (valueToWriteWhenNotIndenting) { + write(valueToWriteWhenNotIndenting); + } + return false; + } } function emitPropertyAccess(node) { if (tryEmitConstantValue(node)) { return; } emit(node.expression); - var indented = indentIfOnDifferentLines(node, node.expression, node.dotToken); + var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); write("."); - indented = indented || indentIfOnDifferentLines(node, node.dotToken, node.name); + var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); emit(node.name); - if (indented) { - decreaseIndent(); - } + decreaseIndentIf(indentedBeforeDot, indentedAfterDot); } function emitQualifiedName(node) { emit(node.left); @@ -20050,7 +24725,9 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 171; }); + return ts.forEach(elements, function (e) { + return e.kind === 171; + }); } function skipParentheses(node) { while (node.kind === 159 || node.kind === 158) { @@ -20163,14 +24840,7 @@ var ts; while (operand.kind == 158) { operand = operand.expression; } - if (operand.kind !== 165 && - operand.kind !== 164 && - operand.kind !== 163 && - operand.kind !== 162 && - operand.kind !== 166 && - operand.kind !== 156 && - !(operand.kind === 155 && node.parent.kind === 156) && - !(operand.kind === 160 && node.parent.kind === 155)) { + if (operand.kind !== 165 && operand.kind !== 164 && operand.kind !== 163 && operand.kind !== 162 && operand.kind !== 166 && operand.kind !== 156 && !(operand.kind === 155 && node.parent.kind === 156) && !(operand.kind === 160 && node.parent.kind === 155)) { emit(operand); return; } @@ -20213,27 +24883,16 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operatorToken.kind === 52 && - (node.left.kind === 152 || node.left.kind === 151)) { - emitDestructuring(node); + if (languageVersion < 2 && node.operatorToken.kind === 52 && (node.left.kind === 152 || node.left.kind === 151)) { + emitDestructuring(node, node.parent.kind === 177); } else { emit(node.left); - var indented1 = indentIfOnDifferentLines(node, node.left, node.operatorToken); - if (!indented1 && node.operatorToken.kind !== 23) { - write(" "); - } + var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 23 ? " " : undefined); write(ts.tokenToString(node.operatorToken.kind)); - if (!indented1) { - var indented2 = indentIfOnDifferentLines(node, node.operatorToken, node.right); - } - if (!indented2) { - write(" "); - } + var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); emit(node.right); - if (indented1 || indented2) { - decreaseIndent(); - } + decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); } } function synthesizedNodeStartsOnNewLine(node) { @@ -20241,34 +24900,22 @@ var ts; } function emitConditionalExpression(node) { emit(node.condition); - var indent1 = indentIfOnDifferentLines(node, node.condition, node.questionToken); - if (!indent1) { - write(" "); - } + var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); write("?"); - if (!indent1) { - var indent2 = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue); - } - if (!indent2) { - write(" "); - } + var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); emit(node.whenTrue); - if (indent1 || indent2) { + decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); + var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); + write(":"); + var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); + emit(node.whenFalse); + decreaseIndentIf(indentedBeforeColon, indentedAfterColon); + } + function decreaseIndentIf(value1, value2) { + if (value1) { decreaseIndent(); } - var indent3 = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken); - if (!indent3) { - write(" "); - } - write(":"); - if (!indent3) { - var indent4 = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse); - } - if (!indent4) { - write(" "); - } - emit(node.whenFalse); - if (indent3 || indent4) { + if (value2) { decreaseIndent(); } } @@ -20279,7 +24926,7 @@ var ts; } } function emitBlock(node) { - if (isSingleLineEmptyBlock(node)) { + if (preserveNewLines && isSingleLineEmptyBlock(node)) { emitToken(14, node.pos); write(" "); emitToken(15, node.statements.end); @@ -20401,6 +25048,9 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { + if (languageVersion < 2 && node.kind === 183) { + return emitDownLevelForOfStatement(node); + } var endPos = emitToken(81, node.pos); write(" "); endPos = emitToken(16, endPos); @@ -20426,6 +25076,86 @@ var ts; emitToken(17, node.expression.end); emitEmbeddedStatement(node.statement); } + function emitDownLevelForOfStatement(node) { + var endPos = emitToken(81, node.pos); + write(" "); + endPos = emitToken(16, endPos); + var rhsIsIdentifier = node.expression.kind === 64; + var counter = createTempVariable(node, true); + var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, false); + emitStart(node.expression); + write("var "); + emitNodeWithoutSourceMap(counter); + write(" = 0"); + emitEnd(node.expression); + if (!rhsIsIdentifier) { + write(", "); + emitStart(node.expression); + emitNodeWithoutSourceMap(rhsReference); + write(" = "); + emitNodeWithoutSourceMap(node.expression); + emitEnd(node.expression); + } + write("; "); + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write(" < "); + emitNodeWithoutSourceMap(rhsReference); + write(".length"); + emitEnd(node.initializer); + write("; "); + emitStart(node.initializer); + emitNodeWithoutSourceMap(counter); + write("++"); + emitEnd(node.initializer); + emitToken(17, node.expression.end); + write(" {"); + writeLine(); + increaseIndent(); + var rhsIterationValue = createElementAccessExpression(rhsReference, counter); + emitStart(node.initializer); + if (node.initializer.kind === 194) { + write("var "); + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length > 0) { + var declaration = variableDeclarationList.declarations[0]; + if (ts.isBindingPattern(declaration.name)) { + emitDestructuring(declaration, false, rhsIterationValue); + } + else { + emitNodeWithoutSourceMap(declaration); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + emitNodeWithoutSourceMap(createTempVariable(node, false)); + write(" = "); + emitNodeWithoutSourceMap(rhsIterationValue); + } + } + else { + var assignmentExpression = createBinaryExpression(node.initializer, 52, rhsIterationValue, false); + if (node.initializer.kind === 151 || node.initializer.kind === 152) { + emitDestructuring(assignmentExpression, true, undefined, node); + } + else { + emitNodeWithoutSourceMap(assignmentExpression); + } + } + emitEnd(node.initializer); + write(";"); + if (node.statement.kind === 174) { + emitLines(node.statement.statements); + } + else { + writeLine(); + emit(node.statement); + } + writeLine(); + decreaseIndent(); + write("}"); + } function emitBreakOrContinueStatement(node) { emitToken(node.kind === 185 ? 65 : 70, node.pos); emitOptional(" ", node.label); @@ -20449,7 +25179,10 @@ var ts; emit(node.expression); endPos = emitToken(17, node.expression.end); write(" "); - emitToken(14, endPos); + emitCaseBlock(node.caseBlock, endPos); + } + function emitCaseBlock(node, startPos) { + emitToken(14, startPos); increaseIndent(); emitLines(node.clauses); decreaseIndent(); @@ -20457,19 +25190,16 @@ var ts; emitToken(15, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === - getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function nodeEndPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === - getLineOfLocalPosition(currentSourceFile, node2.end); + return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === - getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 213) { + if (node.kind === 214) { write("case "); emit(node.expression); write(":"); @@ -20477,7 +25207,7 @@ var ts; else { write("default:"); } - if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + if (preserveNewLines && node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -20537,7 +25267,7 @@ var ts; emitContainingModuleName(node); write("."); } - emitNode(node.name); + emitNodeWithoutSourceMap(node.name); emitEnd(node.name); } function createVoidZero() { @@ -20554,21 +25284,22 @@ var ts; emitStart(specifier.name); emitContainingModuleName(specifier); write("."); - emitNode(specifier.name); + emitNodeWithoutSourceMap(specifier.name); emitEnd(specifier.name); write(" = "); - emitNode(name); + emitNodeWithoutSourceMap(name); write(";"); }); } } - function emitDestructuring(root, value) { + function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; var isDeclaration = (root.kind === 193 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 128; if (root.kind === 167) { emitAssignmentExpression(root); } else { + ts.Debug.assert(!isAssignmentExpressionStatement); emitBindingElement(root, value); } function emitAssignment(name, value) { @@ -20587,7 +25318,7 @@ var ts; } function ensureIdentifier(expr) { if (expr.kind !== 64) { - var identifier = createTempVariable(root); + var identifier = createTempVariable(lowestNonSynthesizedAncestor || root); if (!isDeclaration) { recordTempDeclaration(identifier); } @@ -20645,7 +25376,7 @@ var ts; } for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 217 || p.kind === 218) { + if (p.kind === 218 || p.kind === 219) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -20690,7 +25421,7 @@ var ts; function emitAssignmentExpression(root) { var target = root.left; var value = root.right; - if (root.parent.kind === 177) { + if (isAssignmentExpressionStatement) { emitDestructuringAssignment(target, value); } else { @@ -20747,7 +25478,7 @@ var ts; function emitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { if (languageVersion < 2) { - emitDestructuring(node); + emitDestructuring(node, false); } else { emit(node.name); @@ -20755,15 +25486,12 @@ var ts; } } else { - var isLet = renameNonTopLevelLetAndConst(node.name); + renameNonTopLevelLetAndConst(node.name); emitModuleMemberName(node); var initializer = node.initializer; if (!initializer && languageVersion < 2) { - var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && - (getCombinedFlagsForIdentifier(node.name) & 4096); - if (isUninitializedLet && - node.parent.parent.kind !== 182 && - node.parent.parent.kind !== 183) { + var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); + if (isUninitializedLet && node.parent.parent.kind !== 182 && node.parent.parent.kind !== 183) { initializer = createVoidZero(); } } @@ -20779,29 +25507,6 @@ var ts; ts.forEach(name.elements, emitExportVariableAssignments); } } - function getEnclosingBlockScopeContainer(node) { - var current = node; - while (current) { - if (ts.isFunctionLike(current)) { - return current; - } - switch (current.kind) { - case 220: - case 91: - case 216: - case 200: - case 181: - case 182: - case 183: - return current; - case 174: - if (!ts.isFunctionLike(current.parent)) { - return current; - } - } - current = current.parent; - } - } function getCombinedFlagsForIdentifier(node) { if (!node.parent || (node.parent.kind !== 193 && node.parent.kind !== 150)) { return 0; @@ -20809,10 +25514,7 @@ var ts; return ts.getCombinedNodeFlags(node.parent); } function renameNonTopLevelLetAndConst(node) { - if (languageVersion >= 2 || - ts.nodeIsSynthesized(node) || - node.kind !== 64 || - (node.parent.kind !== 193 && node.parent.kind !== 150)) { + if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 64 || (node.parent.kind !== 193 && node.parent.kind !== 150)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); @@ -20820,13 +25522,11 @@ var ts; return; } var list = ts.getAncestor(node, 194); - if (list.parent.kind === 175 && list.parent.parent.kind === 220) { + if (list.parent.kind === 175 && list.parent.parent.kind === 221) { return; } - var blockScopeContainer = getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 220 - ? blockScopeContainer - : blockScopeContainer.parent; + var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); + var parent = blockScopeContainer.kind === 221 ? blockScopeContainer : blockScopeContainer.parent; var generatedName = generateUniqueNameForLocation(parent, node.text); var variableId = resolver.getBlockScopedVariableId(node); if (!generatedBlockScopeNames) { @@ -20873,7 +25573,7 @@ var ts; if (ts.isBindingPattern(p.name)) { writeLine(); write("var "); - emitDestructuring(p, tempParameters[tempIndex]); + emitDestructuring(p, false, tempParameters[tempIndex]); write(";"); tempIndex++; } @@ -20881,14 +25581,14 @@ var ts; writeLine(); emitStart(p); write("if ("); - emitNode(p.name); + emitNodeWithoutSourceMap(p.name); write(" === void 0)"); emitEnd(p); write(" { "); emitStart(p); - emitNode(p.name); + emitNodeWithoutSourceMap(p.name); write(" = "); - emitNode(p.initializer); + emitNodeWithoutSourceMap(p.initializer); emitEnd(p); write("; }"); } @@ -20904,7 +25604,7 @@ var ts; emitLeadingComments(restParam); emitStart(restParam); write("var "); - emitNode(restParam.name); + emitNodeWithoutSourceMap(restParam.name); write(" = [];"); emitEnd(restParam); emitTrailingComments(restParam); @@ -20925,7 +25625,7 @@ var ts; increaseIndent(); writeLine(); emitStart(restParam); - emitNode(restParam.name); + emitNodeWithoutSourceMap(restParam.name); write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); emitEnd(restParam); decreaseIndent(); @@ -20943,7 +25643,7 @@ var ts; } function emitDeclarationName(node) { if (node.name) { - emitNode(node.name); + emitNodeWithoutSourceMap(node.name); } else { write(resolver.getGeneratedNameForNode(node)); @@ -21060,11 +25760,11 @@ var ts; emitFunctionBodyPreamble(node); var preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); - if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + if (preserveNewLines && !preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { write(" "); emitStart(body); write("return "); - emitNode(body, true); + emitWithoutComments(body); emitEnd(body); write(";"); emitTempDeclarations(false); @@ -21075,7 +25775,7 @@ var ts; writeLine(); emitLeadingComments(node.body); write("return "); - emit(node.body, true); + emitWithoutComments(node.body); write(";"); emitTrailingComments(node.body); emitTempDeclarations(true); @@ -21097,7 +25797,7 @@ var ts; emitFunctionBodyPreamble(node); decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; - if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { for (var i = 0, n = body.statements.length; i < n; i++) { write(" "); emit(body.statements[i]); @@ -21138,7 +25838,7 @@ var ts; emitStart(param); emitStart(param.name); write("this."); - emitNode(param.name); + emitNodeWithoutSourceMap(param.name); emitEnd(param.name); write(" = "); emit(param.name); @@ -21150,7 +25850,7 @@ var ts; function emitMemberAccessForPropertyName(memberName) { if (memberName.kind === 8 || memberName.kind === 7) { write("["); - emitNode(memberName); + emitNodeWithoutSourceMap(memberName); write("]"); } else if (memberName.kind === 126) { @@ -21158,7 +25858,7 @@ var ts; } else { write("."); - emitNode(memberName); + emitNodeWithoutSourceMap(memberName); } } function emitMemberAssignments(node, staticFlag) { @@ -21587,8 +26287,7 @@ var ts; emitImportDeclaration(node); return; } - if (resolver.isReferencedAliasDeclaration(node) || - (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + if (resolver.isReferencedAliasDeclaration(node) || (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); if (!(node.flags & 1)) @@ -21617,11 +26316,11 @@ var ts; emitStart(specifier); emitContainingModuleName(specifier); write("."); - emitNode(specifier.name); + emitNodeWithoutSourceMap(specifier.name); write(" = "); write(generatedName); write("."); - emitNode(specifier.propertyName || specifier.name); + emitNodeWithoutSourceMap(specifier.propertyName || specifier.name); write(";"); emitEnd(specifier); }); @@ -21639,15 +26338,15 @@ var ts; } } function createExternalImportInfo(node) { - if (node.kind === 202) { - if (node.moduleReference.kind === 212) { + if (node.kind === 203) { + if (node.moduleReference.kind === 213) { return { rootNode: node, declarationNode: node }; } } - else if (node.kind === 203) { + else if (node.kind === 204) { var importClause = node.importClause; if (importClause) { if (importClause.name) { @@ -21656,7 +26355,7 @@ var ts; declarationNode: importClause }; } - if (importClause.namedBindings.kind === 205) { + if (importClause.namedBindings.kind === 206) { return { rootNode: node, declarationNode: importClause.namedBindings @@ -21672,7 +26371,7 @@ var ts; rootNode: node }; } - else if (node.kind === 209) { + else if (node.kind === 210) { if (node.moduleSpecifier) { return { rootNode: node @@ -21685,7 +26384,7 @@ var ts; exportSpecifiers = {}; exportDefault = undefined; ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 209 && !node.moduleSpecifier) { + if (node.kind === 210 && !node.moduleSpecifier) { ts.forEach(node.exportClause.elements, function (specifier) { if (specifier.name.text === "default") { exportDefault = exportDefault || specifier; @@ -21694,7 +26393,7 @@ var ts; (exportSpecifiers[name] || (exportSpecifiers[name] = [])).push(specifier); }); } - else if (node.kind === 208) { + else if (node.kind === 209) { exportDefault = exportDefault || node; } else if (node.kind === 195 || node.kind === 196) { @@ -21724,7 +26423,7 @@ var ts; } function getFirstExportAssignment(sourceFile) { return ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 208) { + if (node.kind === 209) { return node; } }); @@ -21802,10 +26501,10 @@ var ts; writeLine(); emitStart(exportDefault); write(emitAsReturn ? "return " : "module.exports = "); - if (exportDefault.kind === 208) { + if (exportDefault.kind === 209) { emit(exportDefault.expression); } - else if (exportDefault.kind === 211) { + else if (exportDefault.kind === 212) { emit(exportDefault.propertyName); } else { @@ -21829,8 +26528,7 @@ var ts; } return statements.length; } - function emitSourceFile(node) { - currentSourceFile = node; + function emitSourceFileNode(node) { writeLine(); emitDetachedComments(node); var startIndex = emitDirectivePrologues(node.statements, false); @@ -21870,14 +26568,14 @@ var ts; } emitLeadingComments(node.endOfFileToken); } - function emitNode(node, disableComments) { + function emitNodeWithoutSourceMapWithComments(node) { if (!node) { return; } if (node.flags & 2) { return emitPinnedOrTripleSlashComments(node); } - var emitComments = !disableComments && shouldEmitLeadingAndTrailingComments(node); + var emitComments = shouldEmitLeadingAndTrailingComments(node); if (emitComments) { emitLeadingComments(node); } @@ -21886,14 +26584,23 @@ var ts; emitTrailingComments(node); } } + function emitNodeWithoutSourceMapWithoutComments(node) { + if (!node) { + return; + } + if (node.flags & 2) { + return emitPinnedOrTripleSlashComments(node); + } + emitJavaScriptWorker(node); + } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { case 197: case 195: + case 204: case 203: - case 202: case 198: - case 208: + case 209: return false; case 200: return shouldEmitModuleDeclaration(node); @@ -21948,9 +26655,9 @@ var ts; return emitArrayLiteral(node); case 152: return emitObjectLiteral(node); - case 217: - return emitPropertyAssignment(node); case 218: + return emitPropertyAssignment(node); + case 219: return emitShorthandPropertyAssignment(node); case 126: return emitComputedPropertyName(node); @@ -22019,8 +26726,8 @@ var ts; return emitWithStatement(node); case 188: return emitSwitchStatement(node); - case 213: case 214: + case 215: return emitCaseOrDefaultClause(node); case 189: return emitLabelledStatement(node); @@ -22028,7 +26735,7 @@ var ts; return emitThrowStatement(node); case 191: return emitTryStatement(node); - case 216: + case 217: return emitCatchClause(node); case 192: return emitDebuggerStatement(node); @@ -22040,18 +26747,18 @@ var ts; return emitInterfaceDeclaration(node); case 199: return emitEnumDeclaration(node); - case 219: + case 220: return emitEnumMember(node); case 200: return emitModuleDeclaration(node); - case 203: + case 204: return emitImportDeclaration(node); - case 202: + case 203: return emitImportEqualsDeclaration(node); - case 209: + case 210: return emitExportDeclaration(node); - case 220: - return emitSourceFile(node); + case 221: + return emitSourceFileNode(node); } } function hasDetachedComments(pos) { @@ -22069,7 +26776,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 220 || node.pos !== node.parent.pos) { + if (node.parent.kind === 221 || node.pos !== node.parent.pos) { var leadingComments; if (hasDetachedComments(node.pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -22088,7 +26795,7 @@ var ts; } function emitTrailingDeclarationComments(node) { if (node.parent) { - if (node.parent.kind === 220 || node.end !== node.parent.end) { + if (node.parent.kind === 221 || node.end !== node.parent.end) { var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); } @@ -22102,7 +26809,10 @@ var ts; else { leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); } - emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, { + pos: pos, + end: pos + }, leadingComments); emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitDetachedCommentsAtPosition(node) { @@ -22127,27 +26837,29 @@ var ts; if (nodeLine >= lastCommentLine + 2) { emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; + var currentDetachedCommentInfo = { + nodePos: node.pos, + detachedCommentEndPos: detachedComments[detachedComments.length - 1].end + }; if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); } else { - detachedCommentsInfo = [currentDetachedCommentInfo]; + detachedCommentsInfo = [ + currentDetachedCommentInfo + ]; } } } } } - function emitPinnedOrTripleSlashCommentsOfNode(node) { + function emitPinnedOrTripleSlashComments(node) { var pinnedComments = ts.filter(getLeadingCommentsToEmit(node), isPinnedOrTripleSlashComment); function isPinnedOrTripleSlashComment(comment) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && - currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { return true; } } @@ -22184,6 +26896,7 @@ var ts; (function (ts) { ts.emitTime = 0; ts.ioReadTime = 0; + ts.version = "1.5.0.0"; function createCompilerHost(options) { var currentDirectory; var existingDirectories = {}; @@ -22199,9 +26912,7 @@ var ts; } catch (e) { if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode - ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText - : e.message); + onError(e.number === unsupportedFileEncodingErrorCode ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText : e.message); } text = ""; } @@ -22237,12 +26948,20 @@ var ts; } return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + getDefaultLibFileName: function (options) { + return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); + }, writeFile: writeFile, - getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, - useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, + getCurrentDirectory: function () { + return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); + }, + useCaseSensitiveFileNames: function () { + return ts.sys.useCaseSensitiveFileNames; + }, getCanonicalFileName: getCanonicalFileName, - getNewLine: function () { return ts.sys.newLine; } + getNewLine: function () { + return ts.sys.newLine; + } }; } ts.createCompilerHost = createCompilerHost; @@ -22282,7 +27001,9 @@ var ts; var seenNoDefaultLib = options.noLib; var commonSourceDirectory; host = host || createCompilerHost(options); - ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + ts.forEach(rootNames, function (name) { + return processRootFile(name, false); + }); if (!seenNoDefaultLib) { processRootFile(host.getDefaultLibFileName(options), true); } @@ -22291,21 +27012,35 @@ var ts; var noDiagnosticsTypeChecker; program = { getSourceFile: getSourceFile, - getSourceFiles: function () { return files; }, - getCompilerOptions: function () { return options; }, + getSourceFiles: function () { + return files; + }, + getCompilerOptions: function () { + return options; + }, getSyntacticDiagnostics: getSyntacticDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, getDeclarationDiagnostics: getDeclarationDiagnostics, getTypeChecker: getTypeChecker, getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, - getCommonSourceDirectory: function () { return commonSourceDirectory; }, + getCommonSourceDirectory: function () { + return commonSourceDirectory; + }, emit: emit, getCurrentDirectory: host.getCurrentDirectory, - getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, - getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, - getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, - getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } + getNodeCount: function () { + return getDiagnosticsProducingTypeChecker().getNodeCount(); + }, + getIdentifierCount: function () { + return getDiagnosticsProducingTypeChecker().getIdentifierCount(); + }, + getSymbolCount: function () { + return getDiagnosticsProducingTypeChecker().getSymbolCount(); + }, + getTypeCount: function () { + return getDiagnosticsProducingTypeChecker().getTypeCount(); + } }; return program; function getEmitHost(writeFileCallback) { @@ -22332,7 +27067,11 @@ var ts; } function emit(sourceFile, writeFileCallback) { if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { - return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; + return { + diagnostics: [], + sourceMaps: undefined, + emitSkipped: true + }; } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); var start = new Date().getTime(); @@ -22474,7 +27213,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 203 || node.kind === 202 || node.kind === 209) { + if (node.kind === 204 || node.kind === 203 || node.kind === 210) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8) { var moduleNameText = moduleNameExpr.text; @@ -22496,8 +27235,7 @@ var ts; } else if (node.kind === 200 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && - ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { @@ -22525,19 +27263,17 @@ var ts; } return; } - var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); + var firstExternalModuleSourceFile = ts.forEach(files, function (f) { + return ts.isExternalModule(f) ? f : undefined; + }); if (firstExternalModuleSourceFile && !options.module) { var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } - if (options.outDir || - options.sourceRoot || - (options.mapRoot && - (!options.out || firstExternalModuleSourceFile !== undefined))) { + if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModuleSourceFile !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { - if (!(sourceFile.flags & 2048) - && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { + if (!(sourceFile.flags & 2048) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); sourcePathComponents.pop(); if (commonPathComponents) { @@ -22715,10 +27451,20 @@ var ts; description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, experimental: true }, + { + name: "preserveNewLines", + type: "boolean", + description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, + experimental: true + }, { name: "target", shortName: "t", - type: { "es3": 0, "es5": 1, "es6": 2 }, + type: { + "es3": 0, + "es5": 1, + "es6": 2 + }, description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, paramType: ts.Diagnostics.VERSION, error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6 @@ -22898,7 +27644,9 @@ var ts; var files = []; if (ts.hasProperty(json, "files")) { if (json["files"] instanceof Array) { - var files = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); + var files = ts.map(json["files"], function (s) { + return ts.combinePaths(basePath, s); + }); } } else { @@ -22948,14 +27696,7 @@ var ts; var parent = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent.kind === 179 || - parent.kind === 182 || - parent.kind === 183 || - parent.kind === 181 || - parent.kind === 178 || - parent.kind === 180 || - parent.kind === 187 || - parent.kind === 216) { + if (parent.kind === 179 || parent.kind === 182 || parent.kind === 183 || parent.kind === 181 || parent.kind === 178 || parent.kind === 180 || parent.kind === 187 || parent.kind === 217) { addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } @@ -22991,7 +27732,7 @@ var ts; case 197: case 199: case 152: - case 188: + case 202: var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); @@ -23042,7 +27783,13 @@ var ts; } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ + name: name, + fileName: fileName, + matchKind: matchKind, + isCaseSensitive: allMatchesAreCaseSensitive(matches), + declaration: declaration + }); } } }); @@ -23076,9 +27823,7 @@ var ts; return undefined; } function getTextOfIdentifierOrLiteral(node) { - if (node.kind === 64 || - node.kind === 8 || - node.kind === 7) { + if (node.kind === 64 || node.kind === 8 || node.kind === 7) { return node.text; } return undefined; @@ -23142,11 +27887,11 @@ var ts; } return bestMatchKind; } - var baseSensitivity = { sensitivity: "base" }; + var baseSensitivity = { + sensitivity: "base" + }; function compareNavigateToItems(i1, i2) { - return i1.matchKind - i2.matchKind || - i1.name.localeCompare(i2.name, undefined, baseSensitivity) || - i1.name.localeCompare(i2.name); + return i1.matchKind - i2.matchKind || i1.name.localeCompare(i2.name, undefined, baseSensitivity) || i1.name.localeCompare(i2.name); } function createNavigateToItem(rawItem) { var declaration = rawItem.declaration; @@ -23204,19 +27949,19 @@ var ts; case 149: ts.forEach(node.elements, visit); break; - case 209: + case 210: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 203: + case 204: var importClause = node.importClause; if (importClause) { if (importClause.name) { childNodes.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 205) { + if (importClause.namedBindings.kind === 206) { childNodes.push(importClause.namedBindings); } else { @@ -23236,9 +27981,9 @@ var ts; case 197: case 200: case 195: - case 202: - case 207: - case 211: + case 203: + case 208: + case 212: childNodes.push(node); break; } @@ -23296,7 +28041,9 @@ var ts; function isTopLevelFunctionDeclaration(functionDeclaration) { if (functionDeclaration.kind === 195) { if (functionDeclaration.body && functionDeclaration.body.kind === 174) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 195 && !isEmpty(s.name.text); })) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { + return s.kind === 195 && !isEmpty(s.name.text); + })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -23366,7 +28113,7 @@ var ts; return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); case 138: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 219: + case 220: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); case 136: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); @@ -23405,16 +28152,18 @@ var ts; } case 133: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 211: - case 207: - case 202: - case 204: + case 212: + case 208: + case 203: case 205: + case 206: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; function createItem(node, name, scriptElementKind) { - return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)]); + return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ]); } } function isEmpty(text) { @@ -23439,7 +28188,7 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 220: + case 221: return createSourceFileItem(node); case 196: return createClassItem(node); @@ -23468,12 +28217,16 @@ var ts; function createModuleItem(node) { var moduleName = getModuleName(node); var childItems = getItemsWorker(getChildNodes(getInnermostModule(node).body.statements), createChildItem); - return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ], childItems, getIndent(node)); } function createFunctionItem(node) { if (node.name && node.body && node.body.kind === 174) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ], childItems, getIndent(node)); } return undefined; } @@ -23483,10 +28236,10 @@ var ts; return undefined; } hasGlobalNode = true; - var rootName = ts.isExternalModule(node) - ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(node.fileName)))) + "\"" - : ""; - return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [getNodeSpan(node)], childItems); + var rootName = ts.isExternalModule(node) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(node.fileName)))) + "\"" : ""; + return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [ + getNodeSpan(node) + ], childItems); } function createClassItem(node) { if (!node.name) { @@ -23499,26 +28252,38 @@ var ts; }); var nodes = removeDynamicallyNamedProperties(node); if (constructor) { - nodes.push.apply(nodes, ts.filter(constructor.parameters, function (p) { return !ts.isBindingPattern(p.name); })); + nodes.push.apply(nodes, ts.filter(constructor.parameters, function (p) { + return !ts.isBindingPattern(p.name); + })); } var childItems = getItemsWorker(sortNodes(nodes), createChildItem); } - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ], childItems, getIndent(node)); } function createEnumItem(node) { var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ], childItems, getIndent(node)); } function createIterfaceItem(node) { var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [ + getNodeSpan(node) + ], childItems, getIndent(node)); } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 126; }); + return ts.filter(node.members, function (member) { + return member.name === undefined || member.name.kind !== 126; + }); } function removeDynamicallyNamedProperties(node) { - return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); + return ts.filter(node.members, function (member) { + return !ts.hasDynamicName(member); + }); } function getInnermostModule(node) { while (node.body.kind === 200) { @@ -23527,9 +28292,7 @@ var ts; return node; } function getNodeSpan(node) { - return node.kind === 220 - ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) - : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + return node.kind === 221 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } function getTextOfNode(node) { return ts.getTextOfNodeFromSourceText(sourceFile.text, node); @@ -23559,7 +28322,9 @@ var ts; var stringToWordSpans = {}; pattern = pattern.trim(); var fullPatternSegment = createSegment(pattern); - var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); + var dotSeparatedSegments = pattern.split(".").map(function (p) { + return createSegment(p.trim()); + }); var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); return { getMatches: getMatches, @@ -23667,7 +28432,9 @@ var ts; if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { var match = matchTextChunk(candidate, segment.totalTextChunk, false); if (match) { - return [match]; + return [ + match + ]; } } var subWordTextChunks = segment.subWordTextChunks; @@ -23734,8 +28501,7 @@ var ts; for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; if (gotOneMatchThisCandidate) { - if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || - !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { break; } } @@ -23756,10 +28522,7 @@ var ts; } ts.createPatternMatcher = createPatternMatcher; function patternMatchCompareTo(match1, match2) { - return compareType(match1, match2) || - compareCamelCase(match1, match2) || - compareCase(match1, match2) || - comparePunctuation(match1, match2); + return compareType(match1, match2) || compareCamelCase(match1, match2) || compareCase(match1, match2) || comparePunctuation(match1, match2); } function comparePunctuation(result1, result2) { if (result1.punctuationStripped !== result2.punctuationStripped) { @@ -23908,11 +28671,7 @@ var ts; var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); - if (charIsPunctuation(identifier.charCodeAt(i - 1)) || - charIsPunctuation(identifier.charCodeAt(i)) || - lastIsDigit != currentIsDigit || - hasTransitionFromLowerToUpper || - hasTransitionFromUpperToLower) { + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || charIsPunctuation(identifier.charCodeAt(i)) || lastIsDigit != currentIsDigit || hasTransitionFromLowerToUpper || hasTransitionFromUpperToLower) { if (!isAllPunctuation(identifier, wordStart, i)) { result.push(ts.createTextSpan(wordStart, i - wordStart)); } @@ -23964,8 +28723,7 @@ var ts; } function transitionFromUpperToLower(identifier, word, index, wordStart) { if (word) { - if (index != wordStart && - index + 1 < identifier.length) { + if (index != wordStart && index + 1 < identifier.length) { var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); if (currentIsUpper && nextIsLower) { @@ -23983,9 +28741,7 @@ var ts; function transitionFromLowerToUpper(identifier, word, index) { var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); - var transition = word - ? (currentIsUpper && !lastIsUpper) - : currentIsUpper; + var transition = word ? (currentIsUpper && !lastIsUpper) : currentIsUpper; return transition; } })(ts || (ts = {})); @@ -24021,8 +28777,7 @@ var ts; function getImmediatelyContainingArgumentInfo(node) { if (node.parent.kind === 155 || node.parent.kind === 156) { var callExpression = node.parent; - if (node.kind === 24 || - node.kind === 16) { + if (node.kind === 24 || node.kind === 16) { var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; ts.Debug.assert(list !== undefined); @@ -24031,15 +28786,15 @@ var ts; invocation: callExpression, argumentsSpan: getApplicableSpanForArguments(list), argumentIndex: 0, - argumentCount: getCommaBasedArgCount(list) + argumentCount: getArgumentCount(list) }; } var listItemInfo = ts.findListItemInfo(node); if (listItemInfo) { var list = listItemInfo.list; var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; - var argumentIndex = (listItemInfo.listItemIndex + 1) >> 1; - var argumentCount = getCommaBasedArgCount(list); + var argumentIndex = getArgumentIndex(list, node); + var argumentCount = getArgumentCount(list); ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); return { kind: isTypeArgList ? 0 : 1, @@ -24076,10 +28831,29 @@ var ts; } return undefined; } - function getCommaBasedArgCount(argumentsList) { - return argumentsList.getChildCount() === 0 - ? 0 - : 1 + ts.countWhere(argumentsList.getChildren(), function (arg) { return arg.kind === 23; }); + function getArgumentIndex(argumentsList, node) { + var argumentIndex = 0; + var listChildren = argumentsList.getChildren(); + for (var i = 0, n = listChildren.length; i < n; i++) { + var child = listChildren[i]; + if (child === node) { + break; + } + if (child.kind !== 23) { + argumentIndex++; + } + } + return argumentIndex; + } + function getArgumentCount(argumentsList) { + var listChildren = argumentsList.getChildren(); + var argumentCount = ts.countWhere(listChildren, function (arg) { + return arg.kind !== 23; + }); + if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 23) { + argumentCount++; + } + return argumentCount; } function getArgumentIndexForTemplatePiece(spanIndex, node) { ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); @@ -24092,9 +28866,7 @@ var ts; return spanIndex + 1; } function getArgumentListInfoForTemplate(tagExpression, argumentIndex) { - var argumentCount = tagExpression.template.kind === 10 - ? 1 - : tagExpression.template.templateSpans.length + 1; + var argumentCount = tagExpression.template.kind === 10 ? 1 : tagExpression.template.templateSpans.length + 1; ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); return { kind: 2, @@ -24122,7 +28894,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 220; n = n.parent) { + for (var n = node; n.kind !== 221; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -24199,7 +28971,10 @@ var ts; isVariadic: candidateSignature.hasRestParameter, prefixDisplayParts: prefixDisplayParts, suffixDisplayParts: suffixDisplayParts, - separatorDisplayParts: [ts.punctuationPart(23), ts.spacePart()], + separatorDisplayParts: [ + ts.punctuationPart(23), + ts.spacePart() + ], parameters: signatureHelpParameters, documentation: candidateSignature.getDocumentationComment() }; @@ -24308,24 +29083,31 @@ var ts; } ts.findListItemInfo = findListItemInfo; function findChildOfKind(n, kind, sourceFile) { - return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; }); + return ts.forEach(n.getChildren(sourceFile), function (c) { + return c.kind === kind && c; + }); } ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 221 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 222 && c.pos <= node.pos && c.end >= node.end) { return c; } }); + ts.Debug.assert(!syntaxList || ts.contains(syntaxList.getChildren(), node)); return syntaxList; } ts.findContainingList = findContainingList; function getTouchingWord(sourceFile, position) { - return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }); + return getTouchingToken(sourceFile, position, function (n) { + return isWord(n.kind); + }); } ts.getTouchingWord = getTouchingWord; function getTouchingPropertyName(sourceFile, position) { - return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }); + return getTouchingToken(sourceFile, position, function (n) { + return isPropertyName(n.kind); + }); } ts.getTouchingPropertyName = getTouchingPropertyName; function getTouchingToken(sourceFile, position, includeItemAtEndPosition) { @@ -24379,8 +29161,7 @@ var ts; var children = n.getChildren(); for (var i = 0, len = children.length; i < len; ++i) { var child = children[i]; - var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || - (child.pos === previousToken.end); + var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { return find(child); } @@ -24418,7 +29199,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 220); + ts.Debug.assert(startNode !== undefined || n.kind === 221); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -24483,8 +29264,7 @@ var ts; } ts.isPunctuation = isPunctuation; function isInsideTemplateLiteral(node, position) { - return ts.isTemplateLiteralKind(node.kind) - && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); + return ts.isTemplateLiteralKind(node.kind) && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); } ts.isInsideTemplateLiteral = isInsideTemplateLiteral; function compareDataObjects(dst, src) { @@ -24517,19 +29297,38 @@ var ts; var indent; resetWriter(); return { - displayParts: function () { return displayParts; }, - writeKeyword: function (text) { return writeKind(text, 5); }, - writeOperator: function (text) { return writeKind(text, 12); }, - writePunctuation: function (text) { return writeKind(text, 15); }, - writeSpace: function (text) { return writeKind(text, 16); }, - writeStringLiteral: function (text) { return writeKind(text, 8); }, - writeParameter: function (text) { return writeKind(text, 13); }, + displayParts: function () { + return displayParts; + }, + writeKeyword: function (text) { + return writeKind(text, 5); + }, + writeOperator: function (text) { + return writeKind(text, 12); + }, + writePunctuation: function (text) { + return writeKind(text, 15); + }, + writeSpace: function (text) { + return writeKind(text, 16); + }, + writeStringLiteral: function (text) { + return writeKind(text, 8); + }, + writeParameter: function (text) { + return writeKind(text, 13); + }, writeSymbol: writeSymbol, writeLine: writeLine, - increaseIndent: function () { indent++; }, - decreaseIndent: function () { indent--; }, + increaseIndent: function () { + indent++; + }, + decreaseIndent: function () { + indent--; + }, clear: resetWriter, - trackSymbol: function () { } + trackSymbol: function () { + } }; function writeIndent() { if (lineStart) { @@ -24690,7 +29489,9 @@ var ts; advance: advance, readTokenInfo: readTokenInfo, isOnToken: isOnToken, - lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, + lastTrailingTriviaWasNewLine: function () { + return wasNewLine; + }, close: function () { lastTokenInfo = undefined; scanner.setText(undefined); @@ -24751,8 +29552,7 @@ var ts; return container.kind === 9; } function shouldRescanTemplateToken(container) { - return container.kind === 12 || - container.kind === 13; + return container.kind === 12 || container.kind === 13; } function startsWithSlashToken(t) { return t === 36 || t === 56; @@ -24765,13 +29565,7 @@ var ts; token: undefined }; } - var expectedScanAction = shouldRescanGreaterThanToken(n) - ? 1 - : shouldRescanSlashToken(n) - ? 2 - : shouldRescanTemplateToken(n) - ? 3 - : 0; + var expectedScanAction = shouldRescanGreaterThanToken(n) ? 1 : shouldRescanSlashToken(n) ? 2 : shouldRescanTemplateToken(n) ? 3 : 0; if (lastTokenInfo && expectedScanAction === lastScanAction) { return fixTokenKind(lastTokenInfo, n); } @@ -24951,9 +29745,7 @@ var ts; this.Flag = Flag; } Rule.prototype.toString = function () { - return "[desc=" + this.Descriptor + "," + - "operation=" + this.Operation + "," + - "flag=" + this.Flag + "]"; + return "[desc=" + this.Descriptor + "," + "operation=" + this.Operation + "," + "flag=" + this.Flag + "]"; }; return Rule; })(); @@ -24983,8 +29775,7 @@ var ts; this.RightTokenRange = RightTokenRange; } RuleDescriptor.prototype.toString = function () { - return "[leftRange=" + this.LeftTokenRange + "," + - "rightRange=" + this.RightTokenRange + "]"; + return "[leftRange=" + this.LeftTokenRange + "," + "rightRange=" + this.RightTokenRange + "]"; }; RuleDescriptor.create1 = function (left, right) { return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right)); @@ -25024,8 +29815,7 @@ var ts; this.Action = null; } RuleOperation.prototype.toString = function () { - return "[context=" + this.Context + "," + - "action=" + this.Action + "]"; + return "[context=" + this.Context + "," + "action=" + this.Action + "]"; }; RuleOperation.create1 = function (action) { return RuleOperation.create2(formatting.RuleOperationContext.Any, action); @@ -25091,7 +29881,12 @@ var ts; this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(15, 75), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(15, 99), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.FromTokens([17, 19, 23, 22])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.FromTokens([ + 17, + 19, + 23, + 22 + ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); @@ -25100,9 +29895,19 @@ var ts; this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([64, 3]); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([ + 64, + 3 + ]); this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([17, 3, 74, 95, 80, 75]); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([ + 17, + 3, + 74, + 95, + 80, + 75 + ]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(14, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); @@ -25121,79 +29926,151 @@ var ts; this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(34, 34), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(34, 39), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([97, 93, 87, 73, 89, 96]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([104, 69]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ + 97, + 93, + 87, + 73, + 89, + 96 + ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ + 104, + 69 + ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(82, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(98, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2)); this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(89, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([17, 74, 75, 66]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([95, 80]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([115, 119]), 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ + 17, + 74, + 75, + 66 + ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ + 95, + 80 + ]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ + 115, + 119 + ]), 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(113, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([116, 117]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([68, 114, 76, 77, 78, 115, 102, 84, 103, 116, 106, 108, 119, 109]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([78, 102])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ + 116, + 117 + ]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ + 68, + 114, + 76, + 77, + 78, + 115, + 102, + 84, + 103, + 116, + 106, + 108, + 119, + 109 + ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([ + 78, + 102 + ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(8, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(32, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(21, 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.FromTokens([17, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.FromTokens([ + 17, + 23 + ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(17, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.TypeNames), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); - this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([16, 18, 25, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([ + 16, + 18, + 25, + 23 + ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8)); - this.HighPriorityCommonRules = - [ - this.IgnoreBeforeComment, this.IgnoreAfterLineComment, - this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, - this.NoSpaceAfterQuestionMark, - this.NoSpaceBeforeDot, this.NoSpaceAfterDot, - this.NoSpaceAfterUnaryPrefixOperator, - this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, - this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, - this.SpaceAfterPostincrementWhenFollowedByAdd, - this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, - this.SpaceAfterPostdecrementWhenFollowedBySubtract, - this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, - this.NoSpaceAfterCloseBrace, - this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, - this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, - this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, - this.NoSpaceBetweenReturnAndSemicolon, - this.SpaceAfterCertainKeywords, - this.SpaceAfterLetConstInVariableDeclaration, - this.NoSpaceBeforeOpenParenInFuncCall, - this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, - this.SpaceAfterVoidOperator, - this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, - this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, - this.SpaceAfterModuleName, - this.SpaceAfterArrow, - this.NoSpaceAfterEllipsis, - this.NoSpaceAfterOptionalParameters, - this.NoSpaceBetweenEmptyInterfaceBraceBrackets, - this.NoSpaceBeforeOpenAngularBracket, - this.NoSpaceBetweenCloseParenAndAngularBracket, - this.NoSpaceAfterOpenAngularBracket, - this.NoSpaceBeforeCloseAngularBracket, - this.NoSpaceAfterCloseAngularBracket - ]; - this.LowPriorityCommonRules = - [ - this.NoSpaceBeforeSemicolon, - this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, - this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket, - this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket, - this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, - this.SpaceBetweenStatements, this.SpaceAfterTryFinally - ]; + this.HighPriorityCommonRules = [ + this.IgnoreBeforeComment, + this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, + this.SpaceAfterColon, + this.NoSpaceBeforeQuestionMark, + this.SpaceAfterQuestionMarkInConditionalOperator, + this.NoSpaceAfterQuestionMark, + this.NoSpaceBeforeDot, + this.NoSpaceAfterDot, + this.NoSpaceAfterUnaryPrefixOperator, + this.NoSpaceAfterUnaryPreincrementOperator, + this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, + this.NoSpaceBeforeUnaryPostdecrementOperator, + this.SpaceAfterPostincrementWhenFollowedByAdd, + this.SpaceAfterAddWhenFollowedByUnaryPlus, + this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterPostdecrementWhenFollowedBySubtract, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, + this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.NoSpaceAfterCloseBrace, + this.SpaceAfterOpenBrace, + this.SpaceBeforeCloseBrace, + this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, + this.SpaceBetweenCloseBraceAndElse, + this.SpaceBetweenCloseBraceAndWhile, + this.NoSpaceBetweenEmptyBraceBrackets, + this.SpaceAfterFunctionInFuncDecl, + this.NewLineAfterOpenBraceInBlockContext, + this.SpaceAfterGetSetInMember, + this.NoSpaceBetweenReturnAndSemicolon, + this.SpaceAfterCertainKeywords, + this.SpaceAfterLetConstInVariableDeclaration, + this.NoSpaceBeforeOpenParenInFuncCall, + this.SpaceBeforeBinaryKeywordOperator, + this.SpaceAfterBinaryKeywordOperator, + this.SpaceAfterVoidOperator, + this.NoSpaceAfterConstructor, + this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, + this.SpaceBeforeCertainTypeScriptKeywords, + this.SpaceAfterModuleName, + this.SpaceAfterArrow, + this.NoSpaceAfterEllipsis, + this.NoSpaceAfterOptionalParameters, + this.NoSpaceBetweenEmptyInterfaceBraceBrackets, + this.NoSpaceBeforeOpenAngularBracket, + this.NoSpaceBetweenCloseParenAndAngularBracket, + this.NoSpaceAfterOpenAngularBracket, + this.NoSpaceBeforeCloseAngularBracket, + this.NoSpaceAfterCloseAngularBracket + ]; + this.LowPriorityCommonRules = [ + this.NoSpaceBeforeSemicolon, + this.SpaceBeforeOpenBraceInControl, + this.SpaceBeforeOpenBraceInFunction, + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.NoSpaceBeforeComma, + this.NoSpaceBeforeOpenBracket, + this.NoSpaceAfterOpenBracket, + this.NoSpaceBeforeCloseBracket, + this.NoSpaceAfterCloseBracket, + this.SpaceAfterSemicolon, + this.NoSpaceBeforeOpenParenInFuncDecl, + this.SpaceBetweenStatements, + this.SpaceAfterTryFinally + ]; this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); @@ -25235,10 +30112,10 @@ var ts; case 167: case 168: return true; - case 202: + case 203: case 193: case 128: - case 219: + case 220: case 130: case 129: return context.currentTokenSpan.kind === 52 || context.nextTokenSpan.kind === 52; @@ -25281,7 +30158,7 @@ var ts; } switch (node.kind) { case 174: - case 188: + case 202: case 152: case 201: return true; @@ -25324,7 +30201,7 @@ var ts; case 200: case 199: case 174: - case 216: + case 217: case 201: case 188: return true; @@ -25342,7 +30219,7 @@ var ts; case 191: case 179: case 187: - case 216: + case 217: return true; default: return false; @@ -25367,8 +30244,7 @@ var ts; return context.TokensAreOnSameLine(); }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 194 && - context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; + return context.currentTokenParent.kind === 194 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind != 2; @@ -25402,8 +30278,7 @@ var ts; } }; Rules.IsTypeArgumentOrParameterContext = function (context) { - return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || - Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); + return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsVoidOpContext = function (context) { return context.currentTokenSpan.kind === 98 && context.currentTokenParent.kind === 164; @@ -25446,8 +30321,7 @@ var ts; }; RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) { var _this = this; - var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && - rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; + var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) { rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) { var rulesBucketIndex = _this.GetRuleBucketIndex(left, right); @@ -25521,19 +30395,13 @@ var ts; RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) { var position; if (rule.Operation.Action == 1) { - position = specificTokens ? - 0 : - RulesPosition.IgnoreRulesAny; + position = specificTokens ? 0 : RulesPosition.IgnoreRulesAny; } else if (!rule.Operation.Context.IsAny()) { - position = specificTokens ? - RulesPosition.ContextRulesSpecific : - RulesPosition.ContextRulesAny; + position = specificTokens ? RulesPosition.ContextRulesSpecific : RulesPosition.ContextRulesAny; } else { - position = specificTokens ? - RulesPosition.NoContextRulesSpecific : - RulesPosition.NoContextRulesAny; + position = specificTokens ? RulesPosition.NoContextRulesSpecific : RulesPosition.NoContextRulesAny; } var state = constructionState[rulesBucketIndex]; if (state === undefined) { @@ -25590,7 +30458,9 @@ var ts; this.token = token; } TokenSingleValueAccess.prototype.GetTokens = function () { - return [this.token]; + return [ + this.token + ]; }; TokenSingleValueAccess.prototype.Contains = function (tokenValue) { return tokenValue == this.token; @@ -25644,18 +30514,68 @@ var ts; return this.tokenAccess.toString(); }; TokenRange.Any = TokenRange.AllTokens(); - TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); + TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([ + 3 + ])); TokenRange.Keywords = TokenRange.FromRange(65, 124); TokenRange.BinaryOperators = TokenRange.FromRange(24, 63); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([85, 86, 124]); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([38, 39, 47, 46]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7, 64, 16, 18, 14, 92, 87]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); - TokenRange.Comments = TokenRange.FromTokens([2, 3]); - TokenRange.TypeNames = TokenRange.FromTokens([64, 118, 120, 112, 121, 98, 111]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([ + 85, + 86, + 124 + ]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([ + 38, + 39, + 47, + 46 + ]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([ + 7, + 64, + 16, + 18, + 14, + 92, + 87 + ]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([ + 64, + 16, + 92, + 87 + ]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([ + 64, + 17, + 19, + 87 + ]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([ + 64, + 16, + 92, + 87 + ]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([ + 64, + 17, + 19, + 87 + ]); + TokenRange.Comments = TokenRange.FromTokens([ + 2, + 3 + ]); + TokenRange.TypeNames = TokenRange.FromTokens([ + 64, + 118, + 120, + 112, + 121, + 98, + 111 + ]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -25804,16 +30724,11 @@ var ts; } function findOutermostParent(position, expectedTokenKind, sourceFile) { var precedingToken = ts.findPrecedingToken(position, sourceFile); - if (!precedingToken || - precedingToken.kind !== expectedTokenKind || - position !== precedingToken.getEnd()) { + if (!precedingToken || precedingToken.kind !== expectedTokenKind || position !== precedingToken.getEnd()) { return undefined; } var current = precedingToken; - while (current && - current.parent && - current.parent.end === precedingToken.end && - !isListElement(current.parent, current)) { + while (current && current.parent && current.parent.end === precedingToken.end && !isListElement(current.parent, current)) { current = current.parent; } return current; @@ -25826,11 +30741,11 @@ var ts; case 200: var body = parent.body; return body && body.kind === 174 && ts.rangeContainsRange(body.statements, node); - case 220: + case 221: case 174: case 201: return ts.rangeContainsRange(parent.statements, node); - case 216: + case 217: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -25838,7 +30753,9 @@ var ts; function findEnclosingNode(range, sourceFile) { return find(sourceFile); function find(n) { - var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; }); + var candidate = ts.forEachChild(n, function (c) { + return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; + }); if (candidate) { var result = find(candidate); if (result) { @@ -25852,9 +30769,11 @@ var ts; if (!errors.length) { return rangeHasNoErrors; } - var sorted = errors - .filter(function (d) { return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); }) - .sort(function (e1, e2) { return e1.start - e2.start; }); + var sorted = errors.filter(function (d) { + return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); + }).sort(function (e1, e2) { + return e1.start - e2.start; + }); if (!sorted.length) { return rangeHasNoErrors; } @@ -25948,10 +30867,7 @@ var ts; var indentation = inheritedIndentation; if (indentation === -1) { if (isSomeBlock(node.kind)) { - if (isSomeBlock(parent.kind) || - parent.kind === 220 || - parent.kind === 213 || - parent.kind === 214) { + if (isSomeBlock(parent.kind) || parent.kind === 221 || parent.kind === 214 || parent.kind === 215) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -26000,8 +30916,12 @@ var ts; return nodeStartLine !== line ? indentation + delta : indentation; } }, - getIndentation: function () { return indentation; }, - getDelta: function () { return delta; }, + getIndentation: function () { + return indentation; + }, + getDelta: function () { + return delta; + }, recomputeIndentation: function (lineAdded) { if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent.kind, node.kind)) { if (lineAdded) { @@ -26194,8 +31114,7 @@ var ts; trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { - lineAdded = - processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); + lineAdded = processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); } } previousRange = range; @@ -26223,9 +31142,7 @@ var ts; dynamicIndentation.recomputeIndentation(true); } } - trimTrailingWhitespaces = - (rule.Operation.Action & (4 | 2)) && - rule.Flag !== 1; + trimTrailingWhitespaces = (rule.Operation.Action & (4 | 2)) && rule.Flag !== 1; } else { trimTrailingWhitespaces = true; @@ -26262,10 +31179,16 @@ var ts; var startPos = commentRange.pos; for (var line = startLine; line < endLine; ++line) { var endOfLine = ts.getEndLinePosition(line, sourceFile); - parts.push({ pos: startPos, end: endOfLine }); + parts.push({ + pos: startPos, + end: endOfLine + }); startPos = ts.getStartPositionOfLine(line + 1, sourceFile); } - parts.push({ pos: startPos, end: commentRange.end }); + parts.push({ + pos: startPos, + end: commentRange.end + }); } var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options); @@ -26280,9 +31203,7 @@ var ts; var delta = indentation - nonWhitespaceColumnInFirstPart.column; for (var i = startIndex, len = parts.length; i < len; ++i, ++startLine) { var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); - var nonWhitespaceCharacterAndColumn = i === 0 - ? nonWhitespaceColumnInFirstPart - : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); + var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); var newIndentation = nonWhitespaceCharacterAndColumn.column + delta; if (newIndentation > 0) { var indentationString = getIndentationString(newIndentation, options); @@ -26311,7 +31232,10 @@ var ts; } } function newTextChange(start, len, newText) { - return { span: ts.createTextSpan(start, len), newText: newText }; + return { + span: ts.createTextSpan(start, len), + newText: newText + }; } function recordDelete(start, len) { if (len) { @@ -26465,12 +31389,7 @@ var ts; if (!precedingToken) { return 0; } - var precedingTokenIsLiteral = precedingToken.kind === 8 || - precedingToken.kind === 9 || - precedingToken.kind === 10 || - precedingToken.kind === 11 || - precedingToken.kind === 12 || - precedingToken.kind === 13; + var precedingTokenIsLiteral = precedingToken.kind === 8 || precedingToken.kind === 9 || precedingToken.kind === 10 || precedingToken.kind === 11 || precedingToken.kind === 12 || precedingToken.kind === 13; if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } @@ -26530,8 +31449,7 @@ var ts; } } parentStart = getParentStart(parent, current, sourceFile); - var parentAndChildShareLine = parentStart.line === currentStart.line || - childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); + var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); if (useActualIndentation) { var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); if (actualIndentation !== -1) { @@ -26564,8 +31482,7 @@ var ts; } } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { - var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 220 || !parentAndChildShareLine); + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && (parent.kind === 221 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -26605,8 +31522,7 @@ var ts; if (node.parent) { switch (node.parent.kind) { case 139: - if (node.parent.typeArguments && - ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { + if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; @@ -26622,8 +31538,7 @@ var ts; case 136: case 137: var start = node.getStart(sourceFile); - if (node.parent.typeParameters && - ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { + if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { return node.parent.typeParameters; } if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { @@ -26633,12 +31548,10 @@ var ts; case 156: case 155: var start = node.getStart(sourceFile); - if (node.parent.typeArguments && - ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { + if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { return node.parent.typeArguments; } - if (node.parent.arguments && - ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { + if (node.parent.arguments && ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { return node.parent.arguments; } break; @@ -26690,7 +31603,10 @@ var ts; } character++; } - return { column: column, character: character }; + return { + column: column, + character: character + }; } SmartIndenter.findFirstNonWhitespaceCharacterAndColumn = findFirstNonWhitespaceCharacterAndColumn; function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { @@ -26707,15 +31623,15 @@ var ts; case 201: case 152: case 143: - case 188: + case 202: + case 215: case 214: - case 213: case 159: case 155: case 156: case 175: case 193: - case 208: + case 209: case 186: case 168: return true; @@ -26771,9 +31687,9 @@ var ts; case 152: case 174: case 201: - case 188: + case 202: return nodeEndsWith(n, 15, sourceFile); - case 216: + case 217: return isCompletedNode(n.block, sourceFile); case 159: case 136: @@ -26797,9 +31713,15 @@ var ts; return isCompletedNode(n.expression, sourceFile); case 151: return nodeEndsWith(n, 19, sourceFile); - case 213: case 214: + case 215: return false; + case 181: + return isCompletedNode(n.statement, sourceFile); + case 182: + return isCompletedNode(n.statement, sourceFile); + case 183: + return isCompletedNode(n.statement, sourceFile); case 180: return isCompletedNode(n.statement, sourceFile); case 179: @@ -26898,7 +31820,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(221, nodes.pos, nodes.end, 1024, this); + var list = createNode(222, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; for (var i = 0, len = nodes.length; i < len; i++) { @@ -27067,10 +31989,7 @@ var ts; return pos; } function isName(pos, end, sourceFile, name) { - return pos + name.length < end && - sourceFile.text.substr(pos, name.length) === name && - (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || - ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); + return pos + name.length < end && sourceFile.text.substr(pos, name.length) === name && (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); } function isParamTag(pos, end, sourceFile) { return isName(pos, end, sourceFile, paramTag); @@ -27286,7 +32205,9 @@ var ts; }; SignatureObject.prototype.getDocumentationComment = function () { if (this.documentationComment === undefined) { - this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration], undefined, false) : []; + this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([ + this.declaration + ], undefined, false) : []; } return this.documentationComment; }; @@ -27320,9 +32241,7 @@ var ts; case 131: var functionDeclaration = node; if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) { - var lastDeclaration = namedDeclarations.length > 0 ? - namedDeclarations[namedDeclarations.length - 1] : - undefined; + var lastDeclaration = namedDeclarations.length > 0 ? namedDeclarations[namedDeclarations.length - 1] : undefined; if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) { if (functionDeclaration.body && !lastDeclaration.body) { namedDeclarations[namedDeclarations.length - 1] = functionDeclaration; @@ -27339,12 +32258,12 @@ var ts; case 198: case 199: case 200: - case 202: - case 211: - case 207: - case 202: - case 204: + case 203: + case 212: + case 208: + case 203: case 205: + case 206: case 134: case 135: case 143: @@ -27374,24 +32293,24 @@ var ts; ts.forEachChild(node.name, visit); break; } - case 219: + case 220: case 130: case 129: namedDeclarations.push(node); break; - case 209: + case 210: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 203: + case 204: var importClause = node.importClause; if (importClause) { if (importClause.name) { namedDeclarations.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 205) { + if (importClause.namedBindings.kind === 206) { namedDeclarations.push(importClause.namedBindings); } else { @@ -27536,7 +32455,9 @@ var ts; ts.ClassificationTypeNames = ClassificationTypeNames; function displayPartsToString(displayParts) { if (displayParts) { - return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(""); + return ts.map(displayParts, function (displayPart) { + return displayPart.text; + }).join(""); } return ""; } @@ -27553,7 +32474,7 @@ var ts; return false; } for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { - if (parent.kind === 220 || parent.kind === 201) { + if (parent.kind === 221 || parent.kind === 201) { return false; } } @@ -27713,7 +32634,9 @@ var ts; return bucket; } function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === '_'; }).map(function (name) { + var bucketInfoArray = Object.keys(buckets).filter(function (name) { + return name && name.charAt(0) === '_'; + }).map(function (name) { var entries = ts.lookUp(buckets, name); var sourceFiles = []; for (var i in entries) { @@ -27724,7 +32647,9 @@ var ts; references: entry.owners.slice(0) }); } - sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); + sourceFiles.sort(function (x, y) { + return y.refCount - x.refCount; + }); return { bucket: name, sourceFiles: sourceFiles @@ -27913,7 +32838,11 @@ var ts; processImport(); } processTripleSlashDirectives(); - return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib }; + return { + referencedFiles: referencedFiles, + importedFiles: importedFiles, + isLibFile: isNoDefaultLib + }; } ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { @@ -27926,14 +32855,10 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 64 && - (node.parent.kind === 185 || node.parent.kind === 184) && - node.parent.label === node; + return node.kind === 64 && (node.parent.kind === 185 || node.parent.kind === 184) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 64 && - node.parent.kind === 189 && - node.parent.label === node; + return node.kind === 64 && node.parent.kind === 189 && node.parent.label === node; } function isLabeledBy(node, labelName) { for (var owner = node.parent; owner.kind === 189; owner = owner.parent) { @@ -27968,20 +32893,18 @@ var ts; return node.parent.kind === 200 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 64 && - ts.isFunctionLike(node.parent) && node.parent.name === node; + return node.kind === 64 && ts.isFunctionLike(node.parent) && node.parent.name === node; } function isNameOfPropertyAssignment(node) { - return (node.kind === 64 || node.kind === 8 || node.kind === 7) && - (node.parent.kind === 217 || node.parent.kind === 218) && node.parent.name === node; + return (node.kind === 64 || node.kind === 8 || node.kind === 7) && (node.parent.kind === 218 || node.parent.kind === 219) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 || node.kind === 7) { switch (node.parent.kind) { case 130: case 129: - case 217: - case 219: + case 218: + case 220: case 132: case 131: case 134: @@ -27996,15 +32919,12 @@ var ts; } function isNameOfExternalModuleImportOrDeclaration(node) { if (node.kind === 8) { - return isNameOfModuleDeclaration(node) || - (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); + return isNameOfModuleDeclaration(node) || (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); } return false; } function isInsideComment(sourceFile, token, position) { - return position <= token.getStart(sourceFile) && - (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || - isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); + return position <= token.getStart(sourceFile) && (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); function isInsideCommentRange(comments) { return ts.forEach(comments, function (comment) { if (comment.pos < position && position < comment.end) { @@ -28017,8 +32937,7 @@ var ts; return true; } else { - return !(text.charCodeAt(comment.end - 1) === 47 && - text.charCodeAt(comment.end - 2) === 42); + return !(text.charCodeAt(comment.end - 1) === 47 && text.charCodeAt(comment.end - 2) === 42); } } return false; @@ -28055,7 +32974,7 @@ var ts; return undefined; } switch (node.kind) { - case 220: + case 221: case 132: case 131: case 195: @@ -28073,38 +32992,49 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 200: return ScriptElementKind.moduleElement; - case 196: return ScriptElementKind.classElement; - case 197: return ScriptElementKind.interfaceElement; - case 198: return ScriptElementKind.typeElement; - case 199: return ScriptElementKind.enumElement; + case 200: + return ScriptElementKind.moduleElement; + case 196: + return ScriptElementKind.classElement; + case 197: + return ScriptElementKind.interfaceElement; + case 198: + return ScriptElementKind.typeElement; + case 199: + return ScriptElementKind.enumElement; case 193: - return ts.isConst(node) - ? ScriptElementKind.constElement - : ts.isLet(node) - ? ScriptElementKind.letElement - : ScriptElementKind.variableElement; - case 195: return ScriptElementKind.functionElement; - case 134: return ScriptElementKind.memberGetAccessorElement; - case 135: return ScriptElementKind.memberSetAccessorElement; + return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; + case 195: + return ScriptElementKind.functionElement; + case 134: + return ScriptElementKind.memberGetAccessorElement; + case 135: + return ScriptElementKind.memberSetAccessorElement; case 132: case 131: return ScriptElementKind.memberFunctionElement; case 130: case 129: return ScriptElementKind.memberVariableElement; - case 138: return ScriptElementKind.indexSignatureElement; - case 137: return ScriptElementKind.constructSignatureElement; - case 136: return ScriptElementKind.callSignatureElement; - case 133: return ScriptElementKind.constructorImplementationElement; - case 127: return ScriptElementKind.typeParameterElement; - case 219: return ScriptElementKind.variableElement; - case 128: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 202: - case 207: - case 204: - case 211: + case 138: + return ScriptElementKind.indexSignatureElement; + case 137: + return ScriptElementKind.constructSignatureElement; + case 136: + return ScriptElementKind.callSignatureElement; + case 133: + return ScriptElementKind.constructorImplementationElement; + case 127: + return ScriptElementKind.typeParameterElement; + case 220: + return ScriptElementKind.variableElement; + case 128: + return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 203: + case 208: case 205: + case 212: + case 206: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -28155,13 +33085,26 @@ var ts; var changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { getSourceFile: getOrCreateSourceFile, - getCancellationToken: function () { return cancellationToken; }, - getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); }, - useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, - getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, - getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, - writeFile: function (fileName, data, writeByteOrderMark) { }, - getCurrentDirectory: function () { return host.getCurrentDirectory(); } + getCancellationToken: function () { + return cancellationToken; + }, + getCanonicalFileName: function (fileName) { + return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); + }, + useCaseSensitiveFileNames: function () { + return useCaseSensitivefileNames; + }, + getNewLine: function () { + return host.getNewLine ? host.getNewLine() : "\r\n"; + }, + getDefaultLibFileName: function (options) { + return host.getDefaultLibFileName(options); + }, + writeFile: function (fileName, data, writeByteOrderMark) { + }, + getCurrentDirectory: function () { + return host.getCurrentDirectory(); + } }); if (program) { var oldSourceFiles = program.getSourceFiles(); @@ -28248,8 +33191,7 @@ var ts; if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { return undefined; } - if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && - (firstCharCode === 39 || firstCharCode === 34)) { + if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && (firstCharCode === 39 || firstCharCode === 34)) { displayName = displayName.substring(1, displayName.length - 1); } var isValid = ts.isIdentifierStart(displayName.charCodeAt(0), target); @@ -28365,11 +33307,11 @@ var ts; getCompletionEntriesFromSymbols(filteredMembers, activeCompletionSession); } } - else if (ts.getAncestor(previousToken, 204)) { + else if (ts.getAncestor(previousToken, 205)) { isMemberCompletion = true; isNewIdentifierLocation = true; if (showCompletionsInImportsClause(previousToken)) { - var importDeclaration = ts.getAncestor(previousToken, 203); + var importDeclaration = ts.getAncestor(previousToken, 204); ts.Debug.assert(importDeclaration !== undefined); var exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); var filteredExports = filterModuleExports(exports, importDeclaration); @@ -28410,16 +33352,14 @@ var ts; } function isCompletionListBlocker(previousToken) { var start = new Date().getTime(); - var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || - isIdentifierDefinitionLocation(previousToken) || - isRightOfIllegalDot(previousToken); + var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); return result; } function showCompletionsInImportsClause(node) { if (node) { if (node.kind === 14 || node.kind === 23) { - return node.parent.kind === 206; + return node.parent.kind === 207; } } return false; @@ -28429,16 +33369,9 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 155 - || containingNodeKind === 133 - || containingNodeKind === 156 - || containingNodeKind === 151 - || containingNodeKind === 167; + return containingNodeKind === 155 || containingNodeKind === 133 || containingNodeKind === 156 || containingNodeKind === 151 || containingNodeKind === 167; case 16: - return containingNodeKind === 155 - || containingNodeKind === 133 - || containingNodeKind === 156 - || containingNodeKind === 159; + return containingNodeKind === 155 || containingNodeKind === 133 || containingNodeKind === 156 || containingNodeKind === 159; case 18: return containingNodeKind === 151; case 116: @@ -28448,8 +33381,7 @@ var ts; case 14: return containingNodeKind === 196; case 52: - return containingNodeKind === 193 - || containingNodeKind === 167; + return containingNodeKind === 193 || containingNodeKind === 167; case 11: return containingNodeKind === 169; case 12: @@ -28469,9 +33401,7 @@ var ts; return false; } function isInStringOrRegularExpressionOrTemplateLiteral(previousToken) { - if (previousToken.kind === 8 - || previousToken.kind === 9 - || ts.isTemplateLiteralKind(previousToken.kind)) { + if (previousToken.kind === 8 || previousToken.kind === 9 || ts.isTemplateLiteralKind(previousToken.kind)) { var start = previousToken.getStart(); var end = previousToken.getEnd(); if (start < position && position < end) { @@ -28518,43 +33448,23 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 193 || - containingNodeKind === 194 || - containingNodeKind === 175 || - containingNodeKind === 199 || - isFunction(containingNodeKind) || - containingNodeKind === 196 || - containingNodeKind === 195 || - containingNodeKind === 197 || - containingNodeKind === 149 || - containingNodeKind === 148; + return containingNodeKind === 193 || containingNodeKind === 194 || containingNodeKind === 175 || containingNodeKind === 199 || isFunction(containingNodeKind) || containingNodeKind === 196 || containingNodeKind === 195 || containingNodeKind === 197 || containingNodeKind === 149 || containingNodeKind === 148; case 20: return containingNodeKind === 149; case 18: return containingNodeKind === 149; case 16: - return containingNodeKind === 216 || - isFunction(containingNodeKind); + return containingNodeKind === 217 || isFunction(containingNodeKind); case 14: - return containingNodeKind === 199 || - containingNodeKind === 197 || - containingNodeKind === 143 || - containingNodeKind === 148; + return containingNodeKind === 199 || containingNodeKind === 197 || containingNodeKind === 143 || containingNodeKind === 148; case 22: - return containingNodeKind === 129 && - (previousToken.parent.parent.kind === 197 || - previousToken.parent.parent.kind === 143); + return containingNodeKind === 129 && (previousToken.parent.parent.kind === 197 || previousToken.parent.parent.kind === 143); case 24: - return containingNodeKind === 196 || - containingNodeKind === 195 || - containingNodeKind === 197 || - isFunction(containingNodeKind); + return containingNodeKind === 196 || containingNodeKind === 195 || containingNodeKind === 197 || isFunction(containingNodeKind); case 109: return containingNodeKind === 130; case 21: - return containingNodeKind === 128 || - containingNodeKind === 133 || - (previousToken.parent.parent.kind === 149); + return containingNodeKind === 128 || containingNodeKind === 133 || (previousToken.parent.parent.kind === 149); case 108: case 106: case 107: @@ -28599,8 +33509,7 @@ var ts; if (!importDeclaration.importClause) { return exports; } - if (importDeclaration.importClause.namedBindings && - importDeclaration.importClause.namedBindings.kind === 206) { + if (importDeclaration.importClause.namedBindings && importDeclaration.importClause.namedBindings.kind === 207) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { var name = el.propertyName || el.name; exisingImports[name.text] = true; @@ -28609,7 +33518,9 @@ var ts; if (ts.isEmpty(exisingImports)) { return exports; } - return ts.filter(exports, function (e) { return !ts.lookUp(exisingImports, e.name); }); + return ts.filter(exports, function (e) { + return !ts.lookUp(exisingImports, e.name); + }); } function filterContextualMembersList(contextualMemberSymbols, existingMembers) { if (!existingMembers || existingMembers.length === 0) { @@ -28617,7 +33528,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 217 && m.kind !== 218) { + if (m.kind !== 218 && m.kind !== 219) { return; } if (m.getStart() <= position && position <= m.getEnd()) { @@ -28659,7 +33570,9 @@ var ts; name: entryName, kind: ScriptElementKind.keyword, kindModifiers: ScriptElementKindModifier.none, - displayParts: [ts.displayPart(entryName, 5)], + displayParts: [ + ts.displayPart(entryName, 5) + ], documentation: undefined }; } @@ -28757,9 +33670,7 @@ var ts; return ScriptElementKind.unknown; } function getSymbolModifiers(symbol) { - return symbol && symbol.declarations && symbol.declarations.length > 0 - ? ts.getNodeModifiers(symbol.declarations[0]) - : ScriptElementKindModifier.none; + return symbol && symbol.declarations && symbol.declarations.length > 0 ? ts.getNodeModifiers(symbol.declarations[0]) : ScriptElementKindModifier.none; } function getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, enclosingDeclaration, typeResolver, location, semanticMeaning) { if (semanticMeaning === void 0) { semanticMeaning = getMeaningFromLocation(location); } @@ -28842,8 +33753,7 @@ var ts; hasAddedSymbolInfo = true; } } - else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || - (location.kind === 113 && location.parent.kind === 133)) { + else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || (location.kind === 113 && location.parent.kind === 133)) { var signature; var functionDeclaration = location.parent; var allSignatures = functionDeclaration.kind === 133 ? type.getConstructSignatures() : type.getCallSignatures(); @@ -28858,8 +33768,7 @@ var ts; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 136 && - !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 136 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); hasAddedSymbolInfo = true; @@ -28935,7 +33844,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 219) { + if (declaration.kind === 220) { var constantValue = typeResolver.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -28951,7 +33860,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 202) { + if (declaration.kind === 203) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -28979,9 +33888,7 @@ var ts; if (symbolKind !== ScriptElementKind.unknown) { if (type) { addPrefixForAnyFunctionOrVar(symbol, symbolKind); - if (symbolKind === ScriptElementKind.memberVariableElement || - symbolFlags & 3 || - symbolKind === ScriptElementKind.localVariableElement) { + if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 || symbolKind === ScriptElementKind.localVariableElement) { displayParts.push(ts.punctuationPart(51)); displayParts.push(ts.spacePart()); if (type.symbol && type.symbol.flags & 262144) { @@ -28994,12 +33901,7 @@ var ts; displayParts.push.apply(displayParts, ts.typeToDisplayParts(typeResolver, type, enclosingDeclaration)); } } - else if (symbolFlags & 16 || - symbolFlags & 8192 || - symbolFlags & 16384 || - symbolFlags & 131072 || - symbolFlags & 98304 || - symbolKind === ScriptElementKind.memberFunctionElement) { + else if (symbolFlags & 16 || symbolFlags & 8192 || symbolFlags & 16384 || symbolFlags & 131072 || symbolFlags & 98304 || symbolKind === ScriptElementKind.memberFunctionElement) { var allSignatures = type.getCallSignatures(); addSignatureDisplayParts(allSignatures[0], allSignatures); } @@ -29012,7 +33914,11 @@ var ts; if (!documentation) { documentation = symbol.getDocumentationComment(); } - return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; + return { + displayParts: displayParts, + documentation: documentation, + symbolKind: symbolKind + }; function addNewLineIfDisplayPartsExist() { if (displayParts.length) { displayParts.push(ts.lineBreakPart()); @@ -29099,20 +34005,26 @@ var ts; if (isJumpStatementTarget(node)) { var labelName = node.text; var label = getTargetLabel(node.parent, node.text); - return label ? [getDefinitionInfo(label, ScriptElementKind.label, labelName, undefined)] : undefined; + return label ? [ + getDefinitionInfo(label, ScriptElementKind.label, labelName, undefined) + ] : undefined; } - var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); + var comment = ts.forEach(sourceFile.referencedFiles, function (r) { + return (r.pos <= position && position < r.end) ? r : undefined; + }); if (comment) { var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); if (referenceFile) { - return [{ + return [ + { fileName: referenceFile.fileName, textSpan: ts.createTextSpanFromBounds(0, 0), kind: ScriptElementKind.scriptElement, name: comment.fileName, containerName: undefined, containerKind: undefined - }]; + } + ]; } return undefined; } @@ -29127,7 +34039,7 @@ var ts; } } var result = []; - if (node.parent.kind === 218) { + if (node.parent.kind === 219) { var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); var shorthandDeclarations = shorthandSymbol.getDeclarations(); var shorthandSymbolKind = getSymbolKind(shorthandSymbol, typeInfoResolver, node); @@ -29143,8 +34055,7 @@ var ts; var symbolKind = getSymbolKind(symbol, typeInfoResolver, node); var containerSymbol = symbol.parent; var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : ""; - if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && - !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { + if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { ts.forEach(declarations, function (declaration) { result.push(getDefinitionInfo(declaration, symbolKind, symbolName, containerName)); }); @@ -29164,8 +34075,7 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 133) || - (!selectConstructors && (d.kind === 195 || d.kind === 132 || d.kind === 131))) { + if ((selectConstructors && d.kind === 133) || (!selectConstructors && (d.kind === 195 || d.kind === 132 || d.kind === 131))) { declarations.push(d); if (d.body) definition = d; @@ -29205,9 +34115,10 @@ var ts; if (!node) { return undefined; } - if (node.kind === 64 || node.kind === 92 || node.kind === 90 || - isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { - return getReferencesForNode(node, [sourceFile], true, false, false); + if (node.kind === 64 || node.kind === 92 || node.kind === 90 || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + return getReferencesForNode(node, [ + sourceFile + ], true, false, false); } switch (node.kind) { case 83: @@ -29244,8 +34155,8 @@ var ts; break; case 66: case 72: - if (hasKind(parent(parent(node)), 188)) { - return getSwitchCaseDefaultOccurrences(node.parent.parent); + if (hasKind(parent(parent(parent(node))), 188)) { + return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 65: @@ -29255,9 +34166,7 @@ var ts; } break; case 81: - if (hasKind(node.parent, 181) || - hasKind(node.parent, 182) || - hasKind(node.parent, 183)) { + if (hasKind(node.parent, 181) || hasKind(node.parent, 182) || hasKind(node.parent, 183)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -29278,8 +34187,7 @@ var ts; return getGetAndSetOccurrences(node.parent); } default: - if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 175)) { + if (ts.isModifier(node.kind) && node.parent && (ts.isDeclaration(node.parent) || node.parent.kind === 175)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -29388,7 +34296,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 220) { + if (ts.isFunctionBlock(parent) || parent.kind === 221) { return parent; } if (parent.kind === 191) { @@ -29436,7 +34344,7 @@ var ts; function getSwitchCaseDefaultOccurrences(switchStatement) { var keywords = []; pushKeywordIf(keywords, switchStatement.getFirstToken(), 91); - ts.forEach(switchStatement.clauses, function (clause) { + ts.forEach(switchStatement.caseBlock.clauses, function (clause) { pushKeywordIf(keywords, clause.getFirstToken(), 66, 72); var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); ts.forEach(breaksAndContinues, function (statement) { @@ -29524,15 +34432,16 @@ var ts; function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 115, 119); }); + ts.forEach(accessor.getChildren(), function (child) { + return pushKeywordIf(keywords, child, 115, 119); + }); } } } function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (declaration.flags & 112) { - if (!(container.kind === 196 || - (declaration.kind === 128 && hasKind(container, 133)))) { + if (!(container.kind === 196 || (declaration.kind === 128 && hasKind(container, 133)))) { return undefined; } } @@ -29542,7 +34451,7 @@ var ts; } } else if (declaration.flags & (1 | 2)) { - if (!(container.kind === 201 || container.kind === 220)) { + if (!(container.kind === 201 || container.kind === 221)) { return undefined; } } @@ -29554,7 +34463,7 @@ var ts; var nodes; switch (container.kind) { case 201: - case 220: + case 221: nodes = container.statements; break; case 133: @@ -29576,7 +34485,9 @@ var ts; } ts.forEach(nodes, function (node) { if (node.modifiers && node.flags & modifierFlag) { - ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); + ts.forEach(node.modifiers, function (child) { + return pushKeywordIf(keywords, child, modifier); + }); } }); return ts.map(keywords, getReferenceEntryFromNode); @@ -29630,9 +34541,7 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 64 && - !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && - !isNameOfExternalModuleImportOrDeclaration(node)) { + if (node.kind !== 64 && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } ts.Debug.assert(node.kind === 64 || node.kind === 7 || node.kind === 8); @@ -29642,7 +34551,9 @@ var ts; if (isLabelName(node)) { if (isJumpStatementTarget(node)) { var labelDefinition = getTargetLabel(node.parent, node.text); - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [getReferenceEntryFromNode(node)]; + return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [ + getReferenceEntryFromNode(node) + ]; } else { return getLabelReferencesInNode(node.parent, node); @@ -29656,7 +34567,9 @@ var ts; } var symbol = typeInfoResolver.getSymbolAtLocation(node); if (!symbol) { - return [getReferenceEntryFromNode(node)]; + return [ + getReferenceEntryFromNode(node) + ]; } var declarations = symbol.declarations; if (!declarations || !declarations.length) { @@ -29690,17 +34603,17 @@ var ts; } return result; function isImportOrExportSpecifierName(location) { - return location.parent && - (location.parent.kind === 207 || location.parent.kind === 211) && - location.parent.propertyName === location; + return location.parent && (location.parent.kind === 208 || location.parent.kind === 212) && location.parent.propertyName === location; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 207 || declaration.kind === 211; + return declaration.kind === 208 || declaration.kind === 212; }); } function getDeclaredName(symbol, location) { - var functionExpression = ts.forEach(symbol.declarations, function (d) { return d.kind === 160 ? d : undefined; }); + var functionExpression = ts.forEach(symbol.declarations, function (d) { + return d.kind === 160 ? d : undefined; + }); if (functionExpression && functionExpression.name) { var name = functionExpression.name.text; } @@ -29714,7 +34627,9 @@ var ts; if (isImportOrExportSpecifierName(location)) { return location.getText(); } - var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 160 ? d : undefined; }); + var functionExpression = ts.forEach(declarations, function (d) { + return d.kind === 160 ? d : undefined; + }); if (functionExpression && functionExpression.name) { var name = functionExpression.name.text; } @@ -29733,7 +34648,9 @@ var ts; } function getSymbolScope(symbol) { if (symbol.flags & (4 | 8192)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { + return (d.flags & 32) ? d : undefined; + }); if (privateDeclaration) { return ts.getAncestor(privateDeclaration, 196); } @@ -29755,7 +34672,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 220 && !ts.isExternalModule(container)) { + if (container.kind === 221 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -29777,8 +34694,7 @@ var ts; if (position > end) break; var endPosition = position + symbolNameLength; - if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && - (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { positions.push(position); } position = text.indexOf(symbolName, position + symbolNameLength + 1); @@ -29796,8 +34712,7 @@ var ts; if (!node || node.getWidth() !== labelName.length) { return; } - if (node === targetLabel || - (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { + if (node === targetLabel || (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { result.push(getReferenceEntryFromNode(node)); } }); @@ -29809,8 +34724,7 @@ var ts; case 64: return node.getWidth() === searchSymbolName.length; case 8: - if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || - isNameOfExternalModuleImportOrDeclaration(node)) { + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { return node.getWidth() === searchSymbolName.length + 2; } break; @@ -29833,8 +34747,7 @@ var ts; cancellationToken.throwIfCancellationRequested(); var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); if (!isValidReferencePosition(referenceLocation, searchText)) { - if ((findInStrings && isInString(position)) || - (findInComments && isInComment(position))) { + if ((findInStrings && isInString(position)) || (findInComments && isInComment(position))) { result.push({ fileName: sourceFile.fileName, textSpan: ts.createTextSpan(position, searchText.length), @@ -29932,7 +34845,7 @@ var ts; staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 220: + case 221: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } @@ -29943,7 +34856,7 @@ var ts; return undefined; } var result = []; - if (searchSpaceNode.kind === 220) { + if (searchSpaceNode.kind === 221) { ts.forEach(sourceFiles, function (sourceFile) { var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, result); @@ -29981,8 +34894,8 @@ var ts; result.push(getReferenceEntryFromNode(node)); } break; - case 220: - if (container.kind === 220 && !ts.isExternalModule(container)) { + case 221: + if (container.kind === 221 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -29991,7 +34904,9 @@ var ts; } } function populateSearchSymbolSet(symbol, location) { - var result = [symbol]; + var result = [ + symbol + ]; if (isImportOrExportSpecifierImportSymbol(symbol)) { result.push(typeInfoResolver.getAliasedSymbol(symbol)); } @@ -30044,13 +34959,14 @@ var ts; if (searchSymbols.indexOf(referenceSymbol) >= 0) { return true; } - if (isImportOrExportSpecifierImportSymbol(referenceSymbol) && - searchSymbols.indexOf(typeInfoResolver.getAliasedSymbol(referenceSymbol)) >= 0) { + if (isImportOrExportSpecifierImportSymbol(referenceSymbol) && searchSymbols.indexOf(typeInfoResolver.getAliasedSymbol(referenceSymbol)) >= 0) { return true; } if (isNameOfPropertyAssignment(referenceLocation)) { return ts.forEach(getPropertySymbolsFromContextualType(referenceLocation), function (contextualSymbol) { - return ts.forEach(typeInfoResolver.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0; }); + return ts.forEach(typeInfoResolver.getRootSymbols(contextualSymbol), function (s) { + return searchSymbols.indexOf(s) >= 0; + }); }); } return ts.forEach(typeInfoResolver.getRootSymbols(referenceSymbol), function (rootSymbol) { @@ -30060,7 +34976,9 @@ var ts; if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { var result = []; getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); - return ts.forEach(result, function (s) { return searchSymbols.indexOf(s) >= 0; }); + return ts.forEach(result, function (s) { + return searchSymbols.indexOf(s) >= 0; + }); } return false; }); @@ -30074,7 +34992,9 @@ var ts; if (contextualType.flags & 16384) { var unionProperty = contextualType.getProperty(name); if (unionProperty) { - return [unionProperty]; + return [ + unionProperty + ]; } else { var result = []; @@ -30090,7 +35010,9 @@ var ts; else { var symbol = contextualType.getProperty(name); if (symbol) { - return [symbol]; + return [ + symbol + ]; } } } @@ -30146,7 +35068,9 @@ var ts; return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); } function containErrors(diagnostics) { - return ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1; }); + return ts.forEach(diagnostics, function (diagnostic) { + return diagnostic.category === 1; + }); } function getEmitOutput(fileName) { synchronizeHostData(); @@ -30172,9 +35096,9 @@ var ts; case 150: case 130: case 129: - case 217: case 218: case 219: + case 220: case 132: case 131: case 133: @@ -30183,7 +35107,7 @@ var ts; case 195: case 160: case 161: - case 216: + case 217: return 1; case 127: case 197: @@ -30203,14 +35127,14 @@ var ts; else { return 4; } - case 206: case 207: - case 202: - case 203: case 208: + case 203: + case 204: case 209: + case 210: return 1 | 2 | 4; - case 220: + case 221: return 4 | 1; } return 1 | 2 | 4; @@ -30240,15 +35164,13 @@ var ts; } function getMeaningFromRightHandSideOfImportEquals(node) { ts.Debug.assert(node.kind === 64); - if (node.parent.kind === 125 && - node.parent.right === node && - node.parent.parent.kind === 202) { + if (node.parent.kind === 125 && node.parent.right === node && node.parent.parent.kind === 203) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 208) { + if (node.parent.kind === 209) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -30301,8 +35223,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 200 && - nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + if (nodeForStartPos.parent.parent.kind === 200 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } else { @@ -30349,8 +35270,7 @@ var ts; } } else if (flags & 1536) { - if (meaningAtPosition & 4 || - (meaningAtPosition & 1 && hasValueSideModule(symbol))) { + if (meaningAtPosition & 4 || (meaningAtPosition & 1 && hasValueSideModule(symbol))) { return ClassificationTypeNames.moduleName; } } @@ -30475,16 +35395,11 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 52) { - if (token.parent.kind === 193 || - token.parent.kind === 130 || - token.parent.kind === 128) { + if (token.parent.kind === 193 || token.parent.kind === 130 || token.parent.kind === 128) { return ClassificationTypeNames.operator; } } - if (token.parent.kind === 167 || - token.parent.kind === 165 || - token.parent.kind === 166 || - token.parent.kind === 168) { + if (token.parent.kind === 167 || token.parent.kind === 165 || token.parent.kind === 166 || token.parent.kind === 168) { return ClassificationTypeNames.operator; } } @@ -30582,14 +35497,22 @@ var ts; return result; function getMatchingTokenKind(token) { switch (token.kind) { - case 14: return 15; - case 16: return 17; - case 18: return 19; - case 24: return 25; - case 15: return 14; - case 17: return 16; - case 19: return 18; - case 25: return 24; + case 14: + return 15; + case 16: + return 17; + case 18: + return 19; + case 24: + return 25; + case 15: + return 14; + case 17: + return 16; + case 19: + return 18; + case 25: + return 24; } return undefined; } @@ -30670,7 +35593,9 @@ var ts; var multiLineCommentStart = /(?:\/\*+\s*)/.source; var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; - var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; + var literals = "(?:" + ts.map(descriptors, function (d) { + return "(" + escapeRegExp(d.text) + ")"; + }).join("|") + ")"; var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; var messageRemainder = /(?:.*?)/.source; var messagePortion = "(" + literals + messageRemainder + ")"; @@ -30678,9 +35603,7 @@ var ts; return new RegExp(regExpString, "gim"); } function isLetterOrDigit(char) { - return (char >= 97 && char <= 122) || - (char >= 65 && char <= 90) || - (char >= 48 && char <= 57); + return (char >= 97 && char <= 122) || (char >= 65 && char <= 90) || (char >= 48 && char <= 57); } } function getRenameInfo(fileName, position) { @@ -30781,9 +35704,7 @@ var ts; break; case 8: case 7: - if (ts.isDeclarationName(node) || - node.parent.kind === 212 || - isArgumentOfElementAccessExpression(node)) { + if (ts.isDeclarationName(node) || node.parent.kind === 213 || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } break; @@ -30793,10 +35714,7 @@ var ts; } } function isArgumentOfElementAccessExpression(node) { - return node && - node.parent && - node.parent.kind === 154 && - node.parent.argumentExpression === node; + return node && node.parent && node.parent.kind === 154 && node.parent.argumentExpression === node; } function createClassifier() { var scanner = ts.createScanner(2, false); @@ -30825,10 +35743,7 @@ var ts; } function canFollow(keyword1, keyword2) { if (isAccessibilityModifier(keyword1)) { - if (keyword2 === 115 || - keyword2 === 119 || - keyword2 === 113 || - keyword2 === 109) { + if (keyword2 === 115 || keyword2 === 119 || keyword2 === 113 || keyword2 === 109) { return true; } return false; @@ -30886,18 +35801,13 @@ var ts; else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { token = 64; } - else if (lastNonTriviaToken === 64 && - token === 24) { + else if (lastNonTriviaToken === 64 && token === 24) { angleBracketStack++; } else if (token === 25 && angleBracketStack > 0) { angleBracketStack--; } - else if (token === 111 || - token === 120 || - token === 118 || - token === 112 || - token === 121) { + else if (token === 111 || token === 120 || token === 118 || token === 112 || token === 121) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { token = 64; } @@ -30948,9 +35858,7 @@ var ts; } if (numBackslashes & 1) { var quoteChar = tokenText.charCodeAt(0); - result.finalLexState = quoteChar === 34 - ? 3 - : 2; + result.finalLexState = quoteChar === 34 ? 3 : 2; } } } @@ -30982,7 +35890,10 @@ var ts; if (result.entries.length === 0) { length -= offset; } - result.entries.push({ length: length, classification: classification }); + result.entries.push({ + length: length, + classification: classification + }); } } } @@ -31077,7 +35988,9 @@ var ts; return 5; } } - return { getClassificationsForLine: getClassificationsForLine }; + return { + getClassificationsForLine: getClassificationsForLine + }; } ts.createClassifier = createClassifier; function getDefaultLibFilePath(options) { @@ -31092,7 +36005,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 220 ? new SourceFileObject() : new NodeObject(); + var proto = kind === 221 ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; @@ -31101,9 +36014,15 @@ var ts; Node.prototype = proto; return Node; }, - getSymbolConstructor: function () { return SymbolObject; }, - getTypeConstructor: function () { return TypeObject; }, - getSignatureConstructor: function () { return SignatureObject; } + getSymbolConstructor: function () { + return SymbolObject; + }, + getTypeConstructor: function () { + return TypeObject; + }, + getSignatureConstructor: function () { + return SignatureObject; + } }; } initializeServices(); @@ -31183,7 +36102,7 @@ var ts; } case 201: return spanInBlock(node); - case 216: + case 217: return spanInBlock(node.block); case 177: return textSpan(node.expression); @@ -31209,20 +36128,20 @@ var ts; return textSpan(node, ts.findNextToken(node.expression, node)); case 188: return textSpan(node, ts.findNextToken(node.expression, node)); - case 213: case 214: + case 215: return spanInNode(node.statements[0]); case 191: return spanInBlock(node.tryBlock); case 190: return textSpan(node, node.expression); - case 208: - return textSpan(node, node.expression); - case 202: - return textSpan(node, node.moduleReference); - case 203: - return textSpan(node, node.moduleSpecifier); case 209: + return textSpan(node, node.expression); + case 203: + return textSpan(node, node.moduleReference); + case 204: + return textSpan(node, node.moduleSpecifier); + case 210: return textSpan(node, node.moduleSpecifier); case 200: if (ts.getModuleInstanceState(node) !== 1) { @@ -31230,7 +36149,7 @@ var ts; } case 196: case 199: - case 219: + case 220: case 155: case 156: return textSpan(node); @@ -31264,7 +36183,7 @@ var ts; case 80: return spanInNextNode(node); default: - if (node.parent.kind === 217 && node.parent.name === node) { + if (node.parent.kind === 218 && node.parent.name === node) { return spanInNode(node.parent.initializer); } if (node.parent.kind === 158 && node.parent.type === node) { @@ -31277,17 +36196,12 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 182 || - variableDeclaration.parent.parent.kind === 183) { + if (variableDeclaration.parent.parent.kind === 182 || variableDeclaration.parent.parent.kind === 183) { return spanInNode(variableDeclaration.parent.parent); } var isParentVariableStatement = variableDeclaration.parent.parent.kind === 175; var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 181 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); - var declarations = isParentVariableStatement - ? variableDeclaration.parent.parent.declarationList.declarations - : isDeclarationOfForStatement - ? variableDeclaration.parent.parent.initializer.declarations - : undefined; + var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement ? variableDeclaration.parent.parent.initializer.declarations : undefined; if (variableDeclaration.initializer || (variableDeclaration.flags & 1)) { if (declarations && declarations[0] === variableDeclaration) { if (isParentVariableStatement) { @@ -31308,8 +36222,7 @@ var ts; } } function canHaveSpanInParameterDeclaration(parameter) { - return !!parameter.initializer || parameter.dotDotDotToken !== undefined || - !!(parameter.flags & 16) || !!(parameter.flags & 32); + return !!parameter.initializer || parameter.dotDotDotToken !== undefined || !!(parameter.flags & 16) || !!(parameter.flags & 32); } function spanInParameterDeclaration(parameter) { if (canHaveSpanInParameterDeclaration(parameter)) { @@ -31327,8 +36240,7 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 1) || - (functionDeclaration.parent.kind === 196 && functionDeclaration.kind !== 133); + return !!(functionDeclaration.flags & 1) || (functionDeclaration.parent.kind === 196 && functionDeclaration.kind !== 133); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -31389,8 +36301,8 @@ var ts; case 196: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 188: - return spanInNodeIfStartsOnSameLine(node.parent, node.parent.clauses[0]); + case 202: + return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } @@ -31407,12 +36319,12 @@ var ts; if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 216: + case 217: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 188: - var switchStatement = node.parent; - var lastClause = switchStatement.clauses[switchStatement.clauses.length - 1]; + case 202: + var caseBlock = node.parent; + var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; if (lastClause) { return spanInNode(lastClause.statements[lastClause.statements.length - 1]); } @@ -31447,7 +36359,7 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isFunctionLike(node.parent) || node.parent.kind === 217) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 218) { return spanInPreviousNode(node); } return spanInNode(node.parent); @@ -31580,15 +36492,21 @@ var ts; function forwardJSONCall(logger, actionDescription, action) { try { var result = simpleForwardCall(logger, actionDescription, action); - return JSON.stringify({ result: result }); + return JSON.stringify({ + result: result + }); } catch (err) { if (err instanceof ts.OperationCanceledException) { - return JSON.stringify({ canceled: true }); + return JSON.stringify({ + canceled: true + }); } logInternalError(logger, err); err.description = actionDescription; - return JSON.stringify({ error: err }); + return JSON.stringify({ + error: err + }); } } var ShimBase = (function () { @@ -31638,7 +36556,9 @@ var ts; LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) { var _this = this; var newLine = this.getNewLine(); - return diagnostics.map(function (d) { return _this.realizeDiagnostic(d, newLine); }); + return diagnostics.map(function (d) { + return _this.realizeDiagnostic(d, newLine); + }); }; LanguageServiceShimObject.prototype.realizeDiagnostic = function (diagnostic, newLine) { return { diff --git a/bin/typescriptServices_internal.d.ts b/bin/typescriptServices_internal.d.ts index 2cd2257c3e1..a899c1e240b 100644 --- a/bin/typescriptServices_internal.d.ts +++ b/bin/typescriptServices_internal.d.ts @@ -171,6 +171,7 @@ declare module ts { function unescapeIdentifier(identifier: string): string; function makeIdentifierFromModuleName(moduleName: string): string; function isBlockOrCatchScoped(declaration: Declaration): boolean; + function getEnclosingBlockScopeContainer(node: Node): Node; function isCatchClauseVariableDeclaration(declaration: Declaration): boolean; function declarationNameToString(name: DeclarationName): string; function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic; @@ -270,7 +271,6 @@ declare module ts { function nodeIsSynthesized(node: Node): boolean; function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node; function generateUniqueName(baseName: string, isExistingName: (name: string) => boolean): string; - function createDiagnosticCollection(): DiagnosticCollection; /** * Based heavily on the abstract 'Quote'/'QuoteJSONString' operation from ECMA-262 (24.3.2.2), * but augmented for a few select characters (e.g. lineSeparator, paragraphSeparator, nextLine) diff --git a/bin/typescript_internal.d.ts b/bin/typescript_internal.d.ts index e2e18df5726..d01fe853505 100644 --- a/bin/typescript_internal.d.ts +++ b/bin/typescript_internal.d.ts @@ -171,6 +171,7 @@ declare module "typescript" { function unescapeIdentifier(identifier: string): string; function makeIdentifierFromModuleName(moduleName: string): string; function isBlockOrCatchScoped(declaration: Declaration): boolean; + function getEnclosingBlockScopeContainer(node: Node): Node; function isCatchClauseVariableDeclaration(declaration: Declaration): boolean; function declarationNameToString(name: DeclarationName): string; function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic; @@ -270,7 +271,6 @@ declare module "typescript" { function nodeIsSynthesized(node: Node): boolean; function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node; function generateUniqueName(baseName: string, isExistingName: (name: string) => boolean): string; - function createDiagnosticCollection(): DiagnosticCollection; /** * Based heavily on the abstract 'Quote'/'QuoteJSONString' operation from ECMA-262 (24.3.2.2), * but augmented for a few select characters (e.g. lineSeparator, paragraphSeparator, nextLine) From 6565c4bea1163b8247b02b30b588127d6803129a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 08:58:18 -0700 Subject: [PATCH 046/101] Use for-of in the parser. --- src/compiler/parser.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 6e444eb23c7..3fcd5fd9fda 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -27,8 +27,8 @@ module ts { function visitEachNode(cbNode: (node: Node) => T, nodes: Node[]) { if (nodes) { - for (var i = 0, len = nodes.length; i < len; i++) { - var result = cbNode(nodes[i]); + for (let node of nodes) { + var result = cbNode(node); if (result) { return result; } @@ -436,8 +436,8 @@ module ts { array.pos += delta; array.end += delta; - for (var i = 0, n = array.length; i < n; i++) { - visitNode(array[i]); + for (let node of array) { + visitNode(node); } } } @@ -589,8 +589,8 @@ module ts { // Adjust the pos or end (or both) of the intersecting array accordingly. adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var i = 0, n = array.length; i < n; i++) { - visitNode(array[i]); + for (let node of array) { + visitNode(node); } return; } @@ -948,7 +948,7 @@ module ts { if (position >= array.pos && position < array.end) { // position was in this array. Search through this array to see if we find a // viable element. - for (var i = 0, n = array.length; i < n; i++) { + for (let i = 0, n = array.length; i < n; i++) { var child = array[i]; if (child) { if (child.pos === position) { From 31b066ec1719e0f0cb636185b3fef7ee7fce6510 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 09:03:31 -0700 Subject: [PATCH 047/101] Use for-of in core.ts --- src/compiler/core.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 463473497cb..0b296233f70 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -25,7 +25,7 @@ module ts { export function forEach(array: T[], callback: (element: T, index: number) => U): U { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (let i = 0, len = array.length; i < len; i++) { var result = callback(array[i], i); if (result) { return result; @@ -37,8 +37,8 @@ module ts { export function contains(array: T[], value: T): boolean { if (array) { - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { + for (let v of array) { + if (v === value) { return true; } } @@ -60,8 +60,8 @@ module ts { export function countWhere(array: T[], predicate: (x: T) => boolean): number { var count = 0; if (array) { - for (var i = 0, len = array.length; i < len; i++) { - if (predicate(array[i])) { + for (let v of array) { + if (predicate(v)) { count++; } } @@ -72,8 +72,7 @@ module ts { export function filter(array: T[], f: (x: T) => boolean): T[] { if (array) { var result: T[] = []; - for (var i = 0, len = array.length; i < len; i++) { - var item = array[i]; + for (let item of array) { if (f(item)) { result.push(item); } @@ -85,8 +84,8 @@ module ts { export function map(array: T[], f: (x: T) => U): U[] { if (array) { var result: U[] = []; - for (var i = 0, len = array.length; i < len; i++) { - result.push(f(array[i])); + for (let v of array) { + result.push(f(v)); } } return result; @@ -102,9 +101,10 @@ module ts { export function deduplicate(array: T[]): T[] { if (array) { var result: T[] = []; - for (var i = 0, len = array.length; i < len; i++) { - var item = array[i]; - if (!contains(result, item)) result.push(item); + for (let item of array) { + if (!contains(result, item)) { + result.push(item); + } } } return result; @@ -119,8 +119,8 @@ module ts { } export function addRange(to: T[], from: T[]): void { - for (var i = 0, n = from.length; i < n; i++) { - to.push(from[i]); + for (let v of from) { + to.push(v); } } From 4642b869faedc4bb686a5ac864ef89a441b8966d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 09:08:27 -0700 Subject: [PATCH 048/101] Use for-of in emitter.ts --- src/compiler/emitter.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 3e7d64eedc9..1db7bb30ebe 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -555,19 +555,19 @@ module ts { } function emitLines(nodes: Node[]) { - for (var i = 0, n = nodes.length; i < n; i++) { - emit(nodes[i]); + for (let node of nodes) { + emit(node); } } function emitSeparatedList(nodes: Node[], separator: string, eachNodeEmitFn: (node: Node) => void) { var currentWriterPos = writer.getTextPos(); - for (var i = 0, n = nodes.length; i < n; i++) { + for (let node of nodes) { if (currentWriterPos !== writer.getTextPos()) { write(separator); } currentWriterPos = writer.getTextPos(); - eachNodeEmitFn(nodes[i]); + eachNodeEmitFn(node); } } @@ -4488,9 +4488,9 @@ module ts { var preambleEmitted = writer.getTextPos() !== initialTextPos; if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var i = 0, n = body.statements.length; i < n; i++) { + for (let statement of body.statements) { write(" "); - emit(body.statements[i]); + emit(statement); } emitTempDeclarations(/*newLine*/ false); write(" "); From 6e8a83af081370335d5801f74520454d461cb460 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 09:16:29 -0700 Subject: [PATCH 049/101] Use for-of in the checker --- src/compiler/checker.ts | 27 +++++++++++++-------------- src/compiler/utilities.ts | 6 +++--- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1500a47f197..2148c9e456e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1290,8 +1290,8 @@ module ts { } if (accessibleSymbolChain) { - for (var i = 0, n = accessibleSymbolChain.length; i < n; i++) { - appendParentTypeArgumentsAndSymbolName(accessibleSymbolChain[i]); + for (let accessibleSymbol of accessibleSymbolChain) { + appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } } else { @@ -3278,14 +3278,14 @@ module ts { } function addTypesToSortedSet(sortedTypes: Type[], types: Type[]) { - for (var i = 0, len = types.length; i < len; i++) { - addTypeToSortedSet(sortedTypes, types[i]); + for (let type of types) { + addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate: Type, types: Type[]): boolean { - for (var i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + for (let type of types) { + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -3805,8 +3805,8 @@ module ts { function unionTypeRelatedToUnionType(source: UnionType, target: UnionType): Ternary { var result = Ternary.True; var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { - var related = typeRelatedToUnionType(sourceTypes[i], target, false); + for (let sourceType of sourceTypes) { + var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { return Ternary.False; } @@ -3829,8 +3829,8 @@ module ts { function unionTypeRelatedToType(source: UnionType, target: Type, reportErrors: boolean): Ternary { var result = Ternary.True; var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { - var related = isRelatedTo(sourceTypes[i], target, reportErrors); + for (let sourceType of sourceTypes) { + var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { return Ternary.False; } @@ -4066,8 +4066,7 @@ module ts { return Ternary.False; } var result = Ternary.True; - for (var i = 0, len = sourceProperties.length; i < len; ++i) { - var sourceProp = sourceProperties[i]; + for (let sourceProp of sourceProperties) { var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { return Ternary.False; @@ -4332,8 +4331,8 @@ module ts { } function isSupertypeOfEach(candidate: Type, types: Type[]): boolean { - for (var i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && !isTypeSubtypeOf(types[i], candidate)) return false; + for (let type of types) { + if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; } return true; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index b0e2540bdf0..4c4c4afd6c4 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -852,9 +852,9 @@ module ts { export function getHeritageClause(clauses: NodeArray, kind: SyntaxKind) { if (clauses) { - for (var i = 0, n = clauses.length; i < n; i++) { - if (clauses[i].token === kind) { - return clauses[i]; + for (let clause of clauses) { + if (clause.token === kind) { + return clause; } } } From d50f7b5ddba83b6280f5ad9619b5b3997e513a27 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 09:28:17 -0700 Subject: [PATCH 050/101] Use for-of in the checker. --- src/compiler/checker.ts | 52 +++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2148c9e456e..75fb5211611 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6583,9 +6583,9 @@ module ts { // declare function f(a: { xa: number; xb: number; }); // f({ | if (!produceDiagnostics) { - for (var i = 0, n = candidates.length; i < n; i++) { - if (hasCorrectArity(node, args, candidates[i])) { - return candidates[i]; + for (let candidate of candidates) { + if (hasCorrectArity(node, args, candidate)) { + return candidate; } } } @@ -7843,8 +7843,8 @@ module ts { if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var i = 0, len = indexSymbol.declarations.length; i < len; ++i) { - var declaration = indexSymbol.declarations[i]; + for (let decl of indexSymbol.declarations) { + var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { case SyntaxKind.StringKeyword: @@ -8319,9 +8319,9 @@ module ts { // function g(x: string, y: string) { } // // The implementation is completely unrelated to the specialized signature, yet we do not check this. - for (var i = 0, len = signatures.length; i < len; ++i) { - if (!signatures[i].hasStringLiterals && !isSignatureAssignableTo(bodySignature, signatures[i])) { - error(signatures[i].declaration, Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + for (let signature of signatures) { + if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { + error(signature.declaration, Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; } } @@ -9473,8 +9473,8 @@ module ts { // NOTE: assignability is checked in checkClassDeclaration var baseProperties = getPropertiesOfObjectType(baseType); - for (var i = 0, len = baseProperties.length; i < len; ++i) { - var base = getTargetSymbol(baseProperties[i]); + for (let baseProperty of baseProperties) { + var base = getTargetSymbol(baseProperty); if (base.flags & SymbolFlags.Prototype) { continue; @@ -9566,11 +9566,9 @@ module ts { forEach(type.declaredProperties, p => { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; - for (var i = 0, len = type.baseTypes.length; i < len; ++i) { - var base = type.baseTypes[i]; + for (let base of type.baseTypes) { var properties = getPropertiesOfObjectType(base); - for (var j = 0, proplen = properties.length; j < proplen; ++j) { - var prop = properties[j]; + for (let prop of properties) { if (!hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, containingType: base }; } @@ -11191,9 +11189,7 @@ module ts { var lastStatic: Node, lastPrivate: Node, lastProtected: Node, lastDeclare: Node; var flags = 0; - for (var i = 0, n = node.modifiers.length; i < n; i++) { - var modifier = node.modifiers[i]; - + for (let modifier of node.modifiers) { switch (modifier.kind) { case SyntaxKind.PublicKeyword: case SyntaxKind.ProtectedKeyword: @@ -11420,8 +11416,7 @@ module ts { function checkGrammarForOmittedArgument(node: CallExpression, arguments: NodeArray): boolean { if (arguments) { var sourceFile = getSourceFileOfNode(node); - for (var i = 0, n = arguments.length; i < n; i++) { - var arg = arguments[i]; + for (let arg of arguments) { if (arg.kind === SyntaxKind.OmittedExpression) { return grammarErrorAtPos(sourceFile, arg.pos, 0, Diagnostics.Argument_expression_expected); } @@ -11451,10 +11446,7 @@ module ts { var seenImplementsClause = false; if (!checkGrammarModifiers(node) && node.heritageClauses) { - for (var i = 0, n = node.heritageClauses.length; i < n; i++) { - Debug.assert(i <= 2); - var heritageClause = node.heritageClauses[i]; - + for (let heritageClause of node.heritageClauses) { if (heritageClause.token === SyntaxKind.ExtendsKeyword) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_already_seen) @@ -11489,10 +11481,7 @@ module ts { var seenExtendsClause = false; if (node.heritageClauses) { - for (var i = 0, n = node.heritageClauses.length; i < n; i++) { - Debug.assert(i <= 1); - var heritageClause = node.heritageClauses[i]; - + for (let heritageClause of node.heritageClauses) { if (heritageClause.token === SyntaxKind.ExtendsKeyword) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_already_seen); @@ -11550,8 +11539,7 @@ module ts { var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & ParserContextFlags.StrictMode) !== 0; - for (var i = 0, n = node.properties.length; i < n; i++) { - var prop = node.properties[i]; + for (let prop of node.properties) { var name = prop.name; if (prop.kind === SyntaxKind.OmittedExpression || name.kind === SyntaxKind.ComputedPropertyName) { @@ -11939,8 +11927,7 @@ module ts { if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = isInAmbientContext(enumDecl); - for (var i = 0, n = enumDecl.members.length; i < n; i++) { - var node = enumDecl.members[i]; + for (let node of enumDecl.members) { // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. @@ -12062,8 +12049,7 @@ module ts { } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file: SourceFile): boolean { - for (var i = 0, n = file.statements.length; i < n; i++) { - var decl = file.statements[i]; + for (let decl of file.statements) { if (isDeclaration(decl) || decl.kind === SyntaxKind.VariableStatement) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; From 29bfc15d9ba074e8427593ac646cefa70f062447 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 09:41:54 -0700 Subject: [PATCH 051/101] use for-of in more places. --- src/compiler/checker.ts | 55 ++++++++++++++------------------------- src/compiler/core.ts | 6 ++--- src/compiler/emitter.ts | 8 +++--- src/compiler/sys.ts | 3 +-- src/compiler/utilities.ts | 3 +-- 5 files changed, 26 insertions(+), 49 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 75fb5211611..25e451d0948 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -850,8 +850,7 @@ module ts { function findConstructorDeclaration(node: ClassDeclaration): ConstructorDeclaration { var members = node.members; - for (var i = 0; i < members.length; i++) { - var member = members[i]; + for (let member of members) { if (member.kind === SyntaxKind.Constructor && nodeIsPresent((member).body)) { return member; } @@ -1549,8 +1548,7 @@ module ts { writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } - for (var i = 0; i < resolved.properties.length; i++) { - var p = resolved.properties[i]; + for (let p of resolved.properties) { var t = getTypeOfSymbol(p); if (p.flags & (SymbolFlags.Function | SymbolFlags.Method) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, SignatureKind.Call); @@ -2402,8 +2400,7 @@ module ts { function createSymbolTable(symbols: Symbol[]): SymbolTable { var result: SymbolTable = {}; - for (var i = 0; i < symbols.length; i++) { - var symbol = symbols[i]; + for (let symbol of symbols) { result[symbol.name] = symbol; } return result; @@ -2411,16 +2408,14 @@ module ts { function createInstantiatedSymbolTable(symbols: Symbol[], mapper: TypeMapper): SymbolTable { var result: SymbolTable = {}; - for (var i = 0; i < symbols.length; i++) { - var symbol = symbols[i]; + for (let symbol of symbols) { result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols: SymbolTable, baseSymbols: Symbol[]) { - for (var i = 0; i < baseSymbols.length; i++) { - var s = baseSymbols[i]; + for (let s of baseSymbols) { if (!hasProperty(symbols, s.name)) { symbols[s.name] = s; } @@ -2728,8 +2723,7 @@ module ts { } var propTypes: Type[] = []; var declarations: Declaration[] = []; - for (var i = 0; i < props.length; i++) { - var prop = props[i]; + for (let prop of props) { if (prop.declarations) { declarations.push.apply(declarations, prop.declarations); } @@ -3181,8 +3175,7 @@ module ts { function getTypeDeclaration(symbol: Symbol): Declaration { var declarations = symbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var declaration = declarations[i]; + for (let declaration of declarations) { switch (declaration.kind) { case SyntaxKind.ClassDeclaration: case SyntaxKind.InterfaceDeclaration: @@ -3982,8 +3975,7 @@ module ts { var result = Ternary.True; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & TypeFlags.ObjectLiteral); - for (var i = 0; i < properties.length; i++) { - var targetProp = properties[i]; + for (let targetProp of properties) { var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { @@ -4091,8 +4083,7 @@ module ts { var targetSignatures = getSignaturesOfType(target, kind); var result = Ternary.True; var saveErrorInfo = errorInfo; - outer: for (var i = 0; i < targetSignatures.length; i++) { - var t = targetSignatures[i]; + outer: for (let t of targetSignatures) { if (!t.hasStringLiterals || target.flags & TypeFlags.FromSignature) { var localErrors = reportErrors; for (var j = 0; j < sourceSignatures.length; j++) { @@ -4608,8 +4599,7 @@ module ts { var typeParameterCount = 0; var typeParameter: TypeParameter; // First infer to each type in union that isn't a type parameter - for (var i = 0; i < targetTypes.length; i++) { - var t = targetTypes[i]; + for (let t of targetTypes) { if (t.flags & TypeFlags.TypeParameter && contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; @@ -4656,8 +4646,7 @@ module ts { function inferFromProperties(source: Type, target: Type) { var properties = getPropertiesOfObjectType(target); - for (var i = 0; i < properties.length; i++) { - var targetProp = properties[i]; + for (let targetProp of properties) { var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -5789,8 +5778,7 @@ module ts { var contextualType = getContextualType(node); var typeFlags: TypeFlags; - for (var i = 0; i < node.properties.length; i++) { - var memberDecl = node.properties[i]; + for (let memberDecl of node.properties) { var member = memberDecl.symbol; if (memberDecl.kind === SyntaxKind.PropertyAssignment || memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment || @@ -6167,8 +6155,7 @@ module ts { var specializedIndex: number = -1; var spliceIndex: number; Debug.assert(!result.length); - for (var i = 0; i < signatures.length; i++) { - var signature = signatures[i]; + for (let signature of signatures) { var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { @@ -7272,8 +7259,7 @@ module ts { function checkObjectLiteralAssignment(node: ObjectLiteralExpression, sourceType: Type, contextualMapper?: TypeMapper): Type { var properties = node.properties; - for (var i = 0; i < properties.length; i++) { - var p = properties[i]; + for (let p of properties) { if (p.kind === SyntaxKind.PropertyAssignment || p.kind === SyntaxKind.ShorthandPropertyAssignment) { // TODO(andersh): Computed property support var name = (p).name; @@ -8097,8 +8083,7 @@ module ts { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var i = 0; i < signaturesToCheck.length; i++) { - var otherSignature = signaturesToCheck[i]; + for (let otherSignature of signaturesToCheck) { if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; } @@ -9281,8 +9266,7 @@ module ts { if (type.flags & TypeFlags.Class && type.symbol.valueDeclaration.kind === SyntaxKind.ClassDeclaration) { var classDeclaration = type.symbol.valueDeclaration; - for (var i = 0; i < classDeclaration.members.length; i++) { - var member = classDeclaration.members[i]; + for (let member of classDeclaration.members) { // Only process instance properties with computed names here. // Static properties cannot be in conflict with indexers, // and properties with literal names were already checked. @@ -9371,12 +9355,12 @@ module ts { // Check each type parameter and check that list has no duplicate type parameter declarations function checkTypeParameters(typeParameterDeclarations: TypeParameterDeclaration[]) { if (typeParameterDeclarations) { - for (var i = 0; i < typeParameterDeclarations.length; i++) { + for (let i = 0, n = typeParameterDeclarations.length; i < n; i++) { var node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { - for (var j = 0; j < i; j++) { + for (let j = 0; j < i; j++) { if (typeParameterDeclarations[j].symbol === node.symbol) { error(node.name, Diagnostics.Duplicate_identifier_0, declarationNameToString(node.name)); } @@ -9855,8 +9839,7 @@ module ts { function getFirstNonAmbientClassOrFunctionDeclaration(symbol: Symbol): Declaration { var declarations = symbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var declaration = declarations[i]; + for (let declaration of declarations) { if ((declaration.kind === SyntaxKind.ClassDeclaration || (declaration.kind === SyntaxKind.FunctionDeclaration && nodeIsPresent((declaration).body))) && !isInAmbientContext(declaration)) { return declaration; } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 0b296233f70..941f3097585 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -427,8 +427,7 @@ module ts { function getNormalizedParts(normalizedSlashedPath: string, rootLength: number) { var parts = normalizedSlashedPath.substr(rootLength).split(directorySeparator); var normalized: string[] = []; - for (var i = 0; i < parts.length; i++) { - var part = parts[i]; + for (let part of parts) { if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { normalized.pop(); @@ -603,8 +602,7 @@ module ts { var supportedExtensions = [".d.ts", ".ts", ".js"]; export function removeFileExtension(path: string): string { - for (var i = 0; i < supportedExtensions.length; i++) { - var ext = supportedExtensions[i]; + for (let ext of supportedExtensions) { if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 1db7bb30ebe..da789b6ffef 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2433,7 +2433,7 @@ module ts { headEmitted = true; } - for (var i = 0; i < node.templateSpans.length; i++) { + for (let i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; // Check if the expression has operands and binds its operands less closely than binary '+'. @@ -3952,8 +3952,7 @@ module ts { // to ensure value is evaluated exactly once. value = ensureIdentifier(value); } - for (var i = 0; i < properties.length; i++) { - var p = properties[i]; + for (let p of properties) { if (p.kind === SyntaxKind.PropertyAssignment || p.kind === SyntaxKind.ShorthandPropertyAssignment) { // TODO(andersh): Computed property support var propName = ((p).name); @@ -5148,8 +5147,7 @@ module ts { function getExternalImportInfo(node: ImportDeclaration | ImportEqualsDeclaration): ExternalImportInfo { if (externalImports) { - for (var i = 0; i < externalImports.length; i++) { - var info = externalImports[i]; + for (let info of externalImports) { if (info.rootNode === node) { return info; } diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 5f10a747d42..c86be03d322 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -124,8 +124,7 @@ module ts { function visitDirectory(path: string) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var i = 0; i < files.length; i++) { - var name = files[i]; + for (let name of files) { if (!extension || fileExtensionIs(name, extension)) { result.push(combinePaths(path, name)); } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 4c4c4afd6c4..ea362eb2220 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -15,8 +15,7 @@ module ts { export function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration { var declarations = symbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var declaration = declarations[i]; + for (let declaration of declarations) { if (declaration.kind === kind) { return declaration; } From a6a6a0edef194d9d519882d0455c68d98e4002e3 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 09:45:57 -0700 Subject: [PATCH 052/101] More usage of for-of --- src/compiler/checker.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 25e451d0948..9348a083e6b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4086,8 +4086,7 @@ module ts { outer: for (let t of targetSignatures) { if (!t.hasStringLiterals || target.flags & TypeFlags.FromSignature) { var localErrors = reportErrors; - for (var j = 0; j < sourceSignatures.length; j++) { - var s = sourceSignatures[j]; + for (let s of sourceSignatures) { if (!s.hasStringLiterals || source.flags & TypeFlags.FromSignature) { var related = signatureRelatedTo(s, t, localErrors); if (related) { @@ -10042,16 +10041,14 @@ module ts { var declarations = moduleSymbol.declarations; for (var i = 0; i < declarations.length; i++) { var statements = getModuleStatements(declarations[i]); - for (var j = 0; j < statements.length; j++) { - var node = statements[j]; + for (let node of statements) { if (node.kind === SyntaxKind.ExportDeclaration) { var exportClause = (node).exportClause; if (!exportClause) { return true; } var specifiers = exportClause.elements; - for (var k = 0; k < specifiers.length; k++) { - var specifier = specifiers[k]; + for (let specifier of specifiers) { if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) { return true; } From 224de1db722cd461511d338d96107c1660cc38f4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 10:03:01 -0700 Subject: [PATCH 053/101] use for-of in more places. --- src/services/formatting/formatting.ts | 10 +++--- .../formatting/ruleOperationContext.ts | 4 +-- src/services/formatting/rulesMap.ts | 6 ++-- src/services/navigateTo.ts | 11 +++---- src/services/navigationBar.ts | 14 +++----- src/services/patternMatcher.ts | 7 ++-- src/services/services.ts | 33 ++++++++----------- src/services/signatureHelp.ts | 3 +- src/services/utilities.ts | 7 ++-- 9 files changed, 38 insertions(+), 57 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index dd12b452b57..b20d8fea22d 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -609,8 +609,8 @@ module ts.formatting { } var inheritedIndentation = Constants.Unknown; - for (var i = 0, len = nodes.length; i < len; ++i) { - inheritedIndentation = processChildNode(nodes[i], inheritedIndentation, node, listDynamicIndentation, startLine, /*isListElement*/ true) + for (let child of nodes) { + inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, /*isListElement*/ true) } if (listEndToken !== SyntaxKind.Unknown) { @@ -668,8 +668,7 @@ module ts.formatting { if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var i = 0, len = currentTokenInfo.leadingTrivia.length; i < len; ++i) { - var triviaItem = currentTokenInfo.leadingTrivia[i]; + for (let triviaItem of currentTokenInfo.leadingTrivia) { if (!rangeContainsRange(originalRange, triviaItem)) { continue; } @@ -709,8 +708,7 @@ module ts.formatting { } function processTrivia(trivia: TextRangeWithKind[], parent: Node, contextNode: Node, dynamicIndentation: DynamicIndentation): void { - for (var i = 0, len = trivia.length; i < len; ++i) { - var triviaItem = trivia[i]; + for (let triviaItem of trivia) { if (isComment(triviaItem.kind) && rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); diff --git a/src/services/formatting/ruleOperationContext.ts b/src/services/formatting/ruleOperationContext.ts index d037f8e70d7..dc4e5d4f105 100644 --- a/src/services/formatting/ruleOperationContext.ts +++ b/src/services/formatting/ruleOperationContext.ts @@ -36,8 +36,8 @@ module ts.formatting { return true; } - for (var i = 0, len = this.customContextChecks.length; i < len; i++) { - if (!this.customContextChecks[i](context)) { + for (let check of this.customContextChecks) { + if (!check(context)) { return false; } } diff --git a/src/services/formatting/rulesMap.ts b/src/services/formatting/rulesMap.ts index d25320f16a8..634ec61de9c 100644 --- a/src/services/formatting/rulesMap.ts +++ b/src/services/formatting/rulesMap.ts @@ -76,10 +76,10 @@ module ts.formatting { var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var i = 0, len = bucket.Rules().length; i < len; i++) { - var rule = bucket.Rules()[i]; - if (rule.Operation.Context.InContext(context)) + for (let rule of bucket.Rules()) { + if (rule.Operation.Context.InContext(context)) { return rule; + } } } return null; diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts index b3f72d83cb3..7757a7acf3a 100644 --- a/src/services/navigateTo.ts +++ b/src/services/navigateTo.ts @@ -10,8 +10,7 @@ module ts.NavigateTo { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - var declaration = declarations[i]; + for (let declaration of declarations) { var name = getDeclarationName(declaration); if (name !== undefined) { @@ -58,8 +57,8 @@ module ts.NavigateTo { Debug.assert(matches.length > 0); // This is a case sensitive match, only if all the submatches were case sensitive. - for (var i = 0, n = matches.length; i < n; i++) { - if (!matches[i].isCaseSensitive) { + for (let match of matches) { + if (!match.isCaseSensitive) { return false; } } @@ -167,8 +166,8 @@ module ts.NavigateTo { Debug.assert(matches.length > 0); var bestMatchKind = PatternMatchKind.camelCase; - for (var i = 0, n = matches.length; i < n; i++) { - var kind = matches[i].kind; + for (let match of matches) { + var kind = match.kind; if (kind < bestMatchKind) { bestMatchKind = kind; } diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 20e80cc88c0..1f67fef5e71 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -150,8 +150,7 @@ module ts.NavigationBar { function addTopLevelNodes(nodes: Node[], topLevelNodes: Node[]): void { nodes = sortNodes(nodes); - for (var i = 0, n = nodes.length; i < n; i++) { - var node = nodes[i]; + for (let node of nodes) { switch (node.kind) { case SyntaxKind.ClassDeclaration: case SyntaxKind.EnumDeclaration: @@ -204,8 +203,7 @@ module ts.NavigationBar { var keyToItem: Map = {}; - for (var i = 0, n = nodes.length; i < n; i++) { - var child = nodes[i]; + for (let child of nodes) { var item = createItem(child); if (item !== undefined) { if (item.text.length > 0) { @@ -238,12 +236,8 @@ module ts.NavigationBar { // Next, recursively merge or add any children in the source as appropriate. outer: - for (var i = 0, n = source.childItems.length; i < n; i++) { - var sourceChild = source.childItems[i]; - - for (var j = 0, m = target.childItems.length; j < m; j++) { - var targetChild = target.childItems[j]; - + for (let sourceChild of source.childItems) { + for (let targetChild of target.childItems) { if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { // Found a match. merge them. merge(targetChild, sourceChild); diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index 9bcd3e1d000..f7874519334 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -221,8 +221,7 @@ module ts { // word part. That way we don't match something like 'Class' when the user types 'a'. // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). var wordSpans = getWordSpans(candidate); - for (var i = 0, n = wordSpans.length; i < n; i++) { - var span = wordSpans[i] + for (let span of wordSpans) { if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); @@ -339,9 +338,7 @@ module ts { var subWordTextChunks = segment.subWordTextChunks; var matches: PatternMatch[] = undefined; - for (var i = 0, n = subWordTextChunks.length; i < n; i++) { - var subWordTextChunk = subWordTextChunks[i]; - + for (let subWordTextChunk of subWordTextChunks) { // Try to match the candidate with this word var result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true); if (!result) { diff --git a/src/services/services.ts b/src/services/services.ts index 61d7a0736b0..f0e934ed6a2 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -196,8 +196,7 @@ module ts { var list = createNode(SyntaxKind.SyntaxList, nodes.pos, nodes.end, NodeFlags.Synthetic, this); list._children = []; var pos = nodes.pos; - for (var i = 0, len = nodes.length; i < len; i++) { - var node = nodes[i]; + for (let node of nodes) { if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -255,8 +254,7 @@ module ts { public getFirstToken(sourceFile?: SourceFile): Node { var children = this.getChildren(); - for (var i = 0; i < children.length; i++) { - var child = children[i]; + for (let child of children) { if (child.kind < SyntaxKind.FirstNode) { return child; } @@ -1523,8 +1521,8 @@ module ts { // Initialize the list with the root file names var rootFileNames = host.getScriptFileNames(); - for (var i = 0, n = rootFileNames.length; i < n; i++) { - this.createEntry(rootFileNames[i]); + for (let fileName of rootFileNames) { + this.createEntry(fileName); } // store the compilation settings @@ -2252,8 +2250,8 @@ module ts { // not part of the new program. if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var i = 0, n = oldSourceFiles.length; i < n; i++) { - var fileName = oldSourceFiles[i].fileName; + for (let oldSourceFile of oldSourceFiles) { + var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { documentRegistry.releaseDocument(fileName, oldSettings); } @@ -2329,8 +2327,8 @@ module ts { } // If any file is not up-to-date, then the whole program is not up-to-date - for (var i = 0, n = rootFileNames.length; i < n; i++) { - if (!sourceFileUpToDate(program.getSourceFile(rootFileNames[i]))) { + for (let fileName of rootFileNames) { + if (!sourceFileUpToDate(program.getSourceFile(fileName))) { return false; } } @@ -4314,8 +4312,8 @@ module ts { var declarations = symbol.getDeclarations(); if (declarations) { - for (var i = 0, n = declarations.length; i < n; i++) { - var container = getContainerNode(declarations[i]); + for (let declaration of declarations) { + var container = getContainerNode(declaration); if (!container) { return undefined; @@ -4831,8 +4829,8 @@ module ts { // Remember the last meaning var lastIterationMeaning = meaning; - for (var i = 0, n = declarations.length; i < n; i++) { - var declarationMeaning = getMeaningFromDeclaration(declarations[i]); + for (let declaration of declarations) { + var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; @@ -5401,8 +5399,7 @@ module ts { // Ignore nodes that don't intersect the original span to classify. if (textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var i = 0, n = children.length; i < n; i++) { - var child = children[i]; + for (let child of children) { if (isToken(child)) { classifyToken(child); } @@ -5435,9 +5432,7 @@ module ts { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var i = 0, n = childNodes.length; i < n; i++) { - var current = childNodes[i]; - + for (let current of childNodes) { if (current.kind === matchKind) { var range1 = createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); var range2 = createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 52a7b41d8a7..3a677c9506c 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -318,8 +318,7 @@ module ts.SignatureHelp { // arg index. var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var i = 0, n = listChildren.length; i < n; i++) { - var child = listChildren[i]; + for (let child of listChildren) { if (child === node) { break; } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index f2403217c24..332ddffc910 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -184,8 +184,7 @@ module ts { } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; ++i) { - var child = children[i]; + for (let child of children) { var shouldDiveInChildNode = // previous token is enclosed somewhere in the child (child.pos <= previousToken.pos && child.end > previousToken.end) || @@ -221,8 +220,8 @@ module ts { } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; ++i) { - var child = children[i]; + for (var i = 0, len = children.length; i < len; i++) { + let child = children[i]; if (nodeHasTokens(child)) { if (position <= child.end) { if (child.getStart(sourceFile) >= position) { From 5f89a8e3f682db5548b53d2475dd3fcaaef19626 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 10:27:31 -0700 Subject: [PATCH 054/101] Use more for-of --- src/compiler/checker.ts | 57 +++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9348a083e6b..c20f15a0d63 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1507,16 +1507,16 @@ module ts { writePunctuation(writer, SyntaxKind.OpenBraceToken); writer.writeLine(); writer.increaseIndent(); - for (var i = 0; i < resolved.callSignatures.length; i++) { - buildSignatureDisplay(resolved.callSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + for (let signature of resolved.callSignatures) { + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } - for (var i = 0; i < resolved.constructSignatures.length; i++) { + for (let signature of resolved.constructSignatures) { writeKeyword(writer, SyntaxKind.NewKeyword); writeSpace(writer); - buildSignatureDisplay(resolved.constructSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } @@ -1552,12 +1552,12 @@ module ts { var t = getTypeOfSymbol(p); if (p.flags & (SymbolFlags.Function | SymbolFlags.Method) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, SignatureKind.Call); - for (var j = 0; j < signatures.length; j++) { + for (let signature of signatures) { buildSymbolDisplay(p, writer); if (p.flags & SymbolFlags.Optional) { writePunctuation(writer, SyntaxKind.QuestionToken); } - buildSignatureDisplay(signatures[j], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, SyntaxKind.SemicolonToken); writer.writeLine(); } @@ -2424,8 +2424,8 @@ module ts { function addInheritedSignatures(signatures: Signature[], baseSignatures: Signature[]) { if (baseSignatures) { - for (var i = 0; i < baseSignatures.length; i++) { - signatures.push(baseSignatures[i]); + for (let signature of baseSignatures) { + signatures.push(signature); } } } @@ -2536,8 +2536,8 @@ module ts { function getUnionSignatures(types: Type[], kind: SignatureKind): Signature[] { var signatureLists = map(types, t => getSignaturesOfType(t, kind)); var signatures = signatureLists[0]; - for (var i = 0; i < signatures.length; i++) { - if (signatures[i].typeParameters) { + for (let signature of signatures) { + if (signature.typeParameters) { return emptyArray; } } @@ -2558,8 +2558,8 @@ module ts { function getUnionIndexType(types: Type[], kind: IndexKind): Type { var indexTypes: Type[] = []; - for (var i = 0; i < types.length; i++) { - var indexType = getIndexTypeOfType(types[i], kind); + for (let type of types) { + var indexType = getIndexTypeOfType(type, kind); if (!indexType) { return undefined; } @@ -2706,8 +2706,8 @@ module ts { function createUnionProperty(unionType: UnionType, name: string): Symbol { var types = unionType.types; var props: Symbol[]; - for (var i = 0; i < types.length; i++) { - var type = getApparentType(types[i]); + for (let current of types) { + var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); if (!prop) { @@ -3042,7 +3042,10 @@ module ts { default: var result = ""; for (var i = 0; i < types.length; i++) { - if (i > 0) result += ","; + if (i > 0) { + result += ","; + } + result += types[i].id; } return result; @@ -3054,8 +3057,8 @@ module ts { // of an object literal (since those types have widening related information we need to track). function getWideningFlagsOfTypes(types: Type[]): TypeFlags { var result: TypeFlags = 0; - for (var i = 0; i < types.length; i++) { - result |= types[i].flags; + for (let type of types) { + result |= type.flags; } return result & TypeFlags.RequiresWidening; } @@ -3296,8 +3299,8 @@ module ts { } function containsAnyType(types: Type[]) { - for (var i = 0; i < types.length; i++) { - if (types[i].flags & TypeFlags.Any) { + for (let type of types) { + if (type.flags & TypeFlags.Any) { return true; } } @@ -3423,8 +3426,8 @@ module ts { function instantiateList(items: T[], mapper: TypeMapper, instantiator: (item: T, mapper: TypeMapper) => T): T[] { if (items && items.length) { var result: T[] = []; - for (var i = 0; i < items.length; i++) { - result.push(instantiator(items[i], mapper)); + for (let v of items) { + result.push(instantiator(v, mapper)); } return result; } @@ -3446,7 +3449,9 @@ module ts { } return t => { for (var i = 0; i < sources.length; i++) { - if (t === sources[i]) return targets[i]; + if (t === sources[i]) { + return targets[i]; + } } return t; }; @@ -3466,8 +3471,10 @@ module ts { case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return t => { - for (var i = 0; i < sources.length; i++) { - if (t === sources[i]) return anyType; + for (let source of sources) { + if (t === source) { + return anyType; + } } return t; }; @@ -4528,7 +4535,7 @@ module ts { function createInferenceContext(typeParameters: TypeParameter[], inferUnionTypes: boolean): InferenceContext { var inferences: TypeInferences[] = []; - for (var i = 0; i < typeParameters.length; i++) { + for (let unused of typeParameters) { inferences.push({ primary: undefined, secondary: undefined }); } return { From d10a54c6b0cd24ec112c0ca0eada0cc3ad460c64 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 10:36:29 -0700 Subject: [PATCH 055/101] Use for-of in more places. --- src/compiler/checker.ts | 40 ++++++++++++++++++++-------------------- src/compiler/core.ts | 4 ++-- src/compiler/sys.ts | 12 ++++++------ src/services/services.ts | 4 ++-- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c20f15a0d63..e18748835c9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4624,8 +4624,8 @@ module ts { else if (source.flags & TypeFlags.Union) { // Source is a union type, infer from each consituent type var sourceTypes = (source).types; - for (var i = 0; i < sourceTypes.length; i++) { - inferFromTypes(sourceTypes[i], target); + for (let sourceType of sourceTypes) { + inferFromTypes(sourceType, target); } } else if (source.flags & TypeFlags.ObjectType && (target.flags & (TypeFlags.Reference | TypeFlags.Tuple) || @@ -5451,8 +5451,8 @@ module ts { var types = (type).types; var mappedType: Type; var mappedTypes: Type[]; - for (var i = 0; i < types.length; i++) { - var t = mapper(types[i]); + for (let current of types) { + var t = mapper(current); if (t) { if (!mappedType) { mappedType = t; @@ -5628,15 +5628,15 @@ module ts { } var signatureList: Signature[]; var types = (type).types; - for (var i = 0; i < types.length; i++) { + for (let current of types) { // The signature set of all constituent type with call signatures should match // So number of signatures allowed is either 0 or 1 if (signatureList && - getSignaturesOfObjectOrUnionType(types[i], SignatureKind.Call).length > 1) { + getSignaturesOfObjectOrUnionType(current, SignatureKind.Call).length > 1) { return undefined; } - var signature = getNonGenericSignature(types[i]); + var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { // This signature will contribute to contextual union signature @@ -6586,12 +6586,12 @@ module ts { return resolveErrorCall(node); function chooseOverload(candidates: Signature[], relation: Map) { - for (var i = 0; i < candidates.length; i++) { - if (!hasCorrectArity(node, args, candidates[i])) { + for (let current of candidates) { + if (!hasCorrectArity(node, args, current)) { continue; } - var originalCandidate = candidates[i]; + var originalCandidate = current; var inferenceResult: InferenceContext; while (true) { @@ -7198,8 +7198,8 @@ module ts { } if (type.flags & TypeFlags.Union) { var types = (type).types; - for (var i = 0; i < types.length; i++) { - if (types[i].flags & kind) { + for (let current of types) { + if (current.flags & kind) { return true; } } @@ -7215,8 +7215,8 @@ module ts { } if (type.flags & TypeFlags.Union) { var types = (type).types; - for (var i = 0; i < types.length; i++) { - if (!(types[i].flags & kind)) { + for (let current of types) { + if (!(current.flags & kind)) { return false; } } @@ -8219,8 +8219,8 @@ module ts { var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & SymbolFlags.Module; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var i = 0; i < declarations.length; i++) { - var node = declarations[i]; + for (let current of declarations) { + var node = current; var inAmbientContext = isInAmbientContext(node); var inAmbientContextOrInterface = node.parent.kind === SyntaxKind.InterfaceDeclaration || node.parent.kind === SyntaxKind.TypeLiteral || inAmbientContext; if (inAmbientContextOrInterface) { @@ -10046,8 +10046,8 @@ module ts { function hasExportedMembers(moduleSymbol: Symbol) { var declarations = moduleSymbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var statements = getModuleStatements(declarations[i]); + for (let current of declarations) { + var statements = getModuleStatements(current); for (let node of statements) { if (node.kind === SyntaxKind.ExportDeclaration) { var exportClause = (node).exportClause; @@ -11840,8 +11840,8 @@ module ts { } else { var elements = (name).elements; - for (var i = 0; i < elements.length; ++i) { - checkGrammarNameInLetOrConstDeclarations(elements[i].name); + for (let element of elements) { + checkGrammarNameInLetOrConstDeclarations(element.name); } } } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 941f3097585..8939262b6d6 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -112,8 +112,8 @@ module ts { export function sum(array: any[], prop: string): number { var result = 0; - for (var i = 0; i < array.length; i++) { - result += array[i][prop]; + for (let v of array) { + result += v[prop]; } return result; } diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index c86be03d322..f89c474ce7f 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -130,8 +130,8 @@ module ts { } } var subfolders = getNames(folder.subfolders); - for (var i = 0; i < subfolders.length; i++) { - visitDirectory(combinePaths(path, subfolders[i])); + for (let current of subfolders) { + visitDirectory(combinePaths(path, current)); } } } @@ -229,8 +229,8 @@ module ts { function visitDirectory(path: string) { var files = _fs.readdirSync(path || ".").sort(); var directories: string[] = []; - for (var i = 0; i < files.length; i++) { - var name = combinePaths(path, files[i]); + for (let current of files) { + var name = combinePaths(path, current); var stat = _fs.lstatSync(name); if (stat.isFile()) { if (!extension || fileExtensionIs(name, extension)) { @@ -241,8 +241,8 @@ module ts { directories.push(name); } } - for (var i = 0; i < directories.length; i++) { - visitDirectory(directories[i]); + for (let current of directories) { + visitDirectory(current); } } } diff --git a/src/services/services.ts b/src/services/services.ts index f0e934ed6a2..b4c0ef2bbd8 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -5674,8 +5674,8 @@ module ts { // Disallow rename for elements that are defined in the standard TypeScript library. var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var i = 0; i < declarations.length; i++) { - var sourceFile = declarations[i].getSourceFile(); + for (let current of declarations) { + var sourceFile = current.getSourceFile(); if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); } From 069661e6ef07d4bc55820a272b2a069a45081c39 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 10:43:42 -0700 Subject: [PATCH 056/101] Use for-of in more places. --- src/compiler/checker.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e18748835c9..5c571d8e0e3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2999,8 +2999,8 @@ module ts { var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var i = 0; i < len; i++) { - var node = indexSymbol.declarations[i]; + for (let decl of indexSymbol.declarations) { + var node = decl; if (node.parameters.length === 1) { var parameter = node.parameters[0]; if (parameter && parameter.type && parameter.type.kind === syntaxKind) { @@ -4556,7 +4556,9 @@ module ts { function isInProcess(source: Type, target: Type) { for (var i = 0; i < depth; i++) { - if (source === sourceStack[i] && target === targetStack[i]) return true; + if (source === sourceStack[i] && target === targetStack[i]) { + return true; + } } return false; } @@ -4567,7 +4569,9 @@ module ts { var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & TypeFlags.Reference && (t).target === target) count++; + if (t.flags & TypeFlags.Reference && (t).target === target) { + count++; + } } return count < 5; } From 2383fcfb25bcf8e05b958c35d038b1c6f20a3bea Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 10:49:32 -0700 Subject: [PATCH 057/101] Use 'let' in core.ts. --- src/compiler/core.ts | 145 ++++++++++++++++++++++--------------------- 1 file changed, 74 insertions(+), 71 deletions(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 8939262b6d6..27fc152f534 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -26,7 +26,7 @@ module ts { export function forEach(array: T[], callback: (element: T, index: number) => U): U { if (array) { for (let i = 0, len = array.length; i < len; i++) { - var result = callback(array[i], i); + let result = callback(array[i], i); if (result) { return result; } @@ -48,7 +48,7 @@ module ts { export function indexOf(array: T[], value: T): number { if (array) { - for (var i = 0, len = array.length; i < len; i++) { + for (let i = 0, len = array.length; i < len; i++) { if (array[i] === value) { return i; } @@ -58,7 +58,7 @@ module ts { } export function countWhere(array: T[], predicate: (x: T) => boolean): number { - var count = 0; + let count = 0; if (array) { for (let v of array) { if (predicate(v)) { @@ -69,9 +69,10 @@ module ts { return count; } - export function filter(array: T[], f: (x: T) => boolean): T[] { + export function filter(array: T[], f: (x: T) => boolean): T[]{ + let result: T[]; if (array) { - var result: T[] = []; + result = []; for (let item of array) { if (f(item)) { result.push(item); @@ -81,9 +82,10 @@ module ts { return result; } - export function map(array: T[], f: (x: T) => U): U[] { + export function map(array: T[], f: (x: T) => U): U[]{ + let result: U[]; if (array) { - var result: U[] = []; + result = []; for (let v of array) { result.push(f(v)); } @@ -98,9 +100,10 @@ module ts { return array1.concat(array2); } - export function deduplicate(array: T[]): T[] { + export function deduplicate(array: T[]): T[]{ + let result: T[]; if (array) { - var result: T[] = []; + result = []; for (let item of array) { if (!contains(result, item)) { result.push(item); @@ -111,7 +114,7 @@ module ts { } export function sum(array: any[], prop: string): number { - var result = 0; + let result = 0; for (let v of array) { result += v[prop]; } @@ -136,12 +139,12 @@ module ts { } export function binarySearch(array: number[], value: number): number { - var low = 0; - var high = array.length - 1; + let low = 0; + let high = array.length - 1; while (low <= high) { - var middle = low + ((high - low) >> 1); - var midValue = array[middle]; + let middle = low + ((high - low) >> 1); + let midValue = array[middle]; if (midValue === value) { return middle; @@ -157,7 +160,7 @@ module ts { return ~low; } - var hasOwnProperty = Object.prototype.hasOwnProperty; + let hasOwnProperty = Object.prototype.hasOwnProperty; export function hasProperty(map: Map, key: string): boolean { return hasOwnProperty.call(map, key); @@ -168,7 +171,7 @@ module ts { } export function isEmpty(map: Map) { - for (var id in map) { + for (let id in map) { if (hasProperty(map, id)) { return false; } @@ -177,19 +180,19 @@ module ts { } export function clone(object: T): T { - var result: any = {}; - for (var id in object) { + let result: any = {}; + for (let id in object) { result[id] = (object)[id]; } return result; } export function extend(first: Map, second: Map): Map { - var result: Map = {}; - for (var id in first) { + let result: Map = {}; + for (let id in first) { result[id] = first[id]; } - for (var id in second) { + for (let id in second) { if (!hasProperty(result, id)) { result[id] = second[id]; } @@ -198,16 +201,16 @@ module ts { } export function forEachValue(map: Map, callback: (value: T) => U): U { - var result: U; - for (var id in map) { + let result: U; + for (let id in map) { if (result = callback(map[id])) break; } return result; } export function forEachKey(map: Map, callback: (key: string) => U): U { - var result: U; - for (var id in map) { + let result: U; + for (let id in map) { if (result = callback(id)) break; } return result; @@ -218,9 +221,9 @@ module ts { } export function mapToArray(map: Map): T[] { - var result: T[] = []; + let result: T[] = []; - for (var id in map) { + for (let id in map) { result.push(map[id]); } @@ -228,7 +231,7 @@ module ts { } export function copyMap(source: Map, target: Map): void { - for (var p in source) { + for (let p in source) { target[p] = source[p]; } } @@ -244,7 +247,7 @@ module ts { * index in the array will be the one associated with the produced key. */ export function arrayToMap(array: T[], makeKey: (value: T) => string): Map { - var result: Map = {}; + let result: Map = {}; forEach(array, value => { result[makeKey(value)] = value; @@ -259,7 +262,7 @@ module ts { return text.replace(/{(\d+)}/g, (match, index?) => args[+index + baseIndex]); } - export var localizedDiagnosticMessages: Map = undefined; + export let localizedDiagnosticMessages: Map = undefined; export function getLocaleSpecificMessage(message: string) { return localizedDiagnosticMessages && localizedDiagnosticMessages[message] @@ -269,14 +272,14 @@ module ts { export function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic; export function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage): Diagnostic { - var end = start + length; + let end = start + length; Debug.assert(start >= 0, "start must be non-negative, is " + start); Debug.assert(length >= 0, "length must be non-negative, is " + length); Debug.assert(start <= file.text.length, `start must be within the bounds of the file. ${ start } > ${ file.text.length }`); Debug.assert(end <= file.text.length, `end must be the bounds of the file. ${ end } > ${ file.text.length }`); - var text = getLocaleSpecificMessage(message.key); + let text = getLocaleSpecificMessage(message.key); if (arguments.length > 4) { text = formatStringFromArgs(text, arguments, 4); @@ -295,7 +298,7 @@ module ts { export function createCompilerDiagnostic(message: DiagnosticMessage, ...args: any[]): Diagnostic; export function createCompilerDiagnostic(message: DiagnosticMessage): Diagnostic { - var text = getLocaleSpecificMessage(message.key); + let text = getLocaleSpecificMessage(message.key); if (arguments.length > 1) { text = formatStringFromArgs(text, arguments, 1); @@ -314,7 +317,7 @@ module ts { export function chainDiagnosticMessages(details: DiagnosticMessageChain, message: DiagnosticMessage, ...args: any[]): DiagnosticMessageChain; export function chainDiagnosticMessages(details: DiagnosticMessageChain, message: DiagnosticMessage): DiagnosticMessageChain { - var text = getLocaleSpecificMessage(message.key); + let text = getLocaleSpecificMessage(message.key); if (arguments.length > 2) { text = formatStringFromArgs(text, arguments, 2); @@ -358,10 +361,10 @@ module ts { function compareMessageText(text1: string | DiagnosticMessageChain, text2: string | DiagnosticMessageChain): Comparison { while (text1 && text2) { // We still have both chains. - var string1 = typeof text1 === "string" ? text1 : text1.messageText; - var string2 = typeof text2 === "string" ? text2 : text2.messageText; + let string1 = typeof text1 === "string" ? text1 : text1.messageText; + let string2 = typeof text2 === "string" ? text2 : text2.messageText; - var res = compareValues(string1, string2); + let res = compareValues(string1, string2); if (res) { return res; } @@ -388,11 +391,11 @@ module ts { return diagnostics; } - var newDiagnostics = [diagnostics[0]]; - var previousDiagnostic = diagnostics[0]; - for (var i = 1; i < diagnostics.length; i++) { - var currentDiagnostic = diagnostics[i]; - var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === Comparison.EqualTo; + let newDiagnostics = [diagnostics[0]]; + let previousDiagnostic = diagnostics[0]; + for (let i = 1; i < diagnostics.length; i++) { + let currentDiagnostic = diagnostics[i]; + let isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === Comparison.EqualTo; if (!isDupe) { newDiagnostics.push(currentDiagnostic); previousDiagnostic = currentDiagnostic; @@ -410,9 +413,9 @@ module ts { export function getRootLength(path: string): number { if (path.charCodeAt(0) === CharacterCodes.slash) { if (path.charCodeAt(1) !== CharacterCodes.slash) return 1; - var p1 = path.indexOf("/", 2); + let p1 = path.indexOf("/", 2); if (p1 < 0) return 2; - var p2 = path.indexOf("/", p1 + 1); + let p2 = path.indexOf("/", p1 + 1); if (p2 < 0) return p1 + 1; return p2 + 1; } @@ -423,10 +426,10 @@ module ts { return 0; } - export var directorySeparator = "/"; + export let directorySeparator = "/"; function getNormalizedParts(normalizedSlashedPath: string, rootLength: number) { - var parts = normalizedSlashedPath.substr(rootLength).split(directorySeparator); - var normalized: string[] = []; + let parts = normalizedSlashedPath.substr(rootLength).split(directorySeparator); + let normalized: string[] = []; for (let part of parts) { if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -446,9 +449,9 @@ module ts { } export function normalizePath(path: string): string { - var path = normalizeSlashes(path); - var rootLength = getRootLength(path); - var normalized = getNormalizedParts(path, rootLength); + path = normalizeSlashes(path); + let rootLength = getRootLength(path); + let normalized = getNormalizedParts(path, rootLength); return path.substr(0, rootLength) + normalized.join(directorySeparator); } @@ -465,13 +468,13 @@ module ts { } function normalizedPathComponents(path: string, rootLength: number) { - var normalizedParts = getNormalizedParts(path, rootLength); + let normalizedParts = getNormalizedParts(path, rootLength); return [path.substr(0, rootLength)].concat(normalizedParts); } export function getNormalizedPathComponents(path: string, currentDirectory: string) { - var path = normalizeSlashes(path); - var rootLength = getRootLength(path); + path = normalizeSlashes(path); + let rootLength = getRootLength(path); if (rootLength == 0) { // If the path is not rooted it is relative to current directory path = combinePaths(normalizeSlashes(currentDirectory), path); @@ -496,9 +499,9 @@ module ts { // In this example the root is: http://www.website.com/ // normalized path components should be ["http://www.website.com/", "folder1", "folder2"] - var urlLength = url.length; + let urlLength = url.length; // Initial root length is http:// part - var rootLength = url.indexOf("://") + "://".length; + let rootLength = url.indexOf("://") + "://".length; while (rootLength < urlLength) { // Consume all immediate slashes in the protocol // eg.initial rootlength is just file:// but it needs to consume another "/" in file:/// @@ -517,7 +520,7 @@ module ts { } // Find the index of "/" after website.com so the root can be http://www.website.com/ (from existing http://) - var indexOfNextSlash = url.indexOf(directorySeparator, rootLength); + let indexOfNextSlash = url.indexOf(directorySeparator, rootLength); if (indexOfNextSlash !== -1) { // Found the "/" after the website.com so the root is length of http://www.website.com/ // and get components afetr the root normally like any other folder components @@ -543,8 +546,8 @@ module ts { } export function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean) { - var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory); - var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory); + let pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory); + let directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory); if (directoryComponents.length > 1 && directoryComponents[directoryComponents.length - 1] === "") { // If the directory path given was of type test/cases/ then we really need components of directory to be only till its name // that is ["test", "cases", ""] needs to be actually ["test", "cases"] @@ -560,8 +563,8 @@ module ts { // Get the relative path if (joinStartIndex) { - var relativePath = ""; - var relativePathComponents = pathComponents.slice(joinStartIndex, pathComponents.length); + let relativePath = ""; + let relativePathComponents = pathComponents.slice(joinStartIndex, pathComponents.length); for (; joinStartIndex < directoryComponents.length; joinStartIndex++) { if (directoryComponents[joinStartIndex] !== "") { relativePath = relativePath + ".." + directorySeparator; @@ -572,7 +575,7 @@ module ts { } // Cant find the relative path, get the absolute path - var absolutePath = getNormalizedPathFromPathComponents(pathComponents); + let absolutePath = getNormalizedPathFromPathComponents(pathComponents); if (isAbsolutePathAnUrl && isRootedDiskPath(absolutePath)) { absolutePath = "file:///" + absolutePath; } @@ -581,7 +584,7 @@ module ts { } export function getBaseFileName(path: string) { - var i = path.lastIndexOf(directorySeparator); + let i = path.lastIndexOf(directorySeparator); return i < 0 ? path : path.substring(i + 1); } @@ -594,12 +597,12 @@ module ts { } export function fileExtensionIs(path: string, extension: string): boolean { - var pathLen = path.length; - var extLen = extension.length; + let pathLen = path.length; + let extLen = extension.length; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } - var supportedExtensions = [".d.ts", ".ts", ".js"]; + let supportedExtensions = [".d.ts", ".ts", ".js"]; export function removeFileExtension(path: string): string { for (let ext of supportedExtensions) { @@ -612,9 +615,9 @@ module ts { return path; } - var backslashOrDoubleQuote = /[\"\\]/g; - var escapedCharsRegExp = /[\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap: Map = { + let backslashOrDoubleQuote = /[\"\\]/g; + let escapedCharsRegExp = /[\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; + let escapedCharsMap: Map = { "\0": "\\0", "\t": "\\t", "\v": "\\v", @@ -653,7 +656,7 @@ module ts { function Signature(checker: TypeChecker) { } - export var objectAllocator: ObjectAllocator = { + export let objectAllocator: ObjectAllocator = { getNodeConstructor: kind => { function Node() { } @@ -679,7 +682,7 @@ module ts { } export module Debug { - var currentAssertionLevel = AssertionLevel.None; + let currentAssertionLevel = AssertionLevel.None; export function shouldAssert(level: AssertionLevel): boolean { return currentAssertionLevel >= level; @@ -687,7 +690,7 @@ module ts { export function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string): void { if (!expression) { - var verboseDebugString = ""; + let verboseDebugString = ""; if (verboseDebugInfo) { verboseDebugString = "\r\nVerbose Debug Information: " + verboseDebugInfo(); } From a4bf56f2116e6c686420b339cc495e55b4695501 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 10:54:54 -0700 Subject: [PATCH 058/101] Use 'let' in the scanner. --- src/compiler/scanner.ts | 174 ++++++++++++++++++++-------------------- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 9bb66f10f41..835a5b838d0 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -37,7 +37,7 @@ module ts { tryScan(callback: () => T): T; } - var textToToken: Map = { + let textToToken: Map = { "any": SyntaxKind.AnyKeyword, "as": SyntaxKind.AsKeyword, "boolean": SyntaxKind.BooleanKeyword, @@ -170,8 +170,8 @@ module ts { Codepoint ranges for ES3 Identifiers are extracted from the Unicode 3.0.0 specification at: http://www.unicode.org/Public/3.0-Update/UnicodeData-3.0.0.txt */ - var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; - var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; + let unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; + let unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; /* As per ECMAScript Language Specification 5th Edition, Section 7.6: ISyntaxToken Names and Identifiers @@ -195,8 +195,8 @@ module ts { Codepoint ranges for ES5 Identifiers are extracted from the Unicode 6.2 specification at: http://www.unicode.org/Public/6.2.0/ucd/UnicodeData.txt */ - var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; - var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; + let unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; + let unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, ]; function lookupInUnicodeMap(code: number, map: number[]): boolean { // Bail out quickly if it couldn't possibly be in the map. @@ -205,9 +205,9 @@ module ts { } // Perform binary search in one of the Unicode range maps - var lo: number = 0; - var hi: number = map.length; - var mid: number; + let lo: number = 0; + let hi: number = map.length; + let mid: number; while (lo + 1 < hi) { mid = lo + (hi - lo) / 2; @@ -241,8 +241,8 @@ module ts { } function makeReverseMap(source: Map): string[] { - var result: string[] = []; - for (var name in source) { + let result: string[] = []; + for (let name in source) { if (source.hasOwnProperty(name)) { result[source[name]] = name; } @@ -250,18 +250,18 @@ module ts { return result; } - var tokenStrings = makeReverseMap(textToToken); + let tokenStrings = makeReverseMap(textToToken); export function tokenToString(t: SyntaxKind): string { return tokenStrings[t]; } export function computeLineStarts(text: string): number[] { - var result: number[] = new Array(); - var pos = 0; - var lineStart = 0; + let result: number[] = new Array(); + let pos = 0; + let lineStart = 0; while (pos < text.length) { - var ch = text.charCodeAt(pos++); + let ch = text.charCodeAt(pos++); switch (ch) { case CharacterCodes.carriageReturn: if (text.charCodeAt(pos) === CharacterCodes.lineFeed) { @@ -297,7 +297,7 @@ module ts { } export function computeLineAndCharacterOfPosition(lineStarts: number[], position: number) { - var lineNumber = binarySearch(lineStarts, position); + let lineNumber = binarySearch(lineStarts, position); if (lineNumber < 0) { // If the actual position was not found, // the binary search returns the negative value of the next line start @@ -315,7 +315,7 @@ module ts { return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } - var hasOwnProperty = Object.prototype.hasOwnProperty; + let hasOwnProperty = Object.prototype.hasOwnProperty; export function isWhiteSpace(ch: number): boolean { return ch === CharacterCodes.space || ch === CharacterCodes.tab || ch === CharacterCodes.verticalTab || ch === CharacterCodes.formFeed || @@ -337,7 +337,7 @@ module ts { export function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number { while (true) { - var ch = text.charCodeAt(pos); + let ch = text.charCodeAt(pos); switch (ch) { case CharacterCodes.carriageReturn: if (text.charCodeAt(pos + 1) === CharacterCodes.lineFeed) { @@ -401,17 +401,17 @@ module ts { // All conflict markers consist of the same character repeated seven times. If it is // a <<<<<<< or >>>>>>> marker then it is also followd by a space. - var mergeConflictMarkerLength = "<<<<<<<".length; + let mergeConflictMarkerLength = "<<<<<<<".length; function isConflictMarkerTrivia(text: string, pos: number) { Debug.assert(pos >= 0); // Conflict markers must be at the start of a line. if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { - var ch = text.charCodeAt(pos); + let ch = text.charCodeAt(pos); if ((pos + mergeConflictMarkerLength) < text.length) { - for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { + for (let i = 0, n = mergeConflictMarkerLength; i < n; i++) { if (text.charCodeAt(pos + i) !== ch) { return false; } @@ -430,8 +430,8 @@ module ts { error(Diagnostics.Merge_conflict_marker_encountered, mergeConflictMarkerLength); } - var ch = text.charCodeAt(pos); - var len = text.length; + let ch = text.charCodeAt(pos); + let len = text.length; if (ch === CharacterCodes.lessThan || ch === CharacterCodes.greaterThan) { while (pos < len && !isLineBreak(text.charCodeAt(pos))) { @@ -443,7 +443,7 @@ module ts { // Consume everything from the start of the mid-conlict marker to the start of the next // end-conflict marker. while (pos < len) { - var ch = text.charCodeAt(pos); + let ch = text.charCodeAt(pos); if (ch === CharacterCodes.greaterThan && isConflictMarkerTrivia(text, pos)) { break; } @@ -461,10 +461,10 @@ module ts { // comment. Single-line comment ranges include the beginning '//' characters but not the ending line break. Multi-line comment // ranges include the beginning '/* and ending '*/' characters. The return value is undefined if no comments were found. function getCommentRanges(text: string, pos: number, trailing: boolean): CommentRange[] { - var result: CommentRange[]; - var collecting = trailing || pos === 0; + let result: CommentRange[]; + let collecting = trailing || pos === 0; while (true) { - var ch = text.charCodeAt(pos); + let ch = text.charCodeAt(pos); switch (ch) { case CharacterCodes.carriageReturn: if (text.charCodeAt(pos + 1) === CharacterCodes.lineFeed) pos++; @@ -485,10 +485,10 @@ module ts { pos++; continue; case CharacterCodes.slash: - var nextChar = text.charCodeAt(pos + 1); - var hasTrailingNewLine = false; + let nextChar = text.charCodeAt(pos + 1); + let hasTrailingNewLine = false; if (nextChar === CharacterCodes.slash || nextChar === CharacterCodes.asterisk) { - var startPos = pos; + let startPos = pos; pos += 2; if (nextChar === CharacterCodes.slash) { while (pos < text.length) { @@ -550,15 +550,15 @@ module ts { } export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner { - var pos: number; // Current position (end position of text of current token) - var len: number; // Length of text - var startPos: number; // Start position of whitespace before current token - var tokenPos: number; // Start position of text of current token - var token: SyntaxKind; - var tokenValue: string; - var precedingLineBreak: boolean; - var hasExtendedUnicodeEscape: boolean; - var tokenIsUnterminated: boolean; + let pos: number; // Current position (end position of text of current token) + let len: number; // Length of text + let startPos: number; // Start position of whitespace before current token + let tokenPos: number; // Start position of text of current token + let token: SyntaxKind; + let tokenValue: string; + let precedingLineBreak: boolean; + let hasExtendedUnicodeEscape: boolean; + let tokenIsUnterminated: boolean; function error(message: DiagnosticMessage, length?: number): void { if (onError) { @@ -579,13 +579,13 @@ module ts { } function scanNumber(): number { - var start = pos; + let start = pos; while (isDigit(text.charCodeAt(pos))) pos++; if (text.charCodeAt(pos) === CharacterCodes.dot) { pos++; while (isDigit(text.charCodeAt(pos))) pos++; } - var end = pos; + let end = pos; if (text.charCodeAt(pos) === CharacterCodes.E || text.charCodeAt(pos) === CharacterCodes.e) { pos++; if (text.charCodeAt(pos) === CharacterCodes.plus || text.charCodeAt(pos) === CharacterCodes.minus) pos++; @@ -602,7 +602,7 @@ module ts { } function scanOctalDigits(): number { - var start = pos; + let start = pos; while (isOctalDigit(text.charCodeAt(pos))) { pos++; } @@ -626,10 +626,10 @@ module ts { } function scanHexDigits(minCount: number, scanAsManyAsPossible: boolean): number { - var digits = 0; - var value = 0; + let digits = 0; + let value = 0; while (digits < minCount || scanAsManyAsPossible) { - var ch = text.charCodeAt(pos); + let ch = text.charCodeAt(pos); if (ch >= CharacterCodes._0 && ch <= CharacterCodes._9) { value = value * 16 + ch - CharacterCodes._0; } @@ -652,9 +652,9 @@ module ts { } function scanString(): string { - var quote = text.charCodeAt(pos++); - var result = ""; - var start = pos; + let quote = text.charCodeAt(pos++); + let result = ""; + let start = pos; while (true) { if (pos >= len) { result += text.substring(start, pos); @@ -662,7 +662,7 @@ module ts { error(Diagnostics.Unterminated_string_literal); break; } - var ch = text.charCodeAt(pos); + let ch = text.charCodeAt(pos); if (ch === quote) { result += text.substring(start, pos); pos++; @@ -690,12 +690,12 @@ module ts { * a literal component of a TemplateExpression. */ function scanTemplateAndSetTokenValue(): SyntaxKind { - var startedWithBacktick = text.charCodeAt(pos) === CharacterCodes.backtick; + let startedWithBacktick = text.charCodeAt(pos) === CharacterCodes.backtick; pos++; - var start = pos; - var contents = "" - var resultingToken: SyntaxKind; + let start = pos; + let contents = "" + let resultingToken: SyntaxKind; while (true) { if (pos >= len) { @@ -706,7 +706,7 @@ module ts { break; } - var currChar = text.charCodeAt(pos); + let currChar = text.charCodeAt(pos); // '`' if (currChar === CharacterCodes.backtick) { @@ -762,7 +762,7 @@ module ts { error(Diagnostics.Unexpected_end_of_text); return ""; } - var ch = text.charCodeAt(pos++); + let ch = text.charCodeAt(pos++); switch (ch) { case CharacterCodes._0: return "\0"; @@ -814,7 +814,7 @@ module ts { } function scanHexadecimalEscape(numDigits: number): string { - var escapedValue = scanExactNumberOfHexDigits(numDigits); + let escapedValue = scanExactNumberOfHexDigits(numDigits); if (escapedValue >= 0) { return String.fromCharCode(escapedValue); @@ -826,8 +826,8 @@ module ts { } function scanExtendedUnicodeEscape(): string { - var escapedValue = scanMinimumNumberOfHexDigits(1); - var isInvalidExtendedEscape = false; + let escapedValue = scanMinimumNumberOfHexDigits(1); + let isInvalidExtendedEscape = false; // Validate the value of the digit if (escapedValue < 0) { @@ -867,8 +867,8 @@ module ts { return String.fromCharCode(codePoint); } - var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800; - var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00; + let codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800; + let codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00; return String.fromCharCode(codeUnit1, codeUnit2); } @@ -877,9 +877,9 @@ module ts { // and return code point value if valid Unicode escape is found. Otherwise return -1. function peekUnicodeEscape(): number { if (pos + 5 < len && text.charCodeAt(pos + 1) === CharacterCodes.u) { - var start = pos; + let start = pos; pos += 2; - var value = scanExactNumberOfHexDigits(4); + let value = scanExactNumberOfHexDigits(4); pos = start; return value; } @@ -887,10 +887,10 @@ module ts { } function scanIdentifierParts(): string { - var result = ""; - var start = pos; + let result = ""; + let start = pos; while (pos < len) { - var ch = text.charCodeAt(pos); + let ch = text.charCodeAt(pos); if (isIdentifierPart(ch)) { pos++; } @@ -915,9 +915,9 @@ module ts { function getIdentifierToken(): SyntaxKind { // Reserved words are between 2 and 11 characters long and start with a lowercase letter - var len = tokenValue.length; + let len = tokenValue.length; if (len >= 2 && len <= 11) { - var ch = tokenValue.charCodeAt(0); + let ch = tokenValue.charCodeAt(0); if (ch >= CharacterCodes.a && ch <= CharacterCodes.z && hasOwnProperty.call(textToToken, tokenValue)) { return token = textToToken[tokenValue]; } @@ -928,13 +928,13 @@ module ts { function scanBinaryOrOctalDigits(base: number): number { Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); - var value = 0; + let value = 0; // For counting number of digits; Valid binaryIntegerLiteral must have at least one binary digit following B or b. // Similarly valid octalIntegerLiteral must have at least one octal digit following o or O. - var numberOfDigits = 0; + let numberOfDigits = 0; while (true) { - var ch = text.charCodeAt(pos); - var valueOfCh = ch - CharacterCodes._0; + let ch = text.charCodeAt(pos); + let valueOfCh = ch - CharacterCodes._0; if (!isDigit(ch) || valueOfCh >= base) { break; } @@ -1079,9 +1079,9 @@ module ts { if (text.charCodeAt(pos + 1) === CharacterCodes.asterisk) { pos += 2; - var commentClosed = false; + let commentClosed = false; while (pos < len) { - var ch = text.charCodeAt(pos); + let ch = text.charCodeAt(pos); if (ch === CharacterCodes.asterisk && text.charCodeAt(pos + 1) === CharacterCodes.slash) { pos += 2; @@ -1117,7 +1117,7 @@ module ts { case CharacterCodes._0: if (pos + 2 < len && (text.charCodeAt(pos + 1) === CharacterCodes.X || text.charCodeAt(pos + 1) === CharacterCodes.x)) { pos += 2; - var value = scanMinimumNumberOfHexDigits(1); + let value = scanMinimumNumberOfHexDigits(1); if (value < 0) { error(Diagnostics.Hexadecimal_digit_expected); value = 0; @@ -1127,7 +1127,7 @@ module ts { } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === CharacterCodes.B || text.charCodeAt(pos + 1) === CharacterCodes.b)) { pos += 2; - var value = scanBinaryOrOctalDigits(/* base */ 2); + let value = scanBinaryOrOctalDigits(/* base */ 2); if (value < 0) { error(Diagnostics.Binary_digit_expected); value = 0; @@ -1137,7 +1137,7 @@ module ts { } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === CharacterCodes.O || text.charCodeAt(pos + 1) === CharacterCodes.o)) { pos += 2; - var value = scanBinaryOrOctalDigits(/* base */ 8); + let value = scanBinaryOrOctalDigits(/* base */ 8); if (value < 0) { error(Diagnostics.Octal_digit_expected); value = 0; @@ -1304,9 +1304,9 @@ module ts { function reScanSlashToken(): SyntaxKind { if (token === SyntaxKind.SlashToken || token === SyntaxKind.SlashEqualsToken) { - var p = tokenPos + 1; - var inEscape = false; - var inCharacterClass = false; + let p = tokenPos + 1; + let inEscape = false; + let inCharacterClass = false; while (true) { // If we reach the end of a file, or hit a newline, then this is an unterminated // regex. Report error and return what we have so far. @@ -1316,7 +1316,7 @@ module ts { break; } - var ch = text.charCodeAt(p); + let ch = text.charCodeAt(p); if (isLineBreak(ch)) { tokenIsUnterminated = true; error(Diagnostics.Unterminated_regular_expression_literal) @@ -1366,13 +1366,13 @@ module ts { } function speculationHelper(callback: () => T, isLookahead: boolean): T { - var savePos = pos; - var saveStartPos = startPos; - var saveTokenPos = tokenPos; - var saveToken = token; - var saveTokenValue = tokenValue; - var savePrecedingLineBreak = precedingLineBreak; - var result = callback(); + let savePos = pos; + let saveStartPos = startPos; + let saveTokenPos = tokenPos; + let saveToken = token; + let saveTokenValue = tokenValue; + let savePrecedingLineBreak = precedingLineBreak; + let result = callback(); // If our callback returned something 'falsy' or we're just looking ahead, // then unconditionally restore us to where we were. From 0f498ab414638ece5d0520dd29d0f568237eb838 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 10:59:25 -0700 Subject: [PATCH 059/101] Use 'let' in the parser. --- src/compiler/parser.ts | 586 ++++++++++++++++++++--------------------- 1 file changed, 293 insertions(+), 293 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 3fcd5fd9fda..474203702ed 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2,8 +2,8 @@ /// module ts { - var nodeConstructors = new Array Node>(SyntaxKind.Count); - /* @internal */ export var parseTime = 0; + let nodeConstructors = new Array Node>(SyntaxKind.Count); + /* @internal */ export let parseTime = 0; export function getNodeConstructor(kind: SyntaxKind): new () => Node { return nodeConstructors[kind] || (nodeConstructors[kind] = objectAllocator.getNodeConstructor(kind)); @@ -28,7 +28,7 @@ module ts { function visitEachNode(cbNode: (node: Node) => T, nodes: Node[]) { if (nodes) { for (let node of nodes) { - var result = cbNode(node); + let result = cbNode(node); if (result) { return result; } @@ -47,8 +47,8 @@ module ts { // The visitXXX functions could be written as local functions that close over the cbNode and cbNodeArray // callback parameters, but that causes a closure allocation for each invocation with noticeable effects // on performance. - var visitNodes: (cb: (node: Node | Node[]) => T, nodes: Node[]) => T = cbNodeArray ? visitNodeArray : visitEachNode; - var cbNodes = cbNodeArray || cbNode; + let visitNodes: (cb: (node: Node | Node[]) => T, nodes: Node[]) => T = cbNodeArray ? visitNodeArray : visitEachNode; + let cbNodes = cbNodeArray || cbNode; switch (node.kind) { case SyntaxKind.QualifiedName: return visitNode(cbNode, (node).left) || @@ -373,7 +373,7 @@ module ts { // overhead. This functions allows us to set all the parents, without all the expense of // binding. - var parent: Node = sourceFile; + let parent: Node = sourceFile; forEachChild(sourceFile, visitNode); return; @@ -384,7 +384,7 @@ module ts { if (n.parent !== parent) { n.parent = parent; - var saveParent = parent; + let saveParent = parent; parent = n; forEachChild(n, visitNode); parent = saveParent; @@ -519,7 +519,7 @@ module ts { function checkNodePositions(node: Node, aggressiveChecks: boolean) { if (aggressiveChecks) { - var pos = node.pos; + let pos = node.pos; forEachChild(node, child => { Debug.assert(child.pos >= pos); pos = child.end; @@ -553,7 +553,7 @@ module ts { // Check if the element intersects the change range. If it does, then it is not // reusable. Also, we'll need to recurse to see what constituent portions we may // be able to use. - var fullEnd = child.end; + let fullEnd = child.end; if (fullEnd >= changeStart) { child.intersectsChange = true; child._children = undefined; @@ -582,7 +582,7 @@ module ts { // Check if the element intersects the change range. If it does, then it is not // reusable. Also, we'll need to recurse to see what constituent portions we may // be able to use. - var fullEnd = array.end; + let fullEnd = array.end; if (fullEnd >= changeStart) { array.intersectsChange = true; array._children = undefined; @@ -611,35 +611,35 @@ module ts { // (as it does not intersect the actual original change range). Because an edit may // change the token touching it, we actually need to look back *at least* one token so // that the prior token sees that change. - var maxLookahead = 1; + let maxLookahead = 1; - var start = changeRange.span.start; + let start = changeRange.span.start; // the first iteration aligns us with the change start. subsequent iteration move us to // the left by maxLookahead tokens. We only need to do this as long as we're not at the // start of the tree. - for (var i = 0; start > 0 && i <= maxLookahead; i++) { - var nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start); + for (let i = 0; start > 0 && i <= maxLookahead; i++) { + let nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start); Debug.assert(nearestNode.pos <= start); - var position = nearestNode.pos; + let position = nearestNode.pos; start = Math.max(0, position - 1); } - var finalSpan = createTextSpanFromBounds(start, textSpanEnd(changeRange.span)); - var finalLength = changeRange.newLength + (changeRange.span.start - start); + let finalSpan = createTextSpanFromBounds(start, textSpanEnd(changeRange.span)); + let finalLength = changeRange.newLength + (changeRange.span.start - start); return createTextChangeRange(finalSpan, finalLength); } function findNearestNodeStartingBeforeOrAtPosition(sourceFile: SourceFile, position: number): Node { - var bestResult: Node = sourceFile; - var lastNodeEntirelyBeforePosition: Node; + let bestResult: Node = sourceFile; + let lastNodeEntirelyBeforePosition: Node; forEachChild(sourceFile, visit); if (lastNodeEntirelyBeforePosition) { - var lastChildOfLastEntireNodeBeforePosition = getLastChild(lastNodeEntirelyBeforePosition); + let lastChildOfLastEntireNodeBeforePosition = getLastChild(lastNodeEntirelyBeforePosition); if (lastChildOfLastEntireNodeBeforePosition.pos > bestResult.pos) { bestResult = lastChildOfLastEntireNodeBeforePosition; } @@ -649,7 +649,7 @@ module ts { function getLastChild(node: Node): Node { while (true) { - var lastChild = getLastChildWorker(node); + let lastChild = getLastChildWorker(node); if (lastChild) { node = lastChild; } @@ -660,7 +660,7 @@ module ts { } function getLastChildWorker(node: Node): Node { - var last: Node = undefined; + let last: Node = undefined; forEachChild(node, child => { if (nodeIsPresent(child)) { last = child; @@ -728,17 +728,17 @@ module ts { } function checkChangeRange(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks: boolean) { - var oldText = sourceFile.text; + let oldText = sourceFile.text; if (textChangeRange) { Debug.assert((oldText.length - textChangeRange.span.length + textChangeRange.newLength) === newText.length); if (aggressiveChecks || Debug.shouldAssert(AssertionLevel.VeryAggressive)) { - var oldTextPrefix = oldText.substr(0, textChangeRange.span.start); - var newTextPrefix = newText.substr(0, textChangeRange.span.start); + let oldTextPrefix = oldText.substr(0, textChangeRange.span.start); + let newTextPrefix = newText.substr(0, textChangeRange.span.start); Debug.assert(oldTextPrefix === newTextPrefix); - var oldTextSuffix = oldText.substring(textSpanEnd(textChangeRange.span), oldText.length); - var newTextSuffix = newText.substring(textSpanEnd(textChangeRangeNewSpan(textChangeRange)), newText.length); + let oldTextSuffix = oldText.substring(textSpanEnd(textChangeRange.span), oldText.length); + let newTextSuffix = newText.substring(textSpanEnd(textChangeRangeNewSpan(textChangeRange)), newText.length); Debug.assert(oldTextSuffix === newTextSuffix); } } @@ -774,16 +774,16 @@ module ts { // This is because we do incremental parsing in-place. i.e. we take nodes from the old // tree and give them new positions and parents. From that point on, trusting the old // tree at all is not possible as far too much of it may violate invariants. - var incrementalSourceFile = sourceFile; + let incrementalSourceFile = sourceFile; Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed); incrementalSourceFile.hasBeenIncrementallyParsed = true; - var oldText = sourceFile.text; - var syntaxCursor = createSyntaxCursor(sourceFile); + let oldText = sourceFile.text; + let syntaxCursor = createSyntaxCursor(sourceFile); // Make the actual change larger so that we know to reparse anything whose lookahead // might have intersected the change. - var changeRange = extendToAffectedRange(sourceFile, textChangeRange); + let changeRange = extendToAffectedRange(sourceFile, textChangeRange); checkChangeRange(sourceFile, newText, changeRange, aggressiveChecks); // Ensure that extending the affected range only moved the start of the change range @@ -795,7 +795,7 @@ module ts { // The is the amount the nodes after the edit range need to be adjusted. It can be // positive (if the edit added characters), negative (if the edit deleted characters) // or zero (if this was a pure overwrite with nothing added/removed). - var delta = textChangeRangeNewSpan(changeRange).length - changeRange.span.length; + let delta = textChangeRangeNewSpan(changeRange).length - changeRange.span.length; // If we added or removed characters during the edit, then we need to go and adjust all // the nodes after the edit. Those nodes may move forward (if we inserted chars) or they @@ -829,7 +829,7 @@ module ts { // inconsistent tree. Setting the parents on the new tree should be very fast. We // will immediately bail out of walking any subtrees when we can see that their parents // are already correct. - var result = parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /* setParentNode */ true) + let result = parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /* setParentNode */ true) return result; } @@ -842,7 +842,7 @@ module ts { /// Should be called only on prologue directives (isPrologueDirective(node) should be true) function isUseStrictPrologueDirective(sourceFile: SourceFile, node: Node): boolean { Debug.assert(isPrologueDirective(node)); - var nodeText = getSourceTextOfNodeFromSourceFile(sourceFile,(node).expression); + let nodeText = getSourceTextOfNodeFromSourceFile(sourceFile,(node).expression); // Note: the node text must be exactly "use strict" or 'use strict'. It is not ok for the // string to contain unicode escapes (as per ES5). @@ -876,12 +876,12 @@ module ts { } function createSyntaxCursor(sourceFile: SourceFile): SyntaxCursor { - var currentArray: NodeArray = sourceFile.statements; - var currentArrayIndex = 0; + let currentArray: NodeArray = sourceFile.statements; + let currentArrayIndex = 0; Debug.assert(currentArrayIndex < currentArray.length); - var current = currentArray[currentArrayIndex]; - var lastQueriedPosition = InvalidPosition.Value; + let current = currentArray[currentArrayIndex]; + let lastQueriedPosition = InvalidPosition.Value; return { currentNode(position: number) { @@ -949,7 +949,7 @@ module ts { // position was in this array. Search through this array to see if we find a // viable element. for (let i = 0, n = array.length; i < n; i++) { - var child = array[i]; + let child = array[i]; if (child) { if (child.pos === position) { // Found the right node. We're done. @@ -977,21 +977,21 @@ module ts { } export function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false): SourceFile { - var start = new Date().getTime(); - var result = parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes); + let start = new Date().getTime(); + let result = parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes); parseTime += new Date().getTime() - start; return result; } function parseSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, syntaxCursor: SyntaxCursor, setParentNodes = false): SourceFile { - var parsingContext: ParsingContext = 0; - var identifiers: Map = {}; - var identifierCount = 0; - var nodeCount = 0; - var token: SyntaxKind; + let parsingContext: ParsingContext = 0; + let identifiers: Map = {}; + let identifierCount = 0; + let nodeCount = 0; + let token: SyntaxKind; - var sourceFile = createNode(SyntaxKind.SourceFile, /*pos*/ 0); + let sourceFile = createNode(SyntaxKind.SourceFile, /*pos*/ 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; @@ -1049,7 +1049,7 @@ module ts { // Note: it should not be necessary to save/restore these flags during speculative/lookahead // parsing. These context flags are naturally stored and restored through normal recursive // descent parsing and unwinding. - var contextFlags: ParserContextFlags = 0; + let contextFlags: ParserContextFlags = 0; // Whether or not we've had a parse error since creating the last AST node. If we have // encountered an error, it will be stored on the next AST node we create. Parse errors @@ -1078,10 +1078,10 @@ module ts { // // Note: any errors at the end of the file that do not precede a regular node, should get // attached to the EOF token. - var parseErrorBeforeNextFinishedNode: boolean = false; + let parseErrorBeforeNextFinishedNode: boolean = false; // Create and prime the scanner before parsing the source elements. - var scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceText, scanError); + let scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceText, scanError); token = nextToken(); processReferenceComments(sourceFile); @@ -1131,7 +1131,7 @@ module ts { function allowInAnd(func: () => T): T { if (contextFlags & ParserContextFlags.DisallowIn) { setDisallowInContext(false); - var result = func(); + let result = func(); setDisallowInContext(true); return result; } @@ -1147,7 +1147,7 @@ module ts { } setDisallowInContext(true); - var result = func(); + let result = func(); setDisallowInContext(false); return result; } @@ -1159,7 +1159,7 @@ module ts { } setYieldContext(true); - var result = func(); + let result = func(); setYieldContext(false); return result; } @@ -1167,7 +1167,7 @@ module ts { function doOutsideOfYieldContext(func: () => T): T { if (contextFlags & ParserContextFlags.Yield) { setYieldContext(false); - var result = func(); + let result = func(); setYieldContext(true); return result; } @@ -1193,15 +1193,15 @@ module ts { } function parseErrorAtCurrentToken(message: DiagnosticMessage, arg0?: any): void { - var start = scanner.getTokenPos(); - var length = scanner.getTextPos() - start; + let start = scanner.getTokenPos(); + let length = scanner.getTextPos() - start; parseErrorAtPosition(start, length, message, arg0); } function parseErrorAtPosition(start: number, length: number, message: DiagnosticMessage, arg0?: any): void { // Don't report another error if it would just be at the same position as the last error. - var lastError = lastOrUndefined(sourceFile.parseDiagnostics); + let lastError = lastOrUndefined(sourceFile.parseDiagnostics); if (!lastError || start !== lastError.start) { sourceFile.parseDiagnostics.push(createFileDiagnostic(sourceFile, start, length, message, arg0)); } @@ -1212,7 +1212,7 @@ module ts { } function scanError(message: DiagnosticMessage, length?: number) { - var pos = scanner.getTextPos(); + let pos = scanner.getTextPos(); parseErrorAtPosition(pos, length || 0, message); } @@ -1247,20 +1247,20 @@ module ts { function speculationHelper(callback: () => T, isLookAhead: boolean): T { // Keep track of the state we'll need to rollback to if lookahead fails (or if the // caller asked us to always reset our state). - var saveToken = token; - var saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; - var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; + let saveToken = token; + let saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; + let saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; // Note: it is not actually necessary to save/restore the context flags here. That's // because the saving/restorating of these flags happens naturally through the recursive // descent nature of our parser. However, we still store this here just so we can // assert that that invariant holds. - var saveContextFlags = contextFlags; + let saveContextFlags = contextFlags; // If we're only looking ahead, then tell the scanner to only lookahead as well. // Otherwise, if we're actually speculatively parsing, then tell the scanner to do the // same. - var result = isLookAhead + let result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); @@ -1343,7 +1343,7 @@ module ts { } function parseTokenNode(): T { - var node = createNode(token); + let node = createNode(token); nextToken(); return finishNode(node); } @@ -1374,7 +1374,7 @@ module ts { function createNode(kind: SyntaxKind, pos?: number): Node { nodeCount++; - var node = new (nodeConstructors[kind] || (nodeConstructors[kind] = objectAllocator.getNodeConstructor(kind)))(); + let node = new (nodeConstructors[kind] || (nodeConstructors[kind] = objectAllocator.getNodeConstructor(kind)))(); if (!(pos >= 0)) { pos = scanner.getStartPos(); } @@ -1410,7 +1410,7 @@ module ts { parseErrorAtCurrentToken(diagnosticMessage, arg0); } - var result = createNode(kind, scanner.getStartPos()); + let result = createNode(kind, scanner.getStartPos()); (result).text = ""; return finishNode(result); } @@ -1426,7 +1426,7 @@ module ts { function createIdentifier(isIdentifier: boolean, diagnosticMessage?: DiagnosticMessage): Identifier { identifierCount++; if (isIdentifier) { - var node = createNode(SyntaxKind.Identifier); + let node = createNode(SyntaxKind.Identifier); node.text = internIdentifier(scanner.getTokenValue()); nextToken(); return finishNode(node); @@ -1468,13 +1468,13 @@ module ts { // ComputedPropertyName[Yield] : // [ AssignmentExpression[In, ?Yield] ] // - var node = createNode(SyntaxKind.ComputedPropertyName); + let node = createNode(SyntaxKind.ComputedPropertyName); parseExpected(SyntaxKind.OpenBracketToken); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker // will error if it sees a comma expression. - var yieldContext = inYieldContext(); + let yieldContext = inYieldContext(); if (inGeneratorParameterContext()) { setYieldContext(false); } @@ -1534,7 +1534,7 @@ module ts { // True if positioned at the start of a list element function isListElement(parsingContext: ParsingContext, inErrorRecovery: boolean): boolean { - var node = currentNode(parsingContext); + let node = currentNode(parsingContext); if (node) { return true; } @@ -1674,7 +1674,7 @@ module ts { // True if positioned at element or terminator of the current list or any enclosing list function isInSomeParsingContext(): boolean { - for (var kind = 0; kind < ParsingContext.Count; kind++) { + for (let kind = 0; kind < ParsingContext.Count; kind++) { if (parsingContext & (1 << kind)) { if (isListElement(kind, /* inErrorRecovery */ true) || isListTerminator(kind)) { return true; @@ -1687,15 +1687,15 @@ module ts { // Parses a list of elements function parseList(kind: ParsingContext, checkForStrictMode: boolean, parseElement: () => T): NodeArray { - var saveParsingContext = parsingContext; + let saveParsingContext = parsingContext; parsingContext |= 1 << kind; - var result = >[]; + let result = >[]; result.pos = getNodePos(); - var savedStrictModeContext = inStrictModeContext(); + let savedStrictModeContext = inStrictModeContext(); while (!isListTerminator(kind)) { if (isListElement(kind, /* inErrorRecovery */ false)) { - var element = parseListElement(kind, parseElement); + let element = parseListElement(kind, parseElement); result.push(element); // test elements only if we are not already in strict mode @@ -1726,7 +1726,7 @@ module ts { } function parseListElement(parsingContext: ParsingContext, parseElement: () => T): T { - var node = currentNode(parsingContext); + let node = currentNode(parsingContext); if (node) { return consumeNode(node); } @@ -1751,7 +1751,7 @@ module ts { return undefined; } - var node = syntaxCursor.currentNode(scanner.getStartPos()); + let node = syntaxCursor.currentNode(scanner.getStartPos()); // Can't reuse a missing node. if (nodeIsMissing(node)) { @@ -1780,7 +1780,7 @@ module ts { // differently depending on what mode it is in. // // This also applies to all our other context flags as well. - var nodeContextFlags = node.parserContextFlags & ParserContextFlags.ParserGeneratedFlags; + let nodeContextFlags = node.parserContextFlags & ParserContextFlags.ParserGeneratedFlags; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -1978,19 +1978,19 @@ module ts { // Very subtle incremental parsing bug. Consider the following code: // - // var v = new List < A, B + // let v = new List < A, B // // This is actually legal code. It's a list of variable declarators "v = new List() + // let v = new List < A, B >() // // then we have a problem. "v = new Listnode; + let variableDeclarator = node; return variableDeclarator.initializer === undefined; } @@ -2000,7 +2000,7 @@ module ts { } // See the comment in isReusableVariableDeclaration for why we do this. - var parameter = node; + let parameter = node; return parameter.initializer === undefined; } @@ -2017,12 +2017,12 @@ module ts { // Parses a comma-delimited list of elements function parseDelimitedList(kind: ParsingContext, parseElement: () => T, considerSemicolonAsDelimeter?: boolean): NodeArray { - var saveParsingContext = parsingContext; + let saveParsingContext = parsingContext; parsingContext |= 1 << kind; - var result = >[]; + let result = >[]; result.pos = getNodePos(); - var commaStart = -1; // Meaning the previous token was not a comma + let commaStart = -1; // Meaning the previous token was not a comma while (true) { if (isListElement(kind, /* inErrorRecovery */ false)) { result.push(parseListElement(kind, parseElement)); @@ -2076,8 +2076,8 @@ module ts { } function createMissingList(): NodeArray { - var pos = getNodePos(); - var result = >[]; + let pos = getNodePos(); + let result = >[]; result.pos = pos; result.end = pos; return result; @@ -2085,7 +2085,7 @@ module ts { function parseBracketedList(kind: ParsingContext, parseElement: () => T, open: SyntaxKind, close: SyntaxKind): NodeArray { if (parseExpected(open)) { - var result = parseDelimitedList(kind, parseElement); + let result = parseDelimitedList(kind, parseElement); parseExpected(close); return result; } @@ -2095,9 +2095,9 @@ module ts { // The allowReservedWords parameter controls whether reserved words are permitted after the first dot function parseEntityName(allowReservedWords: boolean, diagnosticMessage?: DiagnosticMessage): EntityName { - var entity: EntityName = parseIdentifier(diagnosticMessage); + let entity: EntityName = parseIdentifier(diagnosticMessage); while (parseOptional(SyntaxKind.DotToken)) { - var node = createNode(SyntaxKind.QualifiedName, entity.pos); + let node = createNode(SyntaxKind.QualifiedName, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -2126,7 +2126,7 @@ module ts { // In the first case though, ASI will not take effect because there is not a // line terminator after the keyword. if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord()) { - var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); + let matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); if (matchesPattern) { // Report that we need an identifier. However, report it right after the dot, @@ -2140,12 +2140,12 @@ module ts { } function parseTemplateExpression(): TemplateExpression { - var template = createNode(SyntaxKind.TemplateExpression); + let template = createNode(SyntaxKind.TemplateExpression); template.head = parseLiteralNode(); Debug.assert(template.head.kind === SyntaxKind.TemplateHead, "Template head has wrong token kind"); - var templateSpans = >[]; + let templateSpans = >[]; templateSpans.pos = getNodePos(); do { @@ -2160,10 +2160,10 @@ module ts { } function parseTemplateSpan(): TemplateSpan { - var span = createNode(SyntaxKind.TemplateSpan); + let span = createNode(SyntaxKind.TemplateSpan); span.expression = allowInAnd(parseExpression); - var literal: LiteralExpression; + let literal: LiteralExpression; if (token === SyntaxKind.CloseBraceToken) { reScanTemplateToken() @@ -2178,8 +2178,8 @@ module ts { } function parseLiteralNode(internName?: boolean): LiteralExpression { - var node = createNode(token); - var text = scanner.getTokenValue(); + let node = createNode(token); + let text = scanner.getTokenValue(); node.text = internName ? internIdentifier(text) : text; if (scanner.hasExtendedUnicodeEscape()) { @@ -2190,7 +2190,7 @@ module ts { node.isUnterminated = true; } - var tokenPos = scanner.getTokenPos(); + let tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); @@ -2213,7 +2213,7 @@ module ts { // TYPES function parseTypeReference(): TypeReferenceNode { - var node = createNode(SyntaxKind.TypeReference); + let node = createNode(SyntaxKind.TypeReference); node.typeName = parseEntityName(/*allowReservedWords*/ false, Diagnostics.Type_expected); if (!scanner.hasPrecedingLineBreak() && token === SyntaxKind.LessThanToken) { node.typeArguments = parseBracketedList(ParsingContext.TypeArguments, parseType, SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken); @@ -2222,14 +2222,14 @@ module ts { } function parseTypeQuery(): TypeQueryNode { - var node = createNode(SyntaxKind.TypeQuery); + let node = createNode(SyntaxKind.TypeQuery); parseExpected(SyntaxKind.TypeOfKeyword); node.exprName = parseEntityName(/*allowReservedWords*/ true); return finishNode(node); } function parseTypeParameter(): TypeParameterDeclaration { - var node = createNode(SyntaxKind.TypeParameter); + let node = createNode(SyntaxKind.TypeParameter); node.name = parseIdentifier(); if (parseOptional(SyntaxKind.ExtendsKeyword)) { // It's not uncommon for people to write improper constraints to a generic. If the @@ -2282,7 +2282,7 @@ module ts { } function parseParameter(): ParameterDeclaration { - var node = createNode(SyntaxKind.Parameter); + let node = createNode(SyntaxKind.Parameter); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(SyntaxKind.DotDotDotToken); @@ -2328,7 +2328,7 @@ module ts { yieldAndGeneratorParameterContext: boolean, requireCompleteParameterList: boolean, signature: SignatureDeclaration): void { - var returnTokenRequired = returnToken === SyntaxKind.EqualsGreaterThanToken; + let returnTokenRequired = returnToken === SyntaxKind.EqualsGreaterThanToken; signature.typeParameters = parseTypeParameters(); signature.parameters = parseParameterList(yieldAndGeneratorParameterContext, requireCompleteParameterList); @@ -2361,13 +2361,13 @@ module ts { // [+GeneratorParameter]BindingIdentifier[Yield]Initializer[In]opt // [~GeneratorParameter]BindingIdentifier[?Yield]Initializer[In, ?Yield]opt if (parseExpected(SyntaxKind.OpenParenToken)) { - var savedYieldContext = inYieldContext(); - var savedGeneratorParameterContext = inGeneratorParameterContext(); + let savedYieldContext = inYieldContext(); + let savedGeneratorParameterContext = inGeneratorParameterContext(); setYieldContext(yieldAndGeneratorParameterContext); setGeneratorParameterContext(yieldAndGeneratorParameterContext); - var result = parseDelimitedList(ParsingContext.Parameters, parseParameter); + let result = parseDelimitedList(ParsingContext.Parameters, parseParameter); setYieldContext(savedYieldContext); setGeneratorParameterContext(savedGeneratorParameterContext); @@ -2399,7 +2399,7 @@ module ts { } function parseSignatureMember(kind: SyntaxKind): SignatureDeclaration { - var node = createNode(kind); + let node = createNode(kind); if (kind === SyntaxKind.ConstructSignature) { parseExpected(SyntaxKind.NewKeyword); } @@ -2472,8 +2472,8 @@ module ts { } function parseIndexSignatureDeclaration(modifiers: ModifiersArray): IndexSignatureDeclaration { - var fullStart = modifiers ? modifiers.pos : scanner.getStartPos(); - var node = createNode(SyntaxKind.IndexSignature, fullStart); + let fullStart = modifiers ? modifiers.pos : scanner.getStartPos(); + let node = createNode(SyntaxKind.IndexSignature, fullStart); setModifiers(node, modifiers); node.parameters = parseBracketedList(ParsingContext.Parameters, parseParameter, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); node.type = parseTypeAnnotation(); @@ -2482,12 +2482,12 @@ module ts { } function parsePropertyOrMethodSignature(): Declaration { - var fullStart = scanner.getStartPos(); - var name = parsePropertyName(); - var questionToken = parseOptionalToken(SyntaxKind.QuestionToken); + let fullStart = scanner.getStartPos(); + let name = parsePropertyName(); + let questionToken = parseOptionalToken(SyntaxKind.QuestionToken); if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) { - var method = createNode(SyntaxKind.MethodSignature, fullStart); + let method = createNode(SyntaxKind.MethodSignature, fullStart); method.name = name; method.questionToken = questionToken; @@ -2498,7 +2498,7 @@ module ts { return finishNode(method); } else { - var property = createNode(SyntaxKind.PropertySignature, fullStart); + let property = createNode(SyntaxKind.PropertySignature, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -2515,7 +2515,7 @@ module ts { return true; default: if (isModifier(token)) { - var result = lookAhead(isStartOfIndexSignatureDeclaration); + let result = lookAhead(isStartOfIndexSignatureDeclaration); if (result) { return result; } @@ -2568,7 +2568,7 @@ module ts { // if it has the same text regardless of whether it is inside a class or an // object type. if (isModifier(token)) { - var result = tryParse(parseIndexSignatureWithModifiers); + let result = tryParse(parseIndexSignatureWithModifiers); if (result) { return result; } @@ -2581,7 +2581,7 @@ module ts { } function parseIndexSignatureWithModifiers() { - var modifiers = parseModifiers(); + let modifiers = parseModifiers(); return isIndexSignature() ? parseIndexSignatureDeclaration(modifiers) : undefined; @@ -2593,13 +2593,13 @@ module ts { } function parseTypeLiteral(): TypeLiteralNode { - var node = createNode(SyntaxKind.TypeLiteral); + let node = createNode(SyntaxKind.TypeLiteral); node.members = parseObjectTypeMembers(); return finishNode(node); } function parseObjectTypeMembers(): NodeArray { - var members: NodeArray; + let members: NodeArray; if (parseExpected(SyntaxKind.OpenBraceToken)) { members = parseList(ParsingContext.TypeMembers, /*checkForStrictMode*/ false, parseTypeMember); parseExpected(SyntaxKind.CloseBraceToken); @@ -2612,13 +2612,13 @@ module ts { } function parseTupleType(): TupleTypeNode { - var node = createNode(SyntaxKind.TupleType); + let node = createNode(SyntaxKind.TupleType); node.elementTypes = parseBracketedList(ParsingContext.TupleElementTypes, parseType, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); return finishNode(node); } function parseParenthesizedType(): ParenthesizedTypeNode { - var node = createNode(SyntaxKind.ParenthesizedType); + let node = createNode(SyntaxKind.ParenthesizedType); parseExpected(SyntaxKind.OpenParenToken); node.type = parseType(); parseExpected(SyntaxKind.CloseParenToken); @@ -2626,7 +2626,7 @@ module ts { } function parseFunctionOrConstructorType(kind: SyntaxKind): FunctionOrConstructorTypeNode { - var node = createNode(kind); + let node = createNode(kind); if (kind === SyntaxKind.ConstructorType) { parseExpected(SyntaxKind.NewKeyword); } @@ -2635,7 +2635,7 @@ module ts { } function parseKeywordAndNoDot(): TypeNode { - var node = parseTokenNode(); + let node = parseTokenNode(); return token === SyntaxKind.DotToken ? undefined : node; } @@ -2647,7 +2647,7 @@ module ts { case SyntaxKind.BooleanKeyword: case SyntaxKind.SymbolKeyword: // If these are followed by a dot, then parse these out as a dotted type reference instead. - var node = tryParse(parseKeywordAndNoDot); + let node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); case SyntaxKind.VoidKeyword: return parseTokenNode(); @@ -2693,10 +2693,10 @@ module ts { } function parseArrayTypeOrHigher(): TypeNode { - var type = parseNonArrayType(); + let type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(SyntaxKind.OpenBracketToken)) { parseExpected(SyntaxKind.CloseBracketToken); - var node = createNode(SyntaxKind.ArrayType, type.pos); + let node = createNode(SyntaxKind.ArrayType, type.pos); node.elementType = type; type = finishNode(node); } @@ -2704,15 +2704,15 @@ module ts { } function parseUnionTypeOrHigher(): TypeNode { - var type = parseArrayTypeOrHigher(); + let type = parseArrayTypeOrHigher(); if (token === SyntaxKind.BarToken) { - var types = >[type]; + let types = >[type]; types.pos = type.pos; while (parseOptional(SyntaxKind.BarToken)) { types.push(parseArrayTypeOrHigher()); } types.end = getNodeEnd(); - var node = createNode(SyntaxKind.UnionType, type.pos); + let node = createNode(SyntaxKind.UnionType, type.pos); node.types = types; type = finishNode(node); } @@ -2760,13 +2760,13 @@ module ts { function parseType(): TypeNode { // The rules about 'yield' only apply to actual code/expression contexts. They don't // apply to 'type' contexts. So we disable these parameters here before moving on. - var savedYieldContext = inYieldContext(); - var savedGeneratorParameterContext = inGeneratorParameterContext(); + let savedYieldContext = inYieldContext(); + let savedGeneratorParameterContext = inGeneratorParameterContext(); setYieldContext(false); setGeneratorParameterContext(false); - var result = parseTypeWorker(); + let result = parseTypeWorker(); setYieldContext(savedYieldContext); setGeneratorParameterContext(savedGeneratorParameterContext); @@ -2847,8 +2847,8 @@ module ts { // AssignmentExpression[in] // Expression[in] , AssignmentExpression[in] - var expr = parseAssignmentExpressionOrHigher(); - var operatorToken: Node; + let expr = parseAssignmentExpressionOrHigher(); + let operatorToken: Node; while ((operatorToken = parseOptionalToken(SyntaxKind.CommaToken))) { expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } @@ -2899,7 +2899,7 @@ module ts { // parameter list. If we do, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is // not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done // with AssignmentExpression if we see one. - var arrowExpression = tryParseParenthesizedArrowFunctionExpression(); + let arrowExpression = tryParseParenthesizedArrowFunctionExpression(); if (arrowExpression) { return arrowExpression; } @@ -2913,7 +2913,7 @@ module ts { // Otherwise, we try to parse out the conditional expression bit. We want to allow any // binary expression here, so we pass in the 'lowest' precedence here so that it matches // and consumes anything. - var expr = parseBinaryExpressionOrHigher(/*precedence:*/ 0); + let expr = parseBinaryExpressionOrHigher(/*precedence:*/ 0); // To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single @@ -2976,7 +2976,7 @@ module ts { } function parseYieldExpression(): YieldExpression { - var node = createNode(SyntaxKind.YieldExpression); + let node = createNode(SyntaxKind.YieldExpression); // YieldExpression[In] : // yield @@ -3000,9 +3000,9 @@ module ts { function parseSimpleArrowFunctionExpression(identifier: Identifier): Expression { Debug.assert(token === SyntaxKind.EqualsGreaterThanToken, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(SyntaxKind.ArrowFunction, identifier.pos); + let node = createNode(SyntaxKind.ArrowFunction, identifier.pos); - var parameter = createNode(SyntaxKind.Parameter, identifier.pos); + let parameter = createNode(SyntaxKind.Parameter, identifier.pos); parameter.name = identifier; finishNode(parameter); @@ -3017,7 +3017,7 @@ module ts { } function tryParseParenthesizedArrowFunctionExpression(): Expression { - var triState = isParenthesizedArrowFunctionExpression(); + let triState = isParenthesizedArrowFunctionExpression(); if (triState === Tristate.False) { // It's definitely not a parenthesized arrow function expression. @@ -3028,7 +3028,7 @@ module ts { // following => or { token. Otherwise, we *might* have an arrow function. Try to parse // it out, but don't allow any ambiguity, and return 'undefined' if this could be an // expression instead. - var arrowFunction = triState === Tristate.True + let arrowFunction = triState === Tristate.True ? parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity:*/ true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); @@ -3070,8 +3070,8 @@ module ts { } function isParenthesizedArrowFunctionExpressionWorker() { - var first = token; - var second = nextToken(); + let first = token; + let second = nextToken(); if (first === SyntaxKind.OpenParenToken) { if (second === SyntaxKind.CloseParenToken) { @@ -3079,7 +3079,7 @@ module ts { // This is an arrow function with no parameters. // The last one is not actually an arrow function, // but this is probably what the user intended. - var third = nextToken(); + let third = nextToken(); switch (third) { case SyntaxKind.EqualsGreaterThanToken: case SyntaxKind.ColonToken: @@ -3134,7 +3134,7 @@ module ts { } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity: boolean): FunctionExpression { - var node = createNode(SyntaxKind.ArrowFunction); + let node = createNode(SyntaxKind.ArrowFunction); // Arrow functions are never generators. // // If we're speculatively parsing a signature for a parenthesized arrow function, then @@ -3177,7 +3177,7 @@ module ts { // user meant to supply a block. For example, if the user wrote: // // a => - // var v = 0; + // let v = 0; // } // // they may be missing an open brace. Check to see if that's the case so we can @@ -3193,14 +3193,14 @@ module ts { function parseConditionalExpressionRest(leftOperand: Expression): Expression { // Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher. - var questionToken = parseOptionalToken(SyntaxKind.QuestionToken); + let questionToken = parseOptionalToken(SyntaxKind.QuestionToken); if (!questionToken) { return leftOperand; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(SyntaxKind.ConditionalExpression, leftOperand.pos); + let node = createNode(SyntaxKind.ConditionalExpression, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = allowInAnd(parseAssignmentExpressionOrHigher); @@ -3211,7 +3211,7 @@ module ts { } function parseBinaryExpressionOrHigher(precedence: number): Expression { - var leftOperand = parseUnaryExpressionOrHigher(); + let leftOperand = parseUnaryExpressionOrHigher(); return parseBinaryExpressionRest(precedence, leftOperand); } @@ -3225,7 +3225,7 @@ module ts { // reScanGreaterToken so that we merge token sequences like > and = into >= reScanGreaterToken(); - var newPrecedence = getBinaryOperatorPrecedence(); + let newPrecedence = getBinaryOperatorPrecedence(); // Check the precedence to see if we should "take" this operator if (newPrecedence <= precedence) { @@ -3293,7 +3293,7 @@ module ts { } function makeBinaryExpression(left: Expression, operatorToken: Node, right: Expression): BinaryExpression { - var node = createNode(SyntaxKind.BinaryExpression, left.pos); + let node = createNode(SyntaxKind.BinaryExpression, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; @@ -3301,7 +3301,7 @@ module ts { } function parsePrefixUnaryExpression() { - var node = createNode(SyntaxKind.PrefixUnaryExpression); + let node = createNode(SyntaxKind.PrefixUnaryExpression); node.operator = token; nextToken(); node.operand = parseUnaryExpressionOrHigher(); @@ -3309,21 +3309,21 @@ module ts { } function parseDeleteExpression() { - var node = createNode(SyntaxKind.DeleteExpression); + let node = createNode(SyntaxKind.DeleteExpression); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(SyntaxKind.TypeOfExpression); + let node = createNode(SyntaxKind.TypeOfExpression); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(SyntaxKind.VoidExpression); + let node = createNode(SyntaxKind.VoidExpression); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); @@ -3352,11 +3352,11 @@ module ts { } function parsePostfixExpressionOrHigher(): PostfixExpression { - var expression = parseLeftHandSideExpressionOrHigher(); + let expression = parseLeftHandSideExpressionOrHigher(); Debug.assert(isLeftHandSideExpression(expression)); if ((token === SyntaxKind.PlusPlusToken || token === SyntaxKind.MinusMinusToken) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(SyntaxKind.PostfixUnaryExpression, expression.pos); + let node = createNode(SyntaxKind.PostfixUnaryExpression, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -3397,7 +3397,7 @@ module ts { // the last two CallExpression productions. Or we have a MemberExpression which either // completes the LeftHandSideExpression, or starts the beginning of the first four // CallExpression productions. - var expression = token === SyntaxKind.SuperKeyword + let expression = token === SyntaxKind.SuperKeyword ? parseSuperExpression() : parseMemberExpressionOrHigher(); @@ -3454,19 +3454,19 @@ module ts { // // Because CallExpression and MemberExpression are left recursive, we need to bottom out // of the recursion immediately. So we parse out a primary expression to start with. - var expression = parsePrimaryExpression(); + let expression = parsePrimaryExpression(); return parseMemberExpressionRest(expression); } function parseSuperExpression(): MemberExpression { - var expression = parseTokenNode(); + let expression = parseTokenNode(); if (token === SyntaxKind.OpenParenToken || token === SyntaxKind.DotToken) { return expression; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(SyntaxKind.PropertyAccessExpression, expression.pos); + let node = createNode(SyntaxKind.PropertyAccessExpression, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(SyntaxKind.DotToken, /*reportAtCurrentPosition:*/ false, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames:*/ true); @@ -3474,7 +3474,7 @@ module ts { } function parseTypeAssertion(): TypeAssertion { - var node = createNode(SyntaxKind.TypeAssertionExpression); + let node = createNode(SyntaxKind.TypeAssertionExpression); parseExpected(SyntaxKind.LessThanToken); node.type = parseType(); parseExpected(SyntaxKind.GreaterThanToken); @@ -3484,9 +3484,9 @@ module ts { function parseMemberExpressionRest(expression: LeftHandSideExpression): MemberExpression { while (true) { - var dotToken = parseOptionalToken(SyntaxKind.DotToken); + let dotToken = parseOptionalToken(SyntaxKind.DotToken); if (dotToken) { - var propertyAccess = createNode(SyntaxKind.PropertyAccessExpression, expression.pos); + let propertyAccess = createNode(SyntaxKind.PropertyAccessExpression, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames:*/ true); @@ -3495,7 +3495,7 @@ module ts { } if (parseOptional(SyntaxKind.OpenBracketToken)) { - var indexedAccess = createNode(SyntaxKind.ElementAccessExpression, expression.pos); + let indexedAccess = createNode(SyntaxKind.ElementAccessExpression, expression.pos); indexedAccess.expression = expression; // It's not uncommon for a user to write: "new Type[]". @@ -3503,7 +3503,7 @@ module ts { if (token !== SyntaxKind.CloseBracketToken) { indexedAccess.argumentExpression = allowInAnd(parseExpression); if (indexedAccess.argumentExpression.kind === SyntaxKind.StringLiteral || indexedAccess.argumentExpression.kind === SyntaxKind.NumericLiteral) { - var literal = indexedAccess.argumentExpression; + let literal = indexedAccess.argumentExpression; literal.text = internIdentifier(literal.text); } } @@ -3514,7 +3514,7 @@ module ts { } if (token === SyntaxKind.NoSubstitutionTemplateLiteral || token === SyntaxKind.TemplateHead) { - var tagExpression = createNode(SyntaxKind.TaggedTemplateExpression, expression.pos); + let tagExpression = createNode(SyntaxKind.TaggedTemplateExpression, expression.pos); tagExpression.tag = expression; tagExpression.template = token === SyntaxKind.NoSubstitutionTemplateLiteral ? parseLiteralNode() @@ -3536,12 +3536,12 @@ module ts { // keep checking for postfix expressions. Otherwise, it's just a '<' that's // part of an arithmetic expression. Break out so we consume it higher in the // stack. - var typeArguments = tryParse(parseTypeArgumentsInExpression); + let typeArguments = tryParse(parseTypeArgumentsInExpression); if (!typeArguments) { return expression; } - var callExpr = createNode(SyntaxKind.CallExpression, expression.pos); + let callExpr = createNode(SyntaxKind.CallExpression, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -3549,7 +3549,7 @@ module ts { continue; } else if (token === SyntaxKind.OpenParenToken) { - var callExpr = createNode(SyntaxKind.CallExpression, expression.pos); + let callExpr = createNode(SyntaxKind.CallExpression, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -3562,7 +3562,7 @@ module ts { function parseArgumentList() { parseExpected(SyntaxKind.OpenParenToken); - var result = parseDelimitedList(ParsingContext.ArgumentExpressions, parseArgumentExpression); + let result = parseDelimitedList(ParsingContext.ArgumentExpressions, parseArgumentExpression); parseExpected(SyntaxKind.CloseParenToken); return result; } @@ -3572,7 +3572,7 @@ module ts { return undefined; } - var typeArguments = parseDelimitedList(ParsingContext.TypeArguments, parseType); + let typeArguments = parseDelimitedList(ParsingContext.TypeArguments, parseType); if (!parseExpected(SyntaxKind.GreaterThanToken)) { // If it doesn't have the closing > then it's definitely not an type argument list. return undefined; @@ -3656,7 +3656,7 @@ module ts { } function parseParenthesizedExpression(): ParenthesizedExpression { - var node = createNode(SyntaxKind.ParenthesizedExpression); + let node = createNode(SyntaxKind.ParenthesizedExpression); parseExpected(SyntaxKind.OpenParenToken); node.expression = allowInAnd(parseExpression); parseExpected(SyntaxKind.CloseParenToken); @@ -3664,7 +3664,7 @@ module ts { } function parseSpreadElement(): Expression { - var node = createNode(SyntaxKind.SpreadElementExpression); + let node = createNode(SyntaxKind.SpreadElementExpression); parseExpected(SyntaxKind.DotDotDotToken); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); @@ -3681,7 +3681,7 @@ module ts { } function parseArrayLiteralExpression(): ArrayLiteralExpression { - var node = createNode(SyntaxKind.ArrayLiteralExpression); + let node = createNode(SyntaxKind.ArrayLiteralExpression); parseExpected(SyntaxKind.OpenBracketToken); if (scanner.hasPrecedingLineBreak()) node.flags |= NodeFlags.MultiLine; node.elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArgumentOrArrayLiteralElement); @@ -3701,34 +3701,34 @@ module ts { } function parseObjectLiteralElement(): ObjectLiteralElement { - var fullStart = scanner.getStartPos(); - var modifiers = parseModifiers(); + let fullStart = scanner.getStartPos(); + let modifiers = parseModifiers(); - var accessor = tryParseAccessorDeclaration(fullStart, modifiers); + let accessor = tryParseAccessorDeclaration(fullStart, modifiers); if (accessor) { return accessor; } - var asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken); - var tokenIsIdentifier = isIdentifier(); - var nameToken = token; - var propertyName = parsePropertyName(); + let asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken); + let tokenIsIdentifier = isIdentifier(); + let nameToken = token; + let propertyName = parsePropertyName(); // Disallowing of optional property assignments happens in the grammar checker. - var questionToken = parseOptionalToken(SyntaxKind.QuestionToken); + let questionToken = parseOptionalToken(SyntaxKind.QuestionToken); if (asteriskToken || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) { return parseMethodDeclaration(fullStart, modifiers, asteriskToken, propertyName, questionToken); } // Parse to check if it is short-hand property assignment or normal property assignment if ((token === SyntaxKind.CommaToken || token === SyntaxKind.CloseBraceToken) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(SyntaxKind.ShorthandPropertyAssignment, fullStart); + let shorthandDeclaration = createNode(SyntaxKind.ShorthandPropertyAssignment, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(SyntaxKind.PropertyAssignment, fullStart); + let propertyAssignment = createNode(SyntaxKind.PropertyAssignment, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(SyntaxKind.ColonToken); @@ -3738,7 +3738,7 @@ module ts { } function parseObjectLiteralExpression(): ObjectLiteralExpression { - var node = createNode(SyntaxKind.ObjectLiteralExpression); + let node = createNode(SyntaxKind.ObjectLiteralExpression); parseExpected(SyntaxKind.OpenBraceToken); if (scanner.hasPrecedingLineBreak()) { node.flags |= NodeFlags.MultiLine; @@ -3754,7 +3754,7 @@ module ts { // function * BindingIdentifier[Yield]opt (FormalParameters[Yield, GeneratorParameter]) { GeneratorBody[Yield] } // FunctionExpression: // function BindingIdentifieropt(FormalParameters) { FunctionBody } - var node = createNode(SyntaxKind.FunctionExpression); + let node = createNode(SyntaxKind.FunctionExpression); parseExpected(SyntaxKind.FunctionKeyword); node.asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken); node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier(); @@ -3768,7 +3768,7 @@ module ts { } function parseNewExpression(): NewExpression { - var node = createNode(SyntaxKind.NewExpression); + let node = createNode(SyntaxKind.NewExpression); parseExpected(SyntaxKind.NewKeyword); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -3781,7 +3781,7 @@ module ts { // STATEMENTS function parseBlock(ignoreMissingOpenBrace: boolean, checkForStrictMode: boolean, diagnosticMessage?: DiagnosticMessage): Block { - var node = createNode(SyntaxKind.Block); + let node = createNode(SyntaxKind.Block); if (parseExpected(SyntaxKind.OpenBraceToken, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(ParsingContext.BlockStatements, checkForStrictMode, parseStatement); parseExpected(SyntaxKind.CloseBraceToken); @@ -3793,10 +3793,10 @@ module ts { } function parseFunctionBlock(allowYield: boolean, ignoreMissingOpenBrace: boolean, diagnosticMessage?: DiagnosticMessage): Block { - var savedYieldContext = inYieldContext(); + let savedYieldContext = inYieldContext(); setYieldContext(allowYield); - var block = parseBlock(ignoreMissingOpenBrace, /*checkForStrictMode*/ true, diagnosticMessage); + let block = parseBlock(ignoreMissingOpenBrace, /*checkForStrictMode*/ true, diagnosticMessage); setYieldContext(savedYieldContext); @@ -3804,13 +3804,13 @@ module ts { } function parseEmptyStatement(): Statement { - var node = createNode(SyntaxKind.EmptyStatement); + let node = createNode(SyntaxKind.EmptyStatement); parseExpected(SyntaxKind.SemicolonToken); return finishNode(node); } function parseIfStatement(): IfStatement { - var node = createNode(SyntaxKind.IfStatement); + let node = createNode(SyntaxKind.IfStatement); parseExpected(SyntaxKind.IfKeyword); parseExpected(SyntaxKind.OpenParenToken); node.expression = allowInAnd(parseExpression); @@ -3821,7 +3821,7 @@ module ts { } function parseDoStatement(): DoStatement { - var node = createNode(SyntaxKind.DoStatement); + let node = createNode(SyntaxKind.DoStatement); parseExpected(SyntaxKind.DoKeyword); node.statement = parseStatement(); parseExpected(SyntaxKind.WhileKeyword); @@ -3838,7 +3838,7 @@ module ts { } function parseWhileStatement(): WhileStatement { - var node = createNode(SyntaxKind.WhileStatement); + let node = createNode(SyntaxKind.WhileStatement); parseExpected(SyntaxKind.WhileKeyword); parseExpected(SyntaxKind.OpenParenToken); node.expression = allowInAnd(parseExpression); @@ -3848,11 +3848,11 @@ module ts { } function parseForOrForInOrForOfStatement(): Statement { - var pos = getNodePos(); + let pos = getNodePos(); parseExpected(SyntaxKind.ForKeyword); parseExpected(SyntaxKind.OpenParenToken); - var initializer: VariableDeclarationList | Expression = undefined; + let initializer: VariableDeclarationList | Expression = undefined; if (token !== SyntaxKind.SemicolonToken) { if (token === SyntaxKind.VarKeyword || token === SyntaxKind.LetKeyword || token === SyntaxKind.ConstKeyword) { initializer = parseVariableDeclarationList(/*inForStatementInitializer:*/ true); @@ -3861,22 +3861,22 @@ module ts { initializer = disallowInAnd(parseExpression); } } - var forOrForInOrForOfStatement: IterationStatement; + let forOrForInOrForOfStatement: IterationStatement; if (parseOptional(SyntaxKind.InKeyword)) { - var forInStatement = createNode(SyntaxKind.ForInStatement, pos); + let forInStatement = createNode(SyntaxKind.ForInStatement, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(SyntaxKind.CloseParenToken); forOrForInOrForOfStatement = forInStatement; } else if (parseOptional(SyntaxKind.OfKeyword)) { - var forOfStatement = createNode(SyntaxKind.ForOfStatement, pos); + let forOfStatement = createNode(SyntaxKind.ForOfStatement, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(SyntaxKind.CloseParenToken); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(SyntaxKind.ForStatement, pos); + let forStatement = createNode(SyntaxKind.ForStatement, pos); forStatement.initializer = initializer; parseExpected(SyntaxKind.SemicolonToken); if (token !== SyntaxKind.SemicolonToken && token !== SyntaxKind.CloseParenToken) { @@ -3896,7 +3896,7 @@ module ts { } function parseBreakOrContinueStatement(kind: SyntaxKind): BreakOrContinueStatement { - var node = createNode(kind); + let node = createNode(kind); parseExpected(kind === SyntaxKind.BreakStatement ? SyntaxKind.BreakKeyword : SyntaxKind.ContinueKeyword); if (!canParseSemicolon()) { @@ -3908,7 +3908,7 @@ module ts { } function parseReturnStatement(): ReturnStatement { - var node = createNode(SyntaxKind.ReturnStatement); + let node = createNode(SyntaxKind.ReturnStatement); parseExpected(SyntaxKind.ReturnKeyword); if (!canParseSemicolon()) { @@ -3920,7 +3920,7 @@ module ts { } function parseWithStatement(): WithStatement { - var node = createNode(SyntaxKind.WithStatement); + let node = createNode(SyntaxKind.WithStatement); parseExpected(SyntaxKind.WithKeyword); parseExpected(SyntaxKind.OpenParenToken); node.expression = allowInAnd(parseExpression); @@ -3930,7 +3930,7 @@ module ts { } function parseCaseClause(): CaseClause { - var node = createNode(SyntaxKind.CaseClause); + let node = createNode(SyntaxKind.CaseClause); parseExpected(SyntaxKind.CaseKeyword); node.expression = allowInAnd(parseExpression); parseExpected(SyntaxKind.ColonToken); @@ -3939,7 +3939,7 @@ module ts { } function parseDefaultClause(): DefaultClause { - var node = createNode(SyntaxKind.DefaultClause); + let node = createNode(SyntaxKind.DefaultClause); parseExpected(SyntaxKind.DefaultKeyword); parseExpected(SyntaxKind.ColonToken); node.statements = parseList(ParsingContext.SwitchClauseStatements, /*checkForStrictMode*/ false, parseStatement); @@ -3951,12 +3951,12 @@ module ts { } function parseSwitchStatement(): SwitchStatement { - var node = createNode(SyntaxKind.SwitchStatement); + let node = createNode(SyntaxKind.SwitchStatement); parseExpected(SyntaxKind.SwitchKeyword); parseExpected(SyntaxKind.OpenParenToken); node.expression = allowInAnd(parseExpression); parseExpected(SyntaxKind.CloseParenToken); - var caseBlock = createNode(SyntaxKind.CaseBlock, scanner.getStartPos()); + let caseBlock = createNode(SyntaxKind.CaseBlock, scanner.getStartPos()); parseExpected(SyntaxKind.OpenBraceToken); caseBlock.clauses = parseList(ParsingContext.SwitchClauses, /*checkForStrictMode*/ false, parseCaseOrDefaultClause); parseExpected(SyntaxKind.CloseBraceToken); @@ -3973,7 +3973,7 @@ module ts { // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(SyntaxKind.ThrowStatement); + let node = createNode(SyntaxKind.ThrowStatement); parseExpected(SyntaxKind.ThrowKeyword); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -3982,7 +3982,7 @@ module ts { // TODO: Review for error recovery function parseTryStatement(): TryStatement { - var node = createNode(SyntaxKind.TryStatement); + let node = createNode(SyntaxKind.TryStatement); parseExpected(SyntaxKind.TryKeyword); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode*/ false); @@ -3999,7 +3999,7 @@ module ts { } function parseCatchClause(): CatchClause { - var result = createNode(SyntaxKind.CatchClause); + let result = createNode(SyntaxKind.CatchClause); parseExpected(SyntaxKind.CatchKeyword); if (parseExpected(SyntaxKind.OpenParenToken)) { result.variableDeclaration = parseVariableDeclaration(); @@ -4011,7 +4011,7 @@ module ts { } function parseDebuggerStatement(): Statement { - var node = createNode(SyntaxKind.DebuggerStatement); + let node = createNode(SyntaxKind.DebuggerStatement); parseExpected(SyntaxKind.DebuggerKeyword); parseSemicolon(); return finishNode(node); @@ -4021,17 +4021,17 @@ module ts { // Avoiding having to do the lookahead for a labeled statement by just trying to parse // out an expression, seeing if it is identifier and then seeing if it is followed by // a colon. - var fullStart = scanner.getStartPos(); - var expression = allowInAnd(parseExpression); + let fullStart = scanner.getStartPos(); + let expression = allowInAnd(parseExpression); if (expression.kind === SyntaxKind.Identifier && parseOptional(SyntaxKind.ColonToken)) { - var labeledStatement = createNode(SyntaxKind.LabeledStatement, fullStart); + let labeledStatement = createNode(SyntaxKind.LabeledStatement, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(SyntaxKind.ExpressionStatement, fullStart); + let expressionStatement = createNode(SyntaxKind.ExpressionStatement, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -4045,7 +4045,7 @@ module ts { // as the parser will produce the same FunctionDeclaraiton or VariableStatement if it has // the same text regardless of whether it is inside a block or not. if (isModifier(token)) { - var result = lookAhead(parseVariableStatementOrFunctionDeclarationWithModifiers); + let result = lookAhead(parseVariableStatementOrFunctionDeclarationWithModifiers); if (result) { return true; } @@ -4085,7 +4085,7 @@ module ts { // const keyword can precede enum keyword when defining constant enums // 'const enum' do not start statement. // In ES 6 'enum' is a future reserved keyword, so it should not be used as identifier - var isConstEnum = lookAhead(nextTokenIsEnumKeyword); + let isConstEnum = lookAhead(nextTokenIsEnumKeyword); return !isConstEnum; case SyntaxKind.InterfaceKeyword: case SyntaxKind.ClassKeyword: @@ -4175,7 +4175,7 @@ module ts { // same FunctionDeclaraiton or VariableStatement if it has the same text // regardless of whether it is inside a block or not. if (isModifier(token)) { - var result = tryParse(parseVariableStatementOrFunctionDeclarationWithModifiers); + let result = tryParse(parseVariableStatementOrFunctionDeclarationWithModifiers); if (result) { return result; } @@ -4186,11 +4186,11 @@ module ts { } function parseVariableStatementOrFunctionDeclarationWithModifiers(): FunctionDeclaration | VariableStatement { - var start = scanner.getStartPos(); - var modifiers = parseModifiers(); + let start = scanner.getStartPos(); + let modifiers = parseModifiers(); switch (token) { case SyntaxKind.ConstKeyword: - var nextTokenIsEnum = lookAhead(nextTokenIsEnumKeyword) + let nextTokenIsEnum = lookAhead(nextTokenIsEnumKeyword) if (nextTokenIsEnum) { return undefined; } @@ -4226,7 +4226,7 @@ module ts { if (token === SyntaxKind.CommaToken) { return createNode(SyntaxKind.OmittedExpression); } - var node = createNode(SyntaxKind.BindingElement); + let node = createNode(SyntaxKind.BindingElement); node.dotDotDotToken = parseOptionalToken(SyntaxKind.DotDotDotToken); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(/*inParameter*/ false); @@ -4234,9 +4234,9 @@ module ts { } function parseObjectBindingElement(): BindingElement { - var node = createNode(SyntaxKind.BindingElement); + let node = createNode(SyntaxKind.BindingElement); // TODO(andersh): Handle computed properties - var id = parsePropertyName(); + let id = parsePropertyName(); if (id.kind === SyntaxKind.Identifier && token !== SyntaxKind.ColonToken) { node.name = id; } @@ -4250,7 +4250,7 @@ module ts { } function parseObjectBindingPattern(): BindingPattern { - var node = createNode(SyntaxKind.ObjectBindingPattern); + let node = createNode(SyntaxKind.ObjectBindingPattern); parseExpected(SyntaxKind.OpenBraceToken); node.elements = parseDelimitedList(ParsingContext.ObjectBindingElements, parseObjectBindingElement); parseExpected(SyntaxKind.CloseBraceToken); @@ -4258,7 +4258,7 @@ module ts { } function parseArrayBindingPattern(): BindingPattern { - var node = createNode(SyntaxKind.ArrayBindingPattern); + let node = createNode(SyntaxKind.ArrayBindingPattern); parseExpected(SyntaxKind.OpenBracketToken); node.elements = parseDelimitedList(ParsingContext.ArrayBindingElements, parseArrayBindingElement); parseExpected(SyntaxKind.CloseBracketToken); @@ -4280,7 +4280,7 @@ module ts { } function parseVariableDeclaration(): VariableDeclaration { - var node = createNode(SyntaxKind.VariableDeclaration); + let node = createNode(SyntaxKind.VariableDeclaration); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -4290,7 +4290,7 @@ module ts { } function parseVariableDeclarationList(inForStatementInitializer: boolean): VariableDeclarationList { - var node = createNode(SyntaxKind.VariableDeclarationList); + let node = createNode(SyntaxKind.VariableDeclarationList); switch (token) { case SyntaxKind.VarKeyword: @@ -4309,7 +4309,7 @@ module ts { // The user may have written the following: // - // for (var of X) { } + // for (let of X) { } // // In this case, we want to parse an empty declaration list, and then parse 'of' // as a keyword. The reason this is not automatic is that 'of' is a valid identifier. @@ -4320,7 +4320,7 @@ module ts { node.declarations = createMissingList(); } else { - var savedDisallowIn = inDisallowInContext(); + let savedDisallowIn = inDisallowInContext(); setDisallowInContext(inForStatementInitializer); node.declarations = parseDelimitedList(ParsingContext.VariableDeclarations, parseVariableDeclaration); @@ -4336,7 +4336,7 @@ module ts { } function parseVariableStatement(fullStart: number, modifiers: ModifiersArray): VariableStatement { - var node = createNode(SyntaxKind.VariableStatement, fullStart); + let node = createNode(SyntaxKind.VariableStatement, fullStart); setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer:*/ false); parseSemicolon(); @@ -4344,7 +4344,7 @@ module ts { } function parseFunctionDeclaration(fullStart: number, modifiers: ModifiersArray): FunctionDeclaration { - var node = createNode(SyntaxKind.FunctionDeclaration, fullStart); + let node = createNode(SyntaxKind.FunctionDeclaration, fullStart); setModifiers(node, modifiers); parseExpected(SyntaxKind.FunctionKeyword); node.asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken); @@ -4355,7 +4355,7 @@ module ts { } function parseConstructorDeclaration(pos: number, modifiers: ModifiersArray): ConstructorDeclaration { - var node = createNode(SyntaxKind.Constructor, pos); + let node = createNode(SyntaxKind.Constructor, pos); setModifiers(node, modifiers); parseExpected(SyntaxKind.ConstructorKeyword); fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, node); @@ -4364,7 +4364,7 @@ module ts { } function parseMethodDeclaration(fullStart: number, modifiers: ModifiersArray, asteriskToken: Node, name: DeclarationName, questionToken: Node, diagnosticMessage?: DiagnosticMessage): MethodDeclaration { - var method = createNode(SyntaxKind.MethodDeclaration, fullStart); + let method = createNode(SyntaxKind.MethodDeclaration, fullStart); setModifiers(method, modifiers); method.asteriskToken = asteriskToken; method.name = name; @@ -4375,17 +4375,17 @@ module ts { } function parsePropertyOrMethodDeclaration(fullStart: number, modifiers: ModifiersArray): ClassElement { - var asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken); - var name = parsePropertyName(); + let asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken); + let name = parsePropertyName(); // Note: this is not legal as per the grammar. But we allow it in the parser and // report an error in the grammar checker. - var questionToken = parseOptionalToken(SyntaxKind.QuestionToken); + let questionToken = parseOptionalToken(SyntaxKind.QuestionToken); if (asteriskToken || token === SyntaxKind.OpenParenToken || token === SyntaxKind.LessThanToken) { return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, Diagnostics.or_expected); } else { - var property = createNode(SyntaxKind.PropertyDeclaration, fullStart); + let property = createNode(SyntaxKind.PropertyDeclaration, fullStart); setModifiers(property, modifiers); property.name = name; property.questionToken = questionToken; @@ -4401,7 +4401,7 @@ module ts { } function parseAccessorDeclaration(kind: SyntaxKind, fullStart: number, modifiers: ModifiersArray): AccessorDeclaration { - var node = createNode(kind, fullStart); + let node = createNode(kind, fullStart); setModifiers(node, modifiers); node.name = parsePropertyName(); fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, node); @@ -4410,7 +4410,7 @@ module ts { } function isClassMemberStart(): boolean { - var idToken: SyntaxKind; + let idToken: SyntaxKind; // Eat up all modifiers, but hold on to the last one in case it is actually an identifier. while (isModifier(token)) { @@ -4464,11 +4464,11 @@ module ts { } function parseModifiers(): ModifiersArray { - var flags = 0; - var modifiers: ModifiersArray; + let flags = 0; + let modifiers: ModifiersArray; while (true) { - var modifierStart = scanner.getStartPos(); - var modifierKind = token; + let modifierStart = scanner.getStartPos(); + let modifierKind = token; if (!parseAnyContextualModifier()) { break; @@ -4489,10 +4489,10 @@ module ts { } function parseClassElement(): ClassElement { - var fullStart = getNodePos(); - var modifiers = parseModifiers(); + let fullStart = getNodePos(); + let modifiers = parseModifiers(); - var accessor = tryParseAccessorDeclaration(fullStart, modifiers); + let accessor = tryParseAccessorDeclaration(fullStart, modifiers); if (accessor) { return accessor; } @@ -4521,7 +4521,7 @@ module ts { } function parseClassDeclaration(fullStart: number, modifiers: ModifiersArray): ClassDeclaration { - var node = createNode(SyntaxKind.ClassDeclaration, fullStart); + let node = createNode(SyntaxKind.ClassDeclaration, fullStart); setModifiers(node, modifiers); parseExpected(SyntaxKind.ClassKeyword); node.name = node.flags & NodeFlags.Default ? parseOptionalIdentifier() : parseIdentifier(); @@ -4564,7 +4564,7 @@ module ts { function parseHeritageClause() { if (token === SyntaxKind.ExtendsKeyword || token === SyntaxKind.ImplementsKeyword) { - var node = createNode(SyntaxKind.HeritageClause); + let node = createNode(SyntaxKind.HeritageClause); node.token = token; nextToken(); node.types = parseDelimitedList(ParsingContext.TypeReferences, parseTypeReference); @@ -4583,7 +4583,7 @@ module ts { } function parseInterfaceDeclaration(fullStart: number, modifiers: ModifiersArray): InterfaceDeclaration { - var node = createNode(SyntaxKind.InterfaceDeclaration, fullStart); + let node = createNode(SyntaxKind.InterfaceDeclaration, fullStart); setModifiers(node, modifiers); parseExpected(SyntaxKind.InterfaceKeyword); node.name = parseIdentifier(); @@ -4594,7 +4594,7 @@ module ts { } function parseTypeAliasDeclaration(fullStart: number, modifiers: ModifiersArray): TypeAliasDeclaration { - var node = createNode(SyntaxKind.TypeAliasDeclaration, fullStart); + let node = createNode(SyntaxKind.TypeAliasDeclaration, fullStart); setModifiers(node, modifiers); parseExpected(SyntaxKind.TypeKeyword); node.name = parseIdentifier(); @@ -4609,14 +4609,14 @@ module ts { // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember(): EnumMember { - var node = createNode(SyntaxKind.EnumMember, scanner.getStartPos()); + let node = createNode(SyntaxKind.EnumMember, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart: number, modifiers: ModifiersArray): EnumDeclaration { - var node = createNode(SyntaxKind.EnumDeclaration, fullStart); + let node = createNode(SyntaxKind.EnumDeclaration, fullStart); setModifiers(node, modifiers); parseExpected(SyntaxKind.EnumKeyword); node.name = parseIdentifier(); @@ -4631,7 +4631,7 @@ module ts { } function parseModuleBlock(): ModuleBlock { - var node = createNode(SyntaxKind.ModuleBlock, scanner.getStartPos()); + let node = createNode(SyntaxKind.ModuleBlock, scanner.getStartPos()); if (parseExpected(SyntaxKind.OpenBraceToken)) { node.statements = parseList(ParsingContext.ModuleElements, /*checkForStrictMode*/false, parseModuleElement); parseExpected(SyntaxKind.CloseBraceToken); @@ -4643,7 +4643,7 @@ module ts { } function parseInternalModuleTail(fullStart: number, modifiers: ModifiersArray, flags: NodeFlags): ModuleDeclaration { - var node = createNode(SyntaxKind.ModuleDeclaration, fullStart); + let node = createNode(SyntaxKind.ModuleDeclaration, fullStart); setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); @@ -4654,7 +4654,7 @@ module ts { } function parseAmbientExternalModuleDeclaration(fullStart: number, modifiers: ModifiersArray): ModuleDeclaration { - var node = createNode(SyntaxKind.ModuleDeclaration, fullStart); + let node = createNode(SyntaxKind.ModuleDeclaration, fullStart); setModifiers(node, modifiers); node.name = parseLiteralNode(/*internName:*/ true); node.body = parseModuleBlock(); @@ -4685,16 +4685,16 @@ module ts { function parseImportDeclarationOrImportEqualsDeclaration(fullStart: number, modifiers: ModifiersArray): ImportEqualsDeclaration | ImportDeclaration { parseExpected(SyntaxKind.ImportKeyword); - var afterImportPos = scanner.getStartPos(); + let afterImportPos = scanner.getStartPos(); - var identifier: Identifier; + let identifier: Identifier; if (isIdentifier()) { identifier = parseIdentifier(); if (token !== SyntaxKind.CommaToken && token !== SyntaxKind.FromKeyword) { // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(SyntaxKind.ImportEqualsDeclaration, fullStart); + let importEqualsDeclaration = createNode(SyntaxKind.ImportEqualsDeclaration, fullStart); setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; parseExpected(SyntaxKind.EqualsToken); @@ -4705,7 +4705,7 @@ module ts { } // Import statement - var importDeclaration = createNode(SyntaxKind.ImportDeclaration, fullStart); + let importDeclaration = createNode(SyntaxKind.ImportDeclaration, fullStart); setModifiers(importDeclaration, modifiers); // ImportDeclaration: @@ -4731,7 +4731,7 @@ module ts { // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(SyntaxKind.ImportClause, fullStart); + let importClause = createNode(SyntaxKind.ImportClause, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -4755,7 +4755,7 @@ module ts { } function parseExternalModuleReference() { - var node = createNode(SyntaxKind.ExternalModuleReference); + let node = createNode(SyntaxKind.ExternalModuleReference); parseExpected(SyntaxKind.RequireKeyword); parseExpected(SyntaxKind.OpenParenToken); node.expression = parseModuleSpecifier(); @@ -4767,7 +4767,7 @@ module ts { // We allow arbitrary expressions here, even though the grammar only allows string // literals. We check to ensure that it is only a string literal later in the grammar // walker. - var result = parseExpression(); + let result = parseExpression(); // Ensure the string being required is in our 'identifier' table. This will ensure // that features like 'find refs' will look inside this file when search for its name. if (result.kind === SyntaxKind.StringLiteral) { @@ -4779,7 +4779,7 @@ module ts { function parseNamespaceImport(): NamespaceImport { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(SyntaxKind.NamespaceImport); + let namespaceImport = createNode(SyntaxKind.NamespaceImport); parseExpected(SyntaxKind.AsteriskToken); parseExpected(SyntaxKind.AsKeyword); namespaceImport.name = parseIdentifier(); @@ -4787,7 +4787,7 @@ module ts { } function parseNamedImportsOrExports(kind: SyntaxKind): NamedImportsOrExports { - var node = createNode(kind); + let node = createNode(kind); // NamedImports: // { } @@ -4812,13 +4812,13 @@ module ts { } function parseImportOrExportSpecifier(kind: SyntaxKind): ImportOrExportSpecifier { - var node = createNode(kind); + let node = createNode(kind); // ImportSpecifier: // ImportedBinding // IdentifierName as ImportedBinding - var isFirstIdentifierNameNotAnIdentifier = isKeyword(token) && !isIdentifier(); - var start = scanner.getTokenPos(); - var identifierName = parseIdentifierName(); + let isFirstIdentifierNameNotAnIdentifier = isKeyword(token) && !isIdentifier(); + let start = scanner.getTokenPos(); + let identifierName = parseIdentifierName(); if (token === SyntaxKind.AsKeyword) { node.propertyName = identifierName; parseExpected(SyntaxKind.AsKeyword); @@ -4841,7 +4841,7 @@ module ts { } function parseExportDeclaration(fullStart: number, modifiers: ModifiersArray): ExportDeclaration { - var node = createNode(SyntaxKind.ExportDeclaration, fullStart); + let node = createNode(SyntaxKind.ExportDeclaration, fullStart); setModifiers(node, modifiers); if (parseOptional(SyntaxKind.AsteriskToken)) { parseExpected(SyntaxKind.FromKeyword); @@ -4858,7 +4858,7 @@ module ts { } function parseExportAssignment(fullStart: number, modifiers: ModifiersArray): ExportAssignment { - var node = createNode(SyntaxKind.ExportAssignment, fullStart); + let node = createNode(SyntaxKind.ExportAssignment, fullStart); setModifiers(node, modifiers); if (parseOptional(SyntaxKind.EqualsToken)) { node.isExportEquals = true; @@ -4947,8 +4947,8 @@ module ts { } function parseDeclaration(): ModuleElement { - var fullStart = getNodePos(); - var modifiers = parseModifiers(); + let fullStart = getNodePos(); + let modifiers = parseModifiers(); if (token === SyntaxKind.ExportKeyword) { nextToken(); if (token === SyntaxKind.DefaultKeyword || token === SyntaxKind.EqualsToken) { @@ -5002,16 +5002,16 @@ module ts { } function processReferenceComments(sourceFile: SourceFile): void { - var triviaScanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/false, sourceText); - var referencedFiles: FileReference[] = []; - var amdDependencies: {path: string; name: string}[] = []; - var amdModuleName: string; + let triviaScanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/false, sourceText); + let referencedFiles: FileReference[] = []; + let amdDependencies: {path: string; name: string}[] = []; + let amdModuleName: string; // Keep scanning all the leading trivia in the file until we get to something that // isn't trivia. Any single line comment will be analyzed to see if it is a // reference comment. while (true) { - var kind = triviaScanner.scan(); + let kind = triviaScanner.scan(); if (kind === SyntaxKind.WhitespaceTrivia || kind === SyntaxKind.NewLineTrivia || kind === SyntaxKind.MultiLineCommentTrivia) { continue; } @@ -5019,14 +5019,14 @@ module ts { break; } - var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; + let range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; - var comment = sourceText.substring(range.pos, range.end); - var referencePathMatchResult = getFileReferenceFromReferencePath(comment, range); + let comment = sourceText.substring(range.pos, range.end); + let referencePathMatchResult = getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { - var fileReference = referencePathMatchResult.fileReference; + let fileReference = referencePathMatchResult.fileReference; sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; - var diagnosticMessage = referencePathMatchResult.diagnosticMessage; + let diagnosticMessage = referencePathMatchResult.diagnosticMessage; if (fileReference) { referencedFiles.push(fileReference); } @@ -5035,8 +5035,8 @@ module ts { } } else { - var amdModuleNameRegEx = /^\/\/\/\s* Date: Fri, 13 Mar 2015 11:10:12 -0700 Subject: [PATCH 060/101] Use 'let' in the binder. --- src/compiler/binder.ts | 55 +++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index e325b2033e7..d0d6005d979 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1,7 +1,7 @@ /// module ts { - /* @internal */ export var bindTime = 0; + /* @internal */ export let bindTime = 0; export const enum ModuleInstanceState { NonInstantiated = 0, @@ -25,7 +25,7 @@ module ts { } // 4. other uninstantiated module declarations. else if (node.kind === SyntaxKind.ModuleBlock) { - var state = ModuleInstanceState.NonInstantiated; + let state = ModuleInstanceState.NonInstantiated; forEachChild(node, n => { switch (getModuleInstanceState(n)) { case ModuleInstanceState.NonInstantiated: @@ -52,18 +52,18 @@ module ts { } export function bindSourceFile(file: SourceFile): void { - var start = new Date().getTime(); + let start = new Date().getTime(); bindSourceFileWorker(file); bindTime += new Date().getTime() - start; } function bindSourceFileWorker(file: SourceFile): void { var parent: Node; - var container: Node; - var blockScopeContainer: Node; - var lastContainer: Node; - var symbolCount = 0; - var Symbol = objectAllocator.getSymbolConstructor(); + let container: Node; + let blockScopeContainer: Node; + let lastContainer: Node; + let symbolCount = 0; + let Symbol = objectAllocator.getSymbolConstructor(); if (!file.locals) { file.locals = {}; @@ -103,7 +103,7 @@ module ts { return '"' + (node.name).text + '"'; } if (node.name.kind === SyntaxKind.ComputedPropertyName) { - var nameExpression = (node.name).expression; + let nameExpression = (node.name).expression; Debug.assert(isWellKnownSymbolSyntactically(nameExpression)); return getPropertyNameForKnownSymbolName((nameExpression).name.text); } @@ -138,10 +138,11 @@ module ts { Debug.assert(!hasDynamicName(node)); // The exported symbol for an export default function/class node is always named "default" - var name = node.flags & NodeFlags.Default && parent ? "default" : getDeclarationName(node); + let name = node.flags & NodeFlags.Default && parent ? "default" : getDeclarationName(node); + let symbol: Symbol; if (name !== undefined) { - var symbol = hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); + symbol = hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); if (symbol.flags & excludes) { if (node.name) { node.name.parent = node; @@ -149,7 +150,7 @@ module ts { // Report errors every position with duplicate declaration // Report errors on previous encountered declarations - var message = symbol.flags & SymbolFlags.BlockScopedVariable + let message = symbol.flags & SymbolFlags.BlockScopedVariable ? Diagnostics.Cannot_redeclare_block_scoped_variable_0 : Diagnostics.Duplicate_identifier_0; @@ -172,7 +173,7 @@ module ts { // Every class automatically contains a static property member named 'prototype', // the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter. // It is an error to explicitly declare a static property member with the name 'prototype'. - var prototypeSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Prototype, "prototype"); + let prototypeSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Prototype, "prototype"); if (hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { node.name.parent = node; @@ -196,7 +197,7 @@ module ts { } function declareModuleMember(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags) { - var hasExportModifier = getCombinedNodeFlags(node) & NodeFlags.Export; + let hasExportModifier = getCombinedNodeFlags(node) & NodeFlags.Export; if (symbolKind & SymbolFlags.Alias) { if (node.kind === SyntaxKind.ExportSpecifier || (node.kind === SyntaxKind.ImportEqualsDeclaration && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); @@ -218,10 +219,10 @@ module ts { // but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way // when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope. if (hasExportModifier || isAmbientContext(container)) { - var exportKind = (symbolKind & SymbolFlags.Value ? SymbolFlags.ExportValue : 0) | + let exportKind = (symbolKind & SymbolFlags.Value ? SymbolFlags.ExportValue : 0) | (symbolKind & SymbolFlags.Type ? SymbolFlags.ExportType : 0) | (symbolKind & SymbolFlags.Namespace ? SymbolFlags.ExportNamespace : 0); - var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); + let local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); node.localSymbol = local; } @@ -238,9 +239,9 @@ module ts { node.locals = {}; } - var saveParent = parent; - var saveContainer = container; - var savedBlockScopeContainer = blockScopeContainer; + let saveParent = parent; + let saveContainer = container; + let savedBlockScopeContainer = blockScopeContainer; parent = node; if (symbolKind & SymbolFlags.IsContainer) { container = node; @@ -315,7 +316,7 @@ module ts { bindDeclaration(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes, /*isBlockScopeContainer*/ true); } else { - var state = getModuleInstanceState(node); + let state = getModuleInstanceState(node); if (state === ModuleInstanceState.NonInstantiated) { bindDeclaration(node, SymbolFlags.NamespaceModule, SymbolFlags.NamespaceModuleExcludes, /*isBlockScopeContainer*/ true); } @@ -341,18 +342,18 @@ module ts { // symbol as its sole member. To the rest of the system, this symbol will be indistinguishable // from an actual type literal symbol you would have gotten had you used the long form. - var symbol = createSymbol(SymbolFlags.Signature, getDeclarationName(node)); + let symbol = createSymbol(SymbolFlags.Signature, getDeclarationName(node)); addDeclarationToSymbol(symbol, node, SymbolFlags.Signature); bindChildren(node, SymbolFlags.Signature, /*isBlockScopeContainer:*/ false); - var typeLiteralSymbol = createSymbol(SymbolFlags.TypeLiteral, "__type"); + let typeLiteralSymbol = createSymbol(SymbolFlags.TypeLiteral, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, SymbolFlags.TypeLiteral); typeLiteralSymbol.members = {}; typeLiteralSymbol.members[node.kind === SyntaxKind.FunctionType ? "__call" : "__new"] = symbol } function bindAnonymousDeclaration(node: Declaration, symbolKind: SymbolFlags, name: string, isBlockScopeContainer: boolean) { - var symbol = createSymbol(symbolKind, name); + let symbol = createSymbol(symbolKind, name); addDeclarationToSymbol(symbol, node, symbolKind); bindChildren(node, symbolKind, isBlockScopeContainer); } @@ -525,9 +526,9 @@ module ts { // Otherwise this won't be considered as redeclaration of a block scoped local: // function foo() { // let x; - // var x; + // let x; // } - // 'var x' will be placed into the function locals and 'let x' - into the locals of the block + // 'let x' will be placed into the function locals and 'let x' - into the locals of the block bindChildren(node, 0, /*isBlockScopeContainer*/ !isFunctionLike(node.parent)); break; case SyntaxKind.CatchClause: @@ -538,7 +539,7 @@ module ts { bindChildren(node, 0, /*isBlockScopeContainer*/ true); break; default: - var saveParent = parent; + let saveParent = parent; parent = node; forEachChild(node, bind); parent = saveParent; @@ -559,7 +560,7 @@ module ts { node.parent.kind === SyntaxKind.Constructor && node.parent.parent.kind === SyntaxKind.ClassDeclaration) { - var classDeclaration = node.parent.parent; + let classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes); } } From 64fa7fbecbede0b33acdff69cb63e7425ff6c23b Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Fri, 13 Mar 2015 11:52:14 -0700 Subject: [PATCH 061/101] use Value meaning as a filter when resolving names to prevent skipping other value in favor of block-scoped variables --- src/compiler/checker.ts | 2 +- .../letConstMatchingParameterNames.js | 28 ++++++++++++++ .../letConstMatchingParameterNames.types | 37 +++++++++++++++++++ .../letConstMatchingParameterNames.ts | 15 ++++++++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/letConstMatchingParameterNames.js create mode 100644 tests/baselines/reference/letConstMatchingParameterNames.types create mode 100644 tests/cases/compiler/letConstMatchingParameterNames.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1500a47f197..782ffccc0ed 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11072,7 +11072,7 @@ module ts { var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || - resolveName(n, n.text, SymbolFlags.BlockScopedVariable | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); + resolveName(n, n.text, SymbolFlags.Value | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); var isLetOrConst = symbol && diff --git a/tests/baselines/reference/letConstMatchingParameterNames.js b/tests/baselines/reference/letConstMatchingParameterNames.js new file mode 100644 index 00000000000..a11405b9f83 --- /dev/null +++ b/tests/baselines/reference/letConstMatchingParameterNames.js @@ -0,0 +1,28 @@ +//// [letConstMatchingParameterNames.ts] +let parent = true; +const parent2 = true; +declare function use(a: any); + +function a() { + + let parent = 1; + const parent2 = 2; + + function b(parent: string, parent2: number) { + use(parent); + use(parent2); + } +} + + +//// [letConstMatchingParameterNames.js] +var parent = true; +var parent2 = true; +function a() { + var _parent = 1; + var _parent2 = 2; + function b(parent, parent2) { + use(parent); + use(parent2); + } +} diff --git a/tests/baselines/reference/letConstMatchingParameterNames.types b/tests/baselines/reference/letConstMatchingParameterNames.types new file mode 100644 index 00000000000..66fccc637df --- /dev/null +++ b/tests/baselines/reference/letConstMatchingParameterNames.types @@ -0,0 +1,37 @@ +=== tests/cases/compiler/letConstMatchingParameterNames.ts === +let parent = true; +>parent : boolean + +const parent2 = true; +>parent2 : boolean + +declare function use(a: any); +>use : (a: any) => any +>a : any + +function a() { +>a : () => void + + let parent = 1; +>parent : number + + const parent2 = 2; +>parent2 : number + + function b(parent: string, parent2: number) { +>b : (parent: string, parent2: number) => void +>parent : string +>parent2 : number + + use(parent); +>use(parent) : any +>use : (a: any) => any +>parent : string + + use(parent2); +>use(parent2) : any +>use : (a: any) => any +>parent2 : number + } +} + diff --git a/tests/cases/compiler/letConstMatchingParameterNames.ts b/tests/cases/compiler/letConstMatchingParameterNames.ts new file mode 100644 index 00000000000..e749912ad82 --- /dev/null +++ b/tests/cases/compiler/letConstMatchingParameterNames.ts @@ -0,0 +1,15 @@ +// @target: es5 +let parent = true; +const parent2 = true; +declare function use(a: any); + +function a() { + + let parent = 1; + const parent2 = 2; + + function b(parent: string, parent2: number) { + use(parent); + use(parent2); + } +} From e46442f45f99f3277d6e2fc222402c5051379c6f Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Fri, 13 Mar 2015 12:08:58 -0700 Subject: [PATCH 062/101] addressed PR feedback: fixed typo in function name --- src/compiler/parser.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 7656e2eb2c9..2620c23398b 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2975,9 +2975,10 @@ module ts { return !scanner.hasPrecedingLineBreak() && isIdentifier() } - function netTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() { + function nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() { nextToken(); - return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === SyntaxKind.OpenBraceToken || token === SyntaxKind.OpenBracketToken) + return !scanner.hasPrecedingLineBreak() && + (isIdentifier() || token === SyntaxKind.OpenBraceToken || token === SyntaxKind.OpenBracketToken); } function parseYieldExpression(): YieldExpression { @@ -4878,9 +4879,9 @@ module ts { } function isLetDeclaration() { - // It is let declaration if in strict mode or next token is identifier\open brace\open curly on same line. + // It is let declaration if in strict mode or next token is identifier\open bracket\open curly on same line. // otherwise it needs to be treated like identifier - return inStrictModeContext() || lookAhead(netTokenIsIdentifierOrStartOfDestructuringOnTheSameLine); + return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine); } function isDeclarationStart(): boolean { From 01d2280dfc479f04c27805764f3938c7f608b1b4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 12:26:10 -0700 Subject: [PATCH 063/101] Use 'let' in the checker. --- src/compiler/checker.ts | 2252 ++++++++++++++++++++------------------- 1 file changed, 1127 insertions(+), 1125 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5c571d8e0e3..7015c7deb21 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1,28 +1,28 @@ /// module ts { - var nextSymbolId = 1; - var nextNodeId = 1; - var nextMergeId = 1; + let nextSymbolId = 1; + let nextNodeId = 1; + let nextMergeId = 1; - /* @internal */ export var checkTime = 0; + /* @internal */ export let checkTime = 0; export function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker { - var Symbol = objectAllocator.getSymbolConstructor(); - var Type = objectAllocator.getTypeConstructor(); - var Signature = objectAllocator.getSignatureConstructor(); + let Symbol = objectAllocator.getSymbolConstructor(); + let Type = objectAllocator.getTypeConstructor(); + let Signature = objectAllocator.getSignatureConstructor(); - var typeCount = 0; + let typeCount = 0; - var emptyArray: any[] = []; - var emptySymbols: SymbolTable = {}; + let emptyArray: any[] = []; + let emptySymbols: SymbolTable = {}; - var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || ScriptTarget.ES3; + let compilerOptions = host.getCompilerOptions(); + let languageVersion = compilerOptions.target || ScriptTarget.ES3; - var emitResolver = createResolver(); + let emitResolver = createResolver(); - var checker: TypeChecker = { + let checker: TypeChecker = { getNodeCount: () => sum(host.getSourceFiles(), "nodeCount"), getIdentifierCount: () => sum(host.getSourceFiles(), "identifierCount"), getSymbolCount: () => sum(host.getSourceFiles(), "symbolCount"), @@ -61,59 +61,59 @@ module ts { var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined"); var argumentsSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "arguments"); - var unknownSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "unknown"); - var resolvingSymbol = createSymbol(SymbolFlags.Transient, "__resolving__"); + let unknownSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "unknown"); + let resolvingSymbol = createSymbol(SymbolFlags.Transient, "__resolving__"); - var anyType = createIntrinsicType(TypeFlags.Any, "any"); - var stringType = createIntrinsicType(TypeFlags.String, "string"); - var numberType = createIntrinsicType(TypeFlags.Number, "number"); - var booleanType = createIntrinsicType(TypeFlags.Boolean, "boolean"); - var esSymbolType = createIntrinsicType(TypeFlags.ESSymbol, "symbol"); - var voidType = createIntrinsicType(TypeFlags.Void, "void"); - var undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined"); - var nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null"); - var unknownType = createIntrinsicType(TypeFlags.Any, "unknown"); - var resolvingType = createIntrinsicType(TypeFlags.Any, "__resolving__"); + let anyType = createIntrinsicType(TypeFlags.Any, "any"); + let stringType = createIntrinsicType(TypeFlags.String, "string"); + let numberType = createIntrinsicType(TypeFlags.Number, "number"); + let booleanType = createIntrinsicType(TypeFlags.Boolean, "boolean"); + let esSymbolType = createIntrinsicType(TypeFlags.ESSymbol, "symbol"); + let voidType = createIntrinsicType(TypeFlags.Void, "void"); + let undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined"); + let nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null"); + let unknownType = createIntrinsicType(TypeFlags.Any, "unknown"); + let resolvingType = createIntrinsicType(TypeFlags.Any, "__resolving__"); - var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var inferenceFailureType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + let emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + let anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + let noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + let inferenceFailureType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var anySignature = createSignature(undefined, undefined, emptyArray, anyType, 0, false, false); - var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, 0, false, false); + let anySignature = createSignature(undefined, undefined, emptyArray, anyType, 0, false, false); + let unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, 0, false, false); - var globals: SymbolTable = {}; + let globals: SymbolTable = {}; - var globalArraySymbol: Symbol; - var globalESSymbolConstructorSymbol: Symbol; + let globalArraySymbol: Symbol; + let globalESSymbolConstructorSymbol: Symbol; - var globalObjectType: ObjectType; - var globalFunctionType: ObjectType; - var globalArrayType: ObjectType; - var globalStringType: ObjectType; - var globalNumberType: ObjectType; - var globalBooleanType: ObjectType; - var globalRegExpType: ObjectType; - var globalTemplateStringsArrayType: ObjectType; - var globalESSymbolType: ObjectType; - var globalIterableType: ObjectType; + let globalObjectType: ObjectType; + let globalFunctionType: ObjectType; + let globalArrayType: ObjectType; + let globalStringType: ObjectType; + let globalNumberType: ObjectType; + let globalBooleanType: ObjectType; + let globalRegExpType: ObjectType; + let globalTemplateStringsArrayType: ObjectType; + let globalESSymbolType: ObjectType; + let globalIterableType: ObjectType; - var anyArrayType: Type; + let anyArrayType: Type; - var tupleTypes: Map = {}; - var unionTypes: Map = {}; - var stringLiteralTypes: Map = {}; - var emitExtends = false; + let tupleTypes: Map = {}; + let unionTypes: Map = {}; + let stringLiteralTypes: Map = {}; + let emitExtends = false; - var mergedSymbols: Symbol[] = []; - var symbolLinks: SymbolLinks[] = []; - var nodeLinks: NodeLinks[] = []; - var potentialThisCollisions: Node[] = []; + let mergedSymbols: Symbol[] = []; + let symbolLinks: SymbolLinks[] = []; + let nodeLinks: NodeLinks[] = []; + let potentialThisCollisions: Node[] = []; - var diagnostics = createDiagnosticCollection(); + let diagnostics = createDiagnosticCollection(); - var primitiveTypeInfo: Map<{ type: Type; flags: TypeFlags }> = { + let primitiveTypeInfo: Map<{ type: Type; flags: TypeFlags }> = { "string": { type: stringType, flags: TypeFlags.StringLike @@ -140,7 +140,7 @@ module ts { } function error(location: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { - var diagnostic = location + let diagnostic = location ? createDiagnosticForNode(location, message, arg0, arg1, arg2) : createCompilerDiagnostic(message, arg0, arg1, arg2); diagnostics.add(diagnostic); @@ -151,7 +151,7 @@ module ts { } function getExcludedSymbolFlags(flags: SymbolFlags): SymbolFlags { - var result: SymbolFlags = 0; + let result: SymbolFlags = 0; if (flags & SymbolFlags.BlockScopedVariable) result |= SymbolFlags.BlockScopedVariableExcludes; if (flags & SymbolFlags.FunctionScopedVariable) result |= SymbolFlags.FunctionScopedVariableExcludes; if (flags & SymbolFlags.Property) result |= SymbolFlags.PropertyExcludes; @@ -177,7 +177,7 @@ module ts { } function cloneSymbol(symbol: Symbol): Symbol { - var result = createSymbol(symbol.flags | SymbolFlags.Merged, symbol.name); + let result = createSymbol(symbol.flags | SymbolFlags.Merged, symbol.name); result.declarations = symbol.declarations.slice(0); result.parent = symbol.parent; if (symbol.valueDeclaration) result.valueDeclaration = symbol.valueDeclaration; @@ -210,7 +210,7 @@ module ts { recordMergedSymbol(target, source); } else { - var message = target.flags & SymbolFlags.BlockScopedVariable || source.flags & SymbolFlags.BlockScopedVariable + let message = target.flags & SymbolFlags.BlockScopedVariable || source.flags & SymbolFlags.BlockScopedVariable ? Diagnostics.Cannot_redeclare_block_scoped_variable_0 : Diagnostics.Duplicate_identifier_0; forEach(source.declarations, node => { error(node.name ? node.name : node, message, symbolToString(source)); @@ -222,8 +222,8 @@ module ts { } function cloneSymbolTable(symbolTable: SymbolTable): SymbolTable { - var result: SymbolTable = {}; - for (var id in symbolTable) { + let result: SymbolTable = {}; + for (let id in symbolTable) { if (hasProperty(symbolTable, id)) { result[id] = symbolTable[id]; } @@ -232,13 +232,13 @@ module ts { } function mergeSymbolTable(target: SymbolTable, source: SymbolTable) { - for (var id in source) { + for (let id in source) { if (hasProperty(source, id)) { if (!hasProperty(target, id)) { target[id] = source[id]; } else { - var symbol = target[id]; + let symbol = target[id]; if (!(symbol.flags & SymbolFlags.Merged)) { target[id] = symbol = cloneSymbol(symbol); } @@ -269,14 +269,14 @@ module ts { function getSymbol(symbols: SymbolTable, name: string, meaning: SymbolFlags): Symbol { if (meaning && hasProperty(symbols, name)) { - var symbol = symbols[name]; + let symbol = symbols[name]; Debug.assert((symbol.flags & SymbolFlags.Instantiated) === 0, "Should never get an instantiated symbol here."); if (symbol.flags & meaning) { return symbol; } if (symbol.flags & SymbolFlags.Alias) { - var target = resolveAlias(symbol); + let target = resolveAlias(symbol); // Unknown symbol means an error occurred in alias resolution, treat it as positive answer to avoid cascading errors if (target === unknownSymbol || target.flags & meaning) { return symbol; @@ -289,8 +289,8 @@ module ts { /** Returns true if node1 is defined before node 2**/ function isDefinedBefore(node1: Node, node2: Node): boolean { - var file1 = getSourceFileOfNode(node1); - var file2 = getSourceFileOfNode(node2); + let file1 = getSourceFileOfNode(node1); + let file2 = getSourceFileOfNode(node2); if (file1 === file2) { return node1.pos <= node2.pos; } @@ -299,7 +299,7 @@ module ts { return true; } - var sourceFiles = host.getSourceFiles(); + let sourceFiles = host.getSourceFiles(); return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2); } @@ -307,10 +307,10 @@ module ts { // the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with // the given name can be found. function resolveName(location: Node, name: string, meaning: SymbolFlags, nameNotFoundMessage: DiagnosticMessage, nameArg: string | Identifier): Symbol { - var result: Symbol; - var lastLocation: Node; - var propertyWithInvalidInitializer: Node; - var errorLocation = location; + let result: Symbol; + let lastLocation: Node; + let propertyWithInvalidInitializer: Node; + let errorLocation = location; loop: while (location) { // Locals of a source file are not in scope (because they get merged into the global symbol table) @@ -344,7 +344,7 @@ module ts { // by the same name as a constructor parameter or local variable are inaccessible // in initializer expressions for instance member variables. if (location.parent.kind === SyntaxKind.ClassDeclaration && !(location.flags & NodeFlags.Static)) { - var ctor = findConstructorDeclaration(location.parent); + let ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & SymbolFlags.Value)) { // Remember the property node, it will be used later to report appropriate error @@ -376,7 +376,7 @@ module ts { // } // case SyntaxKind.ComputedPropertyName: - var grandparent = location.parent.parent; + let grandparent = location.parent.parent; if (grandparent.kind === SyntaxKind.ClassDeclaration || grandparent.kind === SyntaxKind.InterfaceDeclaration) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & SymbolFlags.Type)) { @@ -402,7 +402,7 @@ module ts { result = argumentsSymbol; break loop; } - var id = (location).name; + let id = (location).name; if (id && name === id.text) { result = location.symbol; break loop; @@ -429,7 +429,7 @@ module ts { if (propertyWithInvalidInitializer) { // We have a match, but the reference occurred within a property initializer and the identifier also binds // to a local variable in the constructor where the code will be emitted. - var propertyName = (propertyWithInvalidInitializer).name; + let propertyName = (propertyWithInvalidInitializer).name; error(errorLocation, Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg)); return undefined; @@ -444,12 +444,12 @@ module ts { function checkResolvedBlockScopedVariable(result: Symbol, errorLocation: Node): void { Debug.assert((result.flags & SymbolFlags.BlockScopedVariable) !== 0) // Block-scoped variables cannot be used before their definition - var declaration = forEach(result.declarations, d => isBlockOrCatchScoped(d) ? d : undefined); + let declaration = forEach(result.declarations, d => isBlockOrCatchScoped(d) ? d : undefined); Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); // first check if usage is lexically located after the declaration - var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); + let isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { // lexical check succeeded however code still can be illegal. // - block scoped variables cannot be used in its initializers @@ -459,8 +459,8 @@ module ts { // for (let x of x) // climb up to the variable declaration skipping binding patterns - var variableDeclaration = getAncestor(declaration, SyntaxKind.VariableDeclaration); - var container = getEnclosingBlockScopeContainer(variableDeclaration); + let variableDeclaration = getAncestor(declaration, SyntaxKind.VariableDeclaration); + let container = getEnclosingBlockScopeContainer(variableDeclaration); if (variableDeclaration.parent.parent.kind === SyntaxKind.VariableStatement || variableDeclaration.parent.parent.kind === SyntaxKind.ForStatement) { @@ -471,7 +471,7 @@ module ts { else if (variableDeclaration.parent.parent.kind === SyntaxKind.ForOfStatement || variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement) { // ForIn/ForOf case - use site should not be used in expression part - var expression = (variableDeclaration.parent.parent).expression; + let expression = (variableDeclaration.parent.parent).expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } } @@ -488,7 +488,7 @@ module ts { if (!parent) { return false; } - for (var current = initial; current && current !== stopAt && !isFunctionLike(current); current = current.parent) { + for (let current = initial; current && current !== stopAt && !isFunctionLike(current); current = current.parent) { if (current === parent) { return true; } @@ -518,17 +518,17 @@ module ts { function getTargetOfImportEqualsDeclaration(node: ImportEqualsDeclaration): Symbol { if (node.moduleReference.kind === SyntaxKind.ExternalModuleReference) { - var moduleSymbol = resolveExternalModuleName(node, getExternalModuleImportEqualsDeclarationExpression(node)); - var exportAssignmentSymbol = moduleSymbol && getResolvedExportAssignmentSymbol(moduleSymbol); + let moduleSymbol = resolveExternalModuleName(node, getExternalModuleImportEqualsDeclarationExpression(node)); + let exportAssignmentSymbol = moduleSymbol && getResolvedExportAssignmentSymbol(moduleSymbol); return exportAssignmentSymbol || moduleSymbol; } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); } function getTargetOfImportClause(node: ImportClause): Symbol { - var moduleSymbol = resolveExternalModuleName(node, (node.parent).moduleSpecifier); + let moduleSymbol = resolveExternalModuleName(node, (node.parent).moduleSpecifier); if (moduleSymbol) { - var exportAssignmentSymbol = getResolvedExportAssignmentSymbol(moduleSymbol); + let exportAssignmentSymbol = getResolvedExportAssignmentSymbol(moduleSymbol); if (!exportAssignmentSymbol) { error(node.name, Diagnostics.External_module_0_has_no_default_export_or_export_assignment, symbolToString(moduleSymbol)); } @@ -541,11 +541,11 @@ module ts { } function getExternalModuleMember(node: ImportDeclaration | ExportDeclaration, specifier: ImportOrExportSpecifier): Symbol { - var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); + let moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); if (moduleSymbol) { - var name = specifier.propertyName || specifier.name; + let name = specifier.propertyName || specifier.name; if (name.text) { - var symbol = getSymbol(getExportsOfSymbol(moduleSymbol), name.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace); + let symbol = getSymbol(getExportsOfSymbol(moduleSymbol), name.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace); if (!symbol) { error(name, Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), declarationNameToString(name)); return; @@ -588,11 +588,11 @@ module ts { function resolveAlias(symbol: Symbol): Symbol { Debug.assert((symbol.flags & SymbolFlags.Alias) !== 0, "Should only get Alias here."); - var links = getSymbolLinks(symbol); + let links = getSymbolLinks(symbol); if (!links.target) { links.target = resolvingSymbol; - var node = getDeclarationOfAliasSymbol(symbol); - var target = getTargetOfImportDeclaration(node); + let node = getDeclarationOfAliasSymbol(symbol); + let target = getTargetOfImportDeclaration(node); if (links.target === resolvingSymbol) { links.target = target || unknownSymbol; } @@ -607,8 +607,8 @@ module ts { } function markExportAsReferenced(node: ImportEqualsDeclaration | ExportAssignment | ExportSpecifier) { - var symbol = getSymbolOfNode(node); - var target = resolveAlias(symbol); + let symbol = getSymbolOfNode(node); + let target = resolveAlias(symbol); if (target && target !== unknownSymbol && target.flags & SymbolFlags.Value && !isConstEnumOrConstEnumOnlyModule(target)) { markAliasSymbolAsReferenced(symbol); } @@ -618,10 +618,10 @@ module ts { // we reach a non-alias or an exported entity (which is always considered referenced). We do this by checking the target of // the alias as an expression (which recursively takes us back here if the target references another alias). function markAliasSymbolAsReferenced(symbol: Symbol) { - var links = getSymbolLinks(symbol); + let links = getSymbolLinks(symbol); if (!links.referenced) { links.referenced = true; - var node = getDeclarationOfAliasSymbol(symbol); + let node = getDeclarationOfAliasSymbol(symbol); if (node.kind === SyntaxKind.ExportAssignment) { // export default checkExpressionCached((node).expression); @@ -680,11 +680,11 @@ module ts { } } else if (name.kind === SyntaxKind.QualifiedName) { - var namespace = resolveEntityName((name).left, SymbolFlags.Namespace); + let namespace = resolveEntityName((name).left, SymbolFlags.Namespace); if (!namespace || namespace === unknownSymbol || getFullWidth((name).right) === 0) { return undefined; } - var right = (name).right; + let right = (name).right; var symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { error(right, Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), declarationNameToString(right)); @@ -706,26 +706,26 @@ module ts { return; } - var moduleReferenceLiteral = moduleReferenceExpression; - var searchPath = getDirectoryPath(getSourceFile(location).fileName); + let moduleReferenceLiteral = moduleReferenceExpression; + let searchPath = getDirectoryPath(getSourceFile(location).fileName); // Module names are escaped in our symbol table. However, string literal values aren't. // Escape the name in the "require(...)" clause to ensure we find the right symbol. - var moduleName = escapeIdentifier(moduleReferenceLiteral.text); + let moduleName = escapeIdentifier(moduleReferenceLiteral.text); if (!moduleName) return; - var isRelative = isExternalModuleNameRelative(moduleName); + let isRelative = isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, '"' + moduleName + '"', SymbolFlags.ValueModule); + let symbol = getSymbol(globals, '"' + moduleName + '"', SymbolFlags.ValueModule); if (symbol) { return symbol; } } while (true) { - var fileName = normalizePath(combinePaths(searchPath, moduleName)); + let fileName = normalizePath(combinePaths(searchPath, moduleName)); var sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); if (sourceFile || isRelative) break; - var parentPath = getDirectoryPath(searchPath); + let parentPath = getDirectoryPath(searchPath); if (parentPath === searchPath) break; searchPath = parentPath; } @@ -744,7 +744,7 @@ module ts { } function getResolvedExportAssignmentSymbol(moduleSymbol: Symbol): Symbol { - var symbol = getExportAssignmentSymbol(moduleSymbol); + let symbol = getExportAssignmentSymbol(moduleSymbol); if (symbol) { if (symbol.flags & (SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace)) { return symbol; @@ -760,12 +760,12 @@ module ts { } function getExportsOfModule(moduleSymbol: Symbol): SymbolTable { - var links = getSymbolLinks(moduleSymbol); + let links = getSymbolLinks(moduleSymbol); return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol)); } function extendExportSymbols(target: SymbolTable, source: SymbolTable) { - for (var id in source) { + for (let id in source) { if (id !== "default" && !hasProperty(target, id)) { target[id] = source[id]; } @@ -775,15 +775,15 @@ module ts { function getExportsForModule(moduleSymbol: Symbol): SymbolTable { if (compilerOptions.target < ScriptTarget.ES6) { // A default export hides all other exports in CommonJS and AMD modules - var defaultSymbol = getExportAssignmentSymbol(moduleSymbol); + let defaultSymbol = getExportAssignmentSymbol(moduleSymbol); if (defaultSymbol) { return { "default": defaultSymbol }; } } - var result: SymbolTable; - var visitedSymbols: Symbol[] = []; + let result: SymbolTable; + let visitedSymbols: Symbol[] = []; visit(moduleSymbol); return result || moduleSymbol.exports; @@ -799,7 +799,7 @@ module ts { extendExportSymbols(result, symbol.exports); } // All export * declarations are collected in an __export symbol by the binder - var exportStars = symbol.exports["__export"]; + let exportStars = symbol.exports["__export"]; if (exportStars) { forEach(exportStars.declarations, node => { visit(resolveExternalModuleName(node, (node).moduleSpecifier)); @@ -810,7 +810,7 @@ module ts { } function getMergedSymbol(symbol: Symbol): Symbol { - var merged: Symbol; + let merged: Symbol; return symbol && symbol.mergeId && (merged = mergedSymbols[symbol.mergeId]) ? merged : symbol; } @@ -849,7 +849,7 @@ module ts { } function findConstructorDeclaration(node: ClassDeclaration): ConstructorDeclaration { - var members = node.members; + let members = node.members; for (let member of members) { if (member.kind === SyntaxKind.Constructor && nodeIsPresent((member).body)) { return member; @@ -858,19 +858,19 @@ module ts { } function createType(flags: TypeFlags): Type { - var result = new Type(checker, flags); + let result = new Type(checker, flags); result.id = typeCount++; return result; } function createIntrinsicType(kind: TypeFlags, intrinsicName: string): IntrinsicType { - var type = createType(kind); + let type = createType(kind); type.intrinsicName = intrinsicName; return type; } function createObjectType(kind: TypeFlags, symbol?: Symbol): ObjectType { - var type = createType(kind); + let type = createType(kind); type.symbol = symbol; return type; } @@ -887,12 +887,12 @@ module ts { } function getNamedMembers(members: SymbolTable): Symbol[] { - var result: Symbol[]; - for (var id in members) { + let result: Symbol[]; + for (let id in members) { if (hasProperty(members, id)) { if (!isReservedMemberName(id)) { if (!result) result = []; - var symbol = members[id]; + let symbol = members[id]; if (symbolIsValue(symbol)) { result.push(symbol); } @@ -918,8 +918,8 @@ module ts { } function forEachSymbolTableInScope(enclosingDeclaration: Node, callback: (symbolTable: SymbolTable) => T): T { - var result: T; - for (var location = enclosingDeclaration; location; location = location.parent) { + let result: T; + for (let location = enclosingDeclaration; location; location = location.parent) { // Locals of a source file are not in scope (because they get merged into the global symbol table) if (location.locals && !isGlobalSourceFile(location)) { if (result = callback(location.locals)) { @@ -962,7 +962,7 @@ module ts { } // If symbol needs qualification, make sure that parent is accessible, if it is then this symbol is accessible too - var accessibleParent = getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning), useOnlyExternalAliasing); + let accessibleParent = getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning), useOnlyExternalAliasing); return !!accessibleParent; } @@ -988,14 +988,14 @@ module ts { // Is this external alias, then use it to name ts.forEach(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) { - var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); + let resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { return [symbolFromSymbolTable]; } // Look in the exported members, if we can find accessibleSymbolChain, symbol is accessible using this chain // but only if the symbolFromSymbolTable can be qualified - var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; + let accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); } @@ -1010,7 +1010,7 @@ module ts { } function needsQualification(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) { - var qualify = false; + let qualify = false; forEachSymbolTableInScope(enclosingDeclaration, symbolTable => { // If symbol of this name is not available in the symbol table we are ok if (!hasProperty(symbolTable, symbol.name)) { @@ -1018,7 +1018,7 @@ module ts { return false; } // If the symbol with this name is present it should refer to the symbol - var symbolFromSymbolTable = symbolTable[symbol.name]; + let symbolFromSymbolTable = symbolTable[symbol.name]; if (symbolFromSymbolTable === symbol) { // No need to qualify return true; @@ -1040,13 +1040,13 @@ module ts { function isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult { if (symbol && enclosingDeclaration && !(symbol.flags & SymbolFlags.TypeParameter)) { - var initialSymbol = symbol; - var meaningToLook = meaning; + let initialSymbol = symbol; + let meaningToLook = meaning; while (symbol) { // Symbol is accessible if it by itself is accessible - var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, /*useOnlyExternalAliasing*/ false); + let accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, /*useOnlyExternalAliasing*/ false); if (accessibleSymbolChain) { - var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]); + let hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]); if (!hasAccessibleDeclarations) { return { accessibility: SymbolAccessibility.NotAccessible, @@ -1064,7 +1064,7 @@ module ts { // export class c { // } // } - // var x: typeof m.c + // let x: typeof m.c // In the above example when we start with checking if typeof m.c symbol is accessible, // we are going to see if c can be accessed in scope directly. // But it can't, hence the accessible is going to be undefined, but that doesn't mean m.c is inaccessible @@ -1075,9 +1075,9 @@ module ts { // This could be a symbol that is not exported in the external module // or it could be a symbol from different external module that is not aliased and hence cannot be named - var symbolExternalModule = forEach(initialSymbol.declarations, getExternalModuleContainer); + let symbolExternalModule = forEach(initialSymbol.declarations, getExternalModuleContainer); if (symbolExternalModule) { - var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration); + let enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration); if (symbolExternalModule !== enclosingExternalModule) { // name from different external module that is not visible return { @@ -1112,7 +1112,7 @@ module ts { } function hasVisibleDeclarations(symbol: Symbol): SymbolVisibilityResult { - var aliasesToMakeVisible: ImportEqualsDeclaration[]; + let aliasesToMakeVisible: ImportEqualsDeclaration[]; if (forEach(symbol.declarations, declaration => !getIsDeclarationVisible(declaration))) { return undefined; } @@ -1147,7 +1147,7 @@ module ts { function isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult { // get symbol of the first identifier of the entityName - var meaning: SymbolFlags; + let meaning: SymbolFlags; if (entityName.parent.kind === SyntaxKind.TypeQuery) { // Typeof value meaning = SymbolFlags.Value | SymbolFlags.ExportValue; @@ -1163,8 +1163,8 @@ module ts { meaning = SymbolFlags.Type; } - var firstIdentifier = getFirstIdentifier(entityName); - var symbol = resolveName(enclosingDeclaration, (firstIdentifier).text, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined); + let firstIdentifier = getFirstIdentifier(entityName); + let symbol = resolveName(enclosingDeclaration, (firstIdentifier).text, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined); // Verify if the symbol is accessible return (symbol && hasVisibleDeclarations(symbol)) || { @@ -1187,23 +1187,23 @@ module ts { } function symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string { - var writer = getSingleLineStringWriter(); + let writer = getSingleLineStringWriter(); getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning); - var result = writer.string(); + let result = writer.string(); releaseStringWriter(writer); return result; } function typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string { - var writer = getSingleLineStringWriter(); + let writer = getSingleLineStringWriter(); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); - var result = writer.string(); + let result = writer.string(); releaseStringWriter(writer); - var maxLength = compilerOptions.noErrorTruncation || flags & TypeFormatFlags.NoTruncation ? undefined : 100; + let maxLength = compilerOptions.noErrorTruncation || flags & TypeFormatFlags.NoTruncation ? undefined : 100; if (maxLength && result.length >= maxLength) { result = result.substr(0, maxLength - "...".length) + "..."; } @@ -1213,7 +1213,7 @@ module ts { function getTypeAliasForTypeLiteral(type: Type): Symbol { if (type.symbol && type.symbol.flags & SymbolFlags.TypeLiteral) { - var node = type.symbol.declarations[0].parent; + let node = type.symbol.declarations[0].parent; while (node.kind === SyntaxKind.ParenthesizedType) { node = node.parent; } @@ -1225,7 +1225,7 @@ module ts { } // This is for caching the result of getSymbolDisplayBuilder. Do not access directly. - var _displayBuilder: SymbolDisplayBuilder; + let _displayBuilder: SymbolDisplayBuilder; function getSymbolDisplayBuilder(): SymbolDisplayBuilder { /** * Writes only the name of the symbol out to the writer. Uses the original source text @@ -1233,7 +1233,7 @@ module ts { */ function appendSymbolNameOnly(symbol: Symbol, writer: SymbolWriter): void { if (symbol.declarations && symbol.declarations.length > 0) { - var declaration = symbol.declarations[0]; + let declaration = symbol.declarations[0]; if (declaration.name) { writer.writeSymbol(declarationNameToString(declaration.name), symbol); return; @@ -1248,7 +1248,7 @@ module ts { * Meaning needs to be specified if the enclosing declaration is given */ function buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags, typeFlags?: TypeFormatFlags): void { - var parentSymbol: Symbol; + let parentSymbol: Symbol; function appendParentTypeArgumentsAndSymbolName(symbol: Symbol): void { if (parentSymbol) { // Write type arguments of instantiated class/interface here @@ -1277,7 +1277,7 @@ module ts { writer.trackSymbol(symbol, enclosingDeclaration, meaning); function walkSymbol(symbol: Symbol, meaning: SymbolFlags): void { if (symbol) { - var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & SymbolFormatFlags.UseOnlyExternalAliasing)); + let accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & SymbolFormatFlags.UseOnlyExternalAliasing)); if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { @@ -1312,8 +1312,8 @@ module ts { // Get qualified name if the symbol is not a type parameter // and there is an enclosing declaration or we specifically // asked for it - var isTypeParameter = symbol.flags & SymbolFlags.TypeParameter; - var typeFormatFlag = TypeFormatFlags.UseFullyQualifiedType & typeFlags; + let isTypeParameter = symbol.flags & SymbolFlags.TypeParameter; + let typeFormatFlag = TypeFormatFlags.UseFullyQualifiedType & typeFlags; if (!isTypeParameter && (enclosingDeclaration || typeFormatFlag)) { walkSymbol(symbol, meaning); return; @@ -1323,7 +1323,7 @@ module ts { } function buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, globalFlags?: TypeFormatFlags, typeStack?: Type[]) { - var globalFlagsToPass = globalFlags & TypeFormatFlags.WriteOwnNameForAnyLike; + let globalFlagsToPass = globalFlags & TypeFormatFlags.WriteOwnNameForAnyLike; return writeType(type, globalFlags); function writeType(type: Type, flags: TypeFormatFlags) { @@ -1364,7 +1364,7 @@ module ts { } function writeTypeList(types: Type[], union: boolean) { - for (var i = 0; i < types.length; i++) { + for (let i = 0; i < types.length; i++) { if (i > 0) { if (union) { writeSpace(writer); @@ -1417,7 +1417,7 @@ module ts { } else if (typeStack && contains(typeStack, type)) { // If type is an anonymous type literal in a type alias declaration, use type alias name - var typeAlias = getTypeAliasForTypeLiteral(type); + let typeAlias = getTypeAliasForTypeLiteral(type); if (typeAlias) { // The specified symbol flags need to be reinterpreted as type flags buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, SymbolFlags.Type, SymbolFormatFlags.None, flags); @@ -1438,9 +1438,9 @@ module ts { function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & SymbolFlags.Method && // typeof static method + let isStaticMethodSymbol = !!(type.symbol.flags & SymbolFlags.Method && // typeof static method ts.forEach(type.symbol.declarations, declaration => declaration.flags & NodeFlags.Static)); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & SymbolFlags.Function) && + let isNonLocalFunctionSymbol = !!(type.symbol.flags & SymbolFlags.Function) && (type.symbol.parent || // is exported function symbol ts.forEach(type.symbol.declarations, declaration => declaration.parent.kind === SyntaxKind.SourceFile || declaration.parent.kind === SyntaxKind.ModuleBlock)); @@ -1461,7 +1461,7 @@ module ts { } function getIndexerParameterName(type: ObjectType, indexKind: IndexKind, fallbackName: string): string { - var declaration = getIndexDeclarationOfSymbol(type.symbol, indexKind); + let declaration = getIndexDeclarationOfSymbol(type.symbol, indexKind); if (!declaration) { // declaration might not be found if indexer was added from the contextual type. // in this case use fallback name @@ -1472,7 +1472,7 @@ module ts { } function writeLiteralType(type: ObjectType, flags: TypeFormatFlags) { - var resolved = resolveObjectOrUnionTypeMembers(type); + let resolved = resolveObjectOrUnionTypeMembers(type); if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { writePunctuation(writer, SyntaxKind.OpenBraceToken); @@ -1549,9 +1549,9 @@ module ts { writer.writeLine(); } for (let p of resolved.properties) { - var t = getTypeOfSymbol(p); + let t = getTypeOfSymbol(p); if (p.flags & (SymbolFlags.Function | SymbolFlags.Method) && !getPropertiesOfObjectType(t).length) { - var signatures = getSignaturesOfType(t, SignatureKind.Call); + let signatures = getSignaturesOfType(t, SignatureKind.Call); for (let signature of signatures) { buildSymbolDisplay(p, writer); if (p.flags & SymbolFlags.Optional) { @@ -1580,7 +1580,7 @@ module ts { } function buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags) { - var targetSymbol = getTargetSymbol(symbol); + let targetSymbol = getTargetSymbol(symbol); if (targetSymbol.flags & SymbolFlags.Class || targetSymbol.flags & SymbolFlags.Interface) { buildDisplayForTypeParametersAndDelimiters(getTypeParametersOfClassOrInterface(symbol), writer, enclosingDeclaraiton, flags); } @@ -1588,7 +1588,7 @@ module ts { function buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) { appendSymbolNameOnly(tp.symbol, writer); - var constraint = getConstraintOfTypeParameter(tp); + let constraint = getConstraintOfTypeParameter(tp); if (constraint) { writeSpace(writer); writeKeyword(writer, SyntaxKind.ExtendsKeyword); @@ -1614,7 +1614,7 @@ module ts { function buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) { if (typeParameters && typeParameters.length) { writePunctuation(writer, SyntaxKind.LessThanToken); - for (var i = 0; i < typeParameters.length; i++) { + for (let i = 0; i < typeParameters.length; i++) { if (i > 0) { writePunctuation(writer, SyntaxKind.CommaToken); writeSpace(writer); @@ -1628,7 +1628,7 @@ module ts { function buildDisplayForTypeArgumentsAndDelimiters(typeParameters: TypeParameter[], mapper: TypeMapper, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) { if (typeParameters && typeParameters.length) { writePunctuation(writer, SyntaxKind.LessThanToken); - for (var i = 0; i < typeParameters.length; i++) { + for (let i = 0; i < typeParameters.length; i++) { if (i > 0) { writePunctuation(writer, SyntaxKind.CommaToken); writeSpace(writer); @@ -1641,7 +1641,7 @@ module ts { function buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, typeStack?: Type[]) { writePunctuation(writer, SyntaxKind.OpenParenToken); - for (var i = 0; i < parameters.length; i++) { + for (let i = 0; i < parameters.length; i++) { if (i > 0) { writePunctuation(writer, SyntaxKind.CommaToken); writeSpace(writer); @@ -1710,13 +1710,13 @@ module ts { function isUsedInExportAssignment(node: Node) { // Get source File and see if it is external module and has export assigned symbol - var externalModule = getContainingExternalModule(node); + let externalModule = getContainingExternalModule(node); if (externalModule) { // This is export assigned symbol node - var externalModuleSymbol = getSymbolOfNode(externalModule); + let externalModuleSymbol = getSymbolOfNode(externalModule); var exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); var resolvedExportSymbol: Symbol; - var symbolOfNode = getSymbolOfNode(node); + let symbolOfNode = getSymbolOfNode(node); if (isSymbolUsedInExportAssignment(symbolOfNode)) { return true; } @@ -1764,7 +1764,7 @@ module ts { case SyntaxKind.FunctionDeclaration: case SyntaxKind.EnumDeclaration: case SyntaxKind.ImportEqualsDeclaration: - var parent = getDeclarationContainer(node); + let parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(getCombinedNodeFlags(node) & NodeFlags.Export) && !(node.kind !== SyntaxKind.ImportEqualsDeclaration && parent.kind !== SyntaxKind.SourceFile && isInAmbientContext(parent))) { @@ -1813,7 +1813,7 @@ module ts { } if (node) { - var links = getNodeLinks(node); + let links = getNodeLinks(node); if (links.isVisible === undefined) { links.isVisible = !!determineIfDeclarationIsVisible(); } @@ -1841,20 +1841,20 @@ module ts { // Every class automatically contains a static property member named 'prototype', // the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter. // It is an error to explicitly declare a static property member with the name 'prototype'. - var classType = getDeclaredTypeOfSymbol(prototype.parent); + let classType = getDeclaredTypeOfSymbol(prototype.parent); return classType.typeParameters ? createTypeReference(classType, map(classType.typeParameters, _ => anyType)) : classType; } // Return the type of the given property in the given type, or undefined if no such property exists function getTypeOfPropertyOfType(type: Type, name: string): Type { - var prop = getPropertyOfType(type, name); + let prop = getPropertyOfType(type, name); return prop ? getTypeOfSymbol(prop) : undefined; } // Return the inferred type for a binding element function getTypeForBindingElement(declaration: BindingElement): Type { - var pattern = declaration.parent; - var parentType = getTypeForVariableLikeDeclaration(pattern.parent); + let pattern = declaration.parent; + let parentType = getTypeForVariableLikeDeclaration(pattern.parent); // If parent has the unknown (error) type, then so does this binding element if (parentType === unknownType) { return unknownType; @@ -1870,7 +1870,7 @@ module ts { } if (pattern.kind === SyntaxKind.ObjectBindingPattern) { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) - var name = declaration.propertyName || declaration.name; + let name = declaration.propertyName || declaration.name; // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. var type = getTypeOfPropertyOfType(parentType, name.text) || @@ -1889,7 +1889,7 @@ module ts { } if (!declaration.dotDotDotToken) { // Use specific property type when parent is a tuple or numeric index type when parent is an array - var propName = "" + indexOf(pattern.elements, declaration); + let propName = "" + indexOf(pattern.elements, declaration); var type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, IndexKind.Number); if (!type) { if (isTupleType(parentType)) { @@ -1930,16 +1930,16 @@ module ts { return getTypeFromTypeNode(declaration.type); } if (declaration.kind === SyntaxKind.Parameter) { - var func = declaration.parent; + let func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present if (func.kind === SyntaxKind.SetAccessor && !hasDynamicName(func)) { - var getter = getDeclarationOfKind(declaration.parent.symbol, SyntaxKind.GetAccessor); + let getter = getDeclarationOfKind(declaration.parent.symbol, SyntaxKind.GetAccessor); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } } // Use contextual parameter type if one is available - var type = getContextuallyTypedParameterType(declaration); + let type = getContextuallyTypedParameterType(declaration); if (type) { return type; } @@ -1971,11 +1971,11 @@ module ts { // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern: BindingPattern): Type { - var members: SymbolTable = {}; + let members: SymbolTable = {}; forEach(pattern.elements, e => { - var flags = SymbolFlags.Property | SymbolFlags.Transient | (e.initializer ? SymbolFlags.Optional : 0); - var name = e.propertyName || e.name; - var symbol = createSymbol(flags, name.text); + let flags = SymbolFlags.Property | SymbolFlags.Transient | (e.initializer ? SymbolFlags.Optional : 0); + let name = e.propertyName || e.name; + let symbol = createSymbol(flags, name.text); symbol.type = getTypeFromBindingElement(e); members[symbol.name] = symbol; }); @@ -1984,8 +1984,8 @@ module ts { // Return the type implied by an array binding pattern function getTypeFromArrayBindingPattern(pattern: BindingPattern): Type { - var hasSpreadElement: boolean = false; - var elementTypes: Type[] = []; + let hasSpreadElement: boolean = false; + let elementTypes: Type[] = []; forEach(pattern.elements, e => { elementTypes.push(e.kind === SyntaxKind.OmittedExpression || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { @@ -2018,7 +2018,7 @@ module ts { // binding pattern [x, s = ""]. Because the contextual type is a tuple type, the resulting type of [1, "one"] is the // tuple type [number, string]. Thus, the type inferred for 'x' is number and the type inferred for 's' is string. function getWidenedTypeForVariableLikeDeclaration(declaration: VariableLikeDeclaration, reportErrors?: boolean): Type { - var type = getTypeForVariableLikeDeclaration(declaration); + let type = getTypeForVariableLikeDeclaration(declaration); if (type) { if (reportErrors) { reportErrorsFromWidening(declaration, type); @@ -2037,7 +2037,7 @@ module ts { type = declaration.dotDotDotToken ? anyArrayType : anyType; // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { - var root = getRootDeclaration(declaration); + let root = getRootDeclaration(declaration); if (!isPrivateWithinAmbient(root) && !(root.kind === SyntaxKind.Parameter && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } @@ -2046,14 +2046,14 @@ module ts { } function getTypeOfVariableOrParameterOrProperty(symbol: Symbol): Type { - var links = getSymbolLinks(symbol); + let links = getSymbolLinks(symbol); if (!links.type) { // Handle prototype property if (symbol.flags & SymbolFlags.Prototype) { return links.type = getTypeOfPrototypeProperty(symbol); } // Handle catch clause variables - var declaration = symbol.valueDeclaration; + let declaration = symbol.valueDeclaration; if (declaration.parent.kind === SyntaxKind.CatchClause) { return links.type = anyType; } @@ -2063,7 +2063,7 @@ module ts { } // Handle variable, parameter or property links.type = resolvingType; - var type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true); + let type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true); if (links.type === resolvingType) { links.type = type; } @@ -2071,7 +2071,7 @@ module ts { else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var diagnostic = (symbol.valueDeclaration).type ? + let diagnostic = (symbol.valueDeclaration).type ? Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); @@ -2090,7 +2090,7 @@ module ts { return accessor.type && getTypeFromTypeNode(accessor.type); } else { - var setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); + let setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); } } @@ -2098,7 +2098,7 @@ module ts { } function getTypeOfAccessors(symbol: Symbol): Type { - var links = getSymbolLinks(symbol); + let links = getSymbolLinks(symbol); checkAndStoreTypeOfAccessors(symbol, links); return links.type; } @@ -2107,19 +2107,19 @@ module ts { links = links || getSymbolLinks(symbol); if (!links.type) { links.type = resolvingType; - var getter = getDeclarationOfKind(symbol, SyntaxKind.GetAccessor); - var setter = getDeclarationOfKind(symbol, SyntaxKind.SetAccessor); + let getter = getDeclarationOfKind(symbol, SyntaxKind.GetAccessor); + let setter = getDeclarationOfKind(symbol, SyntaxKind.SetAccessor); - var type: Type; + let type: Type; // First try to see if the user specified a return type on the get-accessor. - var getterReturnType = getAnnotatedAccessorType(getter); + let getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { type = getterReturnType; } else { // If the user didn't specify a return type, try to use the set-accessor's parameter type. - var setterParameterType = getAnnotatedAccessorType(setter); + let setterParameterType = getAnnotatedAccessorType(setter); if (setterParameterType) { type = setterParameterType; } @@ -2146,14 +2146,14 @@ module ts { else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var getter = getDeclarationOfKind(symbol, SyntaxKind.GetAccessor); + let getter = getDeclarationOfKind(symbol, SyntaxKind.GetAccessor); error(getter, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } } function getTypeOfFuncClassEnumModule(symbol: Symbol): Type { - var links = getSymbolLinks(symbol); + let links = getSymbolLinks(symbol); if (!links.type) { links.type = createObjectType(TypeFlags.Anonymous, symbol); } @@ -2161,7 +2161,7 @@ module ts { } function getTypeOfEnumMember(symbol: Symbol): Type { - var links = getSymbolLinks(symbol); + let links = getSymbolLinks(symbol); if (!links.type) { links.type = getDeclaredTypeOfEnum(getParentOfSymbol(symbol)); } @@ -2169,7 +2169,7 @@ module ts { } function getTypeOfAlias(symbol: Symbol): Type { - var links = getSymbolLinks(symbol); + let links = getSymbolLinks(symbol); if (!links.type) { links.type = getTypeOfSymbol(resolveAlias(symbol)); } @@ -2177,7 +2177,7 @@ module ts { } function getTypeOfInstantiatedSymbol(symbol: Symbol): Type { - var links = getSymbolLinks(symbol); + let links = getSymbolLinks(symbol); if (!links.type) { links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); } @@ -2213,7 +2213,7 @@ module ts { function hasBaseType(type: InterfaceType, checkBase: InterfaceType) { return check(type); function check(type: InterfaceType): boolean { - var target = getTargetType(type); + let target = getTargetType(type); return target === checkBase || forEach(target.baseTypes, check); } } @@ -2222,13 +2222,13 @@ module ts { // the same, but even if they're not we still need the complete list to ensure instantiations supply type arguments // for all type parameters. function getTypeParametersOfClassOrInterface(symbol: Symbol): TypeParameter[] { - var result: TypeParameter[]; + let result: TypeParameter[]; forEach(symbol.declarations, node => { if (node.kind === SyntaxKind.InterfaceDeclaration || node.kind === SyntaxKind.ClassDeclaration) { - var declaration = node; + let declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { forEach(declaration.typeParameters, node => { - var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + let tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); if (!result) { result = [tp]; } @@ -2243,10 +2243,10 @@ module ts { } function getDeclaredTypeOfClass(symbol: Symbol): InterfaceType { - var links = getSymbolLinks(symbol); + let links = getSymbolLinks(symbol); if (!links.declaredType) { - var type = links.declaredType = createObjectType(TypeFlags.Class, symbol); - var typeParameters = getTypeParametersOfClassOrInterface(symbol); + let type = links.declaredType = createObjectType(TypeFlags.Class, symbol); + let typeParameters = getTypeParametersOfClassOrInterface(symbol); if (typeParameters) { type.flags |= TypeFlags.Reference; type.typeParameters = typeParameters; @@ -2256,10 +2256,10 @@ module ts { (type).typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = getDeclarationOfKind(symbol, SyntaxKind.ClassDeclaration); - var baseTypeNode = getClassBaseTypeNode(declaration); + let declaration = getDeclarationOfKind(symbol, SyntaxKind.ClassDeclaration); + let baseTypeNode = getClassBaseTypeNode(declaration); if (baseTypeNode) { - var baseType = getTypeFromTypeReferenceNode(baseTypeNode); + let baseType = getTypeFromTypeReferenceNode(baseTypeNode); if (baseType !== unknownType) { if (getTargetType(baseType).flags & TypeFlags.Class) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -2284,10 +2284,10 @@ module ts { } function getDeclaredTypeOfInterface(symbol: Symbol): InterfaceType { - var links = getSymbolLinks(symbol); + let links = getSymbolLinks(symbol); if (!links.declaredType) { - var type = links.declaredType = createObjectType(TypeFlags.Interface, symbol); - var typeParameters = getTypeParametersOfClassOrInterface(symbol); + let type = links.declaredType = createObjectType(TypeFlags.Interface, symbol); + let typeParameters = getTypeParametersOfClassOrInterface(symbol); if (typeParameters) { type.flags |= TypeFlags.Reference; type.typeParameters = typeParameters; @@ -2300,7 +2300,7 @@ module ts { forEach(symbol.declarations, declaration => { if (declaration.kind === SyntaxKind.InterfaceDeclaration && getInterfaceBaseTypeNodes(declaration)) { forEach(getInterfaceBaseTypeNodes(declaration), node => { - var baseType = getTypeFromTypeReferenceNode(node); + let baseType = getTypeFromTypeReferenceNode(node); if (baseType !== unknownType) { if (getTargetType(baseType).flags & (TypeFlags.Class | TypeFlags.Interface)) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -2327,27 +2327,27 @@ module ts { } function getDeclaredTypeOfTypeAlias(symbol: Symbol): Type { - var links = getSymbolLinks(symbol); + let links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration); - var type = getTypeFromTypeNode(declaration.type); + let declaration = getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration); + let type = getTypeFromTypeNode(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; } } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration); + let declaration = getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration); error(declaration.name, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; } function getDeclaredTypeOfEnum(symbol: Symbol): Type { - var links = getSymbolLinks(symbol); + let links = getSymbolLinks(symbol); if (!links.declaredType) { - var type = createType(TypeFlags.Enum); + let type = createType(TypeFlags.Enum); type.symbol = symbol; links.declaredType = type; } @@ -2355,9 +2355,9 @@ module ts { } function getDeclaredTypeOfTypeParameter(symbol: Symbol): TypeParameter { - var links = getSymbolLinks(symbol); + let links = getSymbolLinks(symbol); if (!links.declaredType) { - var type = createType(TypeFlags.TypeParameter); + let type = createType(TypeFlags.TypeParameter); type.symbol = symbol; if (!(getDeclarationOfKind(symbol, SyntaxKind.TypeParameter)).constraint) { type.constraint = noConstraintType; @@ -2368,7 +2368,7 @@ module ts { } function getDeclaredTypeOfAlias(symbol: Symbol): Type { - var links = getSymbolLinks(symbol); + let links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = getDeclaredTypeOfSymbol(resolveAlias(symbol)); } @@ -2399,7 +2399,7 @@ module ts { } function createSymbolTable(symbols: Symbol[]): SymbolTable { - var result: SymbolTable = {}; + let result: SymbolTable = {}; for (let symbol of symbols) { result[symbol.name] = symbol; } @@ -2407,7 +2407,7 @@ module ts { } function createInstantiatedSymbolTable(symbols: Symbol[], mapper: TypeMapper): SymbolTable { - var result: SymbolTable = {}; + let result: SymbolTable = {}; for (let symbol of symbols) { result[symbol.name] = instantiateSymbol(symbol, mapper); } @@ -2431,11 +2431,11 @@ module ts { } function resolveClassOrInterfaceMembers(type: InterfaceType): void { - var members = type.symbol.members; - var callSignatures = type.declaredCallSignatures; - var constructSignatures = type.declaredConstructSignatures; - var stringIndexType = type.declaredStringIndexType; - var numberIndexType = type.declaredNumberIndexType; + let members = type.symbol.members; + let callSignatures = type.declaredCallSignatures; + let constructSignatures = type.declaredConstructSignatures; + let stringIndexType = type.declaredStringIndexType; + let numberIndexType = type.declaredNumberIndexType; if (type.baseTypes.length) { members = createSymbolTable(type.declaredProperties); forEach(type.baseTypes, baseType => { @@ -2450,15 +2450,15 @@ module ts { } function resolveTypeReferenceMembers(type: TypeReference): void { - var target = type.target; - var mapper = createTypeMapper(target.typeParameters, type.typeArguments); - var members = createInstantiatedSymbolTable(target.declaredProperties, mapper); - var callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature); - var constructSignatures = instantiateList(target.declaredConstructSignatures, mapper, instantiateSignature); - var stringIndexType = target.declaredStringIndexType ? instantiateType(target.declaredStringIndexType, mapper) : undefined; - var numberIndexType = target.declaredNumberIndexType ? instantiateType(target.declaredNumberIndexType, mapper) : undefined; + let target = type.target; + let mapper = createTypeMapper(target.typeParameters, type.typeArguments); + let members = createInstantiatedSymbolTable(target.declaredProperties, mapper); + let callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature); + let constructSignatures = instantiateList(target.declaredConstructSignatures, mapper, instantiateSignature); + let stringIndexType = target.declaredStringIndexType ? instantiateType(target.declaredStringIndexType, mapper) : undefined; + let numberIndexType = target.declaredNumberIndexType ? instantiateType(target.declaredNumberIndexType, mapper) : undefined; forEach(target.baseTypes, baseType => { - var instantiatedBaseType = instantiateType(baseType, mapper); + let instantiatedBaseType = instantiateType(baseType, mapper); addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); callSignatures = concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, SignatureKind.Call)); constructSignatures = concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, SignatureKind.Construct)); @@ -2470,7 +2470,7 @@ module ts { function createSignature(declaration: SignatureDeclaration, typeParameters: TypeParameter[], parameters: Symbol[], resolvedReturnType: Type, minArgumentCount: number, hasRestParameter: boolean, hasStringLiterals: boolean): Signature { - var sig = new Signature(checker); + let sig = new Signature(checker); sig.declaration = declaration; sig.typeParameters = typeParameters; sig.parameters = parameters; @@ -2488,10 +2488,10 @@ module ts { function getDefaultConstructSignatures(classType: InterfaceType): Signature[] { if (classType.baseTypes.length) { - var baseType = classType.baseTypes[0]; - var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), SignatureKind.Construct); + let baseType = classType.baseTypes[0]; + let baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), SignatureKind.Construct); return map(baseSignatures, baseSignature => { - var signature = baseType.flags & TypeFlags.Reference ? + let signature = baseType.flags & TypeFlags.Reference ? getSignatureInstantiation(baseSignature, (baseType).typeArguments) : cloneSignature(baseSignature); signature.typeParameters = classType.typeParameters; signature.resolvedReturnType = classType; @@ -2502,9 +2502,9 @@ module ts { } function createTupleTypeMemberSymbols(memberTypes: Type[]): SymbolTable { - var members: SymbolTable = {}; - for (var i = 0; i < memberTypes.length; i++) { - var symbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "" + i); + let members: SymbolTable = {}; + for (let i = 0; i < memberTypes.length; i++) { + let symbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "" + i); symbol.type = memberTypes[i]; members[i] = symbol; } @@ -2512,8 +2512,8 @@ module ts { } function resolveTupleTypeMembers(type: TupleType) { - var arrayType = resolveObjectOrUnionTypeMembers(createArrayType(getUnionType(type.elementTypes))); - var members = createTupleTypeMemberSymbols(type.elementTypes); + let arrayType = resolveObjectOrUnionTypeMembers(createArrayType(getUnionType(type.elementTypes))); + let members = createTupleTypeMemberSymbols(type.elementTypes); addInheritedMembers(members, arrayType.properties); setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); } @@ -2522,7 +2522,7 @@ module ts { if (s.length !== t.length) { return false; } - for (var i = 0; i < s.length; i++) { + for (let i = 0; i < s.length; i++) { if (!compareSignatures(s[i], t[i], /*compareReturnTypes*/ false, compareTypes)) { return false; } @@ -2534,21 +2534,21 @@ module ts { // and if none of the signatures are generic, return a list of signatures that has substitutes a union of the // return types of the corresponding signatures in each resulting signature. function getUnionSignatures(types: Type[], kind: SignatureKind): Signature[] { - var signatureLists = map(types, t => getSignaturesOfType(t, kind)); - var signatures = signatureLists[0]; + let signatureLists = map(types, t => getSignaturesOfType(t, kind)); + let signatures = signatureLists[0]; for (let signature of signatures) { if (signature.typeParameters) { return emptyArray; } } - for (var i = 1; i < signatureLists.length; i++) { + for (let i = 1; i < signatureLists.length; i++) { if (!signatureListsIdentical(signatures, signatureLists[i])) { return emptyArray; } } - var result = map(signatures, cloneSignature); + let result = map(signatures, cloneSignature); for (var i = 0; i < result.length; i++) { - var s = result[i]; + let s = result[i]; // Clear resolved return type we possibly got from cloneSignature s.resolvedReturnType = undefined; s.unionSignatures = map(signatureLists, signatures => signatures[i]); @@ -2557,9 +2557,9 @@ module ts { } function getUnionIndexType(types: Type[], kind: IndexKind): Type { - var indexTypes: Type[] = []; + let indexTypes: Type[] = []; for (let type of types) { - var indexType = getIndexTypeOfType(type, kind); + let indexType = getIndexTypeOfType(type, kind); if (!indexType) { return undefined; } @@ -2571,15 +2571,15 @@ module ts { function resolveUnionTypeMembers(type: UnionType) { // The members and properties collections are empty for union types. To get all properties of a union // type use getPropertiesOfType (only the language service uses this). - var callSignatures = getUnionSignatures(type.types, SignatureKind.Call); - var constructSignatures = getUnionSignatures(type.types, SignatureKind.Construct); - var stringIndexType = getUnionIndexType(type.types, IndexKind.String); - var numberIndexType = getUnionIndexType(type.types, IndexKind.Number); + let callSignatures = getUnionSignatures(type.types, SignatureKind.Call); + let constructSignatures = getUnionSignatures(type.types, SignatureKind.Construct); + let stringIndexType = getUnionIndexType(type.types, IndexKind.String); + let numberIndexType = getUnionIndexType(type.types, IndexKind.Number); setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); } function resolveAnonymousTypeMembers(type: ObjectType) { - var symbol = type.symbol; + let symbol = type.symbol; if (symbol.flags & SymbolFlags.TypeLiteral) { var members = symbol.members; var callSignatures = getSignaturesOfSymbol(members["__call"]); @@ -2599,7 +2599,7 @@ module ts { callSignatures = getSignaturesOfSymbol(symbol); } if (symbol.flags & SymbolFlags.Class) { - var classType = getDeclaredTypeOfClass(symbol); + let classType = getDeclaredTypeOfClass(symbol); constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); if (!constructSignatures.length) { constructSignatures = getDefaultConstructSignatures(classType); @@ -2648,9 +2648,9 @@ module ts { // the symbol for that property. Otherwise return undefined. function getPropertyOfObjectType(type: Type, name: string): Symbol { if (type.flags & TypeFlags.ObjectType) { - var resolved = resolveObjectOrUnionTypeMembers(type); + let resolved = resolveObjectOrUnionTypeMembers(type); if (hasProperty(resolved.members, name)) { - var symbol = resolved.members[name]; + let symbol = resolved.members[name]; if (symbolIsValue(symbol)) { return symbol; } @@ -2659,9 +2659,9 @@ module ts { } function getPropertiesOfUnionType(type: UnionType): Symbol[] { - var result: Symbol[] = []; + let result: Symbol[] = []; forEach(getPropertiesOfType(type.types[0]), prop => { - var unionProp = getPropertyOfUnionType(type, prop.name); + let unionProp = getPropertyOfUnionType(type, prop.name); if (unionProp) { result.push(unionProp); } @@ -2704,12 +2704,12 @@ module ts { } function createUnionProperty(unionType: UnionType, name: string): Symbol { - var types = unionType.types; - var props: Symbol[]; + let types = unionType.types; + let props: Symbol[]; for (let current of types) { - var type = getApparentType(current); + let type = getApparentType(current); if (type !== unknownType) { - var prop = getPropertyOfType(type, name); + let prop = getPropertyOfType(type, name); if (!prop) { return undefined; } @@ -2721,15 +2721,15 @@ module ts { } } } - var propTypes: Type[] = []; - var declarations: Declaration[] = []; + let propTypes: Type[] = []; + let declarations: Declaration[] = []; for (let prop of props) { if (prop.declarations) { declarations.push.apply(declarations, prop.declarations); } propTypes.push(getTypeOfSymbol(prop)); } - var result = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | SymbolFlags.UnionProperty, name); + let result = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | SymbolFlags.UnionProperty, name); result.unionType = unionType; result.declarations = declarations; result.type = getUnionType(propTypes); @@ -2737,11 +2737,11 @@ module ts { } function getPropertyOfUnionType(type: UnionType, name: string): Symbol { - var properties = type.resolvedProperties || (type.resolvedProperties = {}); + let properties = type.resolvedProperties || (type.resolvedProperties = {}); if (hasProperty(properties, name)) { return properties[name]; } - var property = createUnionProperty(type, name); + let property = createUnionProperty(type, name); if (property) { properties[name] = property; } @@ -2761,15 +2761,15 @@ module ts { return undefined; } } - var resolved = resolveObjectOrUnionTypeMembers(type); + let resolved = resolveObjectOrUnionTypeMembers(type); if (hasProperty(resolved.members, name)) { - var symbol = resolved.members[name]; + let symbol = resolved.members[name]; if (symbolIsValue(symbol)) { return symbol; } } if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) { - var symbol = getPropertyOfObjectType(globalFunctionType, name); + let symbol = getPropertyOfObjectType(globalFunctionType, name); if (symbol) return symbol; } return getPropertyOfObjectType(globalObjectType, name); @@ -2777,7 +2777,7 @@ module ts { function getSignaturesOfObjectOrUnionType(type: Type, kind: SignatureKind): Signature[] { if (type.flags & (TypeFlags.ObjectType | TypeFlags.Union)) { - var resolved = resolveObjectOrUnionTypeMembers(type); + let resolved = resolveObjectOrUnionTypeMembers(type); return kind === SignatureKind.Call ? resolved.callSignatures : resolved.constructSignatures; } return emptyArray; @@ -2791,7 +2791,7 @@ module ts { function getIndexTypeOfObjectOrUnionType(type: Type, kind: IndexKind): Type { if (type.flags & (TypeFlags.ObjectType | TypeFlags.Union)) { - var resolved = resolveObjectOrUnionTypeMembers(type); + let resolved = resolveObjectOrUnionTypeMembers(type); return kind === IndexKind.String ? resolved.stringIndexType : resolved.numberIndexType; } } @@ -2805,9 +2805,9 @@ module ts { // Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual // type checking functions). function getTypeParametersFromDeclaration(typeParameterDeclarations: TypeParameterDeclaration[]): TypeParameter[] { - var result: TypeParameter[] = []; + let result: TypeParameter[] = []; forEach(typeParameterDeclarations, node => { - var tp = getDeclaredTypeOfTypeParameter(node.symbol); + let tp = getDeclaredTypeOfTypeParameter(node.symbol); if (!contains(result, tp)) { result.push(tp); } @@ -2820,7 +2820,7 @@ module ts { return emptyArray; } - var module = resolveExternalModuleName(node, node.moduleSpecifier); + let module = resolveExternalModuleName(node, node.moduleSpecifier); if (!module || !module.exports) { return emptyArray; } @@ -2829,16 +2829,16 @@ module ts { } function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature { - var links = getNodeLinks(declaration); + let links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === SyntaxKind.Constructor ? getDeclaredTypeOfClass((declaration.parent).symbol) : undefined; - var typeParameters = classType ? classType.typeParameters : + let classType = declaration.kind === SyntaxKind.Constructor ? getDeclaredTypeOfClass((declaration.parent).symbol) : undefined; + let typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; - var parameters: Symbol[] = []; - var hasStringLiterals = false; - var minArgumentCount = -1; - for (var i = 0, n = declaration.parameters.length; i < n; i++) { - var param = declaration.parameters[i]; + let parameters: Symbol[] = []; + let hasStringLiterals = false; + let minArgumentCount = -1; + for (let i = 0, n = declaration.parameters.length; i < n; i++) { + let param = declaration.parameters[i]; parameters.push(param.symbol); if (param.type && param.type.kind === SyntaxKind.StringLiteral) { hasStringLiterals = true; @@ -2854,7 +2854,7 @@ module ts { minArgumentCount = declaration.parameters.length; } - var returnType: Type; + let returnType: Type; if (classType) { returnType = classType; } @@ -2865,7 +2865,7 @@ module ts { // TypeScript 1.0 spec (April 2014): // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. if (declaration.kind === SyntaxKind.GetAccessor && !hasDynamicName(declaration)) { - var setter = getDeclarationOfKind(declaration.symbol, SyntaxKind.SetAccessor); + let setter = getDeclarationOfKind(declaration.symbol, SyntaxKind.SetAccessor); returnType = getAnnotatedAccessorType(setter); } @@ -2882,9 +2882,9 @@ module ts { function getSignaturesOfSymbol(symbol: Symbol): Signature[] { if (!symbol) return emptyArray; - var result: Signature[] = []; - for (var i = 0, len = symbol.declarations.length; i < len; i++) { - var node = symbol.declarations[i]; + let result: Signature[] = []; + for (let i = 0, len = symbol.declarations.length; i < len; i++) { + let node = symbol.declarations[i]; switch (node.kind) { case SyntaxKind.FunctionType: case SyntaxKind.ConstructorType: @@ -2903,7 +2903,7 @@ module ts { // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). if (i > 0 && (node).body) { - var previous = symbol.declarations[i - 1]; + let previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { break; } @@ -2933,7 +2933,7 @@ module ts { else if (signature.resolvedReturnType === resolvingType) { signature.resolvedReturnType = anyType; if (compilerOptions.noImplicitAny) { - var declaration = signature.declaration; + let declaration = signature.declaration; if (declaration.name) { error(declaration.name, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, declarationNameToString(declaration.name)); } @@ -2947,7 +2947,7 @@ module ts { function getRestTypeOfSignature(signature: Signature): Type { if (signature.hasRestParameter) { - var type = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]); + let type = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]); if (type.flags & TypeFlags.Reference && (type).target === globalArrayType) { return (type).typeArguments[0]; } @@ -2978,8 +2978,8 @@ module ts { // object type literal or interface (using the new keyword). Each way of declaring a constructor // will result in a different declaration kind. if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === SyntaxKind.Constructor || signature.declaration.kind === SyntaxKind.ConstructSignature; - var type = createObjectType(TypeFlags.Anonymous | TypeFlags.FromSignature); + let isConstructor = signature.declaration.kind === SyntaxKind.Constructor || signature.declaration.kind === SyntaxKind.ConstructSignature; + let type = createObjectType(TypeFlags.Anonymous | TypeFlags.FromSignature); type.members = emptySymbols; type.properties = emptyArray; type.callSignatures = !isConstructor ? [signature] : emptyArray; @@ -2995,14 +2995,14 @@ module ts { } function getIndexDeclarationOfSymbol(symbol: Symbol, kind: IndexKind): SignatureDeclaration { - var syntaxKind = kind === IndexKind.Number ? SyntaxKind.NumberKeyword : SyntaxKind.StringKeyword; - var indexSymbol = getIndexSymbol(symbol); + let syntaxKind = kind === IndexKind.Number ? SyntaxKind.NumberKeyword : SyntaxKind.StringKeyword; + let indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { - var len = indexSymbol.declarations.length; + let len = indexSymbol.declarations.length; for (let decl of indexSymbol.declarations) { - var node = decl; + let node = decl; if (node.parameters.length === 1) { - var parameter = node.parameters[0]; + let parameter = node.parameters[0]; if (parameter && parameter.type && parameter.type.kind === syntaxKind) { return node; } @@ -3014,7 +3014,7 @@ module ts { } function getIndexTypeOfSymbol(symbol: Symbol, kind: IndexKind): Type { - var declaration = getIndexDeclarationOfSymbol(symbol, kind); + let declaration = getIndexDeclarationOfSymbol(symbol, kind); return declaration ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType : undefined; @@ -3023,7 +3023,7 @@ module ts { function getConstraintOfTypeParameter(type: TypeParameter): Type { if (!type.constraint) { if (type.target) { - var targetConstraint = getConstraintOfTypeParameter(type.target); + let targetConstraint = getConstraintOfTypeParameter(type.target); type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { @@ -3040,8 +3040,8 @@ module ts { case 2: return types[0].id + "," + types[1].id; default: - var result = ""; - for (var i = 0; i < types.length; i++) { + let result = ""; + for (let i = 0; i < types.length; i++) { if (i > 0) { result += ","; } @@ -3056,7 +3056,7 @@ module ts { // It is only necessary to do so if a constituent type might be the undefined type, the null type, or the type // of an object literal (since those types have widening related information we need to track). function getWideningFlagsOfTypes(types: Type[]): TypeFlags { - var result: TypeFlags = 0; + let result: TypeFlags = 0; for (let type of types) { result |= type.flags; } @@ -3064,10 +3064,10 @@ module ts { } function createTypeReference(target: GenericType, typeArguments: Type[]): TypeReference { - var id = getTypeListId(typeArguments); - var type = target.instantiations[id]; + let id = getTypeListId(typeArguments); + let type = target.instantiations[id]; if (!type) { - var flags = TypeFlags.Reference | getWideningFlagsOfTypes(typeArguments); + let flags = TypeFlags.Reference | getWideningFlagsOfTypes(typeArguments); type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -3076,13 +3076,13 @@ module ts { } function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode: TypeReferenceNode, typeParameterSymbol: Symbol): boolean { - var links = getNodeLinks(typeReferenceNode); + let links = getNodeLinks(typeReferenceNode); if (links.isIllegalTypeReferenceInConstraint !== undefined) { return links.isIllegalTypeReferenceInConstraint; } // bubble up to the declaration - var currentNode: Node = typeReferenceNode; + let currentNode: Node = typeReferenceNode; // forEach === exists while (!forEach(typeParameterSymbol.declarations, d => d.parent === currentNode.parent)) { currentNode = currentNode.parent; @@ -3093,12 +3093,12 @@ module ts { } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter: TypeParameterDeclaration): void { - var typeParameterSymbol: Symbol; + let typeParameterSymbol: Symbol; function check(n: Node): void { if (n.kind === SyntaxKind.TypeReference && (n).typeName.kind === SyntaxKind.Identifier) { - var links = getNodeLinks(n); + let links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { - var symbol = resolveName(typeParameter, ((n).typeName).text, SymbolFlags.Type, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + let symbol = resolveName(typeParameter, ((n).typeName).text, SymbolFlags.Type, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); if (symbol && (symbol.flags & SymbolFlags.TypeParameter)) { // TypeScript 1.0 spec (April 2014): 3.4.1 // Type parameters declared in a particular type parameter list @@ -3125,9 +3125,9 @@ module ts { } function getTypeFromTypeReferenceNode(node: TypeReferenceNode): Type { - var links = getNodeLinks(node); + let links = getNodeLinks(node); if (!links.resolvedType) { - var symbol = resolveEntityName(node.typeName, SymbolFlags.Type); + let symbol = resolveEntityName(node.typeName, SymbolFlags.Type); if (symbol) { var type: Type; if ((symbol.flags & SymbolFlags.TypeParameter) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { @@ -3140,7 +3140,7 @@ module ts { else { type = getDeclaredTypeOfSymbol(symbol); if (type.flags & (TypeFlags.Class | TypeFlags.Interface) && type.flags & TypeFlags.Reference) { - var typeParameters = (type).typeParameters; + let typeParameters = (type).typeParameters; if (node.typeArguments && node.typeArguments.length === typeParameters.length) { type = createTypeReference(type, map(node.typeArguments, getTypeFromTypeNode)); } @@ -3163,7 +3163,7 @@ module ts { } function getTypeFromTypeQueryNode(node: TypeQueryNode): Type { - var links = getNodeLinks(node); + let links = getNodeLinks(node); if (!links.resolvedType) { // TypeScript 1.0 spec (April 2014): 3.6.3 // The expression is processed as an identifier expression (section 4.3) @@ -3177,7 +3177,7 @@ module ts { function getTypeOfGlobalSymbol(symbol: Symbol, arity: number): ObjectType { function getTypeDeclaration(symbol: Symbol): Declaration { - var declarations = symbol.declarations; + let declarations = symbol.declarations; for (let declaration of declarations) { switch (declaration.kind) { case SyntaxKind.ClassDeclaration: @@ -3191,7 +3191,7 @@ module ts { if (!symbol) { return emptyObjectType; } - var type = getDeclaredTypeOfSymbol(symbol); + let type = getDeclaredTypeOfSymbol(symbol); if (!(type.flags & TypeFlags.ObjectType)) { error(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name); return emptyObjectType; @@ -3227,12 +3227,12 @@ module ts { // globalArrayType will be undefined if we get here during creation of the Array type. This for example happens if // user code augments the Array type with call or construct signatures that have an array type as the return type. // We instead use globalArraySymbol to obtain the (not yet fully constructed) Array type. - var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); + let arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); return arrayType !== emptyObjectType ? createTypeReference(arrayType, [elementType]) : emptyObjectType; } function getTypeFromArrayTypeNode(node: ArrayTypeNode): Type { - var links = getNodeLinks(node); + let links = getNodeLinks(node); if (!links.resolvedType) { links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType)); } @@ -3240,8 +3240,8 @@ module ts { } function createTupleType(elementTypes: Type[]) { - var id = getTypeListId(elementTypes); - var type = tupleTypes[id]; + let id = getTypeListId(elementTypes); + let type = tupleTypes[id]; if (!type) { type = tupleTypes[id] = createObjectType(TypeFlags.Tuple); type.elementTypes = elementTypes; @@ -3250,7 +3250,7 @@ module ts { } function getTypeFromTupleTypeNode(node: TupleTypeNode): Type { - var links = getNodeLinks(node); + let links = getNodeLinks(node); if (!links.resolvedType) { links.resolvedType = createTupleType(map(node.elementTypes, getTypeFromTypeNode)); } @@ -3262,8 +3262,8 @@ module ts { addTypesToSortedSet(sortedSet, (type).types); } else { - var i = 0; - var id = type.id; + let i = 0; + let id = type.id; while (i < sortedSet.length && sortedSet[i].id < id) { i++; } @@ -3289,7 +3289,7 @@ module ts { } function removeSubtypes(types: Type[]) { - var i = types.length; + let i = types.length; while (i > 0) { i--; if (isSubtypeOfAny(types[i], types)) { @@ -3308,7 +3308,7 @@ module ts { } function removeAllButLast(types: Type[], typeToRemove: Type) { - var i = types.length; + let i = types.length; while (i > 0 && types.length > 1) { i--; if (types[i] === typeToRemove) { @@ -3321,7 +3321,7 @@ module ts { if (types.length === 0) { return emptyObjectType; } - var sortedTypes: Type[] = []; + let sortedTypes: Type[] = []; addTypesToSortedSet(sortedTypes, types); if (noSubtypeReduction) { if (containsAnyType(sortedTypes)) { @@ -3336,8 +3336,8 @@ module ts { if (sortedTypes.length === 1) { return sortedTypes[0]; } - var id = getTypeListId(sortedTypes); - var type = unionTypes[id]; + let id = getTypeListId(sortedTypes); + let type = unionTypes[id]; if (!type) { type = unionTypes[id] = createObjectType(TypeFlags.Union | getWideningFlagsOfTypes(sortedTypes)); type.types = sortedTypes; @@ -3346,7 +3346,7 @@ module ts { } function getTypeFromUnionTypeNode(node: UnionTypeNode): Type { - var links = getNodeLinks(node); + let links = getNodeLinks(node); if (!links.resolvedType) { links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNode), /*noSubtypeReduction*/ true); } @@ -3354,7 +3354,7 @@ module ts { } function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node: Node): Type { - var links = getNodeLinks(node); + let links = getNodeLinks(node); if (!links.resolvedType) { // Deferred resolution of members is handled by resolveObjectTypeMembers links.resolvedType = createObjectType(TypeFlags.Anonymous, node.symbol); @@ -3367,13 +3367,13 @@ module ts { return stringLiteralTypes[node.text]; } - var type = stringLiteralTypes[node.text] = createType(TypeFlags.StringLiteral); + let type = stringLiteralTypes[node.text] = createType(TypeFlags.StringLiteral); type.text = getTextOfNode(node); return type; } function getTypeFromStringLiteral(node: LiteralExpression): Type { - var links = getNodeLinks(node); + let links = getNodeLinks(node); if (!links.resolvedType) { links.resolvedType = getStringLiteralType(node); } @@ -3416,7 +3416,7 @@ module ts { // Callers should first ensure this by calling isTypeNode case SyntaxKind.Identifier: case SyntaxKind.QualifiedName: - var symbol = getSymbolInfo(node); + let symbol = getSymbolInfo(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: return unknownType; @@ -3425,7 +3425,7 @@ module ts { function instantiateList(items: T[], mapper: TypeMapper, instantiator: (item: T, mapper: TypeMapper) => T): T[] { if (items && items.length) { - var result: T[] = []; + let result: T[] = []; for (let v of items) { result.push(instantiator(v, mapper)); } @@ -3448,7 +3448,7 @@ module ts { case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); } return t => { - for (var i = 0; i < sources.length; i++) { + for (let i = 0; i < sources.length; i++) { if (t === sources[i]) { return targets[i]; } @@ -3482,7 +3482,7 @@ module ts { function createInferenceMapper(context: InferenceContext): TypeMapper { return t => { - for (var i = 0; i < context.typeParameters.length; i++) { + for (let i = 0; i < context.typeParameters.length; i++) { if (t === context.typeParameters[i]) { return getInferredType(context, i); } @@ -3500,7 +3500,7 @@ module ts { } function instantiateTypeParameter(typeParameter: TypeParameter, mapper: TypeMapper): TypeParameter { - var result = createType(TypeFlags.TypeParameter); + let result = createType(TypeFlags.TypeParameter); result.symbol = typeParameter.symbol; if (typeParameter.constraint) { result.constraint = instantiateType(typeParameter.constraint, mapper); @@ -3517,7 +3517,7 @@ module ts { var freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); } - var result = createSignature(signature.declaration, freshTypeParameters, + let result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), signature.resolvedReturnType ? instantiateType(signature.resolvedReturnType, mapper) : undefined, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); @@ -3528,7 +3528,7 @@ module ts { function instantiateSymbol(symbol: Symbol, mapper: TypeMapper): Symbol { if (symbol.flags & SymbolFlags.Instantiated) { - var links = getSymbolLinks(symbol); + let links = getSymbolLinks(symbol); // If symbol being instantiated is itself a instantiation, fetch the original target and combine the // type mappers. This ensures that original type identities are properly preserved and that aliases // always reference a non-aliases. @@ -3538,7 +3538,7 @@ module ts { // Keep the flags from the symbol we're instantiating. Mark that is instantiated, and // also transient so that we can just store data on it directly. - var result = createSymbol(SymbolFlags.Instantiated | SymbolFlags.Transient | symbol.flags, symbol.name); + let result = createSymbol(SymbolFlags.Instantiated | SymbolFlags.Transient | symbol.flags, symbol.name); result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -3551,13 +3551,13 @@ module ts { } function instantiateAnonymousType(type: ObjectType, mapper: TypeMapper): ObjectType { - var result = createObjectType(TypeFlags.Anonymous, type.symbol); + let result = createObjectType(TypeFlags.Anonymous, type.symbol); result.properties = instantiateList(getPropertiesOfObjectType(type), mapper, instantiateSymbol); result.members = createSymbolTable(result.properties); result.callSignatures = instantiateList(getSignaturesOfType(type, SignatureKind.Call), mapper, instantiateSignature); result.constructSignatures = instantiateList(getSignaturesOfType(type, SignatureKind.Construct), mapper, instantiateSignature); - var stringIndexType = getIndexTypeOfType(type, IndexKind.String); - var numberIndexType = getIndexTypeOfType(type, IndexKind.Number); + let stringIndexType = getIndexTypeOfType(type, IndexKind.String); + let numberIndexType = getIndexTypeOfType(type, IndexKind.Number); if (stringIndexType) result.stringIndexType = instantiateType(stringIndexType, mapper); if (numberIndexType) result.numberIndexType = instantiateType(numberIndexType, mapper); return result; @@ -3621,9 +3621,9 @@ module ts { function getTypeWithoutConstructors(type: Type): Type { if (type.flags & TypeFlags.ObjectType) { - var resolved = resolveObjectOrUnionTypeMembers(type); + let resolved = resolveObjectOrUnionTypeMembers(type); if (resolved.constructSignatures.length) { - var result = createObjectType(TypeFlags.Anonymous, type.symbol); + let result = createObjectType(TypeFlags.Anonymous, type.symbol); result.members = resolved.members; result.properties = resolved.properties; result.callSignatures = resolved.callSignatures; @@ -3636,9 +3636,9 @@ module ts { // TYPE CHECKING - var subtypeRelation: Map = {}; - var assignableRelation: Map = {}; - var identityRelation: Map = {}; + let subtypeRelation: Map = {}; + let assignableRelation: Map = {}; + let identityRelation: Map = {}; function isTypeIdenticalTo(source: Type, target: Type): boolean { return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined); @@ -3665,8 +3665,8 @@ module ts { } function isSignatureAssignableTo(source: Signature, target: Signature): boolean { - var sourceType = getOrCreateTypeFromSignature(source); - var targetType = getOrCreateTypeFromSignature(target); + let sourceType = getOrCreateTypeFromSignature(source); + let targetType = getOrCreateTypeFromSignature(target); return checkTypeRelatedTo(sourceType, targetType, assignableRelation, /*errorNode*/ undefined); } @@ -3678,17 +3678,17 @@ module ts { headMessage?: DiagnosticMessage, containingMessageChain?: DiagnosticMessageChain): boolean { - var errorInfo: DiagnosticMessageChain; - var sourceStack: ObjectType[]; - var targetStack: ObjectType[]; - var maybeStack: Map[]; - var expandingFlags: number; - var depth = 0; - var overflow = false; + let errorInfo: DiagnosticMessageChain; + let sourceStack: ObjectType[]; + let targetStack: ObjectType[]; + let maybeStack: Map[]; + let expandingFlags: number; + let depth = 0; + let overflow = false; Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); - var result = isRelatedTo(source, target, errorNode !== undefined, headMessage); + let result = isRelatedTo(source, target, errorNode !== undefined, headMessage); if (overflow) { error(errorNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); } @@ -3718,7 +3718,7 @@ module ts { // Ternary.Maybe if they are related with assumptions of other relationships, or // Ternary.False if they are not related. function isRelatedTo(source: Type, target: Type, reportErrors?: boolean, headMessage?: DiagnosticMessage, elaborateErrors = false): Ternary { - var result: Ternary; + let result: Ternary; // both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases if (source === target) return Ternary.True; if (relation !== identityRelation) { @@ -3771,7 +3771,7 @@ module ts { } } else { - var saveErrorInfo = errorInfo; + let saveErrorInfo = errorInfo; if (source.flags & TypeFlags.Reference && target.flags & TypeFlags.Reference && (source).target === (target).target) { // We have type references to same target type, see if relationship holds for all type arguments if (result = typesRelatedTo((source).typeArguments, (target).typeArguments, reportErrors)) { @@ -3780,9 +3780,9 @@ module ts { } // Even if relationship doesn't hold for type arguments, it may hold in a structural comparison // Report structural errors only if we haven't reported any errors yet - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; + let reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; // identity relation does not use apparent type - var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); + let sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); if (sourceOrApparentType.flags & TypeFlags.ObjectType && target.flags & TypeFlags.ObjectType && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; @@ -3791,8 +3791,8 @@ module ts { } if (reportErrors) { headMessage = headMessage || Diagnostics.Type_0_is_not_assignable_to_type_1; - var sourceType = typeToString(source); - var targetType = typeToString(target); + let sourceType = typeToString(source); + let targetType = typeToString(target); if (sourceType === targetType) { sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); targetType = typeToString(target, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); @@ -3803,10 +3803,10 @@ module ts { } function unionTypeRelatedToUnionType(source: UnionType, target: UnionType): Ternary { - var result = Ternary.True; - var sourceTypes = source.types; + let result = Ternary.True; + let sourceTypes = source.types; for (let sourceType of sourceTypes) { - var related = typeRelatedToUnionType(sourceType, target, false); + let related = typeRelatedToUnionType(sourceType, target, false); if (!related) { return Ternary.False; } @@ -3816,9 +3816,9 @@ module ts { } function typeRelatedToUnionType(source: Type, target: UnionType, reportErrors: boolean): Ternary { - var targetTypes = target.types; - for (var i = 0, len = targetTypes.length; i < len; i++) { - var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); + let targetTypes = target.types; + for (let i = 0, len = targetTypes.length; i < len; i++) { + let related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); if (related) { return related; } @@ -3827,10 +3827,10 @@ module ts { } function unionTypeRelatedToType(source: UnionType, target: Type, reportErrors: boolean): Ternary { - var result = Ternary.True; - var sourceTypes = source.types; + let result = Ternary.True; + let sourceTypes = source.types; for (let sourceType of sourceTypes) { - var related = isRelatedTo(sourceType, target, reportErrors); + let related = isRelatedTo(sourceType, target, reportErrors); if (!related) { return Ternary.False; } @@ -3840,9 +3840,9 @@ module ts { } function typesRelatedTo(sources: Type[], targets: Type[], reportErrors: boolean): Ternary { - var result = Ternary.True; - for (var i = 0, len = sources.length; i < len; i++) { - var related = isRelatedTo(sources[i], targets[i], reportErrors); + let result = Ternary.True; + for (let i = 0, len = sources.length; i < len; i++) { + let related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return Ternary.False; } @@ -3867,7 +3867,7 @@ module ts { } else { while (true) { - var constraint = getConstraintOfTypeParameter(source); + let constraint = getConstraintOfTypeParameter(source); if (constraint === target) return Ternary.True; if (!(constraint && constraint.flags & TypeFlags.TypeParameter)) break; source = constraint; @@ -3885,9 +3885,9 @@ module ts { if (overflow) { return Ternary.False; } - var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation[id]; - //var related: RelationComparisonResult = undefined; // relation[id]; + let id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; + let related = relation[id]; + //let related: RelationComparisonResult = undefined; // relation[id]; if (related !== undefined) { // If we computed this relation already and it was failed and reported, or if we're not being asked to elaborate // errors, we can use the cached value. Otherwise, recompute the relation @@ -3896,7 +3896,7 @@ module ts { } } if (depth > 0) { - for (var i = 0; i < depth; i++) { + for (let i = 0; i < depth; i++) { // If source and target are already being compared, consider them related with assumptions if (maybeStack[i][id]) { return Ternary.Maybe; @@ -3918,14 +3918,15 @@ module ts { maybeStack[depth] = {}; maybeStack[depth][id] = RelationComparisonResult.Succeeded; depth++; - var saveExpandingFlags = expandingFlags; + let saveExpandingFlags = expandingFlags; if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack)) expandingFlags |= 1; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) expandingFlags |= 2; + let result: Ternary; if (expandingFlags === 3) { - var result = Ternary.Maybe; + result = Ternary.Maybe; } else { - var result = propertiesRelatedTo(source, target, reportErrors); + result = propertiesRelatedTo(source, target, reportErrors); if (result) { result &= signaturesRelatedTo(source, target, SignatureKind.Call, reportErrors); if (result) { @@ -3942,9 +3943,9 @@ module ts { expandingFlags = saveExpandingFlags; depth--; if (result) { - var maybeCache = maybeStack[depth]; + let maybeCache = maybeStack[depth]; // If result is definitely true, copy assumptions to global cache, else copy to next level up - var destinationCache = (result === Ternary.True || depth === 0) ? relation : maybeStack[depth - 1]; + let destinationCache = (result === Ternary.True || depth === 0) ? relation : maybeStack[depth - 1]; copyMap(maybeCache, destinationCache); } else { @@ -3962,10 +3963,10 @@ module ts { // some level beyond that. function isDeeplyNestedGeneric(type: ObjectType, stack: ObjectType[]): boolean { if (type.flags & TypeFlags.Reference && depth >= 10) { - var target = (type).target; - var count = 0; - for (var i = 0; i < depth; i++) { - var t = stack[i]; + let target = (type).target; + let count = 0; + for (let i = 0; i < depth; i++) { + let t = stack[i]; if (t.flags & TypeFlags.Reference && (t).target === target) { count++; if (count >= 10) return true; @@ -3979,11 +3980,11 @@ module ts { if (relation === identityRelation) { return propertiesIdenticalTo(source, target); } - var result = Ternary.True; - var properties = getPropertiesOfObjectType(target); - var requireOptionalProperties = relation === subtypeRelation && !(source.flags & TypeFlags.ObjectLiteral); + let result = Ternary.True; + let properties = getPropertiesOfObjectType(target); + let requireOptionalProperties = relation === subtypeRelation && !(source.flags & TypeFlags.ObjectLiteral); for (let targetProp of properties) { - var sourceProp = getPropertyOfType(source, targetProp.name); + let sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { if (!(targetProp.flags & SymbolFlags.Optional) || requireOptionalProperties) { @@ -3994,8 +3995,8 @@ module ts { } } else if (!(targetProp.flags & SymbolFlags.Prototype)) { - var sourceFlags = getDeclarationFlagsFromSymbol(sourceProp); - var targetFlags = getDeclarationFlagsFromSymbol(targetProp); + let sourceFlags = getDeclarationFlagsFromSymbol(sourceProp); + let targetFlags = getDeclarationFlagsFromSymbol(targetProp); if (sourceFlags & NodeFlags.Private || targetFlags & NodeFlags.Private) { if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { @@ -4012,9 +4013,9 @@ module ts { } } else if (targetFlags & NodeFlags.Protected) { - var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & SymbolFlags.Class; - var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; - var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); + let sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & SymbolFlags.Class; + let sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; + let targetClass = getDeclaredTypeOfSymbol(targetProp.parent); if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { if (reportErrors) { reportError(Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, @@ -4030,7 +4031,7 @@ module ts { } return Ternary.False; } - var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); + let related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); if (!related) { if (reportErrors) { reportError(Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); @@ -4059,18 +4060,18 @@ module ts { } function propertiesIdenticalTo(source: ObjectType, target: ObjectType): Ternary { - var sourceProperties = getPropertiesOfObjectType(source); - var targetProperties = getPropertiesOfObjectType(target); + let sourceProperties = getPropertiesOfObjectType(source); + let targetProperties = getPropertiesOfObjectType(target); if (sourceProperties.length !== targetProperties.length) { return Ternary.False; } - var result = Ternary.True; + let result = Ternary.True; for (let sourceProp of sourceProperties) { - var targetProp = getPropertyOfObjectType(target, sourceProp.name); + let targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { return Ternary.False; } - var related = compareProperties(sourceProp, targetProp, isRelatedTo); + let related = compareProperties(sourceProp, targetProp, isRelatedTo); if (!related) { return Ternary.False; } @@ -4086,16 +4087,16 @@ module ts { if (target === anyFunctionType || source === anyFunctionType) { return Ternary.True; } - var sourceSignatures = getSignaturesOfType(source, kind); - var targetSignatures = getSignaturesOfType(target, kind); - var result = Ternary.True; - var saveErrorInfo = errorInfo; + let sourceSignatures = getSignaturesOfType(source, kind); + let targetSignatures = getSignaturesOfType(target, kind); + let result = Ternary.True; + let saveErrorInfo = errorInfo; outer: for (let t of targetSignatures) { if (!t.hasStringLiterals || target.flags & TypeFlags.FromSignature) { - var localErrors = reportErrors; + let localErrors = reportErrors; for (let s of sourceSignatures) { if (!s.hasStringLiterals || source.flags & TypeFlags.FromSignature) { - var related = signatureRelatedTo(s, t, localErrors); + let related = signatureRelatedTo(s, t, localErrors); if (related) { result &= related; errorInfo = saveErrorInfo; @@ -4118,9 +4119,9 @@ module ts { if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { return Ternary.False; } - var sourceMax = source.parameters.length; - var targetMax = target.parameters.length; - var checkCount: number; + let sourceMax = source.parameters.length; + let targetMax = target.parameters.length; + let checkCount: number; if (source.hasRestParameter && target.hasRestParameter) { checkCount = sourceMax > targetMax ? sourceMax : targetMax; sourceMax--; @@ -4141,12 +4142,12 @@ module ts { // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N source = getErasedSignature(source); target = getErasedSignature(target); - var result = Ternary.True; - for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - var saveErrorInfo = errorInfo; - var related = isRelatedTo(s, t, reportErrors); + let result = Ternary.True; + for (let i = 0; i < checkCount; i++) { + let s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + let t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + let saveErrorInfo = errorInfo; + let related = isRelatedTo(s, t, reportErrors); if (!related) { related = isRelatedTo(t, s, false); if (!related) { @@ -4161,21 +4162,21 @@ module ts { } result &= related; } - var t = getReturnTypeOfSignature(target); + let t = getReturnTypeOfSignature(target); if (t === voidType) return result; - var s = getReturnTypeOfSignature(source); + let s = getReturnTypeOfSignature(source); return result & isRelatedTo(s, t, reportErrors); } function signaturesIdenticalTo(source: ObjectType, target: ObjectType, kind: SignatureKind): Ternary { - var sourceSignatures = getSignaturesOfType(source, kind); - var targetSignatures = getSignaturesOfType(target, kind); + let sourceSignatures = getSignaturesOfType(source, kind); + let targetSignatures = getSignaturesOfType(target, kind); if (sourceSignatures.length !== targetSignatures.length) { return Ternary.False; } - var result = Ternary.True; - for (var i = 0, len = sourceSignatures.length; i < len; ++i) { - var related = compareSignatures(sourceSignatures[i], targetSignatures[i], /*compareReturnTypes*/ true, isRelatedTo); + let result = Ternary.True; + for (let i = 0, len = sourceSignatures.length; i < len; ++i) { + let related = compareSignatures(sourceSignatures[i], targetSignatures[i], /*compareReturnTypes*/ true, isRelatedTo); if (!related) { return Ternary.False; } @@ -4188,16 +4189,16 @@ module ts { if (relation === identityRelation) { return indexTypesIdenticalTo(IndexKind.String, source, target); } - var targetType = getIndexTypeOfType(target, IndexKind.String); + let targetType = getIndexTypeOfType(target, IndexKind.String); if (targetType) { - var sourceType = getIndexTypeOfType(source, IndexKind.String); + let sourceType = getIndexTypeOfType(source, IndexKind.String); if (!sourceType) { if (reportErrors) { reportError(Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); } return Ternary.False; } - var related = isRelatedTo(sourceType, targetType, reportErrors); + let related = isRelatedTo(sourceType, targetType, reportErrors); if (!related) { if (reportErrors) { reportError(Diagnostics.Index_signatures_are_incompatible); @@ -4213,10 +4214,10 @@ module ts { if (relation === identityRelation) { return indexTypesIdenticalTo(IndexKind.Number, source, target); } - var targetType = getIndexTypeOfType(target, IndexKind.Number); + let targetType = getIndexTypeOfType(target, IndexKind.Number); if (targetType) { - var sourceStringType = getIndexTypeOfType(source, IndexKind.String); - var sourceNumberType = getIndexTypeOfType(source, IndexKind.Number); + let sourceStringType = getIndexTypeOfType(source, IndexKind.String); + let sourceNumberType = getIndexTypeOfType(source, IndexKind.Number); if (!(sourceStringType || sourceNumberType)) { if (reportErrors) { reportError(Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); @@ -4242,8 +4243,8 @@ module ts { } function indexTypesIdenticalTo(indexKind: IndexKind, source: ObjectType, target: ObjectType): Ternary { - var targetType = getIndexTypeOfType(target, indexKind); - var sourceType = getIndexTypeOfType(source, indexKind); + let targetType = getIndexTypeOfType(target, indexKind); + let sourceType = getIndexTypeOfType(source, indexKind); if (!sourceType && !targetType) { return Ternary.True; } @@ -4265,8 +4266,8 @@ module ts { if (sourceProp === targetProp) { return Ternary.True; } - var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (NodeFlags.Private | NodeFlags.Protected); - var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (NodeFlags.Private | NodeFlags.Protected); + let sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (NodeFlags.Private | NodeFlags.Protected); + let targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (NodeFlags.Private | NodeFlags.Protected); if (sourcePropAccessibility !== targetPropAccessibility) { return Ternary.False; } @@ -4292,13 +4293,13 @@ module ts { source.hasRestParameter !== target.hasRestParameter) { return Ternary.False; } - var result = Ternary.True; + let result = Ternary.True; if (source.typeParameters && target.typeParameters) { if (source.typeParameters.length !== target.typeParameters.length) { return Ternary.False; } - for (var i = 0, len = source.typeParameters.length; i < len; ++i) { - var related = compareTypes(source.typeParameters[i], target.typeParameters[i]); + for (let i = 0, len = source.typeParameters.length; i < len; ++i) { + let related = compareTypes(source.typeParameters[i], target.typeParameters[i]); if (!related) { return Ternary.False; } @@ -4312,10 +4313,10 @@ module ts { // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N source = getErasedSignature(source); target = getErasedSignature(target); - for (var i = 0, len = source.parameters.length; i < len; i++) { - var s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); - var related = compareTypes(s, t); + for (let i = 0, len = source.parameters.length; i < len; i++) { + let s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); + let t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + let related = compareTypes(s, t); if (!related) { return Ternary.False; } @@ -4339,14 +4340,14 @@ module ts { } function reportNoCommonSupertypeError(types: Type[], errorLocation: Node, errorMessageChainHead: DiagnosticMessageChain): void { - var bestSupertype: Type; - var bestSupertypeDownfallType: Type; // The type that caused bestSupertype not to be the common supertype - var bestSupertypeScore = 0; + let bestSupertype: Type; + let bestSupertypeDownfallType: Type; // The type that caused bestSupertype not to be the common supertype + let bestSupertypeScore = 0; - for (var i = 0; i < types.length; i++) { - var score = 0; - var downfallType: Type = undefined; - for (var j = 0; j < types.length; j++) { + for (let i = 0; i < types.length; i++) { + let score = 0; + let downfallType: Type = undefined; + for (let j = 0; j < types.length; j++) { if (isTypeSubtypeOf(types[j], types[i])) { score++; } @@ -4396,13 +4397,13 @@ module ts { } function getWidenedTypeOfObjectLiteral(type: Type): Type { - var properties = getPropertiesOfObjectType(type); - var members: SymbolTable = {}; + let properties = getPropertiesOfObjectType(type); + let members: SymbolTable = {}; forEach(properties, p => { - var propType = getTypeOfSymbol(p); - var widenedType = getWidenedType(propType); + let propType = getTypeOfSymbol(p); + let widenedType = getWidenedType(propType); if (propType !== widenedType) { - var symbol = createSymbol(p.flags | SymbolFlags.Transient, p.name); + let symbol = createSymbol(p.flags | SymbolFlags.Transient, p.name); symbol.declarations = p.declarations; symbol.parent = p.parent; symbol.type = widenedType; @@ -4412,8 +4413,8 @@ module ts { } members[p.name] = p; }); - var stringIndexType = getIndexTypeOfType(type, IndexKind.String); - var numberIndexType = getIndexTypeOfType(type, IndexKind.Number); + let stringIndexType = getIndexTypeOfType(type, IndexKind.String); + let numberIndexType = getIndexTypeOfType(type, IndexKind.Number); if (stringIndexType) stringIndexType = getWidenedType(stringIndexType); if (numberIndexType) numberIndexType = getWidenedType(numberIndexType); return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); @@ -4439,7 +4440,7 @@ module ts { function reportWideningErrorsInType(type: Type): boolean { if (type.flags & TypeFlags.Union) { - var errorReported = false; + let errorReported = false; forEach((type).types, t => { if (reportWideningErrorsInType(t)) { errorReported = true; @@ -4451,9 +4452,9 @@ module ts { return reportWideningErrorsInType((type).typeArguments[0]); } if (type.flags & TypeFlags.ObjectLiteral) { - var errorReported = false; + let errorReported = false; forEach(getPropertiesOfObjectType(type), p => { - var t = getTypeOfSymbol(p); + let t = getTypeOfSymbol(p); if (t.flags & TypeFlags.ContainsUndefinedOrNull) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); @@ -4467,7 +4468,7 @@ module ts { } function reportImplicitAnyError(declaration: Declaration, type: Type) { - var typeAsString = typeToString(getWidenedType(type)); + let typeAsString = typeToString(getWidenedType(type)); switch (declaration.kind) { case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: @@ -4507,9 +4508,9 @@ module ts { } function forEachMatchingParameterType(source: Signature, target: Signature, callback: (s: Type, t: Type) => void) { - var sourceMax = source.parameters.length; - var targetMax = target.parameters.length; - var count: number; + let sourceMax = source.parameters.length; + let targetMax = target.parameters.length; + let count: number; if (source.hasRestParameter && target.hasRestParameter) { count = sourceMax > targetMax ? sourceMax : targetMax; sourceMax--; @@ -4526,15 +4527,15 @@ module ts { else { count = sourceMax < targetMax ? sourceMax : targetMax; } - for (var i = 0; i < count; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + for (let i = 0; i < count; i++) { + let s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + let t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); callback(s, t); } } function createInferenceContext(typeParameters: TypeParameter[], inferUnionTypes: boolean): InferenceContext { - var inferences: TypeInferences[] = []; + let inferences: TypeInferences[] = []; for (let unused of typeParameters) { inferences.push({ primary: undefined, secondary: undefined }); } @@ -4548,14 +4549,14 @@ module ts { } function inferTypes(context: InferenceContext, source: Type, target: Type) { - var sourceStack: Type[]; - var targetStack: Type[]; - var depth = 0; - var inferiority = 0; + let sourceStack: Type[]; + let targetStack: Type[]; + let depth = 0; + let inferiority = 0; inferFromTypes(source, target); function isInProcess(source: Type, target: Type) { - for (var i = 0; i < depth; i++) { + for (let i = 0; i < depth; i++) { if (source === sourceStack[i] && target === targetStack[i]) { return true; } @@ -4565,10 +4566,10 @@ module ts { function isWithinDepthLimit(type: Type, stack: Type[]) { if (depth >= 5) { - var target = (type).target; - var count = 0; - for (var i = 0; i < depth; i++) { - var t = stack[i]; + let target = (type).target; + let count = 0; + for (let i = 0; i < depth; i++) { + let t = stack[i]; if (t.flags & TypeFlags.Reference && (t).target === target) { count++; } @@ -4584,11 +4585,11 @@ module ts { } if (target.flags & TypeFlags.TypeParameter) { // If target is a type parameter, make an inference - var typeParameters = context.typeParameters; - for (var i = 0; i < typeParameters.length; i++) { + let typeParameters = context.typeParameters; + for (let i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { - var inferences = context.inferences[i]; - var candidates = inferiority ? + let inferences = context.inferences[i]; + let candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); if (!contains(candidates, source)) candidates.push(source); @@ -4598,16 +4599,16 @@ module ts { } else if (source.flags & TypeFlags.Reference && target.flags & TypeFlags.Reference && (source).target === (target).target) { // If source and target are references to the same generic type, infer from type arguments - var sourceTypes = (source).typeArguments; - var targetTypes = (target).typeArguments; - for (var i = 0; i < sourceTypes.length; i++) { + let sourceTypes = (source).typeArguments; + let targetTypes = (target).typeArguments; + for (let i = 0; i < sourceTypes.length; i++) { inferFromTypes(sourceTypes[i], targetTypes[i]); } } else if (target.flags & TypeFlags.Union) { - var targetTypes = (target).types; - var typeParameterCount = 0; - var typeParameter: TypeParameter; + let targetTypes = (target).types; + let typeParameterCount = 0; + let typeParameter: TypeParameter; // First infer to each type in union that isn't a type parameter for (let t of targetTypes) { if (t.flags & TypeFlags.TypeParameter && contains(context.typeParameters, t)) { @@ -4627,7 +4628,7 @@ module ts { } else if (source.flags & TypeFlags.Union) { // Source is a union type, infer from each consituent type - var sourceTypes = (source).types; + let sourceTypes = (source).types; for (let sourceType of sourceTypes) { inferFromTypes(sourceType, target); } @@ -4655,9 +4656,9 @@ module ts { } function inferFromProperties(source: Type, target: Type) { - var properties = getPropertiesOfObjectType(target); + let properties = getPropertiesOfObjectType(target); for (let targetProp of properties) { - var sourceProp = getPropertyOfObjectType(source, targetProp.name); + let sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } @@ -4665,12 +4666,12 @@ module ts { } function inferFromSignatures(source: Type, target: Type, kind: SignatureKind) { - var sourceSignatures = getSignaturesOfType(source, kind); - var targetSignatures = getSignaturesOfType(target, kind); - var sourceLen = sourceSignatures.length; - var targetLen = targetSignatures.length; - var len = sourceLen < targetLen ? sourceLen : targetLen; - for (var i = 0; i < len; i++) { + let sourceSignatures = getSignaturesOfType(source, kind); + let targetSignatures = getSignaturesOfType(target, kind); + let sourceLen = sourceSignatures.length; + let targetLen = targetSignatures.length; + let len = sourceLen < targetLen ? sourceLen : targetLen; + for (let i = 0; i < len; i++) { inferFromSignature(getErasedSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i])); } } @@ -4681,9 +4682,9 @@ module ts { } function inferFromIndexTypes(source: Type, target: Type, sourceKind: IndexKind, targetKind: IndexKind) { - var targetIndexType = getIndexTypeOfType(target, targetKind); + let targetIndexType = getIndexTypeOfType(target, targetKind); if (targetIndexType) { - var sourceIndexType = getIndexTypeOfType(source, sourceKind); + let sourceIndexType = getIndexTypeOfType(source, sourceKind); if (sourceIndexType) { inferFromTypes(sourceIndexType, targetIndexType); } @@ -4692,17 +4693,17 @@ module ts { } function getInferenceCandidates(context: InferenceContext, index: number): Type[] { - var inferences = context.inferences[index]; + let inferences = context.inferences[index]; return inferences.primary || inferences.secondary || emptyArray; } function getInferredType(context: InferenceContext, index: number): Type { - var inferredType = context.inferredTypes[index]; + let inferredType = context.inferredTypes[index]; if (!inferredType) { - var inferences = getInferenceCandidates(context, index); + let inferences = getInferenceCandidates(context, index); if (inferences.length) { // Infer widened union or supertype, or the undefined type for no common supertype - var unionOrSuperType = context.inferUnionTypes ? getUnionType(inferences) : getCommonSupertype(inferences); + let unionOrSuperType = context.inferUnionTypes ? getUnionType(inferences) : getCommonSupertype(inferences); inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : inferenceFailureType; } else { @@ -4710,7 +4711,7 @@ module ts { inferredType = emptyObjectType; } if (inferredType !== inferenceFailureType) { - var constraint = getConstraintOfTypeParameter(context.typeParameters[index]); + let constraint = getConstraintOfTypeParameter(context.typeParameters[index]); inferredType = constraint && !isTypeAssignableTo(inferredType, constraint) ? constraint : inferredType; } context.inferredTypes[index] = inferredType; @@ -4719,7 +4720,7 @@ module ts { } function getInferredTypes(context: InferenceContext): Type[] { - for (var i = 0; i < context.inferredTypes.length; i++) { + for (let i = 0; i < context.inferredTypes.length; i++) { getInferredType(context, i); } @@ -4733,7 +4734,7 @@ module ts { // EXPRESSION TYPE CHECKING function getResolvedSymbol(node: Identifier): Symbol { - var links = getNodeLinks(node); + let links = getNodeLinks(node); if (!links.resolvedSymbol) { links.resolvedSymbol = (getFullWidth(node) > 0 && resolveName(node, node.text, SymbolFlags.Value | SymbolFlags.ExportValue, Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; } @@ -4763,10 +4764,10 @@ module ts { // or not of the given type kind (when isOfTypeKind is false) function removeTypesFromUnionType(type: Type, typeKind: TypeFlags, isOfTypeKind: boolean, allowEmptyUnionResult: boolean): Type { if (type.flags & TypeFlags.Union) { - var types = (type).types; + let types = (type).types; if (forEach(types, t => !!(t.flags & typeKind) === isOfTypeKind)) { // Above we checked if we have anything to remove, now use the opposite test to do the removal - var narrowedType = getUnionType(filter(types, t => !(t.flags & typeKind) === isOfTypeKind)); + let narrowedType = getUnionType(filter(types, t => !(t.flags & typeKind) === isOfTypeKind)); if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { return narrowedType; } @@ -4786,9 +4787,9 @@ module ts { // Check if a given variable is assigned within a given syntax node function isVariableAssignedWithin(symbol: Symbol, node: Node): boolean { - var links = getNodeLinks(node); + let links = getNodeLinks(node); if (links.assignmentChecks) { - var cachedResult = links.assignmentChecks[symbol.id]; + let cachedResult = links.assignmentChecks[symbol.id]; if (cachedResult !== undefined) { return cachedResult; } @@ -4800,7 +4801,7 @@ module ts { function isAssignedInBinaryExpression(node: BinaryExpression) { if (node.operatorToken.kind >= SyntaxKind.FirstAssignment && node.operatorToken.kind <= SyntaxKind.LastAssignment) { - var n = node.left; + let n = node.left; while (n.kind === SyntaxKind.ParenthesizedExpression) { n = (n).expression; } @@ -4869,8 +4870,8 @@ module ts { function resolveLocation(node: Node) { // Resolve location from top down towards node if it is a context sensitive expression // That helps in making sure not assigning types as any when resolved out of order - var containerNodes: Node[] = []; - for (var parent = node.parent; parent; parent = parent.parent) { + let containerNodes: Node[] = []; + for (let parent = node.parent; parent; parent = parent.parent) { if ((isExpression(parent) || isObjectLiteralMethod(node)) && isContextSensitive(parent)) { containerNodes.unshift(parent); @@ -4909,13 +4910,13 @@ module ts { // Get the narrowed type of a given symbol at a given location function getNarrowedTypeOfSymbol(symbol: Symbol, node: Node) { - var type = getTypeOfSymbol(symbol); + let type = getTypeOfSymbol(symbol); // Only narrow when symbol is variable of type any or an object, union, or type parameter type if (node && symbol.flags & SymbolFlags.Variable && type.flags & (TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.Union | TypeFlags.TypeParameter)) { loop: while (node.parent) { - var child = node; + let child = node; node = node.parent; - var narrowedType = type; + let narrowedType = type; switch (node.kind) { case SyntaxKind.IfStatement: // In a branch of an if statement, narrow based on controlling expression @@ -4967,12 +4968,12 @@ module ts { if (expr.left.kind !== SyntaxKind.TypeOfExpression || expr.right.kind !== SyntaxKind.StringLiteral) { return type; } - var left = expr.left; - var right = expr.right; + let left = expr.left; + let right = expr.right; if (left.expression.kind !== SyntaxKind.Identifier || getResolvedSymbol(left.expression) !== symbol) { return type; } - var typeInfo = primitiveTypeInfo[right.text]; + let typeInfo = primitiveTypeInfo[right.text]; if (expr.operatorToken.kind === SyntaxKind.ExclamationEqualsEqualsToken) { assumeTrue = !assumeTrue; } @@ -5036,16 +5037,16 @@ module ts { return type; } // Check that right operand is a function type with a prototype property - var rightType = checkExpression(expr.right); + let rightType = checkExpression(expr.right); if (!isTypeSubtypeOf(rightType, globalFunctionType)) { return type; } // Target type is type of prototype property - var prototypeProperty = getPropertyOfType(rightType, "prototype"); + let prototypeProperty = getPropertyOfType(rightType, "prototype"); if (!prototypeProperty) { return type; } - var targetType = getTypeOfSymbol(prototypeProperty); + let targetType = getTypeOfSymbol(prototypeProperty); // Narrow to target type if it is a subtype of current type if (isTypeSubtypeOf(targetType, type)) { return targetType; @@ -5064,7 +5065,7 @@ module ts { case SyntaxKind.ParenthesizedExpression: return narrowType(type, (expr).expression, assumeTrue); case SyntaxKind.BinaryExpression: - var operator = (expr).operatorToken.kind; + let operator = (expr).operatorToken.kind; if (operator === SyntaxKind.EqualsEqualsEqualsToken || operator === SyntaxKind.ExclamationEqualsEqualsToken) { return narrowTypeByEquality(type, expr, assumeTrue); } @@ -5089,7 +5090,7 @@ module ts { } function checkIdentifier(node: Identifier): Type { - var symbol = getResolvedSymbol(node); + let symbol = getResolvedSymbol(node); // As noted in ECMAScript 6 language spec, arrow functions never have an arguments objects. // Although in down-level emit of arrow function, we emit it using function expression which means that @@ -5113,7 +5114,7 @@ module ts { } function isInsideFunction(node: Node, threshold: Node): boolean { - var current = node; + let current = node; while (current && current !== threshold) { if (isFunctionLike(current)) { return true; @@ -5137,7 +5138,7 @@ module ts { // nesting structure: // (variable declaration or binding element) -> variable declaration list -> container - var container: Node = symbol.valueDeclaration; + let container: Node = symbol.valueDeclaration; while (container.kind !== SyntaxKind.VariableDeclarationList) { container = container.parent; } @@ -5148,9 +5149,9 @@ module ts { container = container.parent; } - var inFunction = isInsideFunction(node.parent, container); + let inFunction = isInsideFunction(node.parent, container); - var current = container; + let current = container; while (current && !nodeStartsNewLexicalEnvironment(current)) { if (isIterationStatement(current, /*lookInLabeledStatements*/ false)) { if (inFunction) { @@ -5165,7 +5166,7 @@ module ts { } function captureLexicalThis(node: Node, container: Node): void { - var classNode = container.parent && container.parent.kind === SyntaxKind.ClassDeclaration ? container.parent : undefined; + let classNode = container.parent && container.parent.kind === SyntaxKind.ClassDeclaration ? container.parent : undefined; getNodeLinks(node).flags |= NodeCheckFlags.LexicalThis; if (container.kind === SyntaxKind.PropertyDeclaration || container.kind === SyntaxKind.Constructor) { getNodeLinks(classNode).flags |= NodeCheckFlags.CaptureThis; @@ -5178,8 +5179,8 @@ module ts { function checkThisExpression(node: Node): Type { // Stop at the first arrow function so that we can // tell whether 'this' needs to be captured. - var container = getThisContainer(node, /* includeArrowFunctions */ true); - var needToCaptureLexicalThis = false; + let container = getThisContainer(node, /* includeArrowFunctions */ true); + let needToCaptureLexicalThis = false; // Now skip arrow functions to get the "real" owner of 'this'. if (container.kind === SyntaxKind.ArrowFunction) { @@ -5220,16 +5221,16 @@ module ts { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === SyntaxKind.ClassDeclaration ? container.parent : undefined; + let classNode = container.parent && container.parent.kind === SyntaxKind.ClassDeclaration ? container.parent : undefined; if (classNode) { - var symbol = getSymbolOfNode(classNode); + let symbol = getSymbolOfNode(classNode); return container.flags & NodeFlags.Static ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); } return anyType; } function isInConstructorArgumentInitializer(node: Node, constructorDecl: Node): boolean { - for (var n = node; n && n !== constructorDecl; n = n.parent) { + for (let n = node; n && n !== constructorDecl; n = n.parent) { if (n.kind === SyntaxKind.Parameter) { return true; } @@ -5238,11 +5239,11 @@ module ts { } function checkSuperExpression(node: Node): Type { - var isCallExpression = node.parent.kind === SyntaxKind.CallExpression && (node.parent).expression === node; - var enclosingClass = getAncestor(node, SyntaxKind.ClassDeclaration); - var baseClass: Type; + let isCallExpression = node.parent.kind === SyntaxKind.CallExpression && (node.parent).expression === node; + let enclosingClass = getAncestor(node, SyntaxKind.ClassDeclaration); + let baseClass: Type; if (enclosingClass && getClassBaseTypeNode(enclosingClass)) { - var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); + let classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); baseClass = classType.baseTypes.length && classType.baseTypes[0]; } @@ -5251,10 +5252,10 @@ module ts { return unknownType; } - var container = getSuperContainer(node, /*includeFunctions*/ true); + let container = getSuperContainer(node, /*includeFunctions*/ true); if (container) { - var canUseSuperExpression = false; + let canUseSuperExpression = false; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes @@ -5296,7 +5297,7 @@ module ts { } if (canUseSuperExpression) { - var returnType: Type; + let returnType: Type; if ((container.flags & NodeFlags.Static) || isCallExpression) { getNodeLinks(node).flags |= NodeCheckFlags.SuperStatic; @@ -5340,14 +5341,14 @@ module ts { // Return contextual type of parameter or undefined if no contextual type is available function getContextuallyTypedParameterType(parameter: ParameterDeclaration): Type { if (isFunctionExpressionOrArrowFunction(parameter.parent)) { - var func = parameter.parent; + let func = parameter.parent; if (isContextSensitive(func)) { - var contextualSignature = getContextualSignature(func); + let contextualSignature = getContextualSignature(func); if (contextualSignature) { - var funcHasRestParameters = hasRestParameters(func); - var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); - var indexOfParameter = indexOf(func.parameters, parameter); + let funcHasRestParameters = hasRestParameters(func); + let len = func.parameters.length - (funcHasRestParameters ? 1 : 0); + let indexOfParameter = indexOf(func.parameters, parameter); if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } @@ -5369,13 +5370,13 @@ module ts { // of the parameter. Otherwise, in a variable or parameter declaration with a binding pattern name, the contextual // type of an initializer expression is the type implied by the binding pattern. function getContextualTypeForInitializerExpression(node: Expression): Type { - var declaration = node.parent; + let declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { return getTypeFromTypeNode(declaration.type); } if (declaration.kind === SyntaxKind.Parameter) { - var type = getContextuallyTypedParameterType(declaration); + let type = getContextuallyTypedParameterType(declaration); if (type) { return type; } @@ -5388,7 +5389,7 @@ module ts { } function getContextualTypeForReturnExpression(node: Expression): Type { - var func = getContainingFunction(node); + let func = getContainingFunction(node); if (func) { // If the containing function has a return type annotation, is a constructor, or is a get accessor whose // corresponding set accessor has a type annotation, return statements in the function are contextually typed @@ -5397,7 +5398,7 @@ module ts { } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature // and that call signature is non-generic, return statements are contextually typed by the return type of the signature - var signature = getContextualSignatureForFunctionLikeDeclaration(func); + let signature = getContextualSignatureForFunctionLikeDeclaration(func); if (signature) { return getReturnTypeOfSignature(signature); } @@ -5407,10 +5408,10 @@ module ts { // In a typed function call, an argument or substitution expression is contextually typed by the type of the corresponding parameter. function getContextualTypeForArgument(callTarget: CallLikeExpression, arg: Expression): Type { - var args = getEffectiveCallArguments(callTarget); - var argIndex = indexOf(args, arg); + let args = getEffectiveCallArguments(callTarget); + let argIndex = indexOf(args, arg); if (argIndex >= 0) { - var signature = getResolvedSignature(callTarget); + let signature = getResolvedSignature(callTarget); return getTypeAtPosition(signature, argIndex); } return undefined; @@ -5425,8 +5426,8 @@ module ts { } function getContextualTypeForBinaryOperand(node: Expression): Type { - var binaryExpression = node.parent; - var operator = binaryExpression.operatorToken.kind; + let binaryExpression = node.parent; + let operator = binaryExpression.operatorToken.kind; if (operator >= SyntaxKind.FirstAssignment && operator <= SyntaxKind.LastAssignment) { // In an assignment expression, the right operand is contextually typed by the type of the left operand. if (node === binaryExpression.right) { @@ -5436,7 +5437,7 @@ module ts { else if (operator === SyntaxKind.BarBarToken) { // When an || expression has a contextual type, the operands are contextually typed by that type. When an || // expression has no contextual type, the right operand is contextually typed by the type of the left operand. - var type = getContextualType(binaryExpression); + let type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { type = checkExpression(binaryExpression.left); } @@ -5452,11 +5453,11 @@ module ts { if (!(type.flags & TypeFlags.Union)) { return mapper(type); } - var types = (type).types; - var mappedType: Type; - var mappedTypes: Type[]; + let types = (type).types; + let mappedType: Type; + let mappedTypes: Type[]; for (let current of types) { - var t = mapper(current); + let t = mapper(current); if (t) { if (!mappedType) { mappedType = t; @@ -5474,7 +5475,7 @@ module ts { function getTypeOfPropertyOfContextualType(type: Type, name: string) { return applyToContextualType(type, t => { - var prop = getPropertyOfObjectType(t, name); + let prop = getPropertyOfObjectType(t, name); return prop ? getTypeOfSymbol(prop) : undefined; }); } @@ -5507,15 +5508,15 @@ module ts { } function getContextualTypeForObjectLiteralElement(element: ObjectLiteralElement) { - var objectLiteral = element.parent; - var type = getContextualType(objectLiteral); + let objectLiteral = element.parent; + let type = getContextualType(objectLiteral); if (type) { if (!hasDynamicName(element)) { // For a (non-symbol) computed property, there is no reason to look up the name // in the type. It will just be "__computed", which does not appear in any // SymbolTable. - var symbolName = getSymbolOfNode(element).name; - var propertyType = getTypeOfPropertyOfContextualType(type, symbolName); + let symbolName = getSymbolOfNode(element).name; + let propertyType = getTypeOfPropertyOfContextualType(type, symbolName); if (propertyType) { return propertyType; } @@ -5533,10 +5534,10 @@ module ts { // it is the type of the numeric index signature in T. Otherwise, in ES6 and higher, the contextual type is the iterated // type of T. function getContextualTypeForElementExpression(node: Expression): Type { - var arrayLiteral = node.parent; - var type = getContextualType(arrayLiteral); + let arrayLiteral = node.parent; + let type = getContextualType(arrayLiteral); if (type) { - var index = indexOf(arrayLiteral.elements, node); + let index = indexOf(arrayLiteral.elements, node); return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, IndexKind.Number) || (languageVersion >= ScriptTarget.ES6 ? checkIteratedType(type, /*expressionForError*/ undefined) : undefined); @@ -5546,7 +5547,7 @@ module ts { // In a contextually typed conditional expression, the true/false expressions are contextually typed by the same type. function getContextualTypeForConditionalOperand(node: Expression): Type { - var conditional = node.parent; + let conditional = node.parent; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } @@ -5560,7 +5561,7 @@ module ts { if (node.contextualType) { return node.contextualType; } - var parent = node.parent; + let parent = node.parent; switch (parent.kind) { case SyntaxKind.VariableDeclaration: case SyntaxKind.Parameter: @@ -5596,9 +5597,9 @@ module ts { // If the given type is an object or union type, if that type has a single signature, and if // that signature is non-generic, return the signature. Otherwise return undefined. function getNonGenericSignature(type: Type): Signature { - var signatures = getSignaturesOfObjectOrUnionType(type, SignatureKind.Call); + let signatures = getSignaturesOfObjectOrUnionType(type, SignatureKind.Call); if (signatures.length === 1) { - var signature = signatures[0]; + let signature = signatures[0]; if (!signature.typeParameters) { return signature; } @@ -5621,7 +5622,7 @@ module ts { // union type of return types from these signatures function getContextualSignature(node: FunctionExpression | MethodDeclaration): Signature { Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node)); - var type = isObjectLiteralMethod(node) + let type = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); if (!type) { @@ -5630,8 +5631,8 @@ module ts { if (!(type.flags & TypeFlags.Union)) { return getNonGenericSignature(type); } - var signatureList: Signature[]; - var types = (type).types; + let signatureList: Signature[]; + let types = (type).types; for (let current of types) { // The signature set of all constituent type with call signatures should match // So number of signatures allowed is either 0 or 1 @@ -5640,7 +5641,7 @@ module ts { return undefined; } - var signature = getNonGenericSignature(current); + let signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { // This signature will contribute to contextual union signature @@ -5658,7 +5659,7 @@ module ts { } // Result is union of signatures collected (return type is union of return types of this signature set) - var result: Signature; + let result: Signature; if (signatureList) { result = cloneSignature(signatureList[0]); // Clear resolved return type we possibly got from cloneSignature @@ -5678,7 +5679,7 @@ module ts { // assignment in an object literal that is an assignment target, or if it is parented by an array literal that is // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'. function isAssignmentTarget(node: Node): boolean { - var parent = node.parent; + let parent = node.parent; if (parent.kind === SyntaxKind.BinaryExpression && (parent).operatorToken.kind === SyntaxKind.EqualsToken && (parent).left === node) { return true; } @@ -5692,7 +5693,7 @@ module ts { } function checkSpreadElementExpression(node: SpreadElementExpression, contextualMapper?: TypeMapper): Type { - var type = checkExpressionCached(node.expression, contextualMapper); + let type = checkExpressionCached(node.expression, contextualMapper); if (!isArrayLikeType(type)) { error(node.expression, Diagnostics.Type_0_is_not_an_array_type, typeToString(type)); return unknownType; @@ -5701,14 +5702,14 @@ module ts { } function checkArrayLiteral(node: ArrayLiteralExpression, contextualMapper?: TypeMapper): Type { - var elements = node.elements; + let elements = node.elements; if (!elements.length) { return createArrayType(undefinedType); } - var hasSpreadElement: boolean = false; - var elementTypes: Type[] = []; + let hasSpreadElement: boolean = false; + let elementTypes: Type[] = []; forEach(elements, e => { - var type = checkExpression(e, contextualMapper); + let type = checkExpression(e, contextualMapper); if (e.kind === SyntaxKind.SpreadElementExpression) { elementTypes.push(getIndexTypeOfType(type, IndexKind.Number) || anyType); hasSpreadElement = true; @@ -5718,7 +5719,7 @@ module ts { } }); if (!hasSpreadElement) { - var contextualType = getContextualType(node); + let contextualType = getContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType) || isAssignmentTarget(node)) { return createTupleType(elementTypes); } @@ -5762,7 +5763,7 @@ module ts { } function checkComputedPropertyName(node: ComputedPropertyName): Type { - var links = getNodeLinks(node.expression); + let links = getNodeLinks(node.expression); if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); @@ -5783,13 +5784,13 @@ module ts { // Grammar checking checkGrammarObjectLiteralExpression(node); - var propertiesTable: SymbolTable = {}; - var propertiesArray: Symbol[] = []; - var contextualType = getContextualType(node); - var typeFlags: TypeFlags; + let propertiesTable: SymbolTable = {}; + let propertiesArray: Symbol[] = []; + let contextualType = getContextualType(node); + let typeFlags: TypeFlags; for (let memberDecl of node.properties) { - var member = memberDecl.symbol; + let member = memberDecl.symbol; if (memberDecl.kind === SyntaxKind.PropertyAssignment || memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment || isObjectLiteralMethod(memberDecl)) { @@ -5806,7 +5807,7 @@ module ts { : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; - var prop = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.name); + let prop = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.name); prop.declarations = member.declarations; prop.parent = member.parent; if (member.valueDeclaration) { @@ -5833,29 +5834,29 @@ module ts { propertiesArray.push(member); } - var stringIndexType = getIndexType(IndexKind.String); - var numberIndexType = getIndexType(IndexKind.Number); - var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); + let stringIndexType = getIndexType(IndexKind.String); + let numberIndexType = getIndexType(IndexKind.Number); + let result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); result.flags |= TypeFlags.ObjectLiteral | TypeFlags.ContainsObjectLiteral | (typeFlags & TypeFlags.ContainsUndefinedOrNull); return result; function getIndexType(kind: IndexKind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { - var propTypes: Type[] = []; - for (var i = 0; i < propertiesArray.length; i++) { - var propertyDecl = node.properties[i]; + let propTypes: Type[] = []; + for (let i = 0; i < propertiesArray.length; i++) { + let propertyDecl = node.properties[i]; if (kind === IndexKind.String || isNumericName(propertyDecl.name)) { // Do not call getSymbolOfNode(propertyDecl), as that will get the // original symbol for the node. We actually want to get the symbol // created by checkObjectLiteral, since that will be appropriately // contextually typed and resolved. - var type = getTypeOfSymbol(propertiesArray[i]); + let type = getTypeOfSymbol(propertiesArray[i]); if (!contains(propTypes, type)) { propTypes.push(type); } } } - var result = propTypes.length ? getUnionType(propTypes) : undefinedType; + let result = propTypes.length ? getUnionType(propTypes) : undefinedType; typeFlags |= result.flags; return result; } @@ -5874,16 +5875,16 @@ module ts { } function checkClassPropertyAccess(node: PropertyAccessExpression | QualifiedName, left: Expression | QualifiedName, type: Type, prop: Symbol) { - var flags = getDeclarationFlagsFromSymbol(prop); + let flags = getDeclarationFlagsFromSymbol(prop); // Public properties are always accessible if (!(flags & (NodeFlags.Private | NodeFlags.Protected))) { return; } // Property is known to be private or protected at this point // Get the declaring and enclosing class instance types - var enclosingClassDeclaration = getAncestor(node, SyntaxKind.ClassDeclaration); - var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; - var declaringClass = getDeclaredTypeOfSymbol(prop.parent); + let enclosingClassDeclaration = getAncestor(node, SyntaxKind.ClassDeclaration); + let enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; + let declaringClass = getDeclaredTypeOfSymbol(prop.parent); // Private property is accessible if declaring and enclosing class are the same if (flags & NodeFlags.Private) { if (declaringClass !== enclosingClass) { @@ -5920,15 +5921,15 @@ module ts { } function checkPropertyAccessExpressionOrQualifiedName(node: PropertyAccessExpression | QualifiedName, left: Expression | QualifiedName, right: Identifier) { - var type = checkExpressionOrQualifiedName(left); + let type = checkExpressionOrQualifiedName(left); if (type === unknownType) return type; if (type !== anyType) { - var apparentType = getApparentType(getWidenedType(type)); + let apparentType = getApparentType(getWidenedType(type)); if (apparentType === unknownType) { // handle cases when type is Type parameter with invalid constraint return unknownType; } - var prop = getPropertyOfType(apparentType, right.text); + let prop = getPropertyOfType(apparentType, right.text); if (!prop) { if (right.text) { error(right, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(right), typeToString(type)); @@ -5957,19 +5958,19 @@ module ts { } function isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean { - var left = node.kind === SyntaxKind.PropertyAccessExpression + let left = node.kind === SyntaxKind.PropertyAccessExpression ? (node).expression : (node).left; - var type = checkExpressionOrQualifiedName(left); + let type = checkExpressionOrQualifiedName(left); if (type !== unknownType && type !== anyType) { - var prop = getPropertyOfType(getWidenedType(type), propertyName); + let prop = getPropertyOfType(getWidenedType(type), propertyName); if (prop && prop.parent && prop.parent.flags & SymbolFlags.Class) { if (left.kind === SyntaxKind.SuperKeyword && getDeclarationKindFromSymbol(prop) !== SyntaxKind.MethodDeclaration) { return false; } else { - var modificationCount = diagnostics.getModificationCount(); + let modificationCount = diagnostics.getModificationCount(); checkClassPropertyAccess(node, left, type, prop); return diagnostics.getModificationCount() === modificationCount; } @@ -5981,28 +5982,28 @@ module ts { function checkIndexedAccess(node: ElementAccessExpression): Type { // Grammar checking if (!node.argumentExpression) { - var sourceFile = getSourceFile(node); + let sourceFile = getSourceFile(node); if (node.parent.kind === SyntaxKind.NewExpression && (node.parent).expression === node) { - var start = skipTrivia(sourceFile.text, node.expression.end); - var end = node.end; + let start = skipTrivia(sourceFile.text, node.expression.end); + let end = node.end; grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); } else { - var start = node.end - "]".length; - var end = node.end; + let start = node.end - "]".length; + let end = node.end; grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Expression_expected); } } // Obtain base constraint such that we can bail out if the constraint is an unknown type - var objectType = getApparentType(checkExpression(node.expression)); - var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; + let objectType = getApparentType(checkExpression(node.expression)); + let indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; if (objectType === unknownType) { return unknownType; } - var isConstEnum = isConstEnumObjectType(objectType); + let isConstEnum = isConstEnumObjectType(objectType); if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== SyntaxKind.StringLiteral)) { error(node.argumentExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); @@ -6020,9 +6021,9 @@ module ts { // See if we can index as a property. if (node.argumentExpression) { - var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + let name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); if (name !== undefined) { - var prop = getPropertyOfType(objectType, name); + let prop = getPropertyOfType(objectType, name); if (prop) { getNodeLinks(node).resolvedSymbol = prop; return getTypeOfSymbol(prop); @@ -6039,14 +6040,14 @@ module ts { // Try to use a number indexer. if (allConstituentTypesHaveKind(indexType, TypeFlags.Any | TypeFlags.NumberLike)) { - var numberIndexType = getIndexTypeOfType(objectType, IndexKind.Number); + let numberIndexType = getIndexTypeOfType(objectType, IndexKind.Number); if (numberIndexType) { return numberIndexType; } } // Try to use string indexing. - var stringIndexType = getIndexTypeOfType(objectType, IndexKind.String); + let stringIndexType = getIndexTypeOfType(objectType, IndexKind.String); if (stringIndexType) { return stringIndexType; } @@ -6076,7 +6077,7 @@ module ts { return (indexArgumentExpression).text; } if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, /*reportError*/ false)) { - var rightHandSideName = ((indexArgumentExpression).name).text; + let rightHandSideName = ((indexArgumentExpression).name).text; return getPropertyNameForKnownSymbolName(rightHandSideName); } @@ -6110,13 +6111,13 @@ module ts { // The name is Symbol., so make sure Symbol actually resolves to the // global Symbol object - var leftHandSide = (expression).expression; - var leftHandSideSymbol = getResolvedSymbol(leftHandSide); + let leftHandSide = (expression).expression; + let leftHandSideSymbol = getResolvedSymbol(leftHandSide); if (!leftHandSideSymbol) { return false; } - var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + let globalESSymbol = getGlobalESSymbolConstructorSymbol(); if (!globalESSymbol) { // Already errored when we tried to look up the symbol return false; @@ -6155,19 +6156,19 @@ module ts { // so order how inherited signatures are processed is still preserved. // interface A { (x: string): void } // interface B extends A { (x: 'foo'): string } - // var b: B; + // let b: B; // b('foo') // <- here overloads should be processed as [(x:'foo'): string, (x: string): void] function reorderCandidates(signatures: Signature[], result: Signature[]): void { - var lastParent: Node; - var lastSymbol: Symbol; - var cutoffIndex: number = 0; - var index: number; - var specializedIndex: number = -1; - var spliceIndex: number; + let lastParent: Node; + let lastSymbol: Symbol; + let cutoffIndex: number = 0; + let index: number; + let specializedIndex: number = -1; + let spliceIndex: number; Debug.assert(!result.length); for (let signature of signatures) { - var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent = signature.declaration && signature.declaration.parent; + let symbol = signature.declaration && getSymbolOfNode(signature.declaration); + let parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { if (lastParent && parent === lastParent) { index++; @@ -6204,7 +6205,7 @@ module ts { } function getSpreadArgumentIndex(args: Expression[]): number { - for (var i = 0; i < args.length; i++) { + for (let i = 0; i < args.length; i++) { if (args[i].kind === SyntaxKind.SpreadElementExpression) { return i; } @@ -6213,12 +6214,12 @@ module ts { } function hasCorrectArity(node: CallLikeExpression, args: Expression[], signature: Signature) { - var adjustedArgCount: number; // Apparent number of arguments we will have in this call - var typeArguments: NodeArray; // Type arguments (undefined if none) - var callIsIncomplete: boolean; // In incomplete call we want to be lenient when we have too few arguments + let adjustedArgCount: number; // Apparent number of arguments we will have in this call + let typeArguments: NodeArray; // Type arguments (undefined if none) + let callIsIncomplete: boolean; // In incomplete call we want to be lenient when we have too few arguments if (node.kind === SyntaxKind.TaggedTemplateExpression) { - var tagExpression = node; + let tagExpression = node; // Even if the call is incomplete, we'll have a missing expression as our last argument, // so we can say the count is just the arg list length @@ -6228,8 +6229,8 @@ module ts { if (tagExpression.template.kind === SyntaxKind.TemplateExpression) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. - var templateExpression = tagExpression.template; - var lastSpan = lastOrUndefined(templateExpression.templateSpans); + let templateExpression = tagExpression.template; + let lastSpan = lastOrUndefined(templateExpression.templateSpans); Debug.assert(lastSpan !== undefined); // we should always have at least one span. callIsIncomplete = getFullWidth(lastSpan.literal) === 0 || !!lastSpan.literal.isUnterminated; } @@ -6237,13 +6238,13 @@ module ts { // If the template didn't end in a backtick, or its beginning occurred right prior to EOF, // then this might actually turn out to be a TemplateHead in the future; // so we consider the call to be incomplete. - var templateLiteral = tagExpression.template; + let templateLiteral = tagExpression.template; Debug.assert(templateLiteral.kind === SyntaxKind.NoSubstitutionTemplateLiteral); callIsIncomplete = !!templateLiteral.isUnterminated; } } else { - var callExpression = node; + let callExpression = node; if (!callExpression.arguments) { // This only happens when we have something of the form: 'new C' Debug.assert(callExpression.kind === SyntaxKind.NewExpression); @@ -6262,7 +6263,7 @@ module ts { // If the user supplied type arguments, but the number of type arguments does not match // the declared number of type parameters, the call has an incorrect arity. - var hasRightNumberOfTypeArgs = !typeArguments || + let hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); if (!hasRightNumberOfTypeArgs) { return false; @@ -6270,7 +6271,7 @@ module ts { // If spread arguments are present, check that they correspond to a rest parameter. If so, no // further checking is necessary. - var spreadArgIndex = getSpreadArgumentIndex(args); + let spreadArgIndex = getSpreadArgumentIndex(args); if (spreadArgIndex >= 0) { return signature.hasRestParameter && spreadArgIndex >= signature.parameters.length - 1; } @@ -6281,14 +6282,14 @@ module ts { } // If the call is incomplete, we should skip the lower bound check. - var hasEnoughArguments = adjustedArgCount >= signature.minArgumentCount; + let hasEnoughArguments = adjustedArgCount >= signature.minArgumentCount; return callIsIncomplete || hasEnoughArguments; } // If type has a single call signature and no other members, return that signature. Otherwise, return undefined. function getSingleCallSignature(type: Type): Signature { if (type.flags & TypeFlags.ObjectType) { - var resolved = resolveObjectOrUnionTypeMembers(type); + let resolved = resolveObjectOrUnionTypeMembers(type); if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { return resolved.callSignatures[0]; @@ -6299,7 +6300,7 @@ module ts { // Instantiate a generic signature in the context of a non-generic signature (section 3.8.5 in TypeScript spec) function instantiateSignatureInContextOf(signature: Signature, contextualSignature: Signature, contextualMapper: TypeMapper): Signature { - var context = createInferenceContext(signature.typeParameters, /*inferUnionTypes*/ true); + let context = createInferenceContext(signature.typeParameters, /*inferUnionTypes*/ true); forEachMatchingParameterType(contextualSignature, signature, (source, target) => { // Type parameters from outer context referenced by source type are fixed by instantiation of the source type inferTypes(context, instantiateType(source, contextualMapper), target); @@ -6308,23 +6309,23 @@ module ts { } function inferTypeArguments(signature: Signature, args: Expression[], excludeArgument: boolean[]): InferenceContext { - var typeParameters = signature.typeParameters; - var context = createInferenceContext(typeParameters, /*inferUnionTypes*/ false); - var inferenceMapper = createInferenceMapper(context); + let typeParameters = signature.typeParameters; + let context = createInferenceContext(typeParameters, /*inferUnionTypes*/ false); + let inferenceMapper = createInferenceMapper(context); // We perform two passes over the arguments. In the first pass we infer from all arguments, but use // wildcards for all context sensitive function expressions. - for (var i = 0; i < args.length; i++) { - var arg = args[i]; + for (let i = 0; i < args.length; i++) { + let arg = args[i]; if (arg.kind !== SyntaxKind.OmittedExpression) { - var paramType = getTypeAtPosition(signature, arg.kind === SyntaxKind.SpreadElementExpression ? -1 : i); + let paramType = getTypeAtPosition(signature, arg.kind === SyntaxKind.SpreadElementExpression ? -1 : i); if (i === 0 && args[i].parent.kind === SyntaxKind.TaggedTemplateExpression) { var argType = globalTemplateStringsArrayType; } else { // For context sensitive arguments we pass the identityMapper, which is a signal to treat all // context sensitive function expressions as wildcards - var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; + let mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; var argType = checkExpressionWithContextualType(arg, paramType, mapper); } inferTypes(context, argType, paramType); @@ -6335,22 +6336,22 @@ module ts { // time treating function expressions normally (which may cause previously inferred type arguments to be fixed // as we construct types for contextually typed parameters) if (excludeArgument) { - for (var i = 0; i < args.length; i++) { + for (let i = 0; i < args.length; i++) { // No need to check for omitted args and template expressions, their exlusion value is always undefined if (excludeArgument[i] === false) { - var arg = args[i]; - var paramType = getTypeAtPosition(signature, arg.kind === SyntaxKind.SpreadElementExpression ? -1 : i); + let arg = args[i]; + let paramType = getTypeAtPosition(signature, arg.kind === SyntaxKind.SpreadElementExpression ? -1 : i); inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } - var inferredTypes = getInferredTypes(context); + let inferredTypes = getInferredTypes(context); // Inference has failed if the inferenceFailureType type is in list of inferences context.failedTypeParameterIndex = indexOf(inferredTypes, inferenceFailureType); // Wipe out the inferenceFailureType from the array so that error recovery can work properly - for (var i = 0; i < inferredTypes.length; i++) { + for (let i = 0; i < inferredTypes.length; i++) { if (inferredTypes[i] === inferenceFailureType) { inferredTypes[i] = unknownType; } @@ -6360,15 +6361,15 @@ module ts { } function checkTypeArguments(signature: Signature, typeArguments: TypeNode[], typeArgumentResultTypes: Type[], reportErrors: boolean): boolean { - var typeParameters = signature.typeParameters; - var typeArgumentsAreAssignable = true; - for (var i = 0; i < typeParameters.length; i++) { - var typeArgNode = typeArguments[i]; - var typeArgument = getTypeFromTypeNode(typeArgNode); + let typeParameters = signature.typeParameters; + let typeArgumentsAreAssignable = true; + for (let i = 0; i < typeParameters.length; i++) { + let typeArgNode = typeArguments[i]; + let typeArgument = getTypeFromTypeNode(typeArgNode); // Do not push on this array! It has a preallocated length typeArgumentResultTypes[i] = typeArgument; if (typeArgumentsAreAssignable /* so far */) { - var constraint = getConstraintOfTypeParameter(typeParameters[i]); + let constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, constraint, reportErrors ? typeArgNode : undefined, Diagnostics.Type_0_does_not_satisfy_the_constraint_1); @@ -6379,14 +6380,14 @@ module ts { } function checkApplicableSignature(node: CallLikeExpression, args: Expression[], signature: Signature, relation: Map, excludeArgument: boolean[], reportErrors: boolean) { - for (var i = 0; i < args.length; i++) { - var arg = args[i]; + for (let i = 0; i < args.length; i++) { + let arg = args[i]; if (arg.kind !== SyntaxKind.OmittedExpression) { // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter) - var paramType = getTypeAtPosition(signature, arg.kind === SyntaxKind.SpreadElementExpression ? -1 : i); + let paramType = getTypeAtPosition(signature, arg.kind === SyntaxKind.SpreadElementExpression ? -1 : i); // A tagged template expression provides a special first argument, and string literals get string literal types // unless we're reporting errors - var argType = i === 0 && node.kind === SyntaxKind.TaggedTemplateExpression ? globalTemplateStringsArrayType : + let argType = i === 0 && node.kind === SyntaxKind.TaggedTemplateExpression ? globalTemplateStringsArrayType : arg.kind === SyntaxKind.StringLiteral && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); // Use argument expression as error location when reporting errors @@ -6407,9 +6408,9 @@ module ts { * expressions, where the first element of the list is the template for error reporting purposes. */ function getEffectiveCallArguments(node: CallLikeExpression): Expression[] { - var args: Expression[]; + let args: Expression[]; if (node.kind === SyntaxKind.TaggedTemplateExpression) { - var template = (node).template; + let template = (node).template; args = [template]; if (template.kind === SyntaxKind.TemplateExpression) { @@ -6437,8 +6438,8 @@ module ts { */ function getEffectiveTypeArguments(callExpression: CallExpression): TypeNode[] { if (callExpression.expression.kind === SyntaxKind.SuperKeyword) { - var containingClass = getAncestor(callExpression, SyntaxKind.ClassDeclaration); - var baseClassTypeNode = containingClass && getClassBaseTypeNode(containingClass); + let containingClass = getAncestor(callExpression, SyntaxKind.ClassDeclaration); + let baseClassTypeNode = containingClass && getClassBaseTypeNode(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } else { @@ -6448,9 +6449,9 @@ module ts { } function resolveCall(node: CallLikeExpression, signatures: Signature[], candidatesOutArray: Signature[]): Signature { - var isTaggedTemplate = node.kind === SyntaxKind.TaggedTemplateExpression; + let isTaggedTemplate = node.kind === SyntaxKind.TaggedTemplateExpression; - var typeArguments: TypeNode[]; + let typeArguments: TypeNode[]; if (!isTaggedTemplate) { typeArguments = getEffectiveTypeArguments(node); @@ -6461,7 +6462,7 @@ module ts { } } - var candidates = candidatesOutArray || []; + let candidates = candidatesOutArray || []; // reorderCandidates fills up the candidates array directly reorderCandidates(signatures, candidates); if (!candidates.length) { @@ -6469,7 +6470,7 @@ module ts { return resolveErrorCall(node); } - var args = getEffectiveCallArguments(node); + let args = getEffectiveCallArguments(node); // The following applies to any value of 'excludeArgument[i]': // - true: the argument at 'i' is susceptible to a one-time permanent contextual typing. @@ -6482,8 +6483,8 @@ module ts { // // For a tagged template, then the first argument be 'undefined' if necessary // because it represents a TemplateStringsArray. - var excludeArgument: boolean[]; - for (var i = isTaggedTemplate ? 1 : 0; i < args.length; i++) { + let excludeArgument: boolean[]; + for (let i = isTaggedTemplate ? 1 : 0; i < args.length; i++) { if (isContextSensitive(args[i])) { if (!excludeArgument) { excludeArgument = new Array(args.length); @@ -6513,10 +6514,10 @@ module ts { // function foo() {} // foo(0, true); // - var candidateForArgumentError: Signature; - var candidateForTypeArgumentError: Signature; - var resultOfFailedInference: InferenceContext; - var result: Signature; + let candidateForArgumentError: Signature; + let candidateForTypeArgumentError: Signature; + let resultOfFailedInference: InferenceContext; + let result: Signature; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument @@ -6560,10 +6561,10 @@ module ts { } else { Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0); - var failedTypeParameter = candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failedTypeParameterIndex]; - var inferenceCandidates = getInferenceCandidates(resultOfFailedInference, resultOfFailedInference.failedTypeParameterIndex); + let failedTypeParameter = candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failedTypeParameterIndex]; + let inferenceCandidates = getInferenceCandidates(resultOfFailedInference, resultOfFailedInference.failedTypeParameterIndex); - var diagnosticChainHead = chainDiagnosticMessages(/*details*/ undefined, // details will be provided by call to reportNoCommonSupertypeError + let diagnosticChainHead = chainDiagnosticMessages(/*details*/ undefined, // details will be provided by call to reportNoCommonSupertypeError Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly, typeToString(failedTypeParameter)); @@ -6595,13 +6596,13 @@ module ts { continue; } - var originalCandidate = current; - var inferenceResult: InferenceContext; + let originalCandidate = current; + let inferenceResult: InferenceContext; while (true) { var candidate = originalCandidate; if (candidate.typeParameters) { - var typeArgumentTypes: Type[]; + let typeArgumentTypes: Type[]; var typeArgumentsAreValid: boolean; if (typeArguments) { typeArgumentTypes = new Array(candidate.typeParameters.length); @@ -6620,7 +6621,7 @@ module ts { if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, /*reportErrors*/ false)) { break; } - var index = excludeArgument ? indexOf(excludeArgument, true) : -1; + let index = excludeArgument ? indexOf(excludeArgument, true) : -1; if (index < 0) { return candidate; } @@ -6633,7 +6634,7 @@ module ts { // report an error based on the arguments. If there was an issue with type // arguments, then we can only report an error based on the type arguments. if (originalCandidate.typeParameters) { - var instantiatedCandidate = candidate; + let instantiatedCandidate = candidate; if (typeArgumentsAreValid) { candidateForArgumentError = instantiatedCandidate; } @@ -6657,15 +6658,15 @@ module ts { function resolveCallExpression(node: CallExpression, candidatesOutArray: Signature[]): Signature { if (node.expression.kind === SyntaxKind.SuperKeyword) { - var superType = checkSuperExpression(node.expression); + let superType = checkSuperExpression(node.expression); if (superType !== unknownType) { return resolveCall(node, getSignaturesOfType(superType, SignatureKind.Construct), candidatesOutArray); } return resolveUntypedCall(node); } - var funcType = checkExpression(node.expression); - var apparentType = getApparentType(funcType); + let funcType = checkExpression(node.expression); + let apparentType = getApparentType(funcType); if (apparentType === unknownType) { // Another error has already been reported @@ -6676,9 +6677,9 @@ module ts { // but we are not including call signatures that may have been added to the Object or // Function interface, since they have none by default. This is a bit of a leap of faith // that the user will not add any. - var callSignatures = getSignaturesOfType(apparentType, SignatureKind.Call); + let callSignatures = getSignaturesOfType(apparentType, SignatureKind.Call); - var constructSignatures = getSignaturesOfType(apparentType, SignatureKind.Construct); + let constructSignatures = getSignaturesOfType(apparentType, SignatureKind.Construct); // TS 1.0 spec: 4.12 // If FuncExpr is of type Any, or of an object type that has no call or construct signatures // but is a subtype of the Function interface, the call is an untyped function call. In an @@ -6709,13 +6710,13 @@ module ts { function resolveNewExpression(node: NewExpression, candidatesOutArray: Signature[]): Signature { if (node.arguments && languageVersion < ScriptTarget.ES6) { - var spreadIndex = getSpreadArgumentIndex(node.arguments); + let spreadIndex = getSpreadArgumentIndex(node.arguments); if (spreadIndex >= 0) { error(node.arguments[spreadIndex], Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher); } } - var expressionType = checkExpression(node.expression); + let expressionType = checkExpression(node.expression); // TS 1.0 spec: 4.11 // If ConstructExpr is of type Any, Args can be any argument // list and the result of the operation is of type Any. @@ -6741,7 +6742,7 @@ module ts { // but we are not including construct signatures that may have been added to the Object or // Function interface, since they have none by default. This is a bit of a leap of faith // that the user will not add any. - var constructSignatures = getSignaturesOfType(expressionType, SignatureKind.Construct); + let constructSignatures = getSignaturesOfType(expressionType, SignatureKind.Construct); if (constructSignatures.length) { return resolveCall(node, constructSignatures, candidatesOutArray); } @@ -6750,9 +6751,9 @@ module ts { // one or more call signatures, the expression is processed as a function call. A compile-time // error occurs if the result of the function call is not Void. The type of the result of the // operation is Any. - var callSignatures = getSignaturesOfType(expressionType, SignatureKind.Call); + let callSignatures = getSignaturesOfType(expressionType, SignatureKind.Call); if (callSignatures.length) { - var signature = resolveCall(node, callSignatures, candidatesOutArray); + let signature = resolveCall(node, callSignatures, candidatesOutArray); if (getReturnTypeOfSignature(signature) !== voidType) { error(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); } @@ -6764,15 +6765,15 @@ module ts { } function resolveTaggedTemplateExpression(node: TaggedTemplateExpression, candidatesOutArray: Signature[]): Signature { - var tagType = checkExpression(node.tag); - var apparentType = getApparentType(tagType); + let tagType = checkExpression(node.tag); + let apparentType = getApparentType(tagType); if (apparentType === unknownType) { // Another error has already been reported return resolveErrorCall(node); } - var callSignatures = getSignaturesOfType(apparentType, SignatureKind.Call); + let callSignatures = getSignaturesOfType(apparentType, SignatureKind.Call); if (tagType === anyType || (!callSignatures.length && !(tagType.flags & TypeFlags.Union) && isTypeAssignableTo(tagType, globalFunctionType))) { return resolveUntypedCall(node); @@ -6789,7 +6790,7 @@ module ts { // candidatesOutArray is passed by signature help in the language service, and collectCandidates // must fill it up with the appropriate candidate signatures function getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature { - var links = getNodeLinks(node); + let links = getNodeLinks(node); // If getResolvedSignature has already been called, we will have cached the resolvedSignature. // However, it is possible that either candidatesOutArray was not passed in the first time, // or that a different candidatesOutArray was passed in. Therefore, we need to redo the work @@ -6817,12 +6818,12 @@ module ts { // Grammar checking; stop grammar-checking if checkGrammarTypeArguments return true checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); - var signature = getResolvedSignature(node); + let signature = getResolvedSignature(node); if (node.expression.kind === SyntaxKind.SuperKeyword) { return voidType; } if (node.kind === SyntaxKind.NewExpression) { - var declaration = signature.declaration; + let declaration = signature.declaration; if (declaration && declaration.kind !== SyntaxKind.Constructor && declaration.kind !== SyntaxKind.ConstructSignature && @@ -6843,10 +6844,10 @@ module ts { } function checkTypeAssertion(node: TypeAssertion): Type { - var exprType = checkExpression(node.expression); - var targetType = getTypeFromTypeNode(node.type); + let exprType = checkExpression(node.expression); + let targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { - var widenedType = getWidenedType(exprType); + let widenedType = getWidenedType(exprType); if (!(isTypeAssignableTo(targetType, widenedType))) { checkTypeAssignableTo(exprType, targetType, node, Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); } @@ -6866,30 +6867,31 @@ module ts { } function assignContextualParameterTypes(signature: Signature, context: Signature, mapper: TypeMapper) { - var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); - for (var i = 0; i < len; i++) { - var parameter = signature.parameters[i]; - var links = getSymbolLinks(parameter); + let len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); + for (let i = 0; i < len; i++) { + let parameter = signature.parameters[i]; + let links = getSymbolLinks(parameter); links.type = instantiateType(getTypeAtPosition(context, i), mapper); } if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { - var parameter = signature.parameters[signature.parameters.length - 1]; - var links = getSymbolLinks(parameter); + let parameter = signature.parameters[signature.parameters.length - 1]; + let links = getSymbolLinks(parameter); links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); } } function getReturnTypeFromBody(func: FunctionLikeDeclaration, contextualMapper?: TypeMapper): Type { - var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); + let contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); if (!func.body) { return unknownType; } + if (func.body.kind !== SyntaxKind.Block) { var type = checkExpressionCached(func.body, contextualMapper); } else { // Aggregate the types of expressions within all the return statements. - var types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper); + let types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper); if (types.length === 0) { return voidType; } @@ -6909,12 +6911,12 @@ module ts { /// Returns a set of types relating to every return expression relating to a function block. function checkAndAggregateReturnExpressionTypes(body: Block, contextualMapper?: TypeMapper): Type[] { - var aggregatedTypes: Type[] = []; + let aggregatedTypes: Type[] = []; forEachReturnStatement(body, returnStatement => { - var expr = returnStatement.expression; + let expr = returnStatement.expression; if (expr) { - var type = checkExpressionCached(expr, contextualMapper); + let type = checkExpressionCached(expr, contextualMapper); if (!contains(aggregatedTypes, type)) { aggregatedTypes.push(type); } @@ -6953,7 +6955,7 @@ module ts { return; } - var bodyBlock = func.body; + let bodyBlock = func.body; // Ensure the body has at least one return expression. if (bodyContainsAReturnStatement(bodyBlock)) { @@ -6975,7 +6977,7 @@ module ts { Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node)); // Grammar checking - var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); + let hasGrammarError = checkGrammarFunctionLikeDeclaration(node); if (!hasGrammarError && node.kind === SyntaxKind.FunctionExpression) { checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); } @@ -6984,24 +6986,24 @@ module ts { if (contextualMapper === identityMapper && isContextSensitive(node)) { return anyFunctionType; } - var links = getNodeLinks(node); - var type = getTypeOfSymbol(node.symbol); + let links = getNodeLinks(node); + let type = getTypeOfSymbol(node.symbol); // Check if function expression is contextually typed and assign parameter types if so if (!(links.flags & NodeCheckFlags.ContextChecked)) { - var contextualSignature = getContextualSignature(node); + let contextualSignature = getContextualSignature(node); // If a type check is started at a function expression that is an argument of a function call, obtaining the // contextual type may recursively get back to here during overload resolution of the call. If so, we will have // already assigned contextual types. if (!(links.flags & NodeCheckFlags.ContextChecked)) { links.flags |= NodeCheckFlags.ContextChecked; if (contextualSignature) { - var signature = getSignaturesOfType(type, SignatureKind.Call)[0]; + let signature = getSignaturesOfType(type, SignatureKind.Call)[0]; if (isContextSensitive(node)) { assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); } if (!node.type) { signature.resolvedReturnType = resolvingType; - var returnType = getReturnTypeFromBody(node, contextualMapper); + let returnType = getReturnTypeFromBody(node, contextualMapper); if (signature.resolvedReturnType === resolvingType) { signature.resolvedReturnType = returnType; } @@ -7030,7 +7032,7 @@ module ts { checkSourceElement(node.body); } else { - var exprType = checkExpression(node.body); + let exprType = checkExpression(node.body); if (node.type) { checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, /*headMessage*/ undefined); } @@ -7049,7 +7051,7 @@ module ts { function checkReferenceExpression(n: Node, invalidReferenceMessage: DiagnosticMessage, constantVariableMessage: DiagnosticMessage): boolean { function findSymbol(n: Node): Symbol { - var symbol = getNodeLinks(n).resolvedSymbol; + let symbol = getNodeLinks(n).resolvedSymbol; // Because we got the symbol from the resolvedSymbol property, it might be of kind // SymbolFlags.ExportValue. In this case it is necessary to get the actual export // symbol, which will have the correct flags set on it. @@ -7093,12 +7095,12 @@ module ts { var symbol = findSymbol(n); return symbol && (symbol.flags & SymbolFlags.Variable) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & NodeFlags.Const) !== 0; case SyntaxKind.ElementAccessExpression: - var index = (n).argumentExpression; + let index = (n).argumentExpression; var symbol = findSymbol((n).expression); if (symbol && index && index.kind === SyntaxKind.StringLiteral) { - var name = (index).text; - var prop = getPropertyOfType(getTypeOfSymbol(symbol), name); + let name = (index).text; + let prop = getPropertyOfType(getTypeOfSymbol(symbol), name); return prop && (prop.flags & SymbolFlags.Variable) !== 0 && (getDeclarationFlagsFromSymbol(prop) & NodeFlags.Const) !== 0; } return false; @@ -7128,17 +7130,17 @@ module ts { grammarErrorOnNode(node.expression, Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode); } - var operandType = checkExpression(node.expression); + let operandType = checkExpression(node.expression); return booleanType; } function checkTypeOfExpression(node: TypeOfExpression): Type { - var operandType = checkExpression(node.expression); + let operandType = checkExpression(node.expression); return stringType; } function checkVoidExpression(node: VoidExpression): Type { - var operandType = checkExpression(node.expression); + let operandType = checkExpression(node.expression); return undefinedType; } @@ -7151,7 +7153,7 @@ module ts { checkGrammarEvalOrArgumentsInStrictMode(node, node.operand); } - var operandType = checkExpression(node.operand); + let operandType = checkExpression(node.operand); switch (node.operator) { case SyntaxKind.PlusToken: case SyntaxKind.MinusToken: @@ -7164,7 +7166,7 @@ module ts { return booleanType; case SyntaxKind.PlusPlusToken: case SyntaxKind.MinusMinusToken: - var ok = checkArithmeticOperandType(node.operand, operandType, Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + let ok = checkArithmeticOperandType(node.operand, operandType, Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors checkReferenceExpression(node.operand, @@ -7183,8 +7185,8 @@ module ts { // operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator. checkGrammarEvalOrArgumentsInStrictMode(node, node.operand); - var operandType = checkExpression(node.operand); - var ok = checkArithmeticOperandType(node.operand, operandType, Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + let operandType = checkExpression(node.operand); + let ok = checkArithmeticOperandType(node.operand, operandType, Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors checkReferenceExpression(node.operand, @@ -7201,7 +7203,7 @@ module ts { return true; } if (type.flags & TypeFlags.Union) { - var types = (type).types; + let types = (type).types; for (let current of types) { if (current.flags & kind) { return true; @@ -7218,7 +7220,7 @@ module ts { return true; } if (type.flags & TypeFlags.Union) { - var types = (type).types; + let types = (type).types; for (let current of types) { if (!(current.flags & kind)) { return false; @@ -7268,12 +7270,12 @@ module ts { } function checkObjectLiteralAssignment(node: ObjectLiteralExpression, sourceType: Type, contextualMapper?: TypeMapper): Type { - var properties = node.properties; + let properties = node.properties; for (let p of properties) { if (p.kind === SyntaxKind.PropertyAssignment || p.kind === SyntaxKind.ShorthandPropertyAssignment) { // TODO(andersh): Computed property support - var name = (p).name; - var type = sourceType.flags & TypeFlags.Any ? sourceType : + let name = (p).name; + let type = sourceType.flags & TypeFlags.Any ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, IndexKind.Number) || getIndexTypeOfType(sourceType, IndexKind.String); @@ -7297,13 +7299,13 @@ module ts { error(node, Diagnostics.Type_0_is_not_an_array_type, typeToString(sourceType)); return sourceType; } - var elements = node.elements; - for (var i = 0; i < elements.length; i++) { - var e = elements[i]; + let elements = node.elements; + for (let i = 0; i < elements.length; i++) { + let e = elements[i]; if (e.kind !== SyntaxKind.OmittedExpression) { if (e.kind !== SyntaxKind.SpreadElementExpression) { - var propName = "" + i; - var type = sourceType.flags & TypeFlags.Any ? sourceType : + let propName = "" + i; + let type = sourceType.flags & TypeFlags.Any ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, IndexKind.Number); if (type) { @@ -7346,7 +7348,7 @@ module ts { } function checkReferenceAssignment(target: Expression, sourceType: Type, contextualMapper?: TypeMapper): Type { - var targetType = checkExpression(target, contextualMapper); + let targetType = checkExpression(target, contextualMapper); if (checkReferenceExpression(target, Diagnostics.Invalid_left_hand_side_of_assignment_expression, Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant)) { checkTypeAssignableTo(sourceType, targetType, target, /*headMessage*/ undefined); } @@ -7361,12 +7363,12 @@ module ts { checkGrammarEvalOrArgumentsInStrictMode(node, node.left); } - var operator = node.operatorToken.kind; + let operator = node.operatorToken.kind; if (operator === SyntaxKind.EqualsToken && (node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } - var leftType = checkExpression(node.left, contextualMapper); - var rightType = checkExpression(node.right, contextualMapper); + let leftType = checkExpression(node.left, contextualMapper); + let rightType = checkExpression(node.right, contextualMapper); switch (operator) { case SyntaxKind.AsteriskToken: case SyntaxKind.AsteriskEqualsToken: @@ -7397,7 +7399,7 @@ module ts { if (leftType.flags & (TypeFlags.Undefined | TypeFlags.Null)) leftType = rightType; if (rightType.flags & (TypeFlags.Undefined | TypeFlags.Null)) rightType = leftType; - var suggestedOperator: SyntaxKind; + let suggestedOperator: SyntaxKind; // if a user tries to apply a bitwise operator to 2 boolean operands // try and return them a helpful suggestion if ((leftType.flags & TypeFlags.Boolean) && @@ -7407,8 +7409,8 @@ module ts { } else { // otherwise just check each operand separately and report errors as normal - var leftOk = checkArithmeticOperandType(node.left, leftType, Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); - var rightOk = checkArithmeticOperandType(node.right, rightType, Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + let leftOk = checkArithmeticOperandType(node.left, leftType, Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + let rightOk = checkArithmeticOperandType(node.right, rightType, Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); if (leftOk && rightOk) { checkAssignmentOperator(numberType); } @@ -7425,7 +7427,7 @@ module ts { if (leftType.flags & (TypeFlags.Undefined | TypeFlags.Null)) leftType = rightType; if (rightType.flags & (TypeFlags.Undefined | TypeFlags.Null)) rightType = leftType; - var resultType: Type; + let resultType: Type; if (allConstituentTypesHaveKind(leftType, TypeFlags.NumberLike) && allConstituentTypesHaveKind(rightType, TypeFlags.NumberLike)) { // Operands of an enum type are treated as having the primitive type Number. // If both operands are of the Number primitive type, the result is of the Number primitive type. @@ -7490,7 +7492,7 @@ module ts { // Return true if there was no error, false if there was an error. function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean { - var offendingSymbolOperand = + let offendingSymbolOperand = someConstituentTypeHasKind(leftType, TypeFlags.ESSymbol) ? node.left : someConstituentTypeHasKind(rightType, TypeFlags.ESSymbol) ? node.right : undefined; @@ -7526,7 +7528,7 @@ module ts { // requires VarExpr to be classified as a reference // A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1) // and the type of the non - compound operation to be assignable to the type of VarExpr. - var ok = checkReferenceExpression(node.left, Diagnostics.Invalid_left_hand_side_of_assignment_expression, Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + let ok = checkReferenceExpression(node.left, Diagnostics.Invalid_left_hand_side_of_assignment_expression, Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); // Use default messages if (ok) { // to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported @@ -7552,8 +7554,8 @@ module ts { function checkConditionalExpression(node: ConditionalExpression, contextualMapper?: TypeMapper): Type { checkExpression(node.condition); - var type1 = checkExpression(node.whenTrue, contextualMapper); - var type2 = checkExpression(node.whenFalse, contextualMapper); + let type1 = checkExpression(node.whenTrue, contextualMapper); + let type2 = checkExpression(node.whenFalse, contextualMapper); return getUnionType([type1, type2]); } @@ -7571,15 +7573,15 @@ module ts { } function checkExpressionWithContextualType(node: Expression, contextualType: Type, contextualMapper?: TypeMapper): Type { - var saveContextualType = node.contextualType; + let saveContextualType = node.contextualType; node.contextualType = contextualType; - var result = checkExpression(node, contextualMapper); + let result = checkExpression(node, contextualMapper); node.contextualType = saveContextualType; return result; } function checkExpressionCached(node: Expression, contextualMapper?: TypeMapper): Type { - var links = getNodeLinks(node); + let links = getNodeLinks(node); if (!links.resolvedType) { links.resolvedType = checkExpression(node, contextualMapper); } @@ -7608,17 +7610,17 @@ module ts { checkComputedPropertyName(node.name); } - var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + let uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } function instantiateTypeWithSingleGenericCallSignature(node: Expression | MethodDeclaration, type: Type, contextualMapper?: TypeMapper) { if (contextualMapper && contextualMapper !== identityMapper) { - var signature = getSingleCallSignature(type); + let signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { - var contextualType = getContextualType(node); + let contextualType = getContextualType(node); if (contextualType) { - var contextualSignature = getSingleCallSignature(contextualType); + let contextualSignature = getSingleCallSignature(contextualType); if (contextualSignature && !contextualSignature.typeParameters) { return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper)); } @@ -7641,12 +7643,12 @@ module ts { // have the wildcard function type; this form of type check is used during overload resolution to exclude // contextually typed function and arrow expressions in the initial phase. function checkExpressionOrQualifiedName(node: Expression | QualifiedName, contextualMapper?: TypeMapper): Type { - var type: Type; + let type: Type; if (node.kind == SyntaxKind.QualifiedName) { type = checkQualifiedName(node); } else { - var uninstantiatedType = checkExpressionWorker(node, contextualMapper); + let uninstantiatedType = checkExpressionWorker(node, contextualMapper); type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } @@ -7655,7 +7657,7 @@ module ts { // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = + let ok = (node.parent.kind === SyntaxKind.PropertyAccessExpression && (node.parent).expression === node) || (node.parent.kind === SyntaxKind.ElementAccessExpression && (node.parent).expression === node) || ((node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName) && isInRightSideOfImportOrExportAssignment(node)); @@ -7768,7 +7770,7 @@ module ts { checkGrammarModifiers(node) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); checkVariableLikeDeclaration(node); - var func = getContainingFunction(node); + let func = getContainingFunction(node); if (node.flags & NodeFlags.AccessibilityModifier) { func = getContainingFunction(node); if (!(func.kind === SyntaxKind.Constructor && nodeIsPresent(func.body))) { @@ -7824,7 +7826,7 @@ module ts { function checkTypeForDuplicateIndexSignatures(node: Node) { if (node.kind === SyntaxKind.InterfaceDeclaration) { - var nodeSymbol = getSymbolOfNode(node); + let nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { @@ -7835,12 +7837,12 @@ module ts { // TypeScript 1.0 spec (April 2014) // 3.7.4: An object type can contain at most one string index signature and one numeric index signature. // 8.5: A class declaration can have at most one string index member declaration and one numeric index member declaration - var indexSymbol = getIndexSymbol(getSymbolOfNode(node)); + let indexSymbol = getIndexSymbol(getSymbolOfNode(node)); if (indexSymbol) { - var seenNumericIndexer = false; - var seenStringIndexer = false; + let seenNumericIndexer = false; + let seenStringIndexer = false; for (let decl of indexSymbol.declarations) { - var declaration = decl; + let declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { case SyntaxKind.StringKeyword: @@ -7888,8 +7890,8 @@ module ts { checkSourceElement(node.body); - var symbol = getSymbolOfNode(node); - var firstDeclaration = getDeclarationOfKind(symbol, node.kind); + let symbol = getSymbolOfNode(node); + let firstDeclaration = getDeclarationOfKind(symbol, node.kind); // Only type check the symbol once if (node === firstDeclaration) { checkFunctionOrConstructorSymbol(symbol); @@ -7946,12 +7948,12 @@ module ts { // - The containing class is a derived class. // - The constructor declares parameter properties // or the containing class declares instance member variables with initializers. - var superCallShouldBeFirst = + let superCallShouldBeFirst = forEach((node.parent).members, isInstancePropertyWithInitializer) || forEach(node.parameters, p => p.flags & (NodeFlags.Public | NodeFlags.Private | NodeFlags.Protected)); if (superCallShouldBeFirst) { - var statements = (node.body).statements; + let statements = (node.body).statements; if (!statements.length || statements[0].kind !== SyntaxKind.ExpressionStatement || !isSuperCallExpression((statements[0]).expression)) { error(node, Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } @@ -7981,15 +7983,15 @@ module ts { if (!hasDynamicName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. - var otherKind = node.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor; - var otherAccessor = getDeclarationOfKind(node.symbol, otherKind); + let otherKind = node.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor; + let otherAccessor = getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & NodeFlags.AccessibilityModifier) !== (otherAccessor.flags & NodeFlags.AccessibilityModifier))) { error(node.name, Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } - var currentAccessorType = getAnnotatedAccessorType(node); - var otherAccessorType = getAnnotatedAccessorType(otherAccessor); + let currentAccessorType = getAnnotatedAccessorType(node); + let otherAccessorType = getAnnotatedAccessorType(otherAccessor); // TypeScript 1.0 spec (April 2014): 4.5 // If both accessors include type annotations, the specified types must be identical. if (currentAccessorType && otherAccessorType) { @@ -8010,15 +8012,15 @@ module ts { // Grammar checking checkGrammarTypeArguments(node, node.typeArguments); - var type = getTypeFromTypeReferenceNode(node); + let type = getTypeFromTypeReferenceNode(node); if (type !== unknownType && node.typeArguments) { // Do type argument local checks only if referenced type is successfully resolved - var len = node.typeArguments.length; - for (var i = 0; i < len; i++) { + let len = node.typeArguments.length; + for (let i = 0; i < len; i++) { checkSourceElement(node.typeArguments[i]); - var constraint = getConstraintOfTypeParameter((type).target.typeParameters[i]); + let constraint = getConstraintOfTypeParameter((type).target.typeParameters[i]); if (produceDiagnostics && constraint) { - var typeArgument = (type).typeArguments[i]; + let typeArgument = (type).typeArguments[i]; checkTypeAssignableTo(typeArgument, constraint, node, Diagnostics.Type_0_does_not_satisfy_the_constraint_1); } } @@ -8032,7 +8034,7 @@ module ts { function checkTypeLiteral(node: TypeLiteralNode) { forEach(node.members, checkSourceElement); if (produceDiagnostics) { - var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); + let type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); checkIndexConstraints(type); checkTypeForDuplicateIndexSignatures(node); } @@ -8044,7 +8046,7 @@ module ts { function checkTupleType(node: TupleTypeNode) { // Grammar checking - var hasErrorFromDisallowedTrailingComma = checkGrammarForDisallowedTrailingComma(node.elementTypes); + let hasErrorFromDisallowedTrailingComma = checkGrammarForDisallowedTrailingComma(node.elementTypes); if (!hasErrorFromDisallowedTrailingComma && node.elementTypes.length === 0) { grammarErrorOnNode(node, Diagnostics.A_tuple_type_element_list_cannot_be_empty); } @@ -8064,7 +8066,7 @@ module ts { if (!produceDiagnostics) { return; } - var signature = getSignatureFromDeclaration(signatureDeclarationNode); + let signature = getSignatureFromDeclaration(signatureDeclarationNode); if (!signature.hasStringLiterals) { return; } @@ -8079,14 +8081,14 @@ module ts { // TypeScript 1.0 spec (April 2014): 3.7.2.4 // Every specialized call or construct signature in an object type must be assignable // to at least one non-specialized call or construct signature in the same object type - var signaturesToCheck: Signature[]; + let signaturesToCheck: Signature[]; // Unnamed (call\construct) signatures in interfaces are inherited and not shadowed so examining just node symbol won't give complete answer. // Use declaring type to obtain full list of signatures. if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === SyntaxKind.InterfaceDeclaration) { Debug.assert(signatureDeclarationNode.kind === SyntaxKind.CallSignature || signatureDeclarationNode.kind === SyntaxKind.ConstructSignature); - var signatureKind = signatureDeclarationNode.kind === SyntaxKind.CallSignature ? SignatureKind.Call : SignatureKind.Construct; - var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); - var containingType = getDeclaredTypeOfSymbol(containingSymbol); + let signatureKind = signatureDeclarationNode.kind === SyntaxKind.CallSignature ? SignatureKind.Call : SignatureKind.Construct; + let containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); + let containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); } else { @@ -8103,7 +8105,7 @@ module ts { } function getEffectiveDeclarationFlags(n: Node, flagsToCheck: NodeFlags) { - var flags = getCombinedNodeFlags(n); + let flags = getCombinedNodeFlags(n); if (n.parent.kind !== SyntaxKind.InterfaceDeclaration && isInAmbientContext(n)) { if (!(flags & NodeFlags.Ambient)) { // It is nested in an ambient context, which means it is automatically exported @@ -8126,19 +8128,19 @@ module ts { // The caveat is that if some overloads are defined in lib.d.ts, we don't want to // report the errors on those. To achieve this, we will say that the implementation is // the canonical signature only if it is in the same container as the first overload - var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent; + let implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent; return implementationSharesContainerWithFirstOverload ? implementation : overloads[0]; } function checkFlagAgreementBetweenOverloads(overloads: Declaration[], implementation: FunctionLikeDeclaration, flagsToCheck: NodeFlags, someOverloadFlags: NodeFlags, allOverloadFlags: NodeFlags): void { // Error if some overloads have a flag that is not shared by all overloads. To find the // deviations, we XOR someOverloadFlags with allOverloadFlags - var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags; + let someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags; if (someButNotAllOverloadFlags !== 0) { - var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); + let canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); forEach(overloads, o => { - var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; + let deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; if (deviation & NodeFlags.Export) { error(o.name, Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported); } @@ -8154,9 +8156,9 @@ module ts { function checkQuestionTokenAgreementBetweenOverloads(overloads: Declaration[], implementation: FunctionLikeDeclaration, someHaveQuestionToken: boolean, allHaveQuestionToken: boolean): void { if (someHaveQuestionToken !== allHaveQuestionToken) { - var canonicalHasQuestionToken = hasQuestionToken(getCanonicalOverload(overloads, implementation)); + let canonicalHasQuestionToken = hasQuestionToken(getCanonicalOverload(overloads, implementation)); forEach(overloads, o => { - var deviation = hasQuestionToken(o) !== canonicalHasQuestionToken; + let deviation = hasQuestionToken(o) !== canonicalHasQuestionToken; if (deviation) { error(o.name, Diagnostics.Overload_signatures_must_all_be_optional_or_required); } @@ -8164,26 +8166,26 @@ module ts { } } - var flagsToCheck: NodeFlags = NodeFlags.Export | NodeFlags.Ambient | NodeFlags.Private | NodeFlags.Protected; - var someNodeFlags: NodeFlags = 0; - var allNodeFlags = flagsToCheck; - var someHaveQuestionToken = false; - var allHaveQuestionToken = true; - var hasOverloads = false; - var bodyDeclaration: FunctionLikeDeclaration; - var lastSeenNonAmbientDeclaration: FunctionLikeDeclaration; - var previousDeclaration: FunctionLikeDeclaration; + let flagsToCheck: NodeFlags = NodeFlags.Export | NodeFlags.Ambient | NodeFlags.Private | NodeFlags.Protected; + let someNodeFlags: NodeFlags = 0; + let allNodeFlags = flagsToCheck; + let someHaveQuestionToken = false; + let allHaveQuestionToken = true; + let hasOverloads = false; + let bodyDeclaration: FunctionLikeDeclaration; + let lastSeenNonAmbientDeclaration: FunctionLikeDeclaration; + let previousDeclaration: FunctionLikeDeclaration; - var declarations = symbol.declarations; - var isConstructor = (symbol.flags & SymbolFlags.Constructor) !== 0; + let declarations = symbol.declarations; + let isConstructor = (symbol.flags & SymbolFlags.Constructor) !== 0; function reportImplementationExpectedError(node: FunctionLikeDeclaration): void { if (node.name && getFullWidth(node.name) === 0) { return; } - var seen = false; - var subsequentNode = forEachChild(node.parent, c => { + let seen = false; + let subsequentNode = forEachChild(node.parent, c => { if (seen) { return c; } @@ -8193,13 +8195,13 @@ module ts { }); if (subsequentNode) { if (subsequentNode.kind === node.kind) { - var errorNode: Node = (subsequentNode).name || subsequentNode; + let errorNode: Node = (subsequentNode).name || subsequentNode; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && (subsequentNode).name && (node.name).text === ((subsequentNode).name).text) { // the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members Debug.assert(node.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature); Debug.assert((node.flags & NodeFlags.Static) !== (subsequentNode.flags & NodeFlags.Static)); - var diagnostic = node.flags & NodeFlags.Static ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static; + let diagnostic = node.flags & NodeFlags.Static ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static; error(errorNode, diagnostic); return; } @@ -8209,7 +8211,7 @@ module ts { } } } - var errorNode: Node = node.name || node; + let errorNode: Node = node.name || node; if (isConstructor) { error(errorNode, Diagnostics.Constructor_implementation_is_missing); } @@ -8220,13 +8222,13 @@ module ts { // when checking exported function declarations across modules check only duplicate implementations // names and consistency of modifiers are verified when we check local symbol - var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & SymbolFlags.Module; - var duplicateFunctionDeclaration = false; - var multipleConstructorImplementation = false; + let isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & SymbolFlags.Module; + let duplicateFunctionDeclaration = false; + let multipleConstructorImplementation = false; for (let current of declarations) { - var node = current; - var inAmbientContext = isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === SyntaxKind.InterfaceDeclaration || node.parent.kind === SyntaxKind.TypeLiteral || inAmbientContext; + let node = current; + let inAmbientContext = isInAmbientContext(node); + let inAmbientContextOrInterface = node.parent.kind === SyntaxKind.InterfaceDeclaration || node.parent.kind === SyntaxKind.TypeLiteral || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -8239,7 +8241,7 @@ module ts { } if (node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature || node.kind === SyntaxKind.Constructor) { - var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); + let currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; someHaveQuestionToken = someHaveQuestionToken || hasQuestionToken(node); @@ -8295,8 +8297,8 @@ module ts { checkQuestionTokenAgreementBetweenOverloads(declarations, bodyDeclaration, someHaveQuestionToken, allHaveQuestionToken); if (bodyDeclaration) { - var signatures = getSignaturesOfSymbol(symbol); - var bodySignature = getSignatureFromDeclaration(bodyDeclaration); + let signatures = getSignaturesOfSymbol(symbol); + let bodySignature = getSignatureFromDeclaration(bodyDeclaration); // If the implementation signature has string literals, we will have reported an error in // checkSpecializedSignatureDeclaration if (!bodySignature.hasStringLiterals) { @@ -8354,10 +8356,10 @@ module ts { // we use SymbolFlags.ExportValue, SymbolFlags.ExportType and SymbolFlags.ExportNamespace // to denote disjoint declarationSpaces (without making new enum type). - var exportedDeclarationSpaces: SymbolFlags = 0; - var nonExportedDeclarationSpaces: SymbolFlags = 0; + let exportedDeclarationSpaces: SymbolFlags = 0; + let nonExportedDeclarationSpaces: SymbolFlags = 0; forEach(symbol.declarations, d => { - var declarationSpaces = getDeclarationSpaces(d); + let declarationSpaces = getDeclarationSpaces(d); if (getEffectiveDeclarationFlags(d, NodeFlags.Export)) { exportedDeclarationSpaces |= declarationSpaces; } @@ -8366,7 +8368,7 @@ module ts { } }); - var commonDeclarationSpace = exportedDeclarationSpaces & nonExportedDeclarationSpaces; + let commonDeclarationSpace = exportedDeclarationSpaces & nonExportedDeclarationSpaces; if (commonDeclarationSpace) { // declaration spaces for exported and non-exported declarations intersect @@ -8389,8 +8391,8 @@ module ts { case SyntaxKind.EnumDeclaration: return SymbolFlags.ExportType | SymbolFlags.ExportValue; case SyntaxKind.ImportEqualsDeclaration: - var result: SymbolFlags = 0; - var target = resolveAlias(getSymbolOfNode(d)); + let result: SymbolFlags = 0; + let target = resolveAlias(getSymbolOfNode(d)); forEach(target.declarations, d => { result |= getDeclarationSpaces(d); }); return result; default: @@ -8428,10 +8430,10 @@ module ts { // first we want to check the local symbol that contain this declaration // - if node.localSymbol !== undefined - this is current declaration is exported and localSymbol points to the local symbol // - if node.localSymbol === undefined - this node is non-exported so we can just pick the result of getSymbolOfNode - var symbol = getSymbolOfNode(node); - var localSymbol = node.localSymbol || symbol; + let symbol = getSymbolOfNode(node); + let localSymbol = node.localSymbol || symbol; - var firstDeclaration = getDeclarationOfKind(localSymbol, node.kind); + let firstDeclaration = getDeclarationOfKind(localSymbol, node.kind); // Only type check the symbol once if (node === firstDeclaration) { checkFunctionOrConstructorSymbol(localSymbol); @@ -8503,7 +8505,7 @@ module ts { return false; } - var root = getRootDeclaration(node); + let root = getRootDeclaration(node); if (root.kind === SyntaxKind.Parameter && nodeIsMissing((root.parent).body)) { // just an overload - no codegen impact return false; @@ -8520,10 +8522,10 @@ module ts { // this function will run after checking the source file so 'CaptureThis' is correct for all nodes function checkIfThisIsCapturedInEnclosingScope(node: Node): void { - var current = node; + let current = node; while (current) { if (getNodeCheckFlags(current) & NodeCheckFlags.CaptureThis) { - var isDeclaration = node.kind !== SyntaxKind.Identifier; + let isDeclaration = node.kind !== SyntaxKind.Identifier; if (isDeclaration) { error((node).name, Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -8542,14 +8544,14 @@ module ts { } // bubble up and find containing type - var enclosingClass = getAncestor(node, SyntaxKind.ClassDeclaration); + let enclosingClass = getAncestor(node, SyntaxKind.ClassDeclaration); // if containing type was not found or it is ambient - exit (no codegen) if (!enclosingClass || isInAmbientContext(enclosingClass)) { return; } if (getClassBaseTypeNode(enclosingClass)) { - var isDeclaration = node.kind !== SyntaxKind.Identifier; + let isDeclaration = node.kind !== SyntaxKind.Identifier; if (isDeclaration) { error(node, Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -8570,7 +8572,7 @@ module ts { } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent - var parent = getDeclarationContainer(node); + let parent = getDeclarationContainer(node); if (parent.kind === SyntaxKind.SourceFile && isExternalModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, @@ -8593,33 +8595,33 @@ module ts { // A non-initialized declaration is a no-op as the block declaration will resolve before the var // declaration. the problem is if the declaration has an initializer. this will act as a write to the // block declared value. this is fine for let, but not const. - // Only consider declarations with initializers, uninitialized var declarations will not + // Only consider declarations with initializers, uninitialized let declarations will not // step on a let/const variable. // Do not consider let and const declarations, as duplicate block-scoped declarations // are handled by the binder. - // We are only looking for var declarations that step on let\const declarations from a + // We are only looking for let declarations that step on let\const declarations from a // different scope. e.g.: // { // const x = 0; // localDeclarationSymbol obtained after name resolution will correspond to this declaration - // var x = 0; // symbol for this declaration will be 'symbol' + // let x = 0; // symbol for this declaration will be 'symbol' // } if (node.initializer && (getCombinedNodeFlags(node) & NodeFlags.BlockScoped) === 0) { - var symbol = getSymbolOfNode(node); + let symbol = getSymbolOfNode(node); if (symbol.flags & SymbolFlags.FunctionScopedVariable) { - var localDeclarationSymbol = resolveName(node, (node.name).text, SymbolFlags.Variable, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined); + let localDeclarationSymbol = resolveName(node, (node.name).text, SymbolFlags.Variable, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined); if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & SymbolFlags.BlockScopedVariable) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & NodeFlags.BlockScoped) { - var varDeclList = getAncestor(localDeclarationSymbol.valueDeclaration, SyntaxKind.VariableDeclarationList); - var container = + let varDeclList = getAncestor(localDeclarationSymbol.valueDeclaration, SyntaxKind.VariableDeclarationList); + let container = varDeclList.parent.kind === SyntaxKind.VariableStatement && varDeclList.parent.parent; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) - var namesShareScope = + let namesShareScope = container && (container.kind === SyntaxKind.Block && isFunctionLike(container.parent) || (container.kind === SyntaxKind.ModuleBlock && container.kind === SyntaxKind.ModuleDeclaration) || @@ -8630,7 +8632,7 @@ module ts { // otherwise if variable has an initializer - show error that initialization will fail // since LHS will be block scoped name instead of function scoped if (!namesShareScope) { - var name = symbolToString(localDeclarationSymbol); + let name = symbolToString(localDeclarationSymbol); error(node, Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); } } @@ -8654,7 +8656,7 @@ module ts { } function visit(n: Node) { if (n.kind === SyntaxKind.Identifier) { - var referencedSymbol = getNodeLinks(n).resolvedSymbol; + let referencedSymbol = getNodeLinks(n).resolvedSymbol; // check FunctionLikeDeclaration.locals (stores parameters\function local variable) // if it contains entry with a specified name and if this entry matches the resolved symbol if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, SymbolFlags.Value) === referencedSymbol) { @@ -8708,8 +8710,8 @@ module ts { } return; } - var symbol = getSymbolOfNode(node); - var type = getTypeOfVariableOrParameterOrProperty(symbol); + let symbol = getSymbolOfNode(node); + let type = getTypeOfVariableOrParameterOrProperty(symbol); if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer if (node.initializer) { @@ -8720,7 +8722,7 @@ module ts { else { // Node is a secondary declaration, check that type is identical to primary declaration and check that // initializer is consistent with type associated with the node - var declarationType = getWidenedTypeForVariableLikeDeclaration(node); + let declarationType = getWidenedTypeForVariableLikeDeclaration(node); if (type !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(type, declarationType)) { error(node.name, Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, declarationNameToString(node.name), typeToString(type), typeToString(declarationType)); } @@ -8841,8 +8843,8 @@ module ts { checkForInOrForOfVariableDeclaration(node); } else { - var varExpr = node.initializer; - var iteratedType = checkRightHandSideOfForOf(node.expression); + let varExpr = node.initializer; + let iteratedType = checkRightHandSideOfForOf(node.expression); // There may be a destructuring assignment on the left side if (varExpr.kind === SyntaxKind.ArrayLiteralExpression || varExpr.kind === SyntaxKind.ObjectLiteralExpression) { @@ -8852,7 +8854,7 @@ module ts { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { - var leftType = checkExpression(varExpr); + let leftType = checkExpression(varExpr); checkReferenceExpression(varExpr, /*invalidReferenceMessage*/ Diagnostics.Invalid_left_hand_side_in_for_of_statement, /*constantVariableMessage*/ Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant); @@ -8875,11 +8877,11 @@ module ts { // TypeScript 1.0 spec (April 2014): 5.4 // In a 'for-in' statement of the form - // for (var VarDecl in Expr) Statement + // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { - var variable = (node.initializer).declarations[0]; + let variable = (node.initializer).declarations[0]; if (variable && isBindingPattern(variable.name)) { error(variable.name, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } @@ -8891,8 +8893,8 @@ module ts { // for (Var in Expr) Statement // Var must be an expression classified as a reference of type Any or the String primitive type, // and Expr must be an expression of type Any, an object type, or a type parameter type. - var varExpr = node.initializer; - var leftType = checkExpression(varExpr); + let varExpr = node.initializer; + let leftType = checkExpression(varExpr); if (varExpr.kind === SyntaxKind.ArrayLiteralExpression || varExpr.kind === SyntaxKind.ObjectLiteralExpression) { error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } @@ -8905,7 +8907,7 @@ module ts { } } - var rightType = checkExpression(node.expression); + let rightType = checkExpression(node.expression); // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one if (!allConstituentTypesHaveKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { @@ -8916,16 +8918,16 @@ module ts { } function checkForInOrForOfVariableDeclaration(iterationStatement: ForInStatement | ForOfStatement): void { - var variableDeclarationList = iterationStatement.initializer; + let variableDeclarationList = iterationStatement.initializer; // checkGrammarForInOrForOfStatement will check that there is exactly one declaration. if (variableDeclarationList.declarations.length >= 1) { - var decl = variableDeclarationList.declarations[0]; + let decl = variableDeclarationList.declarations[0]; checkVariableDeclaration(decl); } } function checkRightHandSideOfForOf(rhsExpression: Expression): Type { - var expressionType = getTypeOfExpression(rhsExpression); + let expressionType = getTypeOfExpression(rhsExpression); return languageVersion >= ScriptTarget.ES6 ? checkIteratedType(expressionType, rhsExpression) : checkElementTypeOfArrayOrString(expressionType, rhsExpression); @@ -8936,11 +8938,11 @@ module ts { */ function checkIteratedType(iterable: Type, expressionForError: Expression): Type { Debug.assert(languageVersion >= ScriptTarget.ES6); - var iteratedType = getIteratedType(iterable, expressionForError); + let iteratedType = getIteratedType(iterable, expressionForError); // Now even though we have extracted the iteratedType, we will have to validate that the type // passed in is actually an Iterable. if (expressionForError && iteratedType) { - var completeIterableType = globalIterableType !== emptyObjectType + let completeIterableType = globalIterableType !== emptyObjectType ? createTypeReference(globalIterableType, [iteratedType]) : emptyObjectType; checkTypeAssignableTo(iterable, completeIterableType, expressionForError); @@ -8979,12 +8981,12 @@ module ts { return undefined; } - var iteratorFunction = getTypeOfPropertyOfType(iterable, getPropertyNameForKnownSymbolName("iterator")); + let iteratorFunction = getTypeOfPropertyOfType(iterable, getPropertyNameForKnownSymbolName("iterator")); if (iteratorFunction && allConstituentTypesHaveKind(iteratorFunction, TypeFlags.Any)) { return undefined; } - var iteratorFunctionSignatures = iteratorFunction ? getSignaturesOfType(iteratorFunction, SignatureKind.Call) : emptyArray; + let iteratorFunctionSignatures = iteratorFunction ? getSignaturesOfType(iteratorFunction, SignatureKind.Call) : emptyArray; if (iteratorFunctionSignatures.length === 0) { if (expressionForError) { error(expressionForError, Diagnostics.The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator); @@ -8992,17 +8994,17 @@ module ts { return undefined; } - var iterator = getUnionType(map(iteratorFunctionSignatures, getReturnTypeOfSignature)); + let iterator = getUnionType(map(iteratorFunctionSignatures, getReturnTypeOfSignature)); if (allConstituentTypesHaveKind(iterator, TypeFlags.Any)) { return undefined; } - var iteratorNextFunction = getTypeOfPropertyOfType(iterator, "next"); + let iteratorNextFunction = getTypeOfPropertyOfType(iterator, "next"); if (iteratorNextFunction && allConstituentTypesHaveKind(iteratorNextFunction, TypeFlags.Any)) { return undefined; } - var iteratorNextFunctionSignatures = iteratorNextFunction ? getSignaturesOfType(iteratorNextFunction, SignatureKind.Call) : emptyArray; + let iteratorNextFunctionSignatures = iteratorNextFunction ? getSignaturesOfType(iteratorNextFunction, SignatureKind.Call) : emptyArray; if (iteratorNextFunctionSignatures.length === 0) { if (expressionForError) { error(expressionForError, Diagnostics.The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method); @@ -9010,12 +9012,12 @@ module ts { return undefined; } - var iteratorNextResult = getUnionType(map(iteratorNextFunctionSignatures, getReturnTypeOfSignature)); + let iteratorNextResult = getUnionType(map(iteratorNextFunctionSignatures, getReturnTypeOfSignature)); if (allConstituentTypesHaveKind(iteratorNextResult, TypeFlags.Any)) { return undefined; } - var iteratorNextValue = getTypeOfPropertyOfType(iteratorNextResult, "value"); + let iteratorNextValue = getTypeOfPropertyOfType(iteratorNextResult, "value"); if (!iteratorNextValue) { if (expressionForError) { error(expressionForError, Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property); @@ -9049,10 +9051,10 @@ module ts { // After we remove all types that are StringLike, we will know if there was a string constituent // based on whether the remaining type is the same as the initial type. - var arrayType = removeTypesFromUnionType(arrayOrStringType, TypeFlags.StringLike, /*isTypeOfKind*/ true, /*allowEmptyUnionResult*/ true); - var hasStringConstituent = arrayOrStringType !== arrayType; + let arrayType = removeTypesFromUnionType(arrayOrStringType, TypeFlags.StringLike, /*isTypeOfKind*/ true, /*allowEmptyUnionResult*/ true); + let hasStringConstituent = arrayOrStringType !== arrayType; - var reportedError = false; + let reportedError = false; if (hasStringConstituent) { if (languageVersion < ScriptTarget.ES5) { error(expressionForError, Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher); @@ -9072,7 +9074,7 @@ module ts { // if the input type is number | string, we want to say that number is not an array type. // But if the input was just number, we want to say that number is not an array type // or a string type. - var diagnostic = hasStringConstituent + let diagnostic = hasStringConstituent ? Diagnostics.Type_0_is_not_an_array_type : Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; error(expressionForError, diagnostic, typeToString(arrayType)); @@ -9080,7 +9082,7 @@ module ts { return hasStringConstituent ? stringType : unknownType; } - var arrayElementType = getIndexTypeOfType(arrayType, IndexKind.Number) || unknownType; + let arrayElementType = getIndexTypeOfType(arrayType, IndexKind.Number) || unknownType; if (hasStringConstituent) { // This is just an optimization for the case where arrayOrStringType is string | string[] if (arrayElementType.flags & TypeFlags.StringLike) { @@ -9107,17 +9109,17 @@ module ts { function checkReturnStatement(node: ReturnStatement) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - var functionBlock = getContainingFunction(node); + let functionBlock = getContainingFunction(node); if (!functionBlock) { grammarErrorOnFirstToken(node, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); } } if (node.expression) { - var func = getContainingFunction(node); + let func = getContainingFunction(node); if (func) { - var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); - var exprType = checkExpressionCached(node.expression); + let returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + let exprType = checkExpressionCached(node.expression); if (func.kind === SyntaxKind.SetAccessor) { error(node.expression, Diagnostics.Setters_cannot_return_a_value); } @@ -9151,10 +9153,10 @@ module ts { // Grammar checking checkGrammarStatementInAmbientContext(node); - var firstDefaultClause: CaseOrDefaultClause; - var hasDuplicateDefaultClause = false; + let firstDefaultClause: CaseOrDefaultClause; + let hasDuplicateDefaultClause = false; - var expressionType = checkExpression(node.expression); + let expressionType = checkExpression(node.expression); forEach(node.caseBlock.clauses, clause => { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause if (clause.kind === SyntaxKind.DefaultClause && !hasDuplicateDefaultClause) { @@ -9162,19 +9164,19 @@ module ts { firstDefaultClause = clause; } else { - var sourceFile = getSourceFileOfNode(node); - var start = skipTrivia(sourceFile.text, clause.pos); - var end = clause.statements.length > 0 ? clause.statements[0].pos : clause.end; + let sourceFile = getSourceFileOfNode(node); + let start = skipTrivia(sourceFile.text, clause.pos); + let end = clause.statements.length > 0 ? clause.statements[0].pos : clause.end; grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement); hasDuplicateDefaultClause = true; } } if (produceDiagnostics && clause.kind === SyntaxKind.CaseClause) { - var caseClause = clause; + let caseClause = clause; // TypeScript 1.0 spec (April 2014):5.9 // In a 'switch' statement, each 'case' expression must be of a type that is assignable to or from the type of the 'switch' expression. - var caseType = checkExpression(caseClause.expression); + let caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { // check 'expressionType isAssignableTo caseType' failed, try the reversed check and report errors if it fails checkTypeAssignableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); @@ -9187,13 +9189,13 @@ module ts { function checkLabeledStatement(node: LabeledStatement) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - var current = node.parent; + let current = node.parent; while (current) { if (isFunctionLike(current)) { break; } if (current.kind === SyntaxKind.LabeledStatement && (current).label.text === node.label.text) { - var sourceFile = getSourceFileOfNode(node); + let sourceFile = getSourceFileOfNode(node); grammarErrorOnNode(node.label, Diagnostics.Duplicate_label_0, getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; } @@ -9223,7 +9225,7 @@ module ts { checkGrammarStatementInAmbientContext(node); checkBlock(node.tryBlock); - var catchClause = node.catchClause; + let catchClause = node.catchClause; if (catchClause) { // Grammar checking if (catchClause.variableDeclaration) { @@ -9237,10 +9239,10 @@ module ts { grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, Diagnostics.Catch_clause_variable_cannot_have_an_initializer); } else { - var identifierName = (catchClause.variableDeclaration.name).text; - var locals = catchClause.block.locals; + let identifierName = (catchClause.variableDeclaration.name).text; + let locals = catchClause.block.locals; if (locals && hasProperty(locals, identifierName)) { - var localSymbol = locals[identifierName] + let localSymbol = locals[identifierName] if (localSymbol && (localSymbol.flags & SymbolFlags.BlockScopedVariable) !== 0) { grammarErrorOnNode(localSymbol.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, identifierName); } @@ -9261,27 +9263,27 @@ module ts { } function checkIndexConstraints(type: Type) { - var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, IndexKind.Number); - var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, IndexKind.String); + let declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, IndexKind.Number); + let declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, IndexKind.String); - var stringIndexType = getIndexTypeOfType(type, IndexKind.String); - var numberIndexType = getIndexTypeOfType(type, IndexKind.Number); + let stringIndexType = getIndexTypeOfType(type, IndexKind.String); + let numberIndexType = getIndexTypeOfType(type, IndexKind.Number); if (stringIndexType || numberIndexType) { forEach(getPropertiesOfObjectType(type), prop => { - var propType = getTypeOfSymbol(prop); + let propType = getTypeOfSymbol(prop); checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, IndexKind.String); checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, IndexKind.Number); }); if (type.flags & TypeFlags.Class && type.symbol.valueDeclaration.kind === SyntaxKind.ClassDeclaration) { - var classDeclaration = type.symbol.valueDeclaration; + let classDeclaration = type.symbol.valueDeclaration; for (let member of classDeclaration.members) { // Only process instance properties with computed names here. // Static properties cannot be in conflict with indexers, // and properties with literal names were already checked. if (!(member.flags & NodeFlags.Static) && hasDynamicName(member)) { - var propType = getTypeOfSymbol(member.symbol); + let propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, IndexKind.String); checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, IndexKind.Number); } @@ -9289,12 +9291,12 @@ module ts { } } - var errorNode: Node; + let errorNode: Node; if (stringIndexType && numberIndexType) { errorNode = declaredNumberIndexer || declaredStringIndexer; // condition 'errorNode === undefined' may appear if types does not declare nor string neither number indexer if (!errorNode && (type.flags & TypeFlags.Interface)) { - var someBaseTypeHasBothIndexers = forEach((type).baseTypes, base => getIndexTypeOfType(base, IndexKind.String) && getIndexTypeOfType(base, IndexKind.Number)); + let someBaseTypeHasBothIndexers = forEach((type).baseTypes, base => getIndexTypeOfType(base, IndexKind.String) && getIndexTypeOfType(base, IndexKind.Number)); errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; } } @@ -9323,7 +9325,7 @@ module ts { // perform property check if property or indexer is declared in 'type' // this allows to rule out cases when both property and indexer are inherited from the base class - var errorNode: Node; + let errorNode: Node; if (prop.valueDeclaration.name.kind === SyntaxKind.ComputedPropertyName || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } @@ -9334,12 +9336,12 @@ module ts { // for interfaces property and indexer might be inherited from different bases // check if any base class already has both property and indexer. // check should be performed only if 'type' is the first type that brings property\indexer together - var someBaseClassHasBothPropertyAndIndexer = forEach((containingType).baseTypes, base => getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind)); + let someBaseClassHasBothPropertyAndIndexer = forEach((containingType).baseTypes, base => getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind)); errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { - var errorMessage = + let errorMessage = indexKind === IndexKind.String ? Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; @@ -9366,7 +9368,7 @@ module ts { function checkTypeParameters(typeParameterDeclarations: TypeParameterDeclaration[]) { if (typeParameterDeclarations) { for (let i = 0, n = typeParameterDeclarations.length; i < n; i++) { - var node = typeParameterDeclarations[i]; + let node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { @@ -9391,19 +9393,19 @@ module ts { } checkTypeParameters(node.typeParameters); checkExportsOnMergedDeclarations(node); - var symbol = getSymbolOfNode(node); - var type = getDeclaredTypeOfSymbol(symbol); - var staticType = getTypeOfSymbol(symbol); - var baseTypeNode = getClassBaseTypeNode(node); + let symbol = getSymbolOfNode(node); + let type = getDeclaredTypeOfSymbol(symbol); + let staticType = getTypeOfSymbol(symbol); + let baseTypeNode = getClassBaseTypeNode(node); if (baseTypeNode) { emitExtends = emitExtends || !isInAmbientContext(node); checkTypeReference(baseTypeNode); } if (type.baseTypes.length) { if (produceDiagnostics) { - var baseType = type.baseTypes[0]; + let baseType = type.baseTypes[0]; checkTypeAssignableTo(type, baseType, node.name || node, Diagnostics.Class_0_incorrectly_extends_base_class_1); - var staticBaseType = getTypeOfSymbol(baseType.symbol); + let staticBaseType = getTypeOfSymbol(baseType.symbol); checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name || node, Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); if (baseType.symbol !== resolveEntityName(baseTypeNode.typeName, SymbolFlags.Value)) { @@ -9417,14 +9419,14 @@ module ts { checkExpressionOrQualifiedName(baseTypeNode.typeName); } - var implementedTypeNodes = getClassImplementedTypeNodes(node); + let implementedTypeNodes = getClassImplementedTypeNodes(node); if (implementedTypeNodes) { forEach(implementedTypeNodes, typeRefNode => { checkTypeReference(typeRefNode); if (produceDiagnostics) { - var t = getTypeFromTypeReferenceNode(typeRefNode); + let t = getTypeFromTypeReferenceNode(typeRefNode); if (t !== unknownType) { - var declaredType = (t.flags & TypeFlags.Reference) ? (t).target : t; + let declaredType = (t.flags & TypeFlags.Reference) ? (t).target : t; if (declaredType.flags & (TypeFlags.Class | TypeFlags.Interface)) { checkTypeAssignableTo(type, t, node.name || node, Diagnostics.Class_0_incorrectly_implements_interface_1); } @@ -9466,18 +9468,18 @@ module ts { // derived class instance member variables and accessors, but not by other kinds of members. // NOTE: assignability is checked in checkClassDeclaration - var baseProperties = getPropertiesOfObjectType(baseType); + let baseProperties = getPropertiesOfObjectType(baseType); for (let baseProperty of baseProperties) { - var base = getTargetSymbol(baseProperty); + let base = getTargetSymbol(baseProperty); if (base.flags & SymbolFlags.Prototype) { continue; } - var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); + let derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); if (derived) { - var baseDeclarationFlags = getDeclarationFlagsFromSymbol(base); - var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); + let baseDeclarationFlags = getDeclarationFlagsFromSymbol(base); + let derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); if ((baseDeclarationFlags & NodeFlags.Private) || (derivedDeclarationFlags & NodeFlags.Private)) { // either base or derived property is private - not override, skip it continue; @@ -9493,7 +9495,7 @@ module ts { continue; } - var errorMessage: DiagnosticMessage; + let errorMessage: DiagnosticMessage; if (base.flags & SymbolFlags.Method) { if (derived.flags & SymbolFlags.Accessor) { errorMessage = Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; @@ -9532,9 +9534,9 @@ module ts { // TypeScript 1.0 spec (April 2014): // When a generic interface has multiple declarations, all declarations must have identical type parameter // lists, i.e. identical type parameter names with identical constraints in identical order. - for (var i = 0, len = list1.length; i < len; i++) { - var tp1 = list1[i]; - var tp2 = list2[i]; + for (let i = 0, len = list1.length; i < len; i++) { + let tp1 = list1[i]; + let tp2 = list2[i]; if (tp1.name.text !== tp2.name.text) { return false; } @@ -9556,26 +9558,26 @@ module ts { return true; } - var seen: Map<{ prop: Symbol; containingType: Type }> = {}; + let seen: Map<{ prop: Symbol; containingType: Type }> = {}; forEach(type.declaredProperties, p => { seen[p.name] = { prop: p, containingType: type }; }); - var ok = true; + let ok = true; for (let base of type.baseTypes) { - var properties = getPropertiesOfObjectType(base); + let properties = getPropertiesOfObjectType(base); for (let prop of properties) { if (!hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, containingType: base }; } else { - var existing = seen[prop.name]; - var isInheritedProperty = existing.containingType !== type; + let existing = seen[prop.name]; + let isInheritedProperty = existing.containingType !== type; if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) { ok = false; - var typeName1 = typeToString(existing.containingType); - var typeName2 = typeToString(base); + let typeName1 = typeToString(existing.containingType); + let typeName2 = typeToString(base); - var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); + let errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); diagnostics.add(createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); } @@ -9595,8 +9597,8 @@ module ts { checkTypeNameIsReserved(node.name, Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); - var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = getDeclarationOfKind(symbol, SyntaxKind.InterfaceDeclaration); + let symbol = getSymbolOfNode(node); + let firstInterfaceDecl = getDeclarationOfKind(symbol, SyntaxKind.InterfaceDeclaration); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -9605,7 +9607,7 @@ module ts { // Only check this symbol once if (node === firstInterfaceDecl) { - var type = getDeclaredTypeOfSymbol(symbol); + let type = getDeclaredTypeOfSymbol(symbol); // run subsequent checks only if first set succeeded if (checkInheritedPropertiesAreIdentical(type, node.name)) { forEach(type.baseTypes, baseType => { @@ -9632,20 +9634,20 @@ module ts { } function computeEnumMemberValues(node: EnumDeclaration) { - var nodeLinks = getNodeLinks(node); + let nodeLinks = getNodeLinks(node); if (!(nodeLinks.flags & NodeCheckFlags.EnumValuesComputed)) { - var enumSymbol = getSymbolOfNode(node); - var enumType = getDeclaredTypeOfSymbol(enumSymbol); - var autoValue = 0; - var ambient = isInAmbientContext(node); - var enumIsConst = isConst(node); + let enumSymbol = getSymbolOfNode(node); + let enumType = getDeclaredTypeOfSymbol(enumSymbol); + let autoValue = 0; + let ambient = isInAmbientContext(node); + let enumIsConst = isConst(node); forEach(node.members, member => { if (member.name.kind !== SyntaxKind.ComputedPropertyName && isNumericLiteralName((member.name).text)) { error(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name); } - var initializer = member.initializer; + let initializer = member.initializer; if (initializer) { autoValue = getConstantValueForEnumMemberInitializer(initializer, enumIsConst); if (autoValue === undefined) { @@ -9657,7 +9659,7 @@ module ts { // If it is a constant value (not undefined), it is syntactically constrained to be a number. // Also, we do not need to check this for ambients because there is already // a syntax error if it is not a constant. - checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, /*headMessage*/ undefined); + checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, /*headMessage*/ undefined); } } else if (enumIsConst) { @@ -9688,7 +9690,7 @@ module ts { function evalConstant(e: Node): number { switch (e.kind) { case SyntaxKind.PrefixUnaryExpression: - var value = evalConstant((e).operand); + let value = evalConstant((e).operand); if (value === undefined) { return undefined; } @@ -9703,11 +9705,11 @@ module ts { return undefined; } - var left = evalConstant((e).left); + let left = evalConstant((e).left); if (left === undefined) { return undefined; } - var right = evalConstant((e).right); + let right = evalConstant((e).right); if (right === undefined) { return undefined; } @@ -9736,10 +9738,10 @@ module ts { return undefined; } - var member = initializer.parent; - var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); - var enumType: Type; - var propertyName: string; + let member = initializer.parent; + let currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); + let enumType: Type; + let propertyName: string; if (e.kind === SyntaxKind.Identifier) { // unqualified names can refer to member that reside in different declaration of the enum so just doing name resolution won't work. @@ -9753,11 +9755,11 @@ module ts { (e).argumentExpression.kind !== SyntaxKind.StringLiteral) { return undefined; } - var enumType = getTypeOfNode((e).expression); + enumType = getTypeOfNode((e).expression); propertyName = ((e).argumentExpression).text; } else { - var enumType = getTypeOfNode((e).expression); + enumType = getTypeOfNode((e).expression); propertyName = (e).name.text; } if (enumType !== currentType) { @@ -9768,11 +9770,11 @@ module ts { if (propertyName === undefined) { return undefined; } - var property = getPropertyOfObjectType(enumType, propertyName); + let property = getPropertyOfObjectType(enumType, propertyName); if (!property || !(property.flags & SymbolFlags.EnumMember)) { return undefined; } - var propertyDecl = property.valueDeclaration; + let propertyDecl = property.valueDeclaration; // self references are illegal if (member === propertyDecl) { return undefined; @@ -9809,11 +9811,11 @@ module ts { // for the first member. // // Only perform this check once per symbol - var enumSymbol = getSymbolOfNode(node); - var firstDeclaration = getDeclarationOfKind(enumSymbol, node.kind); + let enumSymbol = getSymbolOfNode(node); + let firstDeclaration = getDeclarationOfKind(enumSymbol, node.kind); if (node === firstDeclaration) { if (enumSymbol.declarations.length > 1) { - var enumIsConst = isConst(node); + let enumIsConst = isConst(node); // check that const is placed\omitted on all enum declarations forEach(enumSymbol.declarations, decl => { if (isConstEnumDeclaration(decl) !== enumIsConst) { @@ -9822,19 +9824,19 @@ module ts { }); } - var seenEnumMissingInitialInitializer = false; + let seenEnumMissingInitialInitializer = false; forEach(enumSymbol.declarations, declaration => { // return true if we hit a violation of the rule, false otherwise if (declaration.kind !== SyntaxKind.EnumDeclaration) { return false; } - var enumDeclaration = declaration; + let enumDeclaration = declaration; if (!enumDeclaration.members.length) { return false; } - var firstEnumMember = enumDeclaration.members[0]; + let firstEnumMember = enumDeclaration.members[0]; if (!firstEnumMember.initializer) { if (seenEnumMissingInitialInitializer) { error(firstEnumMember.name, Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element); @@ -9848,7 +9850,7 @@ module ts { } function getFirstNonAmbientClassOrFunctionDeclaration(symbol: Symbol): Declaration { - var declarations = symbol.declarations; + let declarations = symbol.declarations; for (let declaration of declarations) { if ((declaration.kind === SyntaxKind.ClassDeclaration || (declaration.kind === SyntaxKind.FunctionDeclaration && nodeIsPresent((declaration).body))) && !isInAmbientContext(declaration)) { return declaration; @@ -9869,14 +9871,14 @@ module ts { checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); - var symbol = getSymbolOfNode(node); + let symbol = getSymbolOfNode(node); // The following checks only apply on a non-ambient instantiated module declaration. if (symbol.flags & SymbolFlags.ValueModule && symbol.declarations.length > 1 && !isInAmbientContext(node) && isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { - var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); + let classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (getSourceFileOfNode(node) !== getSourceFileOfNode(classOrFunc)) { error(node.name, Diagnostics.A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); @@ -9908,12 +9910,12 @@ module ts { } function checkExternalImportOrExportDeclaration(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): boolean { - var moduleName = getExternalModuleName(node); + let moduleName = getExternalModuleName(node); if (getFullWidth(moduleName) !== 0 && moduleName.kind !== SyntaxKind.StringLiteral) { error(moduleName, Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && (node.parent.parent).name.kind === SyntaxKind.StringLiteral; + let inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && (node.parent.parent).name.kind === SyntaxKind.StringLiteral; if (node.parent.kind !== SyntaxKind.SourceFile && !inAmbientExternalModule) { error(moduleName, node.kind === SyntaxKind.ExportDeclaration ? Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : @@ -9932,15 +9934,15 @@ module ts { } function checkAliasSymbol(node: ImportEqualsDeclaration | ImportClause | NamespaceImport | ImportSpecifier | ExportSpecifier) { - var symbol = getSymbolOfNode(node); - var target = resolveAlias(symbol); + let symbol = getSymbolOfNode(node); + let target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = + let excludedMeanings = (symbol.flags & SymbolFlags.Value ? SymbolFlags.Value : 0) | (symbol.flags & SymbolFlags.Type ? SymbolFlags.Type : 0) | (symbol.flags & SymbolFlags.Namespace ? SymbolFlags.Namespace : 0); if (target.flags & excludedMeanings) { - var message = node.kind === SyntaxKind.ExportSpecifier ? + let message = node.kind === SyntaxKind.ExportSpecifier ? Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -9959,7 +9961,7 @@ module ts { grammarErrorOnFirstToken(node, Diagnostics.An_import_declaration_cannot_have_modifiers); } if (checkExternalImportOrExportDeclaration(node)) { - var importClause = node.importClause; + let importClause = node.importClause; if (importClause) { if (importClause.name) { checkImportBinding(importClause); @@ -9984,11 +9986,11 @@ module ts { markExportAsReferenced(node); } if (isInternalModuleImportEqualsDeclaration(node)) { - var target = resolveAlias(getSymbolOfNode(node)); + let target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { if (target.flags & SymbolFlags.Value) { // Target is a value symbol, check that it is not hidden by a local declaration with the same name - var moduleName = getFirstIdentifier(node.moduleReference); + let moduleName = getFirstIdentifier(node.moduleReference); if (!(resolveEntityName(moduleName, SymbolFlags.Value | SymbolFlags.Namespace).flags & SymbolFlags.Namespace)) { error(moduleName, Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, declarationNameToString(moduleName)); } @@ -10020,7 +10022,7 @@ module ts { } function checkExportAssignment(node: ExportAssignment) { - var container = node.parent.kind === SyntaxKind.SourceFile ? node.parent : node.parent.parent; + let container = node.parent.kind === SyntaxKind.SourceFile ? node.parent : node.parent.parent; if (container.kind === SyntaxKind.ModuleDeclaration && (container).name.kind === SyntaxKind.Identifier) { error(node, Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); return; @@ -10049,16 +10051,16 @@ module ts { } function hasExportedMembers(moduleSymbol: Symbol) { - var declarations = moduleSymbol.declarations; + let declarations = moduleSymbol.declarations; for (let current of declarations) { - var statements = getModuleStatements(current); + let statements = getModuleStatements(current); for (let node of statements) { if (node.kind === SyntaxKind.ExportDeclaration) { - var exportClause = (node).exportClause; + let exportClause = (node).exportClause; if (!exportClause) { return true; } - var specifiers = exportClause.elements; + let specifiers = exportClause.elements; for (let specifier of specifiers) { if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) { return true; @@ -10073,13 +10075,13 @@ module ts { } function checkExternalModuleExports(node: SourceFile | ModuleDeclaration) { - var moduleSymbol = getSymbolOfNode(node); - var links = getSymbolLinks(moduleSymbol); + let moduleSymbol = getSymbolOfNode(node); + let links = getSymbolLinks(moduleSymbol); if (!links.exportsChecked) { - var defaultSymbol = getExportAssignmentSymbol(moduleSymbol); + let defaultSymbol = getExportAssignmentSymbol(moduleSymbol); if (defaultSymbol) { if (hasExportedMembers(moduleSymbol)) { - var declaration = getDeclarationOfAliasSymbol(defaultSymbol) || defaultSymbol.valueDeclaration; + let declaration = getDeclarationOfAliasSymbol(defaultSymbol) || defaultSymbol.valueDeclaration; error(declaration, Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); } } @@ -10195,8 +10197,8 @@ module ts { // Function expression bodies are checked after all statements in the enclosing body. This is to ensure // constructs like the following are permitted: - // var foo = function () { - // var s = foo(); + // let foo = function () { + // let s = foo(); // return "hello"; // } // Here, performing a full type check of the body of the function expression whilst in the process of @@ -10285,14 +10287,14 @@ module ts { } function checkSourceFile(node: SourceFile) { - var start = new Date().getTime(); + let start = new Date().getTime(); checkSourceFileWorker(node); checkTime += new Date().getTime() - start; } // Fully type check a source file and collect the relevant diagnostics. function checkSourceFileWorker(node: SourceFile) { - var links = getNodeLinks(node); + let links = getNodeLinks(node); if (!(links.flags & NodeCheckFlags.TypeChecked)) { // Grammar checking checkGrammarSourceFile(node); @@ -10357,11 +10359,11 @@ module ts { } function getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[] { - var symbols: SymbolTable = {}; - var memberFlags: NodeFlags = 0; + let symbols: SymbolTable = {}; + let memberFlags: NodeFlags = 0; function copySymbol(symbol: Symbol, meaning: SymbolFlags) { if (symbol.flags & meaning) { - var id = symbol.name; + let id = symbol.name; if (!isReservedMemberName(id) && !hasProperty(symbols, id)) { symbols[id] = symbol; } @@ -10369,7 +10371,7 @@ module ts { } function copySymbols(source: SymbolTable, meaning: SymbolFlags) { if (meaning) { - for (var id in source) { + for (let id in source) { if (hasProperty(source, id)) { copySymbol(source[id], meaning); } @@ -10433,7 +10435,7 @@ module ts { // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(entityName: EntityName): boolean { - var node: Node = entityName; + let node: Node = entityName; while (node.parent && node.parent.kind === SyntaxKind.QualifiedName) node = node.parent; return node.parent && node.parent.kind === SyntaxKind.TypeReference; } @@ -10468,13 +10470,13 @@ module ts { // At this point, node is either a qualified name or an identifier Debug.assert(node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); - var parent = node.parent; + let parent = node.parent; if (parent.kind === SyntaxKind.TypeQuery) { return false; } // Do not recursively call isTypeNode on the parent. In the example: // - // var a: A.B.C; + // let a: A.B.C; // // Calling isTypeNode would consider the qualified name A.B a type node. Only C or // A.B.C is a type node. @@ -10571,18 +10573,18 @@ module ts { if (entityName.kind === SyntaxKind.Identifier) { // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. - var meaning: SymbolFlags = SymbolFlags.Value | SymbolFlags.Alias; + let meaning: SymbolFlags = SymbolFlags.Value | SymbolFlags.Alias; return resolveEntityName(entityName, meaning); } else if (entityName.kind === SyntaxKind.PropertyAccessExpression) { - var symbol = getNodeLinks(entityName).resolvedSymbol; + let symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } else if (entityName.kind === SyntaxKind.QualifiedName) { - var symbol = getNodeLinks(entityName).resolvedSymbol; + let symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); } @@ -10590,7 +10592,7 @@ module ts { } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === SyntaxKind.TypeReference ? SymbolFlags.Type : SymbolFlags.Namespace; + let meaning = entityName.parent.kind === SyntaxKind.TypeReference ? SymbolFlags.Type : SymbolFlags.Namespace; // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. meaning |= SymbolFlags.Alias; @@ -10626,12 +10628,12 @@ module ts { case SyntaxKind.ThisKeyword: case SyntaxKind.SuperKeyword: - var type = checkExpression(node); + let type = checkExpression(node); return type.symbol; case SyntaxKind.ConstructorKeyword: // constructor keyword for an overload, should take us to the definition if it exist - var constructorDeclaration = node.parent; + let constructorDeclaration = node.parent; if (constructorDeclaration && constructorDeclaration.kind === SyntaxKind.Constructor) { return (constructorDeclaration.parent).symbol; } @@ -10639,7 +10641,7 @@ module ts { case SyntaxKind.StringLiteral: // External module name in an import declaration - var moduleName: Expression; + let moduleName: Expression; if ((isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || ((node.parent.kind === SyntaxKind.ImportDeclaration || node.parent.kind === SyntaxKind.ExportDeclaration) && @@ -10651,9 +10653,9 @@ module ts { case SyntaxKind.NumericLiteral: // index access if (node.parent.kind == SyntaxKind.ElementAccessExpression && (node.parent).argumentExpression === node) { - var objectType = checkExpression((node.parent).expression); + let objectType = checkExpression((node.parent).expression); if (objectType === unknownType) return undefined; - var apparentType = getApparentType(objectType); + let apparentType = getApparentType(objectType); if (apparentType === unknownType) return undefined; return getPropertyOfType(apparentType, (node).text); } @@ -10688,29 +10690,29 @@ module ts { if (isTypeDeclaration(node)) { // In this case, we call getSymbolOfNode instead of getSymbolInfo because it is a declaration - var symbol = getSymbolOfNode(node); + let symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); } if (isTypeDeclarationName(node)) { - var symbol = getSymbolInfo(node); + let symbol = getSymbolInfo(node); return symbol && getDeclaredTypeOfSymbol(symbol); } if (isDeclaration(node)) { // In this case, we call getSymbolOfNode instead of getSymbolInfo because it is a declaration - var symbol = getSymbolOfNode(node); + let symbol = getSymbolOfNode(node); return getTypeOfSymbol(symbol); } if (isDeclarationName(node)) { - var symbol = getSymbolInfo(node); + let symbol = getSymbolInfo(node); return symbol && getTypeOfSymbol(symbol); } if (isInRightSideOfImportOrExportAssignment(node)) { - var symbol = getSymbolInfo(node); - var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); + let symbol = getSymbolInfo(node); + let declaredType = symbol && getDeclaredTypeOfSymbol(symbol); return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); } @@ -10728,7 +10730,7 @@ module ts { // if the type has call or construct signatures function getAugmentedPropertiesOfType(type: Type): Symbol[] { var type = getApparentType(type); - var propsByName = createSymbolTable(getPropertiesOfType(type)); + let propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, SignatureKind.Call).length || getSignaturesOfType(type, SignatureKind.Construct).length) { forEach(getPropertiesOfType(globalFunctionType), p => { if (!hasProperty(propsByName, p.name)) { @@ -10741,15 +10743,15 @@ module ts { function getRootSymbols(symbol: Symbol): Symbol[] { if (symbol.flags & SymbolFlags.UnionProperty) { - var symbols: Symbol[] = []; - var name = symbol.name; + let symbols: Symbol[] = []; + let name = symbol.name; forEach(getSymbolLinks(symbol).unionType.types, t => { symbols.push(getPropertyOfType(t, name)); }); return symbols; } else if (symbol.flags & SymbolFlags.Transient) { - var target = getSymbolLinks(symbol).target; + let target = getSymbolLinks(symbol).target; if (target) { return [target]; } @@ -10772,7 +10774,7 @@ module ts { } function isUniqueLocalName(name: string, container: Node): boolean { - for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { + for (let node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { if (node.locals && hasProperty(node.locals, name)) { // We conservatively include alias symbols to cover cases where they're emitted as locals if (node.locals[name].flags & (SymbolFlags.Value | SymbolFlags.ExportValue | SymbolFlags.Alias)) { @@ -10784,8 +10786,8 @@ module ts { } function getGeneratedNamesForSourceFile(sourceFile: SourceFile): Map { - var links = getNodeLinks(sourceFile); - var generatedNames = links.generatedNames; + let links = getNodeLinks(sourceFile); + let generatedNames = links.generatedNames; if (!generatedNames) { generatedNames = links.generatedNames = {}; generateNames(sourceFile); @@ -10826,7 +10828,7 @@ module ts { } function makeUniqueName(baseName: string): string { - var name = generateUniqueName(baseName, isExistingName); + let name = generateUniqueName(baseName, isExistingName); return generatedNames[name] = name; } @@ -10842,15 +10844,15 @@ module ts { function generateNameForModuleOrEnum(node: ModuleDeclaration | EnumDeclaration) { if (node.name.kind === SyntaxKind.Identifier) { - var name = node.name.text; + let name = node.name.text; // Use module/enum name itself if it is unique, otherwise make a unique variation assignGeneratedName(node, isUniqueLocalName(name, node) ? name : makeUniqueName(name)); } } function generateNameForImportOrExportDeclaration(node: ImportDeclaration | ExportDeclaration) { - var expr = getExternalModuleName(node); - var baseName = expr.kind === SyntaxKind.StringLiteral ? + let expr = getExternalModuleName(node); + let baseName = expr.kind === SyntaxKind.StringLiteral ? escapeIdentifier(makeIdentifierFromModuleName((expr).text)) : "module"; assignGeneratedName(node, makeUniqueName(baseName)); } @@ -10875,7 +10877,7 @@ module ts { } function getGeneratedNameForNode(node: Node) { - var links = getNodeLinks(node); + let links = getNodeLinks(node); if (!links.generatedName) { getGeneratedNamesForSourceFile(getSourceFile(node)); } @@ -10891,10 +10893,10 @@ module ts { } function getAliasNameSubstitution(symbol: Symbol): string { - var declaration = getDeclarationOfAliasSymbol(symbol); + let declaration = getDeclarationOfAliasSymbol(symbol); if (declaration && declaration.kind === SyntaxKind.ImportSpecifier) { - var moduleName = getGeneratedNameForNode(declaration.parent.parent.parent); - var propertyName = (declaration).propertyName || (declaration).name; + let moduleName = getGeneratedNameForNode(declaration.parent.parent.parent); + let propertyName = (declaration).propertyName || (declaration).name; return moduleName + "." + unescapeIdentifier(propertyName.text); } } @@ -10903,8 +10905,8 @@ module ts { if (isExternalModuleSymbol(symbol.parent)) { return "exports." + unescapeIdentifier(symbol.name); } - var node = location; - var containerSymbol = getParentOfSymbol(symbol); + let node = location; + let containerSymbol = getParentOfSymbol(symbol); while (node) { if ((node.kind === SyntaxKind.ModuleDeclaration || node.kind === SyntaxKind.EnumDeclaration) && getSymbolOfNode(node) === containerSymbol) { return getGeneratedNameForNode(node) + "." + unescapeIdentifier(symbol.name); @@ -10914,7 +10916,7 @@ module ts { } function getExpressionNameSubstitution(node: Identifier): string { - var symbol = getNodeLinks(node).resolvedSymbol; + let symbol = getNodeLinks(node).resolvedSymbol; if (symbol) { // Whan an identifier resolves to a parented symbol, it references an exported entity from // another declaration of the same internal module. @@ -10924,7 +10926,7 @@ module ts { // If we reference an exported entity within the same module declaration, then whether // we prefix depends on the kind of entity. SymbolFlags.ExportHasLocal encompasses all the // kinds that we do NOT prefix. - var exportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); + let exportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (symbol !== exportSymbol && !(exportSymbol.flags & SymbolFlags.ExportHasLocal)) { return getExportNameSubstitution(exportSymbol, node.parent); } @@ -10936,7 +10938,7 @@ module ts { } function hasExportDefaultValue(node: SourceFile): boolean { - var symbol = getResolvedExportAssignmentSymbol(getSymbolOfNode(node)); + let symbol = getResolvedExportAssignmentSymbol(getSymbolOfNode(node)); return symbol && symbol !== unknownSymbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol); } @@ -10949,7 +10951,7 @@ module ts { } function isAliasResolvedToValue(symbol: Symbol): boolean { - var target = resolveAlias(symbol); + let target = resolveAlias(symbol); // const enums and modules that contain only const enums are not considered values from the emit perespective return target !== unknownSymbol && target.flags & SymbolFlags.Value && !isConstEnumOrConstEnumOnlyModule(target); } @@ -10960,7 +10962,7 @@ module ts { function isReferencedAliasDeclaration(node: Node): boolean { if (isAliasSymbolDeclaration(node)) { - var symbol = getSymbolOfNode(node); + let symbol = getSymbolOfNode(node); if (getSymbolLinks(symbol).referenced) { return true; } @@ -10970,8 +10972,8 @@ module ts { function isImplementationOfOverload(node: FunctionLikeDeclaration) { if (nodeIsPresent(node.body)) { - var symbol = getSymbolOfNode(node); - var signaturesOfSymbol = getSignaturesOfSymbol(symbol); + let symbol = getSymbolOfNode(node); + let signaturesOfSymbol = getSignaturesOfSymbol(symbol); // If this function body corresponds to function with multiple signature, it is implementation of overload // e.g.: function foo(a: string): string; // function foo(a: number): number; @@ -11003,10 +11005,10 @@ module ts { return getEnumMemberValue(node); } - var symbol = getNodeLinks(node).resolvedSymbol; + let symbol = getNodeLinks(node).resolvedSymbol; if (symbol && (symbol.flags & SymbolFlags.EnumMember)) { - var declaration = symbol.valueDeclaration; - var constantValue: number; + let declaration = symbol.valueDeclaration; + let constantValue: number; if (declaration.kind === SyntaxKind.EnumMember) { return getEnumMemberValue(declaration); } @@ -11017,8 +11019,8 @@ module ts { function writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) { // Get type of the symbol if this is the valid symbol otherwise get type at location - var symbol = getSymbolOfNode(declaration); - var type = symbol && !(symbol.flags & (SymbolFlags.TypeLiteral | SymbolFlags.Signature)) + let symbol = getSymbolOfNode(declaration); + let type = symbol && !(symbol.flags & (SymbolFlags.TypeLiteral | SymbolFlags.Signature)) ? getTypeOfSymbol(symbol) : unknownType; @@ -11026,7 +11028,7 @@ module ts { } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) { - var signature = getSignatureFromDeclaration(signatureDeclaration); + let signature = getSignatureFromDeclaration(signatureDeclaration); getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } @@ -11052,17 +11054,17 @@ module ts { } // for names in variable declarations and binding elements try to short circuit and fetch symbol from the node - var declarationSymbol: Symbol = + let declarationSymbol: Symbol = (n.parent.kind === SyntaxKind.VariableDeclaration && (n.parent).name === n) || n.parent.kind === SyntaxKind.BindingElement ? getSymbolOfNode(n.parent) : undefined; - var symbol = declarationSymbol || + let symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, SymbolFlags.BlockScopedVariable | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); - var isLetOrConst = + let isLetOrConst = symbol && (symbol.flags & SymbolFlags.BlockScopedVariable) && symbol.valueDeclaration.parent.kind !== SyntaxKind.CatchClause; @@ -11178,14 +11180,14 @@ module ts { return; } - var lastStatic: Node, lastPrivate: Node, lastProtected: Node, lastDeclare: Node; - var flags = 0; + let lastStatic: Node, lastPrivate: Node, lastProtected: Node, lastDeclare: Node; + let flags = 0; for (let modifier of node.modifiers) { switch (modifier.kind) { case SyntaxKind.PublicKeyword: case SyntaxKind.ProtectedKeyword: case SyntaxKind.PrivateKeyword: - var text: string; + let text: string; if (modifier.kind === SyntaxKind.PublicKeyword) { text = "public"; } @@ -11283,9 +11285,9 @@ module ts { function checkGrammarForDisallowedTrailingComma(list: NodeArray): boolean { if (list && list.hasTrailingComma) { - var start = list.end - ",".length; - var end = list.end; - var sourceFile = getSourceFileOfNode(list[0]); + let start = list.end - ",".length; + let end = list.end; + let sourceFile = getSourceFileOfNode(list[0]); return grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Trailing_comma_not_allowed); } } @@ -11296,9 +11298,9 @@ module ts { } if (typeParameters && typeParameters.length === 0) { - var start = typeParameters.pos - "<".length; - var sourceFile = getSourceFileOfNode(node); - var end = skipTrivia(sourceFile.text, typeParameters.end) + ">".length; + let start = typeParameters.pos - "<".length; + let sourceFile = getSourceFileOfNode(node); + let end = skipTrivia(sourceFile.text, typeParameters.end) + ">".length; return grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Type_parameter_list_cannot_be_empty); } } @@ -11308,11 +11310,11 @@ module ts { return true; } - var seenOptionalParameter = false; - var parameterCount = parameters.length; + let seenOptionalParameter = false; + let parameterCount = parameters.length; - for (var i = 0; i < parameterCount; i++) { - var parameter = parameters[i]; + for (let i = 0; i < parameterCount; i++) { + let parameter = parameters[i]; if (parameter.dotDotDotToken) { if (i !== (parameterCount - 1)) { return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); @@ -11347,7 +11349,7 @@ module ts { } function checkGrammarIndexSignatureParameters(node: SignatureDeclaration): boolean { - var parameter = node.parameters[0]; + let parameter = node.parameters[0]; if (node.parameters.length !== 1) { if (parameter) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_must_have_exactly_one_parameter); @@ -11392,9 +11394,9 @@ module ts { function checkGrammarForAtLeastOneTypeArgument(node: Node, typeArguments: NodeArray): boolean { if (typeArguments && typeArguments.length === 0) { - var sourceFile = getSourceFileOfNode(node); - var start = typeArguments.pos - "<".length; - var end = skipTrivia(sourceFile.text, typeArguments.end) + ">".length; + let sourceFile = getSourceFileOfNode(node); + let start = typeArguments.pos - "<".length; + let end = skipTrivia(sourceFile.text, typeArguments.end) + ">".length; return grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Type_argument_list_cannot_be_empty); } } @@ -11406,7 +11408,7 @@ module ts { function checkGrammarForOmittedArgument(node: CallExpression, arguments: NodeArray): boolean { if (arguments) { - var sourceFile = getSourceFileOfNode(node); + let sourceFile = getSourceFileOfNode(node); for (let arg of arguments) { if (arg.kind === SyntaxKind.OmittedExpression) { return grammarErrorAtPos(sourceFile, arg.pos, 0, Diagnostics.Argument_expression_expected); @@ -11421,20 +11423,20 @@ module ts { } function checkGrammarHeritageClause(node: HeritageClause): boolean { - var types = node.types; + let types = node.types; if (checkGrammarForDisallowedTrailingComma(types)) { return true; } if (types && types.length === 0) { - var listType = tokenToString(node.token); - var sourceFile = getSourceFileOfNode(node); + let listType = tokenToString(node.token); + let sourceFile = getSourceFileOfNode(node); return grammarErrorAtPos(sourceFile, types.pos, 0, Diagnostics._0_list_cannot_be_empty, listType) } } function checkGrammarClassDeclarationHeritageClauses(node: ClassDeclaration) { - var seenExtendsClause = false; - var seenImplementsClause = false; + let seenExtendsClause = false; + let seenImplementsClause = false; if (!checkGrammarModifiers(node) && node.heritageClauses) { for (let heritageClause of node.heritageClauses) { @@ -11469,7 +11471,7 @@ module ts { } function checkGrammarInterfaceDeclaration(node: InterfaceDeclaration) { - var seenExtendsClause = false; + let seenExtendsClause = false; if (node.heritageClauses) { for (let heritageClause of node.heritageClauses) { @@ -11499,7 +11501,7 @@ module ts { return false; } - var computedPropertyName = node; + let computedPropertyName = node; if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (computedPropertyName.expression).operatorToken.kind === SyntaxKind.CommaToken) { return grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } @@ -11523,15 +11525,15 @@ module ts { } function checkGrammarObjectLiteralExpression(node: ObjectLiteralExpression) { - var seen: Map = {}; - var Property = 1; - var GetAccessor = 2; - var SetAccesor = 4; - var GetOrSetAccessor = GetAccessor | SetAccesor; - var inStrictMode = (node.parserContextFlags & ParserContextFlags.StrictMode) !== 0; + let seen: Map = {}; + let Property = 1; + let GetAccessor = 2; + let SetAccesor = 4; + let GetOrSetAccessor = GetAccessor | SetAccesor; + let inStrictMode = (node.parserContextFlags & ParserContextFlags.StrictMode) !== 0; for (let prop of node.properties) { - var name = prop.name; + let name = prop.name; if (prop.kind === SyntaxKind.OmittedExpression || name.kind === SyntaxKind.ComputedPropertyName) { // If the name is not a ComputedPropertyName, the grammar checking will skip it @@ -11547,7 +11549,7 @@ module ts { // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind: number; + let currentKind: number; if (prop.kind === SyntaxKind.PropertyAssignment || prop.kind === SyntaxKind.ShorthandPropertyAssignment) { // Grammar checking for computedPropertName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop,(prop).questionToken, Diagnostics.An_object_member_cannot_be_declared_optional); @@ -11573,7 +11575,7 @@ module ts { seen[(name).text] = currentKind; } else { - var existingKind = seen[(name).text]; + let existingKind = seen[(name).text]; if (currentKind === Property && existingKind === Property) { if (inStrictMode) { grammarErrorOnNode(name, Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); @@ -11600,23 +11602,23 @@ module ts { } if (forInOrOfStatement.initializer.kind === SyntaxKind.VariableDeclarationList) { - var variableList = forInOrOfStatement.initializer; + let variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement + let diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement ? Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } - var firstDeclaration = variableList.declarations[0]; + let firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement + let diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement ? Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement + let diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement ? Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -11628,7 +11630,7 @@ module ts { } function checkGrammarAccessor(accessor: MethodDeclaration): boolean { - var kind = accessor.kind; + let kind = accessor.kind; if (languageVersion < ScriptTarget.ES5) { return grammarErrorOnNode(accessor.name, Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } @@ -11652,7 +11654,7 @@ module ts { return grammarErrorOnNode(accessor.name, Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } else { - var parameter = accessor.parameters[0]; + let parameter = accessor.parameters[0]; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.A_set_accessor_cannot_have_rest_parameter); } @@ -11731,7 +11733,7 @@ module ts { } function checkGrammarBreakOrContinueStatement(node: BreakOrContinueStatement): boolean { - var current: Node = node; + let current: Node = node; while (current) { if (isFunctionLike(current)) { return grammarErrorOnNode(node, Diagnostics.Jump_target_cannot_cross_function_boundary); @@ -11742,7 +11744,7 @@ module ts { if (node.label && (current).label.text === node.label.text) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === SyntaxKind.ContinueStatement + let isMisplacedContinueLabel = node.kind === SyntaxKind.ContinueStatement && !isIterationStatement((current).statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { @@ -11770,14 +11772,14 @@ module ts { } if (node.label) { - var message = node.kind === SyntaxKind.BreakStatement + let message = node.kind === SyntaxKind.BreakStatement ? Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message) } else { - var message = node.kind === SyntaxKind.BreakStatement + let message = node.kind === SyntaxKind.BreakStatement ? Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message) @@ -11786,7 +11788,7 @@ module ts { function checkGrammarBindingElement(node: BindingElement) { if (node.dotDotDotToken) { - var elements = (node.parent).elements; + let elements = (node.parent).elements; if (node !== elements[elements.length - 1]) { return grammarErrorOnNode(node, Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } @@ -11808,7 +11810,7 @@ module ts { } if (node.initializer) { // Error on equals token which immediate precedes the initializer - var equalsTokenLength = "=".length; + let equalsTokenLength = "=".length; return grammarErrorAtPos(getSourceFileOfNode(node), node.initializer.pos - equalsTokenLength, equalsTokenLength, Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); } @@ -11823,7 +11825,7 @@ module ts { } } - var checkLetConstNames = languageVersion >= ScriptTarget.ES6 && (isLet(node) || isConst(node)); + let checkLetConstNames = languageVersion >= ScriptTarget.ES6 && (isLet(node) || isConst(node)); // 1. LexicalDeclaration : LetOrConst BindingList ; // It is a Syntax Error if the BoundNames of BindingList contains "let". @@ -11843,7 +11845,7 @@ module ts { } } else { - var elements = (name).elements; + let elements = (name).elements; for (let element of elements) { checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -11851,7 +11853,7 @@ module ts { } function checkGrammarVariableDeclarationList(declarationList: VariableDeclarationList): boolean { - var declarations = declarationList.declarations; + let declarations = declarationList.declarations; if (checkGrammarForDisallowedTrailingComma(declarationList.declarations)) { return true; } @@ -11891,7 +11893,7 @@ module ts { function isIntegerLiteral(expression: Expression): boolean { if (expression.kind === SyntaxKind.PrefixUnaryExpression) { - var unaryExpression = expression; + let unaryExpression = expression; if (unaryExpression.operator === SyntaxKind.PlusToken || unaryExpression.operator === SyntaxKind.MinusToken) { expression = unaryExpression.operand; } @@ -11909,15 +11911,15 @@ module ts { } function checkGrammarEnumDeclaration(enumDecl: EnumDeclaration): boolean { - var enumIsConst = (enumDecl.flags & NodeFlags.Const) !== 0; + let enumIsConst = (enumDecl.flags & NodeFlags.Const) !== 0; - var hasError = false; + let hasError = false; // skip checks below for const enums - they allow arbitrary initializers as long as they can be evaluated to constant expressions. // since all values are known in compile time - it is not necessary to check that constant enum section precedes computed enum members. if (!enumIsConst) { - var inConstantEnumMemberSection = true; - var inAmbientContext = isInAmbientContext(enumDecl); + let inConstantEnumMemberSection = true; + let inAmbientContext = isInAmbientContext(enumDecl); for (let node of enumDecl.members) { // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including @@ -11947,9 +11949,9 @@ module ts { } function grammarErrorOnFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { - var sourceFile = getSourceFileOfNode(node); + let sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { - var span = getSpanOfTokenAtPosition(sourceFile, node.pos); + let span = getSpanOfTokenAtPosition(sourceFile, node.pos); diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2)); return true; } @@ -11963,7 +11965,7 @@ module ts { } function grammarErrorOnNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { - var sourceFile = getSourceFileOfNode(node); + let sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { diagnostics.add(createDiagnosticForNode(node, message, arg0, arg1, arg2)); return true; @@ -11972,9 +11974,9 @@ module ts { function checkGrammarEvalOrArgumentsInStrictMode(contextNode: Node, name: Node): boolean { if (name && name.kind === SyntaxKind.Identifier) { - var identifier = name; + let identifier = name; if (contextNode && (contextNode.parserContextFlags & ParserContextFlags.StrictMode) && isEvalOrArgumentsIdentifier(identifier)) { - var nameText = declarationNameToString(identifier); + let nameText = declarationNameToString(identifier); return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_in_strict_mode, nameText); } } @@ -12061,7 +12063,7 @@ module ts { } // Find containing block which is either Block, ModuleBlock, SourceFile - var links = getNodeLinks(node); + let links = getNodeLinks(node); if (!links.hasReportedStatementInAmbientContext && isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts) } @@ -12072,7 +12074,7 @@ module ts { // this has already been reported, and don't report if it has. // if (node.parent.kind === SyntaxKind.Block || node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) { - var links = getNodeLinks(node.parent); + let links = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links.hasReportedStatementInAmbientContext) { return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -12099,9 +12101,9 @@ module ts { } function grammarErrorAfterFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { - var sourceFile = getSourceFileOfNode(node); + let sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { - var span = getSpanOfTokenAtPosition(sourceFile, node.pos); + let span = getSpanOfTokenAtPosition(sourceFile, node.pos); diagnostics.add(createFileDiagnostic(sourceFile, textSpanEnd(span), /*length*/ 0, message, arg0, arg1, arg2)); return true; } From a6348c1e3187d61c3f69a47ab951f13348b434d8 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 12:34:12 -0700 Subject: [PATCH 064/101] Use 'let' in the emitter. --- src/compiler/emitter.ts | 739 ++++++++++++++++++++-------------------- 1 file changed, 371 insertions(+), 368 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index da789b6ffef..661544749e6 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -54,7 +54,7 @@ module ts { referencePathsOutput: string; } - var indentStrings: string[] = ["", " "]; + let indentStrings: string[] = ["", " "]; export function getIndentString(level: number) { if (indentStrings[level] === undefined) { indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; @@ -81,11 +81,11 @@ module ts { } function createTextWriter(newLine: String): EmitTextWriter { - var output = ""; - var indent = 0; - var lineStart = true; - var lineCount = 0; - var linePos = 0; + let output = ""; + let indent = 0; + let lineStart = true; + let lineCount = 0; + let linePos = 0; function write(s: string) { if (s && s.length) { @@ -109,7 +109,7 @@ module ts { function writeLiteral(s: string) { if (s && s.length) { write(s); - var lineStartsOfS = computeLineStarts(s); + let lineStartsOfS = computeLineStarts(s); if (lineStartsOfS.length > 1) { lineCount = lineCount + lineStartsOfS.length - 1; linePos = output.length - s.length + lineStartsOfS[lineStartsOfS.length - 1]; @@ -160,7 +160,7 @@ module ts { function emitComments(currentSourceFile: SourceFile, writer: EmitTextWriter, comments: CommentRange[], trailingSeparator: boolean, newLine: string, writeComment: (currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) => void) { - var emitLeadingSpace = !trailingSeparator; + let emitLeadingSpace = !trailingSeparator; forEach(comments, comment => { if (emitLeadingSpace) { writer.write(" "); @@ -182,11 +182,11 @@ module ts { function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string){ if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { - var firstCommentLineAndCharacter = getLineAndCharacterOfPosition(currentSourceFile, comment.pos); - var lineCount = getLineStarts(currentSourceFile).length; - var firstCommentLineIndent: number; - for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = (currentLine + 1) === lineCount + let firstCommentLineAndCharacter = getLineAndCharacterOfPosition(currentSourceFile, comment.pos); + let lineCount = getLineStarts(currentSourceFile).length; + let firstCommentLineIndent: number; + for (let pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { + let nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : getStartPositionOfLine(currentLine + 1, currentSourceFile); @@ -197,7 +197,7 @@ module ts { } // These are number of spaces writer is going to write at current indent - var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); + let currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); // Number of spaces we want to be writing // eg: Assume writer indent @@ -213,10 +213,10 @@ module ts { // More right indented comment */ --4 = 8 - 4 + 11 // class c { } // } - var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart); + let spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart); if (spacesToEmit > 0) { - var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(); - var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); + let numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(); + let indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); // Write indent size string ( in eg 1: = "", 2: "" , 3: string with 8 spaces 4: string with 12 spaces writer.rawWrite(indentSizeSpaceString); @@ -245,8 +245,8 @@ module ts { } function writeTrimmedCurrentLine(pos: number, nextLineStart: number) { - var end = Math.min(comment.end, nextLineStart - 1); - var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ''); + let end = Math.min(comment.end, nextLineStart - 1); + let currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ''); if (currentLineText) { // trimmed forward and ending spaces text writer.write(currentLineText); @@ -261,7 +261,7 @@ module ts { } function calculateIndent(pos: number, end: number) { - var currentLineIndent = 0; + let currentLineIndent = 0; for (; pos < end && isWhiteSpace(currentSourceFile.text.charCodeAt(pos)); pos++) { if (currentSourceFile.text.charCodeAt(pos) === CharacterCodes.tab) { // Tabs = TabSize = indent size and go to next tabStop @@ -286,9 +286,9 @@ module ts { } function getAllAccessorDeclarations(declarations: NodeArray, accessor: AccessorDeclaration) { - var firstAccessor: AccessorDeclaration; - var getAccessor: AccessorDeclaration; - var setAccessor: AccessorDeclaration; + let firstAccessor: AccessorDeclaration; + let getAccessor: AccessorDeclaration; + let setAccessor: AccessorDeclaration; if (hasDynamicName(accessor)) { firstAccessor = accessor; if (accessor.kind === SyntaxKind.GetAccessor) { @@ -305,8 +305,8 @@ module ts { forEach(declarations, (member: Declaration) => { if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) && (member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) { - var memberName = getPropertyNameForPropertyNameNode(member.name); - var accessorName = getPropertyNameForPropertyNameNode(accessor.name); + let memberName = getPropertyNameForPropertyNameNode(member.name); + let accessorName = getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { if (!firstAccessor) { firstAccessor = member; @@ -331,18 +331,19 @@ module ts { } function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string) { - var sourceFilePath = getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); + let sourceFilePath = getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); sourceFilePath = sourceFilePath.replace(host.getCommonSourceDirectory(), ""); return combinePaths(newDirPath, sourceFilePath); } function getOwnEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost, extension: string){ - var compilerOptions = host.getCompilerOptions(); + let compilerOptions = host.getCompilerOptions(); + let emitOutputFilePathWithoutExtension: string; if (compilerOptions.outDir) { - var emitOutputFilePathWithoutExtension = removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); + emitOutputFilePathWithoutExtension = removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); } else { - var emitOutputFilePathWithoutExtension = removeFileExtension(sourceFile.fileName); + emitOutputFilePathWithoutExtension = removeFileExtension(sourceFile.fileName); } return emitOutputFilePathWithoutExtension + extension; @@ -355,37 +356,37 @@ module ts { } function emitDeclarations(host: EmitHost, resolver: EmitResolver, diagnostics: Diagnostic[], jsFilePath: string, root?: SourceFile): DeclarationEmit { - var newLine = host.getNewLine(); - var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || ScriptTarget.ES3; + let newLine = host.getNewLine(); + let compilerOptions = host.getCompilerOptions(); + let languageVersion = compilerOptions.target || ScriptTarget.ES3; - var write: (s: string) => void; - var writeLine: () => void; - var increaseIndent: () => void; - var decreaseIndent: () => void; - var writeTextOfNode: (sourceFile: SourceFile, node: Node) => void; + let write: (s: string) => void; + let writeLine: () => void; + let increaseIndent: () => void; + let decreaseIndent: () => void; + let writeTextOfNode: (sourceFile: SourceFile, node: Node) => void; - var writer = createAndSetNewTextWriterWithSymbolWriter(); + let writer = createAndSetNewTextWriterWithSymbolWriter(); - var enclosingDeclaration: Node; - var currentSourceFile: SourceFile; - var reportedDeclarationError = false; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration: Node) { } : writeJsDocComments; - var emit = compilerOptions.stripInternal ? stripInternal : emitNode; + let enclosingDeclaration: Node; + let currentSourceFile: SourceFile; + let reportedDeclarationError = false; + let emitJsDocComments = compilerOptions.removeComments ? function (declaration: Node) { } : writeJsDocComments; + let emit = compilerOptions.stripInternal ? stripInternal : emitNode; - var aliasDeclarationEmitInfo: AliasDeclarationEmitInfo[] = []; + let aliasDeclarationEmitInfo: AliasDeclarationEmitInfo[] = []; // Contains the reference paths that needs to go in the declaration file. // Collecting this separately because reference paths need to be first thing in the declaration file // and we could be collecting these paths from multiple files into single one with --out option - var referencePathsOutput = ""; + let referencePathsOutput = ""; if (root) { // Emitting just a single file, so emit references in this file only if (!compilerOptions.noResolve) { - var addedGlobalFileReference = false; + let addedGlobalFileReference = false; forEach(root.referencedFiles, fileReference => { - var referencedFile = tryResolveScriptReference(host, root, fileReference); + let referencedFile = tryResolveScriptReference(host, root, fileReference); // All the references that are not going to be part of same file if (referencedFile && ((referencedFile.flags & NodeFlags.DeclarationFile) || // This is a declare file reference @@ -404,13 +405,13 @@ module ts { } else { // Emit references corresponding to this file - var emittedReferencedFiles: SourceFile[] = []; + let emittedReferencedFiles: SourceFile[] = []; forEach(host.getSourceFiles(), sourceFile => { if (!isExternalModuleOrDeclarationFile(sourceFile)) { // Check what references need to be added if (!compilerOptions.noResolve) { forEach(sourceFile.referencedFiles, fileReference => { - var referencedFile = tryResolveScriptReference(host, sourceFile, fileReference); + let referencedFile = tryResolveScriptReference(host, sourceFile, fileReference); // If the reference file is a declaration file or an external module, emit that reference if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && @@ -435,14 +436,14 @@ module ts { } function hasInternalAnnotation(range: CommentRange) { - var text = currentSourceFile.text; - var comment = text.substring(range.pos, range.end); + let text = currentSourceFile.text; + let comment = text.substring(range.pos, range.end); return comment.indexOf("@internal") >= 0; } function stripInternal(node: Node) { if (node) { - var leadingCommentRanges = getLeadingCommentRanges(currentSourceFile.text, node.pos); + let leadingCommentRanges = getLeadingCommentRanges(currentSourceFile.text, node.pos); if (forEach(leadingCommentRanges, hasInternalAnnotation)) { return; } @@ -452,7 +453,7 @@ module ts { } function createAndSetNewTextWriterWithSymbolWriter(): EmitTextWriterWithSymbolWriter { - var writer = createTextWriter(newLine); + let writer = createTextWriter(newLine); writer.trackSymbol = trackSymbol; writer.writeKeyword = writer.write; writer.writeOperator = writer.write; @@ -475,9 +476,9 @@ module ts { } function writeAsychronousImportEqualsDeclarations(importEqualsDeclarations: ImportEqualsDeclaration[]) { - var oldWriter = writer; + let oldWriter = writer; forEach(importEqualsDeclarations, aliasToWrite => { - var aliasEmitInfo = forEach(aliasDeclarationEmitInfo, declEmitInfo => declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined); + let aliasEmitInfo = forEach(aliasDeclarationEmitInfo, declEmitInfo => declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined); // If the alias was marked as not visible when we saw its declaration, we would have saved the aliasEmitInfo, but if we haven't yet visited the alias declaration // then we don't need to write it at this point. We will write it when we actually see its declaration // Eg. @@ -487,7 +488,7 @@ module ts { // we would write alias foo declaration when we visit it since it would now be marked as visible if (aliasEmitInfo) { createAndSetNewTextWriterWithSymbolWriter(); - for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { + for (let declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } writeImportEqualsDeclaration(aliasToWrite); @@ -507,7 +508,7 @@ module ts { else { // Report error reportedDeclarationError = true; - var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccesibilityResult); + let errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccesibilityResult); if (errorInfo) { if (errorInfo.typeName) { diagnostics.push(createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, @@ -561,7 +562,7 @@ module ts { } function emitSeparatedList(nodes: Node[], separator: string, eachNodeEmitFn: (node: Node) => void) { - var currentWriterPos = writer.getTextPos(); + let currentWriterPos = writer.getTextPos(); for (let node of nodes) { if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -577,7 +578,7 @@ module ts { function writeJsDocComments(declaration: Node) { if (declaration) { - var jsDocComments = getJsDocComments(declaration, currentSourceFile); + let jsDocComments = getJsDocComments(declaration, currentSourceFile); emitNewLineBeforeLeadingComments(currentSourceFile, writer, declaration, jsDocComments); // jsDoc comments are emitted at /*leading comment1 */space/*leading comment*/space emitComments(currentSourceFile, writer, jsDocComments, /*trailingSeparator*/ true, newLine, writeCommentRange); @@ -625,7 +626,7 @@ module ts { } function emitEntityName(entityName: EntityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, + let visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration entityName.parent.kind === SyntaxKind.ImportEqualsDeclaration ? entityName.parent : enclosingDeclaration); @@ -637,7 +638,7 @@ module ts { writeTextOfNode(currentSourceFile, entityName); } else { - var qualifiedName = entityName; + let qualifiedName = entityName; writeEntityName(qualifiedName.left); write("."); writeTextOfNode(currentSourceFile, qualifiedName.right); @@ -734,7 +735,7 @@ module ts { } function emitImportEqualsDeclaration(node: ImportEqualsDeclaration) { - var nodeEmitInfo = { + let nodeEmitInfo = { declaration: node, outputPos: writer.getTextPos(), indent: writer.getIndent(), @@ -787,7 +788,7 @@ module ts { write("."); writeTextOfNode(currentSourceFile, node.name); } - var prevEnclosingDeclaration = enclosingDeclaration; + let prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; write(" {"); writeLine(); @@ -842,7 +843,7 @@ module ts { function emitEnumMemberDeclaration(node: EnumMember) { emitJsDocComments(node); writeTextOfNode(currentSourceFile, node.name); - var enumMemberValue = resolver.getConstantValue(node); + let enumMemberValue = resolver.getConstantValue(node); if (enumMemberValue !== undefined) { write(" = "); write(enumMemberValue.toString()); @@ -882,7 +883,7 @@ module ts { function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { // Type parameter constraints are named by user so we should always be able to name it - var diagnosticMessage: DiagnosticMessage; + let diagnosticMessage: DiagnosticMessage; switch (node.parent.kind) { case SyntaxKind.ClassDeclaration: diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; @@ -946,7 +947,7 @@ module ts { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); function getHeritageClauseVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { - var diagnosticMessage: DiagnosticMessage; + let diagnosticMessage: DiagnosticMessage; // Heritage clause is written by user so it can always be named if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) { // Class or Interface implemented/extended is inaccessible @@ -984,10 +985,10 @@ module ts { emitModuleElementDeclarationFlags(node); write("class "); writeTextOfNode(currentSourceFile, node.name); - var prevEnclosingDeclaration = enclosingDeclaration; + let prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - var baseTypeNode = getClassBaseTypeNode(node); + let baseTypeNode = getClassBaseTypeNode(node); if (baseTypeNode) { emitHeritageClause([baseTypeNode], /*isImplementsList*/ false); } @@ -1010,7 +1011,7 @@ module ts { emitModuleElementDeclarationFlags(node); write("interface "); writeTextOfNode(currentSourceFile, node.name); - var prevEnclosingDeclaration = enclosingDeclaration; + let prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); emitHeritageClause(getInterfaceBaseTypeNodes(node), /*isImplementsList*/ false); @@ -1058,7 +1059,7 @@ module ts { } function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { - var diagnosticMessage: DiagnosticMessage; + let diagnosticMessage: DiagnosticMessage; if (node.kind === SyntaxKind.VariableDeclaration) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ? @@ -1110,7 +1111,7 @@ module ts { } function emitVariableStatement(node: VariableStatement) { - var hasDeclarationWithEmit = forEach(node.declarationList.declarations, varDeclaration => resolver.isDeclarationVisible(varDeclaration)); + let hasDeclarationWithEmit = forEach(node.declarationList.declarations, varDeclaration => resolver.isDeclarationVisible(varDeclaration)); if (hasDeclarationWithEmit) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); @@ -1134,18 +1135,20 @@ module ts { return; } - var accessors = getAllAccessorDeclarations((node.parent).members, node); + let accessors = getAllAccessorDeclarations((node.parent).members, node); + let accessorWithTypeAnnotation: AccessorDeclaration; + if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(node); writeTextOfNode(currentSourceFile, node.name); if (!(node.flags & NodeFlags.Private)) { - var accessorWithTypeAnnotation: AccessorDeclaration = node; - var type = getTypeAnnotationFromAccessor(node); + accessorWithTypeAnnotation = node; + let type = getTypeAnnotationFromAccessor(node); if (!type) { // couldn't get type for the first accessor, try the another one - var anotherAccessor = node.kind === SyntaxKind.GetAccessor ? accessors.setAccessor : accessors.getAccessor; + let anotherAccessor = node.kind === SyntaxKind.GetAccessor ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -1168,7 +1171,7 @@ module ts { } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { - var diagnosticMessage: DiagnosticMessage; + let diagnosticMessage: DiagnosticMessage; if (accessorWithTypeAnnotation.kind === SyntaxKind.SetAccessor) { // Setters have to have type named and cannot infer it so, the type should always be named if (accessorWithTypeAnnotation.parent.flags & NodeFlags.Static) { @@ -1263,7 +1266,7 @@ module ts { write("("); } - var prevEnclosingDeclaration = enclosingDeclaration; + let prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; // Parameters @@ -1277,7 +1280,7 @@ module ts { } // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === SyntaxKind.FunctionType || node.kind === SyntaxKind.ConstructorType; + let isFunctionTypeOrConstructorType = node.kind === SyntaxKind.FunctionType || node.kind === SyntaxKind.ConstructorType; if (isFunctionTypeOrConstructorType || node.parent.kind === SyntaxKind.TypeLiteral) { // Emit type literal signature return type only if specified if (node.type) { @@ -1297,7 +1300,7 @@ module ts { } function getReturnTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { - var diagnosticMessage: DiagnosticMessage; + let diagnosticMessage: DiagnosticMessage; switch (node.kind) { case SyntaxKind.ConstructSignature: // Interfaces cannot have return types that cannot be named @@ -1390,7 +1393,7 @@ module ts { } function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic { - var diagnosticMessage: DiagnosticMessage; + let diagnosticMessage: DiagnosticMessage; switch (node.parent.kind) { case SyntaxKind.Constructor: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? @@ -1499,7 +1502,7 @@ module ts { } function writeReferencePath(referencedFile: SourceFile) { - var declFileName = referencedFile.flags & NodeFlags.DeclarationFile + let declFileName = referencedFile.flags & NodeFlags.DeclarationFile ? referencedFile.fileName // Declaration file, use declaration file name : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") // Own output file so get the .d.ts file @@ -1517,8 +1520,8 @@ module ts { } export function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, targetSourceFile: SourceFile): Diagnostic[] { - var diagnostics: Diagnostic[] = []; - var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); + let diagnostics: Diagnostic[] = []; + let jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); emitDeclarations(host, resolver, diagnostics, jsFilePath, targetSourceFile); return diagnostics; } @@ -1526,16 +1529,16 @@ module ts { // @internal // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult { - var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || ScriptTarget.ES3; - var sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap ? [] : undefined; - var diagnostics: Diagnostic[] = []; - var newLine = host.getNewLine(); + let compilerOptions = host.getCompilerOptions(); + let languageVersion = compilerOptions.target || ScriptTarget.ES3; + let sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap ? [] : undefined; + let diagnostics: Diagnostic[] = []; + let newLine = host.getNewLine(); if (targetSourceFile === undefined) { forEach(host.getSourceFiles(), sourceFile => { if (shouldEmitToOwnFile(sourceFile, compilerOptions)) { - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, ".js"); + let jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, ".js"); emitFile(jsFilePath, sourceFile); } }); @@ -1547,7 +1550,7 @@ module ts { else { // targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service) if (shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); + let jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); emitFile(jsFilePath, targetSourceFile); } else if (!isDeclarationFile(targetSourceFile) && compilerOptions.out) { @@ -1565,57 +1568,57 @@ module ts { }; function emitJavaScript(jsFilePath: string, root?: SourceFile) { - var writer = createTextWriter(newLine); - var write = writer.write; - var writeTextOfNode = writer.writeTextOfNode; - var writeLine = writer.writeLine; - var increaseIndent = writer.increaseIndent; - var decreaseIndent = writer.decreaseIndent; - var preserveNewLines = compilerOptions.preserveNewLines || false; + let writer = createTextWriter(newLine); + let write = writer.write; + let writeTextOfNode = writer.writeTextOfNode; + let writeLine = writer.writeLine; + let increaseIndent = writer.increaseIndent; + let decreaseIndent = writer.decreaseIndent; + let preserveNewLines = compilerOptions.preserveNewLines || false; - var currentSourceFile: SourceFile; + let currentSourceFile: SourceFile; - var lastFrame: ScopeFrame; - var currentScopeNames: Map; + let lastFrame: ScopeFrame; + let currentScopeNames: Map; - var generatedBlockScopeNames: string[]; + let generatedBlockScopeNames: string[]; - var extendsEmitted = false; - var tempCount = 0; - var tempVariables: Identifier[]; - var tempParameters: Identifier[]; - var externalImports: ExternalImportInfo[]; - var exportSpecifiers: Map; - var exportDefault: FunctionDeclaration | ClassDeclaration | ExportAssignment | ExportSpecifier; + let extendsEmitted = false; + let tempCount = 0; + let tempVariables: Identifier[]; + let tempParameters: Identifier[]; + let externalImports: ExternalImportInfo[]; + let exportSpecifiers: Map; + let exportDefault: FunctionDeclaration | ClassDeclaration | ExportAssignment | ExportSpecifier; /** write emitted output to disk*/ - var writeEmittedFiles = writeJavaScriptFile; + let writeEmittedFiles = writeJavaScriptFile; /** Emit leading comments of the node */ - var emitLeadingComments = compilerOptions.removeComments ? (node: Node) => { } : emitLeadingDeclarationComments; + let emitLeadingComments = compilerOptions.removeComments ? (node: Node) => { } : emitLeadingDeclarationComments; /** Emit Trailing comments of the node */ - var emitTrailingComments = compilerOptions.removeComments ? (node: Node) => { } : emitTrailingDeclarationComments; + let emitTrailingComments = compilerOptions.removeComments ? (node: Node) => { } : emitTrailingDeclarationComments; - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? (pos: number) => { } : emitLeadingCommentsOfLocalPosition; + let emitLeadingCommentsOfPosition = compilerOptions.removeComments ? (pos: number) => { } : emitLeadingCommentsOfLocalPosition; - var detachedCommentsInfo: { nodePos: number; detachedCommentEndPos: number }[]; + let detachedCommentsInfo: { nodePos: number; detachedCommentEndPos: number }[]; /** Emit detached comments of the node */ - var emitDetachedComments = compilerOptions.removeComments ? (node: TextRange) => { } : emitDetachedCommentsAtPosition; + let emitDetachedComments = compilerOptions.removeComments ? (node: TextRange) => { } : emitDetachedCommentsAtPosition; - var writeComment = writeCommentRange; + let writeComment = writeCommentRange; /** Emit a node */ - var emitNodeWithoutSourceMap = compilerOptions.removeComments ? emitNodeWithoutSourceMapWithoutComments : emitNodeWithoutSourceMapWithComments; - var emit = emitNodeWithoutSourceMap; - var emitWithoutComments = emitNodeWithoutSourceMapWithoutComments; + let emitNodeWithoutSourceMap = compilerOptions.removeComments ? emitNodeWithoutSourceMapWithoutComments : emitNodeWithoutSourceMapWithComments; + let emit = emitNodeWithoutSourceMap; + let emitWithoutComments = emitNodeWithoutSourceMapWithoutComments; /** Called just before starting emit of a node */ - var emitStart = function (node: Node) { }; + let emitStart = function (node: Node) { }; /** Called once the emit of the node is done */ - var emitEnd = function (node: Node) { }; + let emitEnd = function (node: Node) { }; /** Emit the text for the given token that comes after startPos * This by default writes the text provided with the given tokenKind @@ -1623,18 +1626,18 @@ module ts { * @param tokenKind the kind of the token to search and emit * @param startPos the position in the source to start searching for the token * @param emitFn if given will be invoked to emit the text instead of actual token emit */ - var emitToken = emitTokenText; + let emitToken = emitTokenText; /** Called to before starting the lexical scopes as in function/class in the emitted code because of node * @param scopeDeclaration node that starts the lexical scope * @param scopeName Optional name of this scope instead of deducing one from the declaration node */ - var scopeEmitStart = function (scopeDeclaration: Node, scopeName?: string) { } + let scopeEmitStart = function (scopeDeclaration: Node, scopeName?: string) { } /** Called after coming out of the scope */ - var scopeEmitEnd = function () { } + let scopeEmitEnd = function () { } /** Sourcemap data that will get encoded */ - var sourceMapData: SourceMapData; + let sourceMapData: SourceMapData; if (compilerOptions.sourceMap) { initializeEmitterWithSourceMaps(); @@ -1664,7 +1667,7 @@ module ts { // enters the new lexical environment // return value should be passed to matching call to exitNameScope. function enterNameScope(): boolean { - var names = currentScopeNames; + let names = currentScopeNames; currentScopeNames = undefined; if (names) { lastFrame = { names, previous: lastFrame }; @@ -1684,7 +1687,7 @@ module ts { } function generateUniqueNameForLocation(location: Node, baseName: string): string { - var name: string + let name: string // first try to check if base name can be used as is if (!isExistingName(location, baseName)) { name = baseName; @@ -1716,7 +1719,7 @@ module ts { } // check generated names in outer scopes - // var x; + // let x; // function foo() { // let x; // 1 // function bar() { @@ -1728,7 +1731,7 @@ module ts { //} // here both x(1) and x(2) should be renamed and their names should be different // so x in (3) will refer to x(1) - var frame = lastFrame; + let frame = lastFrame; while (frame) { if (hasProperty(frame.names, name)) { return true; @@ -1739,28 +1742,28 @@ module ts { } function initializeEmitterWithSourceMaps() { - var sourceMapDir: string; // The directory in which sourcemap will be + let sourceMapDir: string; // The directory in which sourcemap will be // Current source map file and its index in the sources list - var sourceMapSourceIndex = -1; + let sourceMapSourceIndex = -1; // Names and its index map - var sourceMapNameIndexMap: Map = {}; - var sourceMapNameIndices: number[] = []; + let sourceMapNameIndexMap: Map = {}; + let sourceMapNameIndices: number[] = []; function getSourceMapNameIndex() { return sourceMapNameIndices.length ? sourceMapNameIndices[sourceMapNameIndices.length - 1] : -1; } // Last recorded and encoded spans - var lastRecordedSourceMapSpan: SourceMapSpan; - var lastEncodedSourceMapSpan: SourceMapSpan = { + let lastRecordedSourceMapSpan: SourceMapSpan; + let lastEncodedSourceMapSpan: SourceMapSpan = { emittedLine: 1, emittedColumn: 1, sourceLine: 1, sourceColumn: 1, sourceIndex: 0 }; - var lastEncodedNameIndex = 0; + let lastEncodedNameIndex = 0; // Encoding for sourcemap span function encodeLastRecordedSourceMapSpan() { @@ -1768,7 +1771,7 @@ module ts { return; } - var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; + let prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; // Line/Comma delimiters if (lastEncodedSourceMapSpan.emittedLine == lastRecordedSourceMapSpan.emittedLine) { // Emit comma to separate the entry @@ -1778,7 +1781,7 @@ module ts { } else { // Emit line delimiters - for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { + for (let encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { sourceMapData.sourceMapMappings += ";"; } prevEncodedEmittedColumn = 1; @@ -1826,9 +1829,9 @@ module ts { } // Encode 5 bits at a time starting from least significant bits - var encodedStr = ""; + let encodedStr = ""; do { - var currentDigit = inValue & 31; // 11111 + let currentDigit = inValue & 31; // 11111 inValue = inValue >> 5; if (inValue > 0) { // There are still more digits to decode, set the msb (6th bit) @@ -1842,14 +1845,14 @@ module ts { } function recordSourceMapSpan(pos: number) { - var sourceLinePos = getLineAndCharacterOfPosition(currentSourceFile, pos); + let sourceLinePos = getLineAndCharacterOfPosition(currentSourceFile, pos); // Convert the location to be one-based. sourceLinePos.line++; sourceLinePos.character++; - var emittedLine = writer.getLine(); - var emittedColumn = writer.getColumn(); + let emittedLine = writer.getLine(); + let emittedColumn = writer.getColumn(); // If this location wasn't recorded or the location in source is going backwards, record the span if (!lastRecordedSourceMapSpan || @@ -1889,9 +1892,9 @@ module ts { } function writeTextWithSpanRecord(tokenKind: SyntaxKind, startPos: number, emitFn?: () => void) { - var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); + let tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); recordSourceMapSpan(tokenStartPos); - var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); + let tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); recordSourceMapSpan(tokenEndPos); return tokenEndPos; } @@ -1900,7 +1903,7 @@ module ts { // Add the file to tsFilePaths // If sourceroot option: Use the relative path corresponding to the common directory path // otherwise source locations relative to map file location - var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; + let sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; sourceMapData.sourceMapSources.push(getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, @@ -1919,14 +1922,14 @@ module ts { } function recordScopeNameStart(scopeName: string) { - var scopeNameIndex = -1; + let scopeNameIndex = -1; if (scopeName) { - var parentIndex = getSourceMapNameIndex(); + let parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { // Child scopes are always shown with a dot (even if they have no name), // unless it is a computed property. Then it is shown with brackets, // but the brackets are included in the name. - var name = (node).name; + let name = (node).name; if (!name || name.kind !== SyntaxKind.ComputedPropertyName) { scopeName = "." + scopeName; } @@ -1958,7 +1961,7 @@ module ts { node.kind === SyntaxKind.EnumDeclaration) { // Declaration and has associated name use it if ((node).name) { - var name = (node).name; + let name = (node).name; // For computed property names, the text will include the brackets scopeName = name.kind === SyntaxKind.ComputedPropertyName ? getTextOfNode(name) @@ -1997,8 +2000,8 @@ module ts { return "{\"version\":" + version + ",\"file\":\"" + escapeString(file) + "\",\"sourceRoot\":\"" + escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + escapeString(mappings) + "\"}"; function serializeStringArray(list: string[]): string { - var output = ""; - for (var i = 0, n = list.length; i < n; i++) { + let output = ""; + for (let i = 0, n = list.length; i < n; i++) { if (i) { output += ","; } @@ -2025,7 +2028,7 @@ module ts { } // Initialize source map data - var sourceMapJsFile = getBaseFileName(normalizeSlashes(jsFilePath)); + let sourceMapJsFile = getBaseFileName(normalizeSlashes(jsFilePath)); sourceMapData = { sourceMapFilePath: jsFilePath + ".map", jsSourceMappingURL: sourceMapJsFile + ".map", @@ -2114,7 +2117,7 @@ module ts { // Create a temporary variable with a unique unused name. The forLoopVariable parameter signals that the // name should be one that is appropriate for a for loop variable. function createTempVariable(location: Node, forLoopVariable?: boolean): Identifier { - var name = forLoopVariable ? "_i" : undefined; + let name = forLoopVariable ? "_i" : undefined; while (true) { if (name && !isExistingName(location, name)) { break; @@ -2129,7 +2132,7 @@ module ts { // we just generated. recordNameInCurrentScope(name); - var result = createSynthesizedNode(SyntaxKind.Identifier); + let result = createSynthesizedNode(SyntaxKind.Identifier); result.text = name; return result; } @@ -2142,7 +2145,7 @@ module ts { } function createAndRecordTempVariable(location: Node): Identifier { - var temp = createTempVariable(location, /*forLoopVariable*/ false); + let temp = createTempVariable(location, /*forLoopVariable*/ false); recordTempDeclaration(temp); return temp; @@ -2163,7 +2166,7 @@ module ts { } function emitTokenText(tokenKind: SyntaxKind, startPos: number, emitFn?: () => void) { - var tokenString = tokenToString(tokenKind); + let tokenString = tokenToString(tokenKind); if (emitFn) { emitFn(); } @@ -2210,7 +2213,7 @@ module ts { writeLine(); } - for (var i = 0, n = nodes.length; i < n; i++) { + for (let i = 0, n = nodes.length; i < n; i++) { if (i) { if (preserveNewLines && nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { write(", "); @@ -2241,7 +2244,7 @@ module ts { } function emitList(nodes: Node[], start: number, count: number, multiLine: boolean, trailingComma: boolean) { - for (var i = 0; i < count; i++) { + for (let i = 0; i < count; i++) { if (multiLine) { if (i) { write(","); @@ -2274,7 +2277,7 @@ module ts { } function emitLinesStartingAt(nodes: Node[], startIndex: number): void { - for (var i = startIndex; i < nodes.length; i++) { + for (let i = startIndex; i < nodes.length; i++) { writeLine(); emit(nodes[i]); } @@ -2295,7 +2298,7 @@ module ts { } function emitLiteral(node: LiteralExpression) { - var text = getLiteralText(node); + let text = getLiteralText(node); if (compilerOptions.sourceMap && (node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); @@ -2350,13 +2353,13 @@ module ts { // Find original source text, since we need to emit the raw strings of the tagged template. // The raw strings contain the (escaped) strings of what the user wrote. // Examples: `\n` is converted to "\\n", a template string with a newline to "\n". - var text = getSourceTextOfNodeFromSourceFile(currentSourceFile, node); + let text = getSourceTextOfNodeFromSourceFile(currentSourceFile, node); // text contains the original source, it will also contain quotes ("`"), dolar signs and braces ("${" and "}"), // thus we need to remove those characters. // First template piece starts with "`", others with "}" // Last template piece ends with "`", others with "${" - var isLast = node.kind === SyntaxKind.NoSubstitutionTemplateLiteral || node.kind === SyntaxKind.TemplateTail; + let isLast = node.kind === SyntaxKind.NoSubstitutionTemplateLiteral || node.kind === SyntaxKind.TemplateTail; text = text.substring(1, text.length - (isLast ? 1 : 2)); // Newline normalization: @@ -2384,7 +2387,7 @@ module ts { } function emitDownlevelTaggedTemplate(node: TaggedTemplateExpression) { - var tempVariable = createAndRecordTempVariable(node); + let tempVariable = createAndRecordTempVariable(node); write("("); emit(tempVariable); write(" = "); @@ -2404,7 +2407,7 @@ module ts { if (node.template.kind === SyntaxKind.TemplateExpression) { forEach((node.template).templateSpans, templateSpan => { write(", "); - var needsParens = templateSpan.expression.kind === SyntaxKind.BinaryExpression + let needsParens = templateSpan.expression.kind === SyntaxKind.BinaryExpression && (templateSpan.expression).operatorToken.kind === SyntaxKind.CommaToken; emitParenthesizedIf(templateSpan.expression, needsParens); }); @@ -2420,21 +2423,21 @@ module ts { return; } - var emitOuterParens = isExpression(node.parent) + let emitOuterParens = isExpression(node.parent) && templateNeedsParens(node, node.parent); if (emitOuterParens) { write("("); } - var headEmitted = false; + let headEmitted = false; if (shouldEmitTemplateHead()) { emitLiteral(node.head); headEmitted = true; } for (let i = 0, n = node.templateSpans.length; i < n; i++) { - var templateSpan = node.templateSpans[i]; + let templateSpan = node.templateSpans[i]; // Check if the expression has operands and binds its operands less closely than binary '+'. // If it does, we need to wrap the expression in parentheses. Otherwise, something like @@ -2445,7 +2448,7 @@ module ts { // ("abc" + 1) << (2 + "") // rather than // "abc" + (1 << 2) + "" - var needsParens = templateSpan.expression.kind !== SyntaxKind.ParenthesizedExpression + let needsParens = templateSpan.expression.kind !== SyntaxKind.ParenthesizedExpression && comparePrecedenceToBinaryPlus(templateSpan.expression) !== Comparison.GreaterThan; if (i > 0 || headEmitted) { @@ -2573,7 +2576,7 @@ module ts { } function isNotExpressionIdentifier(node: Identifier) { - var parent = node.parent; + let parent = node.parent; switch (parent.kind) { case SyntaxKind.Parameter: case SyntaxKind.VariableDeclaration: @@ -2605,7 +2608,7 @@ module ts { } function emitExpressionIdentifier(node: Identifier) { - var substitution = resolver.getExpressionNameSubstitution(node); + let substitution = resolver.getExpressionNameSubstitution(node); if (substitution) { write(substitution); } @@ -2620,9 +2623,9 @@ module ts { } function emitIdentifier(node: Identifier) { - var variableId = getBlockScopedVariableId(node); + let variableId = getBlockScopedVariableId(node); if (variableId !== undefined && generatedBlockScopeNames) { - var text = generatedBlockScopeNames[variableId]; + let text = generatedBlockScopeNames[variableId]; if (text) { write(text); return; @@ -2649,7 +2652,7 @@ module ts { } function emitSuper(node: Node) { - var flags = resolver.getNodeCheckFlags(node); + let flags = resolver.getNodeCheckFlags(node); if (flags & NodeCheckFlags.SuperInstance) { write("_super.prototype"); } @@ -2663,14 +2666,14 @@ module ts { function emitObjectBindingPattern(node: BindingPattern) { write("{ "); - var elements = node.elements; + let elements = node.elements; emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); write(" }"); } function emitArrayBindingPattern(node: BindingPattern) { write("["); - var elements = node.elements; + let elements = node.elements; emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); write("]"); } @@ -2713,9 +2716,9 @@ module ts { } function emitListWithSpread(elements: Expression[], multiLine: boolean, trailingComma: boolean) { - var pos = 0; - var group = 0; - var length = elements.length; + let pos = 0; + let group = 0; + let length = elements.length; while (pos < length) { // Emit using the pattern .concat(, , ...) if (group === 1) { @@ -2724,14 +2727,14 @@ module ts { else if (group > 1) { write(", "); } - var e = elements[pos]; + let e = elements[pos]; if (e.kind === SyntaxKind.SpreadElementExpression) { e = (e).expression; emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; } else { - var i = pos; + let i = pos; while (i < length && elements[i].kind !== SyntaxKind.SpreadElementExpression) { i++; } @@ -2758,7 +2761,7 @@ module ts { } function emitArrayLiteral(node: ArrayLiteralExpression) { - var elements = node.elements; + let elements = node.elements; if (elements.length === 0) { write("[]"); } @@ -2774,31 +2777,31 @@ module ts { } function emitDownlevelObjectLiteralWithComputedProperties(node: ObjectLiteralExpression, firstComputedPropertyIndex: number): void { - var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex); + let parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex); return emit(parenthesizedObjectLiteral); } function createDownlevelObjectLiteralWithComputedProperties(originalObjectLiteral: ObjectLiteralExpression, firstComputedPropertyIndex: number): ParenthesizedExpression { // For computed properties, we need to create a unique handle to the object // literal so we can modify it without risking internal assignments tainting the object. - var tempVar = createAndRecordTempVariable(originalObjectLiteral); + let tempVar = createAndRecordTempVariable(originalObjectLiteral); // Hold onto the initial non-computed properties in a new object literal, // then create the rest through property accesses on the temp variable. - var initialObjectLiteral = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); + let initialObjectLiteral = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); initialObjectLiteral.properties = >originalObjectLiteral.properties.slice(0, firstComputedPropertyIndex); initialObjectLiteral.flags |= NodeFlags.MultiLine; // The comma expressions that will patch the object literal. // This will end up being something like '_a = { ... }, _a.x = 10, _a.y = 20, _a'. - var propertyPatches = createBinaryExpression(tempVar, SyntaxKind.EqualsToken, initialObjectLiteral); + let propertyPatches = createBinaryExpression(tempVar, SyntaxKind.EqualsToken, initialObjectLiteral); ts.forEach(originalObjectLiteral.properties, property => { - var patchedProperty = tryCreatePatchingPropertyAssignment(originalObjectLiteral, tempVar, property); + let patchedProperty = tryCreatePatchingPropertyAssignment(originalObjectLiteral, tempVar, property); if (patchedProperty) { // TODO(drosen): Preserve comments - //var leadingComments = getLeadingCommentRanges(currentSourceFile.text, property.pos); - //var trailingComments = getTrailingCommentRanges(currentSourceFile.text, property.end); + //let leadingComments = getLeadingCommentRanges(currentSourceFile.text, property.pos); + //let trailingComments = getTrailingCommentRanges(currentSourceFile.text, property.end); //addCommentsToSynthesizedNode(patchedProperty, leadingComments, trailingComments); propertyPatches = createBinaryExpression(propertyPatches, SyntaxKind.CommaToken, patchedProperty); @@ -2808,11 +2811,11 @@ module ts { // Finally, return the temp variable. propertyPatches = createBinaryExpression(propertyPatches, SyntaxKind.CommaToken, createIdentifier(tempVar.text, /*startsOnNewLine:*/ true)); - var result = createParenthesizedExpression(propertyPatches); + let result = createParenthesizedExpression(propertyPatches); // TODO(drosen): Preserve comments - // var leadingComments = getLeadingCommentRanges(currentSourceFile.text, originalObjectLiteral.pos); - // var trailingComments = getTrailingCommentRanges(currentSourceFile.text, originalObjectLiteral.end); + // let leadingComments = getLeadingCommentRanges(currentSourceFile.text, originalObjectLiteral.pos); + // let trailingComments = getTrailingCommentRanges(currentSourceFile.text, originalObjectLiteral.end); //addCommentsToSynthesizedNode(result, leadingComments, trailingComments); return result; @@ -2826,8 +2829,8 @@ module ts { // Returns 'undefined' if a property has already been accounted for // (e.g. a 'get' accessor which has already been emitted along with its 'set' accessor). function tryCreatePatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, tempVar: Identifier, property: ObjectLiteralElement): Expression { - var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); - var maybeRightHandSide = tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property); + let leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); + let maybeRightHandSide = tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property); return maybeRightHandSide && createBinaryExpression(leftHandSide, SyntaxKind.EqualsToken, maybeRightHandSide, /*startsOnNewLine:*/ true); } @@ -2841,7 +2844,7 @@ module ts { // TODO: (andersh) Technically it isn't correct to make an identifier here since getExpressionNamePrefix returns // a string containing a dotted name. In general I'm not a fan of mini tree rewriters as this one, elsewhere we // manage by just emitting strings (which is a lot more performant). - //var prefix = createIdentifier(resolver.getExpressionNamePrefix((property).name)); + //let prefix = createIdentifier(resolver.getExpressionNamePrefix((property).name)); //return createPropertyAccessExpression(prefix, (property).name); return createIdentifier(resolver.getExpressionNameSubstitution((property).name)); @@ -2857,29 +2860,29 @@ module ts { return undefined; } - var propertyDescriptor = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); + let propertyDescriptor = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); - var descriptorProperties = >[]; + let descriptorProperties = >[]; if (getAccessor) { - var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + let getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); descriptorProperties.push(getProperty); } if (setAccessor) { - var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); + let setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); descriptorProperties.push(setProperty); } - var trueExpr = createSynthesizedNode(SyntaxKind.TrueKeyword); + let trueExpr = createSynthesizedNode(SyntaxKind.TrueKeyword); - var enumerableTrue = createPropertyAssignment(createIdentifier("enumerable"), trueExpr); + let enumerableTrue = createPropertyAssignment(createIdentifier("enumerable"), trueExpr); descriptorProperties.push(enumerableTrue); - var configurableTrue = createPropertyAssignment(createIdentifier("configurable"), trueExpr); + let configurableTrue = createPropertyAssignment(createIdentifier("configurable"), trueExpr); descriptorProperties.push(configurableTrue); propertyDescriptor.properties = descriptorProperties; - var objectDotDefineProperty = createPropertyAccessExpression(createIdentifier("Object"), createIdentifier("defineProperty")); + let objectDotDefineProperty = createPropertyAccessExpression(createIdentifier("Object"), createIdentifier("defineProperty")); return createCallExpression(objectDotDefineProperty, createNodeArray(propertyDescriptor)); default: @@ -2888,14 +2891,14 @@ module ts { } function createParenthesizedExpression(expression: Expression) { - var result = createSynthesizedNode(SyntaxKind.ParenthesizedExpression); + let result = createSynthesizedNode(SyntaxKind.ParenthesizedExpression); result.expression = expression; return result; } function createNodeArray(...elements: T[]): NodeArray { - var result = >elements; + let result = >elements; result.pos = -1; result.end = -1; @@ -2903,7 +2906,7 @@ module ts { } function createBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression, startsOnNewLine?: boolean): BinaryExpression { - var result = createSynthesizedNode(SyntaxKind.BinaryExpression, startsOnNewLine); + let result = createSynthesizedNode(SyntaxKind.BinaryExpression, startsOnNewLine); result.operatorToken = createSynthesizedNode(operator); result.left = left; result.right = right; @@ -2912,7 +2915,7 @@ module ts { } function createExpressionStatement(expression: Expression): ExpressionStatement { - var result = createSynthesizedNode(SyntaxKind.ExpressionStatement); + let result = createSynthesizedNode(SyntaxKind.ExpressionStatement); result.expression = expression; return result; } @@ -2933,7 +2936,7 @@ module ts { } function createPropertyAssignment(name: LiteralExpression | Identifier, initializer: Expression) { - var result = createSynthesizedNode(SyntaxKind.PropertyAssignment); + let result = createSynthesizedNode(SyntaxKind.PropertyAssignment); result.name = name; result.initializer = initializer; @@ -2941,7 +2944,7 @@ module ts { } function createFunctionExpression(parameters: NodeArray, body: Block): FunctionExpression { - var result = createSynthesizedNode(SyntaxKind.FunctionExpression); + let result = createSynthesizedNode(SyntaxKind.FunctionExpression); result.parameters = parameters; result.body = body; @@ -2949,7 +2952,7 @@ module ts { } function createPropertyAccessExpression(expression: LeftHandSideExpression, name: Identifier): PropertyAccessExpression { - var result = createSynthesizedNode(SyntaxKind.PropertyAccessExpression); + let result = createSynthesizedNode(SyntaxKind.PropertyAccessExpression); result.expression = expression; result.dotToken = createSynthesizedNode(SyntaxKind.DotToken); result.name = name; @@ -2958,7 +2961,7 @@ module ts { } function createElementAccessExpression(expression: LeftHandSideExpression, argumentExpression: Expression): ElementAccessExpression { - var result = createSynthesizedNode(SyntaxKind.ElementAccessExpression); + let result = createSynthesizedNode(SyntaxKind.ElementAccessExpression); result.expression = expression; result.argumentExpression = argumentExpression; @@ -2966,14 +2969,14 @@ module ts { } function createIdentifier(name: string, startsOnNewLine?: boolean) { - var result = createSynthesizedNode(SyntaxKind.Identifier, startsOnNewLine); + let result = createSynthesizedNode(SyntaxKind.Identifier, startsOnNewLine); result.text = name; return result; } function createCallExpression(invokedExpression: MemberExpression, arguments: NodeArray) { - var result = createSynthesizedNode(SyntaxKind.CallExpression); + let result = createSynthesizedNode(SyntaxKind.CallExpression); result.expression = invokedExpression; result.arguments = arguments; @@ -2981,22 +2984,22 @@ module ts { } function emitObjectLiteral(node: ObjectLiteralExpression): void { - var properties = node.properties; + let properties = node.properties; if (languageVersion < ScriptTarget.ES6) { - var numProperties = properties.length; + let numProperties = properties.length; // Find the first computed property. // Everything until that point can be emitted as part of the initial object literal. - var numInitialNonComputedProperties = numProperties; - for (var i = 0, n = properties.length; i < n; i++) { + let numInitialNonComputedProperties = numProperties; + for (let i = 0, n = properties.length; i < n; i++) { if (properties[i].name.kind === SyntaxKind.ComputedPropertyName) { numInitialNonComputedProperties = i; break; } } - var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + let hasComputedProperty = numInitialNonComputedProperties !== properties.length; if (hasComputedProperty) { emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); return; @@ -3007,7 +3010,6 @@ module ts { // or we're compiling with an ES6+ target. write("{"); - var properties = node.properties; if (properties.length) { emitLinePreservingList(node, properties, /*allowTrailingComma:*/ languageVersion >= ScriptTarget.ES5, /*spacesBetweenBraces:*/ true) } @@ -3039,10 +3041,10 @@ module ts { emit(node.name); // If short-hand property has a prefix, then regardless of the target version, we will emit it as normal property assignment. For example: // module m { - // export var y; + // export let y; // } // module m { - // export var obj = { y }; + // export let obj = { y }; // } // The short-hand property in obj need to emit as such ... = { y : m.y } regardless of the TargetScript version if (languageVersion < ScriptTarget.ES6 || resolver.getExpressionNameSubstitution(node.name)) { @@ -3055,11 +3057,11 @@ module ts { } function tryEmitConstantValue(node: PropertyAccessExpression | ElementAccessExpression): boolean { - var constantValue = resolver.getConstantValue(node); + let constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName: string = node.kind === SyntaxKind.PropertyAccessExpression ? declarationNameToString((node).name) : getTextOfNode((node).argumentExpression); + let propertyName: string = node.kind === SyntaxKind.PropertyAccessExpression ? declarationNameToString((node).name) : getTextOfNode((node).argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -3071,10 +3073,10 @@ module ts { // If the code is not indented, an optional valueToWriteWhenNotIndenting will be // emitted instead. function indentIfOnDifferentLines(parent: Node, node1: Node, node2: Node, valueToWriteWhenNotIndenting?: string): boolean { - var realNodesAreOnDifferentLines = preserveNewLines && !nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); + let realNodesAreOnDifferentLines = preserveNewLines && !nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); // Always use a newline for synthesized code if the synthesizer desires it. - var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); + let synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); if (realNodesAreOnDifferentLines || synthesizedNodeIsOnDifferentLine) { increaseIndent(); @@ -3095,9 +3097,9 @@ module ts { } emit(node.expression); - var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); + let indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); write("."); - var indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); + let indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); emit(node.name); decreaseIndentIf(indentedBeforeDot, indentedAfterDot); } @@ -3134,7 +3136,7 @@ module ts { emit(node); return node; } - var temp = createAndRecordTempVariable(node); + let temp = createAndRecordTempVariable(node); write("("); emit(temp); @@ -3145,8 +3147,8 @@ module ts { } function emitCallWithSpread(node: CallExpression) { - var target: Expression; - var expr = skipParentheses(node.expression); + let target: Expression; + let expr = skipParentheses(node.expression); if (expr.kind === SyntaxKind.PropertyAccessExpression) { // Target will be emitted as "this" argument target = emitCallTarget((expr).expression); @@ -3192,7 +3194,7 @@ module ts { emitCallWithSpread(node); return; } - var superCall = false; + let superCall = false; if (node.expression.kind === SyntaxKind.SuperKeyword) { write("_super"); superCall = true; @@ -3241,7 +3243,7 @@ module ts { function emitParenExpression(node: ParenthesizedExpression) { if (!node.parent || node.parent.kind !== SyntaxKind.ArrowFunction) { if (node.expression.kind === SyntaxKind.TypeAssertionExpression) { - var operand = (node.expression).expression; + let operand = (node.expression).expression; // Make sure we consider all nested cast expressions, e.g.: // (-A).x; @@ -3309,7 +3311,7 @@ module ts { // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. if (node.operand.kind === SyntaxKind.PrefixUnaryExpression) { - var operand = node.operand; + let operand = node.operand; if (node.operator === SyntaxKind.PlusToken && (operand.operator === SyntaxKind.PlusToken || operand.operator === SyntaxKind.PlusPlusToken)) { write(" "); } @@ -3332,9 +3334,9 @@ module ts { } else { emit(node.left); - var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== SyntaxKind.CommaToken ? " " : undefined); + let indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== SyntaxKind.CommaToken ? " " : undefined); write(tokenToString(node.operatorToken.kind)); - var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); + let indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); emit(node.right); decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); } @@ -3346,14 +3348,14 @@ module ts { function emitConditionalExpression(node: ConditionalExpression) { emit(node.condition); - var indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); + let indentedBeforeQuestion = indentIfOnDifferentLines(node, node.condition, node.questionToken, " "); write("?"); - var indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); + let indentedAfterQuestion = indentIfOnDifferentLines(node, node.questionToken, node.whenTrue, " "); emit(node.whenTrue); decreaseIndentIf(indentedBeforeQuestion, indentedAfterQuestion); - var indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); + let indentedBeforeColon = indentIfOnDifferentLines(node, node.whenTrue, node.colonToken, " "); write(":"); - var indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); + let indentedAfterColon = indentIfOnDifferentLines(node, node.colonToken, node.whenFalse, " "); emit(node.whenFalse); decreaseIndentIf(indentedBeforeColon, indentedAfterColon); } @@ -3373,7 +3375,7 @@ module ts { function isSingleLineEmptyBlock(node: Node) { if (node && node.kind === SyntaxKind.Block) { - var block = node; + let block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } } @@ -3422,7 +3424,7 @@ module ts { } function emitIfStatement(node: IfStatement) { - var endPos = emitToken(SyntaxKind.IfKeyword, node.pos); + let endPos = emitToken(SyntaxKind.IfKeyword, node.pos); write(" "); endPos = emitToken(SyntaxKind.OpenParenToken, endPos); emit(node.expression); @@ -3463,7 +3465,7 @@ module ts { } function emitStartOfVariableDeclarationList(decl: Node, startPos?: number): void { - var tokenKind = SyntaxKind.VarKeyword; + let tokenKind = SyntaxKind.VarKeyword; if (decl && languageVersion >= ScriptTarget.ES6) { if (isLet(decl)) { tokenKind = SyntaxKind.LetKeyword; @@ -3489,12 +3491,12 @@ module ts { } function emitForStatement(node: ForStatement) { - var endPos = emitToken(SyntaxKind.ForKeyword, node.pos); + let endPos = emitToken(SyntaxKind.ForKeyword, node.pos); write(" "); endPos = emitToken(SyntaxKind.OpenParenToken, endPos); if (node.initializer && node.initializer.kind === SyntaxKind.VariableDeclarationList) { - var variableDeclarationList = node.initializer; - var declarations = variableDeclarationList.declarations; + let variableDeclarationList = node.initializer; + let declarations = variableDeclarationList.declarations; emitStartOfVariableDeclarationList(declarations[0], endPos); write(" "); emitCommaList(declarations); @@ -3515,13 +3517,13 @@ module ts { return emitDownLevelForOfStatement(node); } - var endPos = emitToken(SyntaxKind.ForKeyword, node.pos); + let endPos = emitToken(SyntaxKind.ForKeyword, node.pos); write(" "); endPos = emitToken(SyntaxKind.OpenParenToken, endPos); if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { - var variableDeclarationList = node.initializer; + let variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { - var decl = variableDeclarationList.declarations[0]; + let decl = variableDeclarationList.declarations[0]; emitStartOfVariableDeclarationList(decl, endPos); write(" "); emit(decl); @@ -3545,18 +3547,18 @@ module ts { function emitDownLevelForOfStatement(node: ForOfStatement) { // The following ES6 code: // - // for (var v of expr) { } + // for (let v of expr) { } // // should be emitted as // - // for (var _i = 0, _a = expr; _i < _a.length; _i++) { - // var v = _a[_i]; + // for (let _i = 0, _a = expr; _i < _a.length; _i++) { + // let v = _a[_i]; // } // // where _a and _i are temps emitted to capture the RHS and the counter, // respectively. - // When the left hand side is an expression instead of a var declaration, - // the "var v" is not emitted. + // When the left hand side is an expression instead of a let declaration, + // the "let v" is not emitted. // When the left hand side is a let/const, the v is renamed if there is // another v in scope. // Note that all assignments to the LHS are emitted in the body, including @@ -3564,24 +3566,24 @@ module ts { // Note also that because an extra statement is needed to assign to the LHS, // for-of bodies are always emitted as blocks. - var endPos = emitToken(SyntaxKind.ForKeyword, node.pos); + let endPos = emitToken(SyntaxKind.ForKeyword, node.pos); write(" "); endPos = emitToken(SyntaxKind.OpenParenToken, endPos); - // Do not emit the LHS var declaration yet, because it might contain destructuring. + // Do not emit the LHS let declaration yet, because it might contain destructuring. // Do not call recordTempDeclaration because we are declaring the temps // right here. Recording means they will be declared later. // In the case where the user wrote an identifier as the RHS, like this: // - // for (var v of arr) { } + // for (let v of arr) { } // // we don't want to emit a temporary variable for the RHS, just use it directly. - var rhsIsIdentifier = node.expression.kind === SyntaxKind.Identifier; - var counter = createTempVariable(node, /*forLoopVariable*/ true); - var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, /*forLoopVariable*/ false); + let rhsIsIdentifier = node.expression.kind === SyntaxKind.Identifier; + let counter = createTempVariable(node, /*forLoopVariable*/ true); + let rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, /*forLoopVariable*/ false); - // This is the var keyword for the counter and rhsReference. The var keyword for + // This is the let keyword for the counter and rhsReference. The let keyword for // the LHS will be emitted inside the body. emitStart(node.expression); write("var "); @@ -3624,14 +3626,14 @@ module ts { increaseIndent(); // Initialize LHS - // var v = _a[_i]; - var rhsIterationValue = createElementAccessExpression(rhsReference, counter); + // let v = _a[_i]; + let rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { write("var "); - var variableDeclarationList = node.initializer; + let variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { - var declaration = variableDeclarationList.declarations[0]; + let declaration = variableDeclarationList.declarations[0]; if (isBindingPattern(declaration.name)) { // This works whether the declaration is a var, let, or const. // It will use rhsIterationValue _a[_i] as the initializer. @@ -3647,7 +3649,7 @@ module ts { } else { // It's an empty declaration list. This can only happen in an error case, if the user wrote - // for (var of []) {} + // for (let of []) {} emitNodeWithoutSourceMap(createTempVariable(node, /*forLoopVariable*/ false)); write(" = "); emitNodeWithoutSourceMap(rhsIterationValue); @@ -3656,7 +3658,7 @@ module ts { else { // Initializer is an expression. Emit the expression in the body, so that it's // evaluated on every iteration. - var assignmentExpression = createBinaryExpression(node.initializer, SyntaxKind.EqualsToken, rhsIterationValue, /*startsOnNewLine*/ false); + let assignmentExpression = createBinaryExpression(node.initializer, SyntaxKind.EqualsToken, rhsIterationValue, /*startsOnNewLine*/ false); if (node.initializer.kind === SyntaxKind.ArrayLiteralExpression || node.initializer.kind === SyntaxKind.ObjectLiteralExpression) { // This is a destructuring pattern, so call emitDestructuring instead of emit. Calling emit will not work, because it will cause // the BinaryExpression to be passed in instead of the expression statement, which will cause emitDestructuring to crash. @@ -3702,7 +3704,7 @@ module ts { } function emitSwitchStatement(node: SwitchStatement) { - var endPos = emitToken(SyntaxKind.SwitchKeyword, node.pos); + let endPos = emitToken(SyntaxKind.SwitchKeyword, node.pos); write(" "); emitToken(SyntaxKind.OpenParenToken, endPos); emit(node.expression); @@ -3775,7 +3777,7 @@ module ts { function emitCatchClause(node: CatchClause) { writeLine(); - var endPos = emitToken(SyntaxKind.CatchKeyword, node.pos); + let endPos = emitToken(SyntaxKind.CatchKeyword, node.pos); write(" "); emitToken(SyntaxKind.OpenParenToken, endPos); emit(node.variableDeclaration); @@ -3803,7 +3805,7 @@ module ts { } function emitContainingModuleName(node: Node) { - var container = getContainingModule(node); + let container = getContainingModule(node); write(container ? resolver.getGeneratedNameForNode(container) : "exports"); } @@ -3818,9 +3820,9 @@ module ts { } function createVoidZero(): Expression { - var zero = createSynthesizedNode(SyntaxKind.NumericLiteral); + let zero = createSynthesizedNode(SyntaxKind.NumericLiteral); zero.text = "0"; - var result = createSynthesizedNode(SyntaxKind.VoidExpression); + let result = createSynthesizedNode(SyntaxKind.VoidExpression); result.expression = zero; return result; } @@ -3851,10 +3853,10 @@ module ts { isAssignmentExpressionStatement: boolean, value?: Expression, lowestNonSynthesizedAncestor?: Node) { - var emitCount = 0; + let emitCount = 0; // An exported declaration is actually emitted as an assignment (to a property on the module object), so // temporary variables in an exported declaration need to have real declarations elsewhere - var isDeclaration = (root.kind === SyntaxKind.VariableDeclaration && !(getCombinedNodeFlags(root) & NodeFlags.Export)) || root.kind === SyntaxKind.Parameter; + let isDeclaration = (root.kind === SyntaxKind.VariableDeclaration && !(getCombinedNodeFlags(root) & NodeFlags.Export)) || root.kind === SyntaxKind.Parameter; if (root.kind === SyntaxKind.BinaryExpression) { emitAssignmentExpression(root); } @@ -3884,7 +3886,7 @@ module ts { // In case the root is a synthesized node, we need to pass lowestNonSynthesizedAncestor // as the location for determining uniqueness of the variable we are about to // generate. - var identifier = createTempVariable(lowestNonSynthesizedAncestor || root); + let identifier = createTempVariable(lowestNonSynthesizedAncestor || root); if (!isDeclaration) { recordTempDeclaration(identifier); } @@ -3899,7 +3901,7 @@ module ts { // we need to generate a temporary variable value = ensureIdentifier(value); // Return the expression 'value === void 0 ? defaultValue : value' - var equals = createSynthesizedNode(SyntaxKind.BinaryExpression); + let equals = createSynthesizedNode(SyntaxKind.BinaryExpression); equals.left = value; equals.operatorToken = createSynthesizedNode(SyntaxKind.EqualsEqualsEqualsToken); equals.right = createVoidZero(); @@ -3907,7 +3909,7 @@ module ts { } function createConditionalExpression(condition: Expression, whenTrue: Expression, whenFalse: Expression) { - var cond = createSynthesizedNode(SyntaxKind.ConditionalExpression); + let cond = createSynthesizedNode(SyntaxKind.ConditionalExpression); cond.condition = condition; cond.questionToken = createSynthesizedNode(SyntaxKind.QuestionToken); cond.whenTrue = whenTrue; @@ -3917,7 +3919,7 @@ module ts { } function createNumericLiteral(value: number) { - var node = createSynthesizedNode(SyntaxKind.NumericLiteral); + let node = createSynthesizedNode(SyntaxKind.NumericLiteral); node.text = "" + value; return node; } @@ -3926,7 +3928,7 @@ module ts { if (expr.kind === SyntaxKind.Identifier || expr.kind === SyntaxKind.PropertyAccessExpression || expr.kind === SyntaxKind.ElementAccessExpression) { return expr; } - var node = createSynthesizedNode(SyntaxKind.ParenthesizedExpression); + let node = createSynthesizedNode(SyntaxKind.ParenthesizedExpression); node.expression = expr; return node; } @@ -3939,14 +3941,14 @@ module ts { } function createElementAccess(object: Expression, index: Expression): Expression { - var node = createSynthesizedNode(SyntaxKind.ElementAccessExpression); + let node = createSynthesizedNode(SyntaxKind.ElementAccessExpression); node.expression = parenthesizeForAccess(object); node.argumentExpression = index; return node; } function emitObjectLiteralAssignment(target: ObjectLiteralExpression, value: Expression) { - var properties = target.properties; + let properties = target.properties; if (properties.length !== 1) { // For anything but a single element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. @@ -3955,21 +3957,21 @@ module ts { for (let p of properties) { if (p.kind === SyntaxKind.PropertyAssignment || p.kind === SyntaxKind.ShorthandPropertyAssignment) { // TODO(andersh): Computed property support - var propName = ((p).name); + let propName = ((p).name); emitDestructuringAssignment((p).initializer || propName, createPropertyAccess(value, propName)); } } } function emitArrayLiteralAssignment(target: ArrayLiteralExpression, value: Expression) { - var elements = target.elements; + let elements = target.elements; if (elements.length !== 1) { // For anything but a single element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. value = ensureIdentifier(value); } - for (var i = 0; i < elements.length; i++) { - var e = elements[i]; + for (let i = 0; i < elements.length; i++) { + let e = elements[i]; if (e.kind !== SyntaxKind.OmittedExpression) { if (e.kind !== SyntaxKind.SpreadElementExpression) { emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i))); @@ -4002,8 +4004,8 @@ module ts { } function emitAssignmentExpression(root: BinaryExpression) { - var target = root.left; - var value = root.right; + let target = root.left; + let value = root.right; if (isAssignmentExpressionStatement) { emitDestructuringAssignment(target, value); } @@ -4031,18 +4033,18 @@ module ts { value = createVoidZero(); } if (isBindingPattern(target.name)) { - var pattern = target.name; - var elements = pattern.elements; + let pattern = target.name; + let elements = pattern.elements; if (elements.length !== 1) { // For anything but a single element destructuring we need to generate a temporary // to ensure value is evaluated exactly once. value = ensureIdentifier(value); } - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; + for (let i = 0; i < elements.length; i++) { + let element = elements[i]; if (pattern.kind === SyntaxKind.ObjectBindingPattern) { // Rewrite element to a declaration with an initializer that fetches property - var propName = element.propertyName || element.name; + let propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccess(value, propName)); } else if (element.kind !== SyntaxKind.OmittedExpression) { @@ -4080,7 +4082,7 @@ module ts { renameNonTopLevelLetAndConst(node.name); emitModuleMemberName(node); - var initializer = node.initializer; + let initializer = node.initializer; if (!initializer && languageVersion < ScriptTarget.ES6) { // downlevel emit for non-initialized let bindings defined in loops @@ -4089,7 +4091,7 @@ module ts { // for (...) { var = void 0; } // this is necessary to preserve ES6 semantic in scenarios like // for (...) { let x; console.log(x); x = 1 } // assignment on one iteration should not affect other iterations - var isUninitializedLet = + let isUninitializedLet = (resolver.getNodeCheckFlags(node) & NodeCheckFlags.BlockScopedBindingInLoop) && (getCombinedFlagsForIdentifier(node.name) & NodeFlags.Let); @@ -4106,7 +4108,7 @@ module ts { } function emitExportVariableAssignments(node: VariableDeclaration | BindingElement) { - var name = (node).name; + let name = (node).name; if (name.kind === SyntaxKind.Identifier) { emitExportMemberAssignments(name); } @@ -4137,26 +4139,26 @@ module ts { return; } - var combinedFlags = getCombinedFlagsForIdentifier(node); + let combinedFlags = getCombinedFlagsForIdentifier(node); if (((combinedFlags & NodeFlags.BlockScoped) === 0) || combinedFlags & NodeFlags.Export) { // do not rename exported or non-block scoped variables return; } // here it is known that node is a block scoped variable - var list = getAncestor(node, SyntaxKind.VariableDeclarationList); + let list = getAncestor(node, SyntaxKind.VariableDeclarationList); if (list.parent.kind === SyntaxKind.VariableStatement && list.parent.parent.kind === SyntaxKind.SourceFile) { // do not rename variables that are defined on source file level return; } - var blockScopeContainer = getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === SyntaxKind.SourceFile + let blockScopeContainer = getEnclosingBlockScopeContainer(node); + let parent = blockScopeContainer.kind === SyntaxKind.SourceFile ? blockScopeContainer : blockScopeContainer.parent; - var generatedName = generateUniqueNameForLocation(parent, (node).text); - var variableId = resolver.getBlockScopedVariableId(node); + let generatedName = generateUniqueNameForLocation(parent, (node).text); + let variableId = resolver.getBlockScopedVariableId(node); if (!generatedBlockScopeNames) { generatedBlockScopeNames = []; } @@ -4177,7 +4179,7 @@ module ts { function emitParameter(node: ParameterDeclaration) { if (languageVersion < ScriptTarget.ES6) { if (isBindingPattern(node.name)) { - var name = createTempVariable(node); + let name = createTempVariable(node); if (!tempParameters) { tempParameters = []; } @@ -4199,7 +4201,7 @@ module ts { function emitDefaultValueAssignments(node: FunctionLikeDeclaration) { if (languageVersion < ScriptTarget.ES6) { - var tempIndex = 0; + let tempIndex = 0; forEach(node.parameters, p => { if (isBindingPattern(p.name)) { writeLine(); @@ -4229,9 +4231,9 @@ module ts { function emitRestParameter(node: FunctionLikeDeclaration) { if (languageVersion < ScriptTarget.ES6 && hasRestParameters(node)) { - var restIndex = node.parameters.length - 1; - var restParam = node.parameters[restIndex]; - var tempName = createTempVariable(node, /*forLoopVariable*/ true).text; + let restIndex = node.parameters.length - 1; + let restParam = node.parameters[restIndex]; + let tempName = createTempVariable(node, /*forLoopVariable*/ true).text; writeLine(); emitLeadingComments(restParam); emitStart(restParam); @@ -4326,8 +4328,8 @@ module ts { increaseIndent(); write("("); if (node) { - var parameters = node.parameters; - var omitCount = languageVersion < ScriptTarget.ES6 && hasRestParameters(node) ? 1 : 0; + let parameters = node.parameters; + let omitCount = languageVersion < ScriptTarget.ES6 && hasRestParameters(node) ? 1 : 0; emitList(parameters, 0, parameters.length - omitCount, /*multiLine*/ false, /*trailingComma*/ false); } write(")"); @@ -4344,14 +4346,14 @@ module ts { } function emitSignatureAndBody(node: FunctionLikeDeclaration) { - var saveTempCount = tempCount; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; + let saveTempCount = tempCount; + let saveTempVariables = tempVariables; + let saveTempParameters = tempParameters; tempCount = 0; tempVariables = undefined; tempParameters = undefined; - var popFrame = enterNameScope() + let popFrame = enterNameScope() // When targeting ES6, emit arrow function natively in ES6 if (shouldEmitAsArrowFunction(node)) { @@ -4411,7 +4413,7 @@ module ts { write(" "); // Unwrap all type assertions. - var current = body; + let current = body; while (current.kind === SyntaxKind.TypeAssertionExpression) { current = (current).expression; } @@ -4424,10 +4426,10 @@ module ts { scopeEmitStart(node); increaseIndent(); - var outPos = writer.getTextPos(); + let outPos = writer.getTextPos(); emitDetachedComments(node.body); emitFunctionBodyPreamble(node); - var preambleEmitted = writer.getTextPos() !== outPos; + let preambleEmitted = writer.getTextPos() !== outPos; decreaseIndent(); // If we didn't have to emit any preamble code, then attempt to keep the arrow @@ -4473,18 +4475,18 @@ module ts { write(" {"); scopeEmitStart(node); - var initialTextPos = writer.getTextPos(); + let initialTextPos = writer.getTextPos(); increaseIndent(); emitDetachedComments(body.statements); // Emit all the directive prologues (like "use strict"). These have to come before // any other preamble code we write (like parameter initializers). - var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); + let startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); emitFunctionBodyPreamble(node); decreaseIndent(); - var preambleEmitted = writer.getTextPos() !== initialTextPos; + let preambleEmitted = writer.getTextPos() !== initialTextPos; if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { for (let statement of body.statements) { @@ -4511,11 +4513,11 @@ module ts { function findInitialSuperCall(ctor: ConstructorDeclaration): ExpressionStatement { if (ctor.body) { - var statement = (ctor.body).statements[0]; + let statement = (ctor.body).statements[0]; if (statement && statement.kind === SyntaxKind.ExpressionStatement) { - var expr = (statement).expression; + let expr = (statement).expression; if (expr && expr.kind === SyntaxKind.CallExpression) { - var func = (expr).expression; + let func = (expr).expression; if (func && func.kind === SyntaxKind.SuperKeyword) { return statement; } @@ -4608,7 +4610,7 @@ module ts { emitTrailingComments(member); } else if (member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) { - var accessors = getAllAccessorDeclarations(node.members, member); + let accessors = getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); emitStart(member); @@ -4663,7 +4665,7 @@ module ts { write("var "); emitDeclarationName(node); write(" = (function ("); - var baseTypeNode = getClassBaseTypeNode(node); + let baseTypeNode = getClassBaseTypeNode(node); if (baseTypeNode) { write("_super"); } @@ -4713,14 +4715,14 @@ module ts { } function emitConstructorOfClass() { - var saveTempCount = tempCount; - var saveTempVariables = tempVariables; - var saveTempParameters = tempParameters; + let saveTempCount = tempCount; + let saveTempVariables = tempVariables; + let saveTempParameters = tempParameters; tempCount = 0; tempVariables = undefined; tempParameters = undefined; - var popFrame = enterNameScope(); + let popFrame = enterNameScope(); // Emit the constructor overload pinned comments forEach(node.members, member => { @@ -4729,7 +4731,7 @@ module ts { } }); - var ctor = getFirstConstructorWithBody(node); + let ctor = getFirstConstructorWithBody(node); if (ctor) { emitLeadingComments(ctor); } @@ -4744,11 +4746,12 @@ module ts { emitDetachedComments((ctor.body).statements); } emitCaptureThisForNodeIfNecessary(node); + let superCall: ExpressionStatement; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); if (baseTypeNode) { - var superCall = findInitialSuperCall(ctor); + superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); emit(superCall); @@ -4766,7 +4769,7 @@ module ts { } emitMemberAssignments(node, /*nonstatic*/0); if (ctor) { - var statements: Node[] = (ctor.body).statements; + let statements: Node[] = (ctor.body).statements; if (superCall) statements = statements.slice(1); emitLines(statements); } @@ -4796,7 +4799,7 @@ module ts { } function shouldEmitEnumDeclaration(node: EnumDeclaration) { - var isConstEnum = isConst(node); + let isConstEnum = isConst(node); return !isConstEnum || compilerOptions.preserveConstEnums; } @@ -4849,7 +4852,7 @@ module ts { } function emitEnumMember(node: EnumMember) { - var enumParent = node.parent; + let enumParent = node.parent; emitStart(node); write(resolver.getGeneratedNameForNode(enumParent)); write("["); @@ -4866,7 +4869,7 @@ module ts { function writeEnumMemberDeclarationValue(member: EnumMember) { if (!member.initializer || isConst(member.parent)) { - var value = resolver.getConstantValue(member); + let value = resolver.getConstantValue(member); if (value !== undefined) { write(value.toString()); return; @@ -4883,7 +4886,7 @@ module ts { function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration: ModuleDeclaration): ModuleDeclaration { if (moduleDeclaration.body.kind === SyntaxKind.ModuleDeclaration) { - var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); + let recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } } @@ -4894,7 +4897,7 @@ module ts { function emitModuleDeclaration(node: ModuleDeclaration) { // Emit only if this module is non-ambient. - var shouldEmit = shouldEmitModuleDeclaration(node); + let shouldEmit = shouldEmitModuleDeclaration(node); if (!shouldEmit) { return emitPinnedOrTripleSlashComments(node); @@ -4913,11 +4916,11 @@ module ts { emitEnd(node.name); write(") "); if (node.body.kind === SyntaxKind.ModuleBlock) { - var saveTempCount = tempCount; - var saveTempVariables = tempVariables; + let saveTempCount = tempCount; + let saveTempVariables = tempVariables; tempCount = 0; tempVariables = undefined; - var popFrame = enterNameScope(); + let popFrame = enterNameScope(); emit(node.body); @@ -4934,7 +4937,7 @@ module ts { emit(node.body); decreaseIndent(); writeLine(); - var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; + let moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; emitToken(SyntaxKind.CloseBraceToken, moduleBlock.statements.end); scopeEmitEnd(); } @@ -4968,14 +4971,14 @@ module ts { } function emitImportDeclaration(node: ImportDeclaration | ImportEqualsDeclaration) { - var info = getExternalImportInfo(node); + let info = getExternalImportInfo(node); if (info) { - var declarationNode = info.declarationNode; - var namedImports = info.namedImports; + let declarationNode = info.declarationNode; + let namedImports = info.namedImports; if (compilerOptions.module !== ModuleKind.AMD) { emitLeadingComments(node); emitStart(node); - var moduleName = getExternalModuleName(node); + let moduleName = getExternalModuleName(node); if (declarationNode) { if (!(declarationNode.flags & NodeFlags.Export)) write("var "); emitModuleMemberName(declarationNode); @@ -5032,7 +5035,7 @@ module ts { function emitExportDeclaration(node: ExportDeclaration) { if (node.moduleSpecifier) { emitStart(node); - var generatedName = resolver.getGeneratedNameForNode(node); + let generatedName = resolver.getGeneratedNameForNode(node); if (compilerOptions.module !== ModuleKind.AMD) { write("var "); write(generatedName); @@ -5057,7 +5060,7 @@ module ts { } else { // export * - var tempName = createTempVariable(node).text; + let tempName = createTempVariable(node).text; writeLine(); write("for (var " + tempName + " in " + generatedName + ") if (!"); emitContainingModuleName(node); @@ -5079,7 +5082,7 @@ module ts { } } else if (node.kind === SyntaxKind.ImportDeclaration) { - var importClause = (node).importClause; + let importClause = (node).importClause; if (importClause) { if (importClause.name) { return { @@ -5122,7 +5125,7 @@ module ts { if (specifier.name.text === "default") { exportDefault = exportDefault || specifier; } - var name = (specifier.propertyName || specifier.name).text; + let name = (specifier.propertyName || specifier.name).text; (exportSpecifiers[name] || (exportSpecifiers[name] = [])).push(specifier); }); } @@ -5135,7 +5138,7 @@ module ts { } } else { - var info = createExternalImportInfo(node); + let info = createExternalImportInfo(node); if (info) { if ((!info.declarationNode && !info.namedImports) || resolver.isReferencedAliasDeclaration(node)) { externalImports.push(info); @@ -5186,7 +5189,7 @@ module ts { write("[\"require\", \"exports\""); forEach(externalImports, info => { write(", "); - var moduleName = getExternalModuleName(info.rootNode); + let moduleName = getExternalModuleName(info.rootNode); if (moduleName.kind === SyntaxKind.StringLiteral) { emitLiteral(moduleName); } @@ -5195,7 +5198,7 @@ module ts { } }); forEach(node.amdDependencies, amdDependency => { - var text = "\"" + amdDependency.path + "\""; + let text = "\"" + amdDependency.path + "\""; write(", "); write(text); }); @@ -5253,7 +5256,7 @@ module ts { } function emitDirectivePrologues(statements: Node[], startWithNewLine: boolean): number { - for (var i = 0; i < statements.length; ++i) { + for (let i = 0; i < statements.length; ++i) { if (isPrologueDirective(statements[i])) { if (startWithNewLine || i > 0) { writeLine(); @@ -5274,7 +5277,7 @@ module ts { emitDetachedComments(node); // emit prologue directives prior to __extends - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); + let startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); if (!extendsEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitExtends) { writeLine(); write("var __extends = this.__extends || function (d, b) {"); @@ -5322,7 +5325,7 @@ module ts { return emitPinnedOrTripleSlashComments(node); } - var emitComments = shouldEmitLeadingAndTrailingComments(node); + let emitComments = shouldEmitLeadingAndTrailingComments(node); if (emitComments) { emitLeadingComments(node); } @@ -5533,7 +5536,7 @@ module ts { function getLeadingCommentsWithoutDetachedComments() { // get the leading comments from detachedPos - var leadingComments = getLeadingCommentRanges(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos); + let leadingComments = getLeadingCommentRanges(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos); if (detachedCommentsInfo.length - 1) { detachedCommentsInfo.pop(); } @@ -5548,7 +5551,7 @@ module ts { // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) { - var leadingComments: CommentRange[]; + let leadingComments: CommentRange[]; if (hasDetachedComments(node.pos)) { // get comments without detached comments leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -5563,7 +5566,7 @@ module ts { } function emitLeadingDeclarationComments(node: Node) { - var leadingComments = getLeadingCommentsToEmit(node); + let leadingComments = getLeadingCommentsToEmit(node); emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); @@ -5573,7 +5576,7 @@ module ts { // Emit the trailing comments only if the parent's end doesn't match if (node.parent) { if (node.parent.kind === SyntaxKind.SourceFile || node.end !== node.parent.end) { - var trailingComments = getTrailingCommentRanges(currentSourceFile.text, node.end); + let trailingComments = getTrailingCommentRanges(currentSourceFile.text, node.end); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); } @@ -5581,7 +5584,7 @@ module ts { } function emitLeadingCommentsOfLocalPosition(pos: number) { - var leadingComments: CommentRange[]; + let leadingComments: CommentRange[]; if (hasDetachedComments(pos)) { // get comments without detached comments leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -5596,15 +5599,15 @@ module ts { } function emitDetachedCommentsAtPosition(node: TextRange) { - var leadingComments = getLeadingCommentRanges(currentSourceFile.text, node.pos); + let leadingComments = getLeadingCommentRanges(currentSourceFile.text, node.pos); if (leadingComments) { - var detachedComments: CommentRange[] = []; - var lastComment: CommentRange; + let detachedComments: CommentRange[] = []; + let lastComment: CommentRange; forEach(leadingComments, comment => { if (lastComment) { - var lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + let lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); + let commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); if (commentLine >= lastCommentLine + 2) { // There was a blank line between the last comment and this comment. This @@ -5622,13 +5625,13 @@ module ts { // All comments look like they could have been part of the copyright header. Make // sure there is at least one blank line between it and the node. If not, it's not // a copyright header. - var lastCommentLine = getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); - var nodeLine = getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); + let lastCommentLine = getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); + let nodeLine = getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); if (nodeLine >= lastCommentLine + 2) { // Valid detachedComments emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; + let currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); } @@ -5642,7 +5645,7 @@ module ts { /** Emits /// or pinned which is comment starting with /*! comments */ function emitPinnedOrTripleSlashComments(node: Node) { - var pinnedComments = ts.filter(getLeadingCommentsToEmit(node), isPinnedOrTripleSlashComment); + let pinnedComments = ts.filter(getLeadingCommentsToEmit(node), isPinnedOrTripleSlashComment); function isPinnedOrTripleSlashComment(comment: CommentRange) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { @@ -5665,13 +5668,13 @@ module ts { } function writeDeclarationFile(jsFilePath: string, sourceFile: SourceFile) { - var emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile); + let emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile); // TODO(shkamat): Should we not write any declaration file if any of them can produce error, // or should we just not write this file like we are doing now if (!emitDeclarationResult.reportedDeclarationError) { - var declarationOutput = emitDeclarationResult.referencePathsOutput; + let declarationOutput = emitDeclarationResult.referencePathsOutput; // apply additions - var appliedSyncOutputPos = 0; + let appliedSyncOutputPos = 0; forEach(emitDeclarationResult.aliasDeclarationEmitInfo, aliasEmitInfo => { if (aliasEmitInfo.asynchronousOutput) { declarationOutput += emitDeclarationResult.synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos); From 35040b9a8514df9cc209398de29fa0757a38541f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 13:11:17 -0700 Subject: [PATCH 065/101] Use 'let' in the services code. --- src/services/breakpoints.ts | 38 +- src/services/navigateTo.ts | 38 +- src/services/navigationBar.ts | 58 +- src/services/outliningElementsCollector.ts | 40 +- src/services/patternMatcher.ts | 134 +-- src/services/services.ts | 910 +++++++++++---------- src/services/signatureHelp.ts | 136 +-- src/services/utilities.ts | 76 +- 8 files changed, 719 insertions(+), 711 deletions(-) diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 1f87ae40745..c56ea72cd66 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -13,13 +13,13 @@ module ts.BreakpointResolver { return undefined; } - var tokenAtLocation = getTokenAtPosition(sourceFile, position); - var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + let tokenAtLocation = getTokenAtPosition(sourceFile, position); + let lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) { // Get previous token if the token is returned starts on new line - // eg: var x =10; |--- cursor is here - // var y = 10; - // token at position will return var keyword on second line as the token but we would like to use + // eg: let x =10; |--- cursor is here + // let y = 10; + // token at position will return let keyword on second line as the token but we would like to use // token on same line if trailing trivia (comments or white spaces on same line) part of the last token on that line tokenAtLocation = findPrecedingToken(tokenAtLocation.pos, sourceFile); @@ -275,9 +275,9 @@ module ts.BreakpointResolver { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === SyntaxKind.VariableStatement; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === SyntaxKind.ForStatement && contains(((variableDeclaration.parent.parent).initializer).declarations, variableDeclaration); - var declarations = isParentVariableStatement + let isParentVariableStatement = variableDeclaration.parent.parent.kind === SyntaxKind.VariableStatement; + let isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === SyntaxKind.ForStatement && contains(((variableDeclaration.parent.parent).initializer).declarations, variableDeclaration); + let declarations = isParentVariableStatement ? (variableDeclaration.parent.parent).declarationList.declarations : isDeclarationOfForStatement ? ((variableDeclaration.parent.parent).initializer).declarations @@ -287,12 +287,12 @@ module ts.BreakpointResolver { if (variableDeclaration.initializer || (variableDeclaration.flags & NodeFlags.Export)) { if (declarations && declarations[0] === variableDeclaration) { if (isParentVariableStatement) { - // First declaration - include var keyword + // First declaration - include let keyword return textSpan(variableDeclaration.parent, variableDeclaration); } else { Debug.assert(isDeclarationOfForStatement); - // Include var keyword from for statement declarations in the span + // Include let keyword from for statement declarations in the span return textSpan(findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); } } @@ -303,7 +303,7 @@ module ts.BreakpointResolver { } else if (declarations && declarations[0] !== variableDeclaration) { // If we cant set breakpoint on this declaration, set it on previous one - var indexOfCurrentDeclaration = indexOf(declarations, variableDeclaration); + let indexOfCurrentDeclaration = indexOf(declarations, variableDeclaration); return spanInVariableDeclaration(declarations[indexOfCurrentDeclaration - 1]); } } @@ -319,8 +319,8 @@ module ts.BreakpointResolver { return textSpan(parameter); } else { - var functionDeclaration = parameter.parent; - var indexOfParameter = indexOf(functionDeclaration.parameters, parameter); + let functionDeclaration = parameter.parent; + let indexOfParameter = indexOf(functionDeclaration.parameters, parameter); if (indexOfParameter) { // Not a first parameter, go to previous parameter return spanInParameterDeclaration(functionDeclaration.parameters[indexOfParameter - 1]); @@ -353,7 +353,7 @@ module ts.BreakpointResolver { } function spanInFunctionBlock(block: Block): TextSpan { - var nodeForSpanInBlock = block.statements.length ? block.statements[0] : block.getLastToken(); + let nodeForSpanInBlock = block.statements.length ? block.statements[0] : block.getLastToken(); if (canFunctionHaveSpanInWholeDeclaration(block.parent)) { return spanInNodeIfStartsOnSameLine(block.parent, nodeForSpanInBlock); } @@ -387,7 +387,7 @@ module ts.BreakpointResolver { function spanInForStatement(forStatement: ForStatement): TextSpan { if (forStatement.initializer) { if (forStatement.initializer.kind === SyntaxKind.VariableDeclarationList) { - var variableDeclarationList = forStatement.initializer; + let variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); } @@ -409,11 +409,11 @@ module ts.BreakpointResolver { function spanInOpenBraceToken(node: Node): TextSpan { switch (node.parent.kind) { case SyntaxKind.EnumDeclaration: - var enumDeclaration = node.parent; + let enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); case SyntaxKind.ClassDeclaration: - var classDeclaration = node.parent; + let classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); case SyntaxKind.CaseBlock: @@ -449,8 +449,8 @@ module ts.BreakpointResolver { case SyntaxKind.CaseBlock: // breakpoint in last statement of the last clause - var caseBlock = node.parent; - var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; + let caseBlock = node.parent; + let lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; if (lastClause) { return spanInNode(lastClause.statements[lastClause.statements.length - 1]); } diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts index 7757a7acf3a..9871a447c05 100644 --- a/src/services/navigateTo.ts +++ b/src/services/navigateTo.ts @@ -2,21 +2,21 @@ module ts.NavigateTo { type RawNavigateToItem = { name: string; fileName: string; matchKind: PatternMatchKind; isCaseSensitive: boolean; declaration: Declaration }; export function getNavigateToItems(program: Program, cancellationToken: CancellationTokenObject, searchValue: string, maxResultCount: number): NavigateToItem[] { - var patternMatcher = createPatternMatcher(searchValue); - var rawItems: RawNavigateToItem[] = []; + let patternMatcher = createPatternMatcher(searchValue); + let rawItems: RawNavigateToItem[] = []; // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] forEach(program.getSourceFiles(), sourceFile => { cancellationToken.throwIfCancellationRequested(); - var declarations = sourceFile.getNamedDeclarations(); + let declarations = sourceFile.getNamedDeclarations(); for (let declaration of declarations) { var name = getDeclarationName(declaration); if (name !== undefined) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); + let matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); if (!matches) { continue; @@ -25,7 +25,7 @@ module ts.NavigateTo { // It was a match! If the pattern has dots in it, then also see if hte // declaration container matches as well. if (patternMatcher.patternContainsDots) { - var containers = getContainers(declaration); + let containers = getContainers(declaration); if (!containers) { return undefined; } @@ -37,8 +37,8 @@ module ts.NavigateTo { } } - var fileName = sourceFile.fileName; - var matchKind = bestMatchKind(matches); + let fileName = sourceFile.fileName; + let matchKind = bestMatchKind(matches); rawItems.push({ name, fileName, matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration }); } } @@ -49,7 +49,7 @@ module ts.NavigateTo { rawItems = rawItems.slice(0, maxResultCount); } - var items = map(rawItems, createNavigateToItem); + let items = map(rawItems, createNavigateToItem); return items; @@ -67,13 +67,13 @@ module ts.NavigateTo { } function getDeclarationName(declaration: Declaration): string { - var result = getTextOfIdentifierOrLiteral(declaration.name); + let result = getTextOfIdentifierOrLiteral(declaration.name); if (result !== undefined) { return result; } if (declaration.name.kind === SyntaxKind.ComputedPropertyName) { - var expr = (declaration.name).expression; + let expr = (declaration.name).expression; if (expr.kind === SyntaxKind.PropertyAccessExpression) { return (expr).name.text; } @@ -97,7 +97,7 @@ module ts.NavigateTo { function tryAddSingleDeclarationName(declaration: Declaration, containers: string[]) { if (declaration && declaration.name) { - var text = getTextOfIdentifierOrLiteral(declaration.name); + let text = getTextOfIdentifierOrLiteral(declaration.name); if (text !== undefined) { containers.unshift(text); } @@ -117,7 +117,7 @@ module ts.NavigateTo { // // [X.Y.Z]() { } function tryAddComputedPropertyName(expression: Expression, containers: string[], includeLastPortion: boolean): boolean { - var text = getTextOfIdentifierOrLiteral(expression); + let text = getTextOfIdentifierOrLiteral(expression); if (text !== undefined) { if (includeLastPortion) { containers.unshift(text); @@ -126,7 +126,7 @@ module ts.NavigateTo { } if (expression.kind === SyntaxKind.PropertyAccessExpression) { - var propertyAccess = expression; + let propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); } @@ -138,7 +138,7 @@ module ts.NavigateTo { } function getContainers(declaration: Declaration) { - var containers: string[] = []; + let containers: string[] = []; // First, if we started with a computed property name, then add all but the last // portion into the container array. @@ -164,10 +164,10 @@ module ts.NavigateTo { function bestMatchKind(matches: PatternMatch[]) { Debug.assert(matches.length > 0); - var bestMatchKind = PatternMatchKind.camelCase; + let bestMatchKind = PatternMatchKind.camelCase; for (let match of matches) { - var kind = match.kind; + let kind = match.kind; if (kind < bestMatchKind) { bestMatchKind = kind; } @@ -177,7 +177,7 @@ module ts.NavigateTo { } // This means "compare in a case insensitive manner." - var baseSensitivity: Intl.CollatorOptions = { sensitivity: "base" }; + let baseSensitivity: Intl.CollatorOptions = { sensitivity: "base" }; function compareNavigateToItems(i1: RawNavigateToItem, i2: RawNavigateToItem) { // TODO(cyrusn): get the gamut of comparisons that VS already uses here. // Right now we just sort by kind first, and then by name of the item. @@ -189,8 +189,8 @@ module ts.NavigateTo { } function createNavigateToItem(rawItem: RawNavigateToItem): NavigateToItem { - var declaration = rawItem.declaration; - var container = getContainerNode(declaration); + let declaration = rawItem.declaration; + let container = getContainerNode(declaration); return { name: rawItem.name, kind: getNodeKind(declaration), diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 1f67fef5e71..06eaa481dfb 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -4,16 +4,16 @@ module ts.NavigationBar { export function getNavigationBarItems(sourceFile: SourceFile): ts.NavigationBarItem[] { // If the source file has any child items, then it included in the tree // and takes lexical ownership of all other top-level items. - var hasGlobalNode = false; + let hasGlobalNode = false; return getItemsWorker(getTopLevelNodes(sourceFile), createTopLevelItem); function getIndent(node: Node): number { // If we have a global node in the tree, // then it adds an extra layer of depth to all subnodes. - var indent = hasGlobalNode ? 1 : 0; + let indent = hasGlobalNode ? 1 : 0; - var current = node.parent; + let current = node.parent; while (current) { switch (current.kind) { case SyntaxKind.ModuleDeclaration: @@ -39,7 +39,7 @@ module ts.NavigationBar { } function getChildNodes(nodes: Node[]): Node[] { - var childNodes: Node[] = []; + let childNodes: Node[] = []; function visit(node: Node) { switch (node.kind) { @@ -60,7 +60,7 @@ module ts.NavigationBar { break; case SyntaxKind.ImportDeclaration: - var importClause = (node).importClause; + let importClause = (node).importClause; if (importClause) { // Handle default import case e.g.: // import d from "mod"; @@ -102,8 +102,8 @@ module ts.NavigationBar { } } - //for (var i = 0, n = nodes.length; i < n; i++) { - // var node = nodes[i]; + //for (let i = 0, n = nodes.length; i < n; i++) { + // let node = nodes[i]; // if (node.kind === SyntaxKind.ClassDeclaration || // node.kind === SyntaxKind.EnumDeclaration || @@ -122,7 +122,7 @@ module ts.NavigationBar { } function getTopLevelNodes(node: SourceFile): Node[] { - var topLevelNodes: Node[] = []; + let topLevelNodes: Node[] = []; topLevelNodes.push(node); addTopLevelNodes(node.statements, topLevelNodes); @@ -159,13 +159,13 @@ module ts.NavigationBar { break; case SyntaxKind.ModuleDeclaration: - var moduleDeclaration = node; + let moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes((getInnermostModule(moduleDeclaration).body).statements, topLevelNodes); break; case SyntaxKind.FunctionDeclaration: - var functionDeclaration = node; + let functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); addTopLevelNodes((functionDeclaration.body).statements, topLevelNodes); @@ -199,17 +199,17 @@ module ts.NavigationBar { } function getItemsWorker(nodes: Node[], createItem: (n: Node) => ts.NavigationBarItem): ts.NavigationBarItem[] { - var items: ts.NavigationBarItem[] = []; + let items: ts.NavigationBarItem[] = []; - var keyToItem: Map = {}; + let keyToItem: Map = {}; for (let child of nodes) { - var item = createItem(child); + let item = createItem(child); if (item !== undefined) { if (item.text.length > 0) { - var key = item.text + "-" + item.kind + "-" + item.indent; + let key = item.text + "-" + item.kind + "-" + item.indent; - var itemWithSameName = keyToItem[key]; + let itemWithSameName = keyToItem[key]; if (itemWithSameName) { // We had an item with the same name. Merge these items together. merge(itemWithSameName, item); @@ -293,8 +293,8 @@ module ts.NavigationBar { case SyntaxKind.VariableDeclaration: case SyntaxKind.BindingElement: - var variableDeclarationNode: Node; - var name: Node; + let variableDeclarationNode: Node; + let name: Node; if (node.kind === SyntaxKind.BindingElement) { name = (node).name; @@ -391,7 +391,7 @@ module ts.NavigationBar { } // Otherwise, we need to aggregate each identifier to build up the qualified name. - var result: string[] = []; + let result: string[] = []; result.push(moduleDeclaration.name.text); @@ -405,9 +405,9 @@ module ts.NavigationBar { } function createModuleItem(node: ModuleDeclaration): NavigationBarItem { - var moduleName = getModuleName(node); + let moduleName = getModuleName(node); - var childItems = getItemsWorker(getChildNodes((getInnermostModule(node).body).statements), createChildItem); + let childItems = getItemsWorker(getChildNodes((getInnermostModule(node).body).statements), createChildItem); return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, @@ -419,7 +419,7 @@ module ts.NavigationBar { function createFunctionItem(node: FunctionDeclaration) { if (node.name && node.body && node.body.kind === SyntaxKind.Block) { - var childItems = getItemsWorker(sortNodes((node.body).statements), createChildItem); + let childItems = getItemsWorker(sortNodes((node.body).statements), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, @@ -433,14 +433,14 @@ module ts.NavigationBar { } function createSourceFileItem(node: SourceFile): ts.NavigationBarItem { - var childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); + let childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); if (childItems === undefined || childItems.length === 0) { return undefined; } hasGlobalNode = true; - var rootName = isExternalModule(node) + let rootName = isExternalModule(node) ? "\"" + escapeString(getBaseFileName(removeFileExtension(normalizePath(node.fileName)))) + "\"" : "" @@ -457,22 +457,22 @@ module ts.NavigationBar { return undefined; } - var childItems: NavigationBarItem[]; + let childItems: NavigationBarItem[]; if (node.members) { - var constructor = forEach(node.members, member => { + let constructor = forEach(node.members, member => { return member.kind === SyntaxKind.Constructor && member; }); // Add the constructor parameters in as children of the class (for property parameters). // Note that *all non-binding pattern named* parameters will be added to the nodes array, but parameters that // are not properties will be filtered out later by createChildItem. - var nodes: Node[] = removeDynamicallyNamedProperties(node); + let nodes: Node[] = removeDynamicallyNamedProperties(node); if (constructor) { nodes.push.apply(nodes, filter(constructor.parameters, p => !isBindingPattern(p.name))); } - var childItems = getItemsWorker(sortNodes(nodes), createChildItem); + childItems = getItemsWorker(sortNodes(nodes), createChildItem); } return getNavigationBarItem( @@ -485,7 +485,7 @@ module ts.NavigationBar { } function createEnumItem(node: EnumDeclaration): ts.NavigationBarItem { - var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); + let childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); return getNavigationBarItem( node.name.text, ts.ScriptElementKind.enumElement, @@ -496,7 +496,7 @@ module ts.NavigationBar { } function createIterfaceItem(node: InterfaceDeclaration): ts.NavigationBarItem { - var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); + let childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); return getNavigationBarItem( node.name.text, ts.ScriptElementKind.interfaceElement, diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index eee537bbebb..4c9dcedc7a4 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -16,12 +16,12 @@ module ts { export module OutliningElementsCollector { export function collectElements(sourceFile: SourceFile): OutliningSpan[] { - var elements: OutliningSpan[] = []; - var collapseText = "..."; + let elements: OutliningSpan[] = []; + let collapseText = "..."; function addOutliningSpan(hintSpanNode: Node, startElement: Node, endElement: Node, autoCollapse: boolean) { if (hintSpanNode && startElement && endElement) { - var span: OutliningSpan = { + let span: OutliningSpan = { textSpan: createTextSpanFromBounds(startElement.pos, endElement.end), hintSpan: createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end), bannerText: collapseText, @@ -35,8 +35,8 @@ module ts { return isFunctionBlock(node) && node.parent.kind !== SyntaxKind.ArrowFunction; } - var depth = 0; - var maxDepth = 20; + let depth = 0; + let maxDepth = 20; function walk(n: Node): void { if (depth > maxDepth) { return; @@ -44,9 +44,9 @@ module ts { switch (n.kind) { case SyntaxKind.Block: if (!isFunctionBlock(n)) { - var parent = n.parent; - var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile); - var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile); + let parent = n.parent; + let openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile); + let closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile); // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collaps the block, but consider its hint span @@ -66,13 +66,13 @@ module ts { if (parent.kind === SyntaxKind.TryStatement) { // Could be the try-block, or the finally-block. - var tryStatement = parent; + let tryStatement = parent; if (tryStatement.tryBlock === n) { addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { - var finallyKeyword = findChildOfKind(tryStatement, SyntaxKind.FinallyKeyword, sourceFile); + let finallyKeyword = findChildOfKind(tryStatement, SyntaxKind.FinallyKeyword, sourceFile); if (finallyKeyword) { addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n)); break; @@ -84,7 +84,7 @@ module ts { // Block was a standalone block. In this case we want to only collapse // the span of the block, independent of any parent span. - var span = createTextSpanFromBounds(n.getStart(), n.end); + let span = createTextSpanFromBounds(n.getStart(), n.end); elements.push({ textSpan: span, hintSpan: span, @@ -95,23 +95,25 @@ module ts { } // Fallthrough. - case SyntaxKind.ModuleBlock: - var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile); - var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile); + case SyntaxKind.ModuleBlock: { + let openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile); + let closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; + } case SyntaxKind.ClassDeclaration: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.EnumDeclaration: case SyntaxKind.ObjectLiteralExpression: - case SyntaxKind.CaseBlock: - var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile); - var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile); + case SyntaxKind.CaseBlock: { + let openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile); + let closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; + } case SyntaxKind.ArrayLiteralExpression: - var openBracket = findChildOfKind(n, SyntaxKind.OpenBracketToken, sourceFile); - var closeBracket = findChildOfKind(n, SyntaxKind.CloseBracketToken, sourceFile); + let openBracket = findChildOfKind(n, SyntaxKind.OpenBracketToken, sourceFile); + let closeBracket = findChildOfKind(n, SyntaxKind.CloseBracketToken, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); break; } diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index f7874519334..61642552cab 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -112,13 +112,13 @@ module ts { // we see the name of a module that is used everywhere, or the name of an overload). As // such, we cache the information we compute about the candidate for the life of this // pattern matcher so we don't have to compute it multiple times. - var stringToWordSpans: Map = {}; + let stringToWordSpans: Map = {}; pattern = pattern.trim(); - var fullPatternSegment = createSegment(pattern); - var dotSeparatedSegments = pattern.split(".").map(p => createSegment(p.trim())); - var invalidPattern = dotSeparatedSegments.length === 0 || forEach(dotSeparatedSegments, segmentIsInvalid); + let fullPatternSegment = createSegment(pattern); + let dotSeparatedSegments = pattern.split(".").map(p => createSegment(p.trim())); + let invalidPattern = dotSeparatedSegments.length === 0 || forEach(dotSeparatedSegments, segmentIsInvalid); return { getMatches, @@ -147,7 +147,7 @@ module ts { // First, check that the last part of the dot separated pattern matches the name of the // candidate. If not, then there's no point in proceeding and doing the more // expensive work. - var candidateMatch = matchSegment(candidate, lastOrUndefined(dotSeparatedSegments)); + let candidateMatch = matchSegment(candidate, lastOrUndefined(dotSeparatedSegments)); if (!candidateMatch) { return undefined; } @@ -164,16 +164,16 @@ module ts { // So far so good. Now break up the container for the candidate and check if all // the dotted parts match up correctly. - var totalMatch = candidateMatch; + let totalMatch = candidateMatch; - for (var i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; + for (let i = dotSeparatedSegments.length - 2, j = candidateContainers.length - 1; i >= 0; i--, j--) { - var segment = dotSeparatedSegments[i]; - var containerName = candidateContainers[j]; + let segment = dotSeparatedSegments[i]; + let containerName = candidateContainers[j]; - var containerMatch = matchSegment(containerName, segment); + let containerMatch = matchSegment(containerName, segment); if (!containerMatch) { // This container didn't match the pattern piece. So there's no match at all. return undefined; @@ -196,7 +196,7 @@ module ts { } function matchTextChunk(candidate: string, chunk: TextChunk, punctuationStripped: boolean): PatternMatch { - var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); + let index = indexOfIgnoringCase(candidate, chunk.textLowerCase); if (index === 0) { if (chunk.text.length === candidate.length) { // a) Check if the part matches the candidate entirely, in an case insensitive or @@ -210,7 +210,7 @@ module ts { } } - var isLowercase = chunk.isLowerCase; + let isLowercase = chunk.isLowerCase; if (isLowercase) { if (index > 0) { // c) If the part is entirely lowercase, then check if it is contained anywhere in the @@ -220,7 +220,7 @@ module ts { // Note: We only have a substring match if the lowercase part is prefix match of some // word part. That way we don't match something like 'Class' when the user types 'a'. // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). - var wordSpans = getWordSpans(candidate); + let wordSpans = getWordSpans(candidate); for (let span of wordSpans) { if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { return createPatternMatch(PatternMatchKind.substring, punctuationStripped, @@ -241,8 +241,8 @@ module ts { if (!isLowercase) { // e) If the part was not entirely lowercase, then attempt a camel cased match as well. if (chunk.characterSpans.length > 0) { - var candidateParts = getWordSpans(candidate); - var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false); + let candidateParts = getWordSpans(candidate); + let camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false); if (camelCaseWeight !== undefined) { return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, /*isCaseSensitive:*/ true, /*camelCaseWeight:*/ camelCaseWeight); } @@ -273,8 +273,8 @@ module ts { } function containsSpaceOrAsterisk(text: string): boolean { - for (var i = 0; i < text.length; i++) { - var ch = text.charCodeAt(i); + for (let i = 0; i < text.length; i++) { + let ch = text.charCodeAt(i); if (ch === CharacterCodes.space || ch === CharacterCodes.asterisk) { return true; } @@ -292,7 +292,7 @@ module ts { // Note: if the segment contains a space or an asterisk then we must assume that it's a // multi-word segment. if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { - var match = matchTextChunk(candidate, segment.totalTextChunk, /*punctuationStripped:*/ false); + let match = matchTextChunk(candidate, segment.totalTextChunk, /*punctuationStripped:*/ false); if (match) { return [match]; } @@ -335,12 +335,12 @@ module ts { // // Only if all words have some sort of match is the pattern considered matched. - var subWordTextChunks = segment.subWordTextChunks; - var matches: PatternMatch[] = undefined; + let subWordTextChunks = segment.subWordTextChunks; + let matches: PatternMatch[] = undefined; for (let subWordTextChunk of subWordTextChunks) { // Try to match the candidate with this word - var result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true); + let result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true); if (!result) { return undefined; } @@ -353,8 +353,8 @@ module ts { } function partStartsWith(candidate: string, candidateSpan: TextSpan, pattern: string, ignoreCase: boolean, patternSpan?: TextSpan): boolean { - var patternPartStart = patternSpan ? patternSpan.start : 0; - var patternPartLength = patternSpan ? patternSpan.length : pattern.length; + let patternPartStart = patternSpan ? patternSpan.start : 0; + let patternPartLength = patternSpan ? patternSpan.length : pattern.length; if (patternPartLength > candidateSpan.length) { // Pattern part is longer than the candidate part. There can never be a match. @@ -362,18 +362,18 @@ module ts { } if (ignoreCase) { - for (var i = 0; i < patternPartLength; i++) { - var ch1 = pattern.charCodeAt(patternPartStart + i); - var ch2 = candidate.charCodeAt(candidateSpan.start + i); + for (let i = 0; i < patternPartLength; i++) { + let ch1 = pattern.charCodeAt(patternPartStart + i); + let ch2 = candidate.charCodeAt(candidateSpan.start + i); if (toLowerCase(ch1) !== toLowerCase(ch2)) { return false; } } } else { - for (var i = 0; i < patternPartLength; i++) { - var ch1 = pattern.charCodeAt(patternPartStart + i); - var ch2 = candidate.charCodeAt(candidateSpan.start + i); + for (let i = 0; i < patternPartLength; i++) { + let ch1 = pattern.charCodeAt(patternPartStart + i); + let ch2 = candidate.charCodeAt(candidateSpan.start + i); if (ch1 !== ch2) { return false; } @@ -384,23 +384,23 @@ module ts { } function tryCamelCaseMatch(candidate: string, candidateParts: TextSpan[], chunk: TextChunk, ignoreCase: boolean): number { - var chunkCharacterSpans = chunk.characterSpans; + let chunkCharacterSpans = chunk.characterSpans; // Note: we may have more pattern parts than candidate parts. This is because multiple // pattern parts may match a candidate part. For example "SiUI" against "SimpleUI". // We'll have 3 pattern parts Si/U/I against two candidate parts Simple/UI. However, U // and I will both match in UI. - var currentCandidate = 0; - var currentChunkSpan = 0; - var firstMatch: number = undefined; - var contiguous: boolean = undefined; + let currentCandidate = 0; + let currentChunkSpan = 0; + let firstMatch: number = undefined; + let contiguous: boolean = undefined; while (true) { // Let's consider our termination cases if (currentChunkSpan === chunkCharacterSpans.length) { // We did match! We shall assign a weight to this - var weight = 0; + let weight = 0; // Was this contiguous? if (contiguous) { @@ -419,15 +419,15 @@ module ts { return undefined; } - var candidatePart = candidateParts[currentCandidate]; - var gotOneMatchThisCandidate = false; + let candidatePart = candidateParts[currentCandidate]; + let gotOneMatchThisCandidate = false; // Consider the case of matching SiUI against SimpleUIElement. The candidate parts // will be Simple/UI/Element, and the pattern parts will be Si/U/I. We'll match 'Si' // against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to // still keep matching pattern parts against that candidate part. for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { - var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; + let chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; if (gotOneMatchThisCandidate) { // We've already gotten one pattern part match in this candidate. We will @@ -537,7 +537,7 @@ module ts { // TODO: find a way to determine this for any unicode characters in a // non-allocating manner. - var str = String.fromCharCode(ch); + let str = String.fromCharCode(ch); return str === str.toUpperCase(); } @@ -554,12 +554,12 @@ module ts { // TODO: find a way to determine this for any unicode characters in a // non-allocating manner. - var str = String.fromCharCode(ch); + let str = String.fromCharCode(ch); return str === str.toLowerCase(); } function containsUpperCaseLetter(string: string): boolean { - for (var i = 0, n = string.length; i < n; i++) { + for (let i = 0, n = string.length; i < n; i++) { if (isUpperCaseLetter(string.charCodeAt(i))) { return true; } @@ -569,7 +569,7 @@ module ts { } function startsWith(string: string, search: string) { - for (var i = 0, n = search.length; i < n; i++) { + for (let i = 0, n = search.length; i < n; i++) { if (string.charCodeAt(i) !== search.charCodeAt(i)) { return false; } @@ -580,7 +580,7 @@ module ts { // Assumes 'value' is already lowercase. function indexOfIgnoringCase(string: string, value: string): number { - for (var i = 0, n = string.length - value.length; i <= n; i++) { + for (let i = 0, n = string.length - value.length; i <= n; i++) { if (startsWithIgnoringCase(string, value, i)) { return i; } @@ -591,9 +591,9 @@ module ts { // Assumes 'value' is already lowercase. function startsWithIgnoringCase(string: string, value: string, start: number): boolean { - for (var i = 0, n = value.length; i < n; i++) { - var ch1 = toLowerCase(string.charCodeAt(i + start)); - var ch2 = value.charCodeAt(i); + for (let i = 0, n = value.length; i < n; i++) { + let ch1 = toLowerCase(string.charCodeAt(i + start)); + let ch2 = value.charCodeAt(i); if (ch1 !== ch2) { return false; @@ -628,12 +628,12 @@ module ts { } function breakPatternIntoTextChunks(pattern: string): TextChunk[] { - var result: TextChunk[] = []; - var wordStart = 0; - var wordLength = 0; + let result: TextChunk[] = []; + let wordStart = 0; + let wordLength = 0; - for (var i = 0; i < pattern.length; i++) { - var ch = pattern.charCodeAt(i); + for (let i = 0; i < pattern.length; i++) { + let ch = pattern.charCodeAt(i); if (isWordChar(ch)) { if (wordLength++ === 0) { wordStart = i; @@ -655,7 +655,7 @@ module ts { } function createTextChunk(text: string): TextChunk { - var textLowerCase = text.toLowerCase(); + let textLowerCase = text.toLowerCase(); return { text, textLowerCase, @@ -673,15 +673,15 @@ module ts { } function breakIntoSpans(identifier: string, word: boolean): TextSpan[] { - var result: TextSpan[] = []; + let result: TextSpan[] = []; - var wordStart = 0; - for (var i = 1, n = identifier.length; i < n; i++) { - var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); - var currentIsDigit = isDigit(identifier.charCodeAt(i)); + let wordStart = 0; + for (let i = 1, n = identifier.length; i < n; i++) { + let lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); + let currentIsDigit = isDigit(identifier.charCodeAt(i)); - var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); - var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); + let hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); + let hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); if (charIsPunctuation(identifier.charCodeAt(i - 1)) || charIsPunctuation(identifier.charCodeAt(i)) || @@ -736,8 +736,8 @@ module ts { } function isAllPunctuation(identifier: string, start: number, end: number): boolean { - for (var i = start; i < end; i++) { - var ch = identifier.charCodeAt(i); + for (let i = start; i < end; i++) { + let ch = identifier.charCodeAt(i); // We don't consider _ or $ as punctuation as there may be things with that name. if (!charIsPunctuation(ch) || ch === CharacterCodes._ || ch === CharacterCodes.$) { @@ -758,8 +758,8 @@ module ts { // etc. if (index != wordStart && index + 1 < identifier.length) { - var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); - var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); + let currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + let nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); if (currentIsUpper && nextIsLower) { // We have a transition from an upper to a lower letter here. But we only @@ -770,7 +770,7 @@ module ts { // that follows. Note: this will make the following not split properly: // "HELLOthere". However, these sorts of names do not show up in .Net // programs. - for (var i = wordStart; i < index; i++) { + for (let i = wordStart; i < index; i++) { if (!isUpperCaseLetter(identifier.charCodeAt(i))) { return false; } @@ -785,8 +785,8 @@ module ts { } function transitionFromLowerToUpper(identifier: string, word: boolean, index: number): boolean { - var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); - var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + let lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); + let currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); // See if the casing indicates we're starting a new word. Note: if we're breaking on // words, then just seeing an upper case character isn't enough. Instead, it has to @@ -801,7 +801,7 @@ module ts { // on characters would be: A M // // We break the search string on characters. But we break the symbol name on words. - var transition = word + let transition = word ? (currentIsUpper && !lastIsUpper) : currentIsUpper; return transition; diff --git a/src/services/services.ts b/src/services/services.ts index b4c0ef2bbd8..1bf5f6336d4 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -12,7 +12,7 @@ module ts { /** The version of the language service API */ - export var servicesVersion = "0.4" + export let servicesVersion = "0.4" export interface Node { getSourceFile(): SourceFile; @@ -124,12 +124,12 @@ module ts { isLibFile: boolean } - var scanner: Scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true); + let scanner: Scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true); - var emptyArray: any[] = []; + let emptyArray: any[] = []; function createNode(kind: SyntaxKind, pos: number, end: number, flags: NodeFlags, parent?: Node): NodeObject { - var node = new (getNodeConstructor(kind))(); + let node = new (getNodeConstructor(kind))(); node.pos = pos; node.end = end; node.flags = flags; @@ -184,8 +184,8 @@ module ts { private addSyntheticNodes(nodes: Node[], pos: number, end: number): number { scanner.setTextPos(pos); while (pos < end) { - var token = scanner.scan(); - var textPos = scanner.getTextPos(); + let token = scanner.scan(); + let textPos = scanner.getTextPos(); nodes.push(createNode(token, pos, textPos, NodeFlags.Synthetic, this)); pos = textPos; } @@ -193,9 +193,9 @@ module ts { } private createSyntaxList(nodes: NodeArray): Node { - var list = createNode(SyntaxKind.SyntaxList, nodes.pos, nodes.end, NodeFlags.Synthetic, this); + let list = createNode(SyntaxKind.SyntaxList, nodes.pos, nodes.end, NodeFlags.Synthetic, this); list._children = []; - var pos = nodes.pos; + let pos = nodes.pos; for (let node of nodes) { if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); @@ -210,18 +210,19 @@ module ts { } private createChildren(sourceFile?: SourceFile) { + let children: Node[]; if (this.kind >= SyntaxKind.FirstNode) { scanner.setText((sourceFile || this.getSourceFile()).text); - var children: Node[] = []; - var pos = this.pos; - var processNode = (node: Node) => { + children = []; + let pos = this.pos; + let processNode = (node: Node) => { if (pos < node.pos) { pos = this.addSyntheticNodes(children, pos, node.pos); } children.push(node); pos = node.end; }; - var processNodes = (nodes: NodeArray) => { + let processNodes = (nodes: NodeArray) => { if (pos < nodes.pos) { pos = this.addSyntheticNodes(children, pos, nodes.pos); } @@ -253,7 +254,7 @@ module ts { } public getFirstToken(sourceFile?: SourceFile): Node { - var children = this.getChildren(); + let children = this.getChildren(); for (let child of children) { if (child.kind < SyntaxKind.FirstNode) { return child; @@ -264,9 +265,9 @@ module ts { } public getLastToken(sourceFile?: SourceFile): Node { - var children = this.getChildren(sourceFile); - for (var i = children.length - 1; i >= 0; i--) { - var child = children[i]; + let children = this.getChildren(sourceFile); + for (let i = children.length - 1; i >= 0; i--) { + let child = children[i]; if (child.kind < SyntaxKind.FirstNode) { return child; } @@ -312,8 +313,8 @@ module ts { } function getJsDocCommentsFromDeclarations(declarations: Declaration[], name: string, canUseParsedParamTagComments: boolean) { - var documentationComment = []; - var docComments = getJsDocCommentsSeparatedByNewLines(); + let documentationComment = []; + let docComments = getJsDocCommentsSeparatedByNewLines(); ts.forEach(docComments, docComment => { if (documentationComment.length) { documentationComment.push(lineBreakPart()); @@ -324,22 +325,22 @@ module ts { return documentationComment; function getJsDocCommentsSeparatedByNewLines() { - var paramTag = "@param"; - var jsDocCommentParts: SymbolDisplayPart[] = []; + let paramTag = "@param"; + let jsDocCommentParts: SymbolDisplayPart[] = []; ts.forEach(declarations, (declaration, indexOfDeclaration) => { // Make sure we are collecting doc comment from declaration once, // In case of union property there might be same declaration multiple times // which only varies in type parameter - // Eg. var a: Array | Array; a.length + // Eg. let a: Array | Array; a.length // The property length will have two declarations of property length coming // from Array - Array and Array if (indexOf(declarations, declaration) === indexOfDeclaration) { - var sourceFileOfDeclaration = getSourceFileOfNode(declaration); + let sourceFileOfDeclaration = getSourceFileOfNode(declaration); // If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments if (canUseParsedParamTagComments && declaration.kind === SyntaxKind.Parameter) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), jsDocCommentTextRange => { - var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + let cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedParamJsDocComment) { jsDocCommentParts.push.apply(jsDocCommentParts, cleanedParamJsDocComment); } @@ -359,7 +360,7 @@ module ts { // Get the cleaned js doc comment text from the declaration ts.forEach(getJsDocCommentTextRange( declaration.kind === SyntaxKind.VariableDeclaration ? declaration.parent.parent : declaration, sourceFileOfDeclaration), jsDocCommentTextRange => { - var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + let cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); } @@ -385,7 +386,7 @@ module ts { } for (; pos < end; pos++) { - var ch = sourceFile.text.charCodeAt(pos); + let ch = sourceFile.text.charCodeAt(pos); if (!isWhiteSpace(ch) || isLineBreak(ch)) { // Either found lineBreak or non whiteSpace return pos; @@ -422,19 +423,19 @@ module ts { } function getCleanedJsDocComment(pos: number, end: number, sourceFile: SourceFile) { - var spacesToRemoveAfterAsterisk: number; - var docComments: SymbolDisplayPart[] = []; - var blankLineCount = 0; - var isInParamTag = false; + let spacesToRemoveAfterAsterisk: number; + let docComments: SymbolDisplayPart[] = []; + let blankLineCount = 0; + let isInParamTag = false; while (pos < end) { - var docCommentTextOfLine = ""; + let docCommentTextOfLine = ""; // First consume leading white space pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile); // If the comment starts with '*' consume the spaces on this line if (pos < end && sourceFile.text.charCodeAt(pos) === CharacterCodes.asterisk) { - var lineStartPos = pos + 1; + let lineStartPos = pos + 1; pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, spacesToRemoveAfterAsterisk); // Set the spaces to remove after asterisk as margin if not already set @@ -448,7 +449,7 @@ module ts { // Analyse text on this line while (pos < end && !isLineBreak(sourceFile.text.charCodeAt(pos))) { - var ch = sourceFile.text.charAt(pos); + let ch = sourceFile.text.charAt(pos); if (ch === "@") { // If it is @param tag if (isParamTag(pos, end, sourceFile)) { @@ -486,12 +487,12 @@ module ts { } function getCleanedParamJsDocComment(pos: number, end: number, sourceFile: SourceFile) { - var paramHelpStringMargin: number; - var paramDocComments: SymbolDisplayPart[] = []; + let paramHelpStringMargin: number; + let paramDocComments: SymbolDisplayPart[] = []; while (pos < end) { if (isParamTag(pos, end, sourceFile)) { - var blankLineCount = 0; - var recordedParamTag = false; + let blankLineCount = 0; + let recordedParamTag = false; // Consume leading spaces pos = consumeWhiteSpaces(pos + paramTag.length); if (pos >= end) { @@ -501,8 +502,8 @@ module ts { // Ignore type expression if (sourceFile.text.charCodeAt(pos) === CharacterCodes.openBrace) { pos++; - for (var curlies = 1; pos < end; pos++) { - var charCode = sourceFile.text.charCodeAt(pos); + for (let curlies = 1; pos < end; pos++) { + let charCode = sourceFile.text.charCodeAt(pos); // { character means we need to find another } to match the found one if (charCode === CharacterCodes.openBrace) { @@ -545,10 +546,10 @@ module ts { break; } - var paramHelpString = ""; - var firstLineParamHelpStringPos = pos; + let paramHelpString = ""; + let firstLineParamHelpStringPos = pos; while (pos < end) { - var ch = sourceFile.text.charCodeAt(pos); + let ch = sourceFile.text.charCodeAt(pos); // at line break, set this comment line text and go to next line if (isLineBreak(ch)) { @@ -617,15 +618,15 @@ module ts { } // Now consume white spaces max - var startOfLinePos = pos; + let startOfLinePos = pos; pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin); if (pos >= end) { return; } - var consumedSpaces = pos - startOfLinePos; + let consumedSpaces = pos - startOfLinePos; if (consumedSpaces < paramHelpStringMargin) { - var ch = sourceFile.text.charCodeAt(pos); + let ch = sourceFile.text.charCodeAt(pos); if (ch === CharacterCodes.asterisk) { // Consume more spaces after asterisk pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, paramHelpStringMargin - consumedSpaces - 1); @@ -765,18 +766,18 @@ module ts { public getNamedDeclarations() { if (!this.namedDeclarations) { - var sourceFile = this; - var namedDeclarations: Declaration[] = []; + let sourceFile = this; + let namedDeclarations: Declaration[] = []; forEachChild(sourceFile, function visit(node: Node): void { switch (node.kind) { case SyntaxKind.FunctionDeclaration: case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: - var functionDeclaration = node; + let functionDeclaration = node; if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) { - var lastDeclaration = namedDeclarations.length > 0 ? + let lastDeclaration = namedDeclarations.length > 0 ? namedDeclarations[namedDeclarations.length - 1] : undefined; @@ -856,7 +857,7 @@ module ts { break; case SyntaxKind.ImportDeclaration: - var importClause = (node).importClause; + let importClause = (node).importClause; if (importClause) { // Handle default import case e.g.: // import d from "mod"; @@ -1324,7 +1325,7 @@ module ts { static enumElement = "enum"; // Inside module and script only - // var v = .. + // let v = .. static variableElement = "var"; // Inside function @@ -1468,7 +1469,7 @@ module ts { } // If the parent is not sourceFile or module block it is local variable - for (var parent = declaration.parent; !isFunctionBlock(parent); parent = parent.parent) { + for (let parent = declaration.parent; !isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block if (parent.kind === SyntaxKind.SourceFile || parent.kind === SyntaxKind.ModuleBlock) { return false; @@ -1520,7 +1521,7 @@ module ts { this.fileNameToEntry = {}; // Initialize the list with the root file names - var rootFileNames = host.getScriptFileNames(); + let rootFileNames = host.getScriptFileNames(); for (let fileName of rootFileNames) { this.createEntry(fileName); } @@ -1534,8 +1535,8 @@ module ts { } private createEntry(fileName: string) { - var entry: HostFileInformation; - var scriptSnapshot = this.host.getScriptSnapshot(fileName); + let entry: HostFileInformation; + let scriptSnapshot = this.host.getScriptSnapshot(fileName); if (scriptSnapshot) { entry = { hostFileName: fileName, @@ -1564,7 +1565,7 @@ module ts { } public getRootFileNames(): string[] { - var fileNames: string[] = []; + let fileNames: string[] = []; forEachKey(this.fileNameToEntry, key => { if (hasProperty(this.fileNameToEntry, key) && this.fileNameToEntry[key]) @@ -1575,12 +1576,12 @@ module ts { } public getVersion(fileName: string): string { - var file = this.getEntry(fileName); + let file = this.getEntry(fileName); return file && file.version; } public getScriptSnapshot(fileName: string): IScriptSnapshot { - var file = this.getEntry(fileName); + let file = this.getEntry(fileName); return file && file.scriptSnapshot; } } @@ -1597,14 +1598,14 @@ module ts { } public getCurrentSourceFile(fileName: string): SourceFile { - var scriptSnapshot = this.host.getScriptSnapshot(fileName); + let scriptSnapshot = this.host.getScriptSnapshot(fileName); if (!scriptSnapshot) { // The host does not know about this file. throw new Error("Could not find file: '" + fileName + "'."); } - var version = this.host.getScriptVersion(fileName); - var sourceFile: SourceFile; + let version = this.host.getScriptVersion(fileName); + let sourceFile: SourceFile; if (this.currentFileName !== fileName) { // This is a new file, just parse it @@ -1612,7 +1613,7 @@ module ts { } else if (this.currentFileVersion !== version) { // This is the same file, just a newer version. Incrementally parse the file. - var editRange = scriptSnapshot.getChangeRange(this.currentFileScriptSnapshot); + let editRange = scriptSnapshot.getChangeRange(this.currentFileScriptSnapshot); sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange); } @@ -1634,14 +1635,14 @@ module ts { } export function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile { - var sourceFile = createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents); + let sourceFile = createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents); setSourceFileFields(sourceFile, scriptSnapshot, version); // after full parsing we can use table with interned strings as name table sourceFile.nameTable = sourceFile.identifiers; return sourceFile; } - export var disableIncrementalParsing = false; + export let disableIncrementalParsing = false; export function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile { // If we were given a text change range, and our version or open-ness changed, then @@ -1650,7 +1651,7 @@ module ts { if (version !== sourceFile.version) { // Once incremental parsing is ready, then just call into this function. if (!disableIncrementalParsing) { - var newSourceFile = updateSourceFile(sourceFile, scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange, aggressiveChecks); + let newSourceFile = updateSourceFile(sourceFile, scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange, aggressiveChecks); setSourceFileFields(newSourceFile, scriptSnapshot, version); // after incremental parsing nameTable might not be up-to-date // drop it so it can be lazily recreated later @@ -1667,15 +1668,15 @@ module ts { export function createDocumentRegistry(): DocumentRegistry { // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have // for those settings. - var buckets: Map> = {}; + let buckets: Map> = {}; function getKeyFromCompilationSettings(settings: CompilerOptions): string { return "_" + settings.target; // + "|" + settings.propagateEnumConstantoString() } function getBucketForCompilationSettings(settings: CompilerOptions, createIfMissing: boolean): Map { - var key = getKeyFromCompilationSettings(settings); - var bucket = lookUp(buckets, key); + let key = getKeyFromCompilationSettings(settings); + let bucket = lookUp(buckets, key); if (!bucket && createIfMissing) { buckets[key] = bucket = {}; } @@ -1683,11 +1684,11 @@ module ts { } function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(name => name && name.charAt(0) === '_').map(name => { - var entries = lookUp(buckets, name); - var sourceFiles: { name: string; refCount: number; references: string[]; }[] = []; - for (var i in entries) { - var entry = entries[i]; + let bucketInfoArray = Object.keys(buckets).filter(name => name && name.charAt(0) === '_').map(name => { + let entries = lookUp(buckets, name); + let sourceFiles: { name: string; refCount: number; references: string[]; }[] = []; + for (let i in entries) { + let entry = entries[i]; sourceFiles.push({ name: i, refCount: entry.languageServiceRefCount, @@ -1718,13 +1719,13 @@ module ts { version: string, acquiring: boolean): SourceFile { - var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true); - var entry = lookUp(bucket, fileName); + let bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true); + let entry = lookUp(bucket, fileName); if (!entry) { Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); // Have never seen this file with these settings. Create a new source file for it. - var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents:*/ false); + let sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents:*/ false); bucket[fileName] = entry = { sourceFile: sourceFile, @@ -1755,10 +1756,10 @@ module ts { } function releaseDocument(fileName: string, compilationSettings: CompilerOptions): void { - var bucket = getBucketForCompilationSettings(compilationSettings, false); + let bucket = getBucketForCompilationSettings(compilationSettings, false); Debug.assert(bucket !== undefined); - var entry = lookUp(bucket, fileName); + let entry = lookUp(bucket, fileName); entry.languageServiceRefCount--; Debug.assert(entry.languageServiceRefCount >= 0); @@ -1776,18 +1777,18 @@ module ts { } export function preProcessFile(sourceText: string, readImportFiles = true): PreProcessedFileInfo { - var referencedFiles: FileReference[] = []; - var importedFiles: FileReference[] = []; - var isNoDefaultLib = false; + let referencedFiles: FileReference[] = []; + let importedFiles: FileReference[] = []; + let isNoDefaultLib = false; function processTripleSlashDirectives(): void { - var commentRanges = getLeadingCommentRanges(sourceText, 0); + let commentRanges = getLeadingCommentRanges(sourceText, 0); forEach(commentRanges, commentRange => { - var comment = sourceText.substring(commentRange.pos, commentRange.end); - var referencePathMatchResult = getFileReferenceFromReferencePath(comment, commentRange); + let comment = sourceText.substring(commentRange.pos, commentRange.end); + let referencePathMatchResult = getFileReferenceFromReferencePath(comment, commentRange); if (referencePathMatchResult) { isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; - var fileReference = referencePathMatchResult.fileReference; + let fileReference = referencePathMatchResult.fileReference; if (fileReference) { referencedFiles.push(fileReference); } @@ -1796,8 +1797,8 @@ module ts { } function recordModuleName() { - var importPath = scanner.getTokenValue(); - var pos = scanner.getTokenPos(); + let importPath = scanner.getTokenValue(); + let pos = scanner.getTokenPos(); importedFiles.push({ fileName: importPath, pos: pos, @@ -1807,7 +1808,7 @@ module ts { function processImport(): void { scanner.setText(sourceText); - var token = scanner.scan(); + let token = scanner.scan(); // Look for: // import "mod"; // import d from "mod" @@ -1972,7 +1973,7 @@ module ts { * Note: 'node' cannot be a SourceFile. */ function isLabeledBy(node: Node, labelName: string) { - for (var owner = node.parent; owner.kind === SyntaxKind.LabeledStatement; owner = owner.parent) { + for (let owner = node.parent; owner.kind === SyntaxKind.LabeledStatement; owner = owner.parent) { if ((owner).label.text === labelName) { return true; } @@ -2066,8 +2067,8 @@ module ts { return true; } else if (position === comment.end) { - var text = sourceFile.text; - var width = comment.end - comment.pos; + let text = sourceFile.text; + let width = comment.end - comment.pos; // is single line comment or just /* if (width <= 2 || text.charCodeAt(comment.pos + 1) === CharacterCodes.slash) { return true; @@ -2099,8 +2100,8 @@ module ts { } // A cache of completion entries for keywords, these do not change between sessions - var keywordCompletions: CompletionEntry[] = []; - for (var i = SyntaxKind.FirstKeyword; i <= SyntaxKind.LastKeyword; i++) { + let keywordCompletions: CompletionEntry[] = []; + for (let i = SyntaxKind.FirstKeyword; i <= SyntaxKind.LastKeyword; i++) { keywordCompletions.push({ name: tokenToString(i), kind: ScriptElementKind.keyword, @@ -2171,15 +2172,15 @@ module ts { } export function createLanguageService(host: LanguageServiceHost, documentRegistry: DocumentRegistry = createDocumentRegistry()): LanguageService { - var syntaxTreeCache: SyntaxTreeCache = new SyntaxTreeCache(host); - var ruleProvider: formatting.RulesProvider; - var program: Program; + let syntaxTreeCache: SyntaxTreeCache = new SyntaxTreeCache(host); + let ruleProvider: formatting.RulesProvider; + let program: Program; // this checker is used to answer all LS questions except errors - var typeInfoResolver: TypeChecker; - var useCaseSensitivefileNames = false; - var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); - var activeCompletionSession: CompletionSession; // The current active completion session, used to get the completion entry details + let typeInfoResolver: TypeChecker; + let useCaseSensitivefileNames = false; + let cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); + let activeCompletionSession: CompletionSession; // The current active completion session, used to get the completion entry details // Check if the localized messages json is set, otherwise query the host for it if (!localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) { @@ -2198,7 +2199,7 @@ module ts { function getValidSourceFile(fileName: string): SourceFile { fileName = normalizeSlashes(fileName); - var sourceFile = program.getSourceFile(getCanonicalFileName(fileName)); + let sourceFile = program.getSourceFile(getCanonicalFileName(fileName)); if (!sourceFile) { throw new Error("Could not find file: '" + fileName + "'."); } @@ -2217,7 +2218,7 @@ module ts { function synchronizeHostData(): void { // Get a fresh cache of the host information - var hostCache = new HostCache(host); + let hostCache = new HostCache(host); // If the program is already up-to-date, we can reuse it if (programUpToDate()) { @@ -2230,12 +2231,12 @@ module ts { // the program points to old source files that have been invalidated because of // incremental parsing. - var oldSettings = program && program.getCompilerOptions(); - var newSettings = hostCache.compilationSettings(); - var changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; + let oldSettings = program && program.getCompilerOptions(); + let newSettings = hostCache.compilationSettings(); + let changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; // Now create a new compiler - var newProgram = createProgram(hostCache.getRootFileNames(), newSettings, { + let newProgram = createProgram(hostCache.getRootFileNames(), newSettings, { getSourceFile: getOrCreateSourceFile, getCancellationToken: () => cancellationToken, getCanonicalFileName: (fileName) => useCaseSensitivefileNames ? fileName : fileName.toLowerCase(), @@ -2249,9 +2250,9 @@ module ts { // Release any files we have acquired in the old program but are // not part of the new program. if (program) { - var oldSourceFiles = program.getSourceFiles(); + let oldSourceFiles = program.getSourceFiles(); for (let oldSourceFile of oldSourceFiles) { - var fileName = oldSourceFile.fileName; + let fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { documentRegistry.releaseDocument(fileName, oldSettings); } @@ -2267,7 +2268,7 @@ module ts { // The program is asking for this file, check first if the host can locate it. // If the host can not locate the file, then it does not exist. return undefined // to the program to allow reporting of errors for missing files. - var hostFileInformation = hostCache.getOrCreateEntry(fileName); + let hostFileInformation = hostCache.getOrCreateEntry(fileName); if (!hostFileInformation) { return undefined; } @@ -2277,7 +2278,7 @@ module ts { // can not be reused. we have to dump all syntax trees and create new ones. if (!changesInCompilationSettingsAffectSyntax) { // Check if the old program had this file already - var oldSourceFile = program && program.getSourceFile(fileName); + let oldSourceFile = program && program.getSourceFile(fileName); if (oldSourceFile) { // We already had a source file for this file name. Go to the registry to // ensure that we get the right up to date version of it. We need this to @@ -2321,7 +2322,7 @@ module ts { } // If number of files in the program do not match, it is not up-to-date - var rootFileNames = hostCache.getRootFileNames(); + let rootFileNames = hostCache.getRootFileNames(); if (program.getSourceFiles().length !== rootFileNames.length) { return false; } @@ -2376,18 +2377,18 @@ module ts { function getSemanticDiagnostics(fileName: string) { synchronizeHostData(); - var targetSourceFile = getValidSourceFile(fileName); + let targetSourceFile = getValidSourceFile(fileName); // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. // Therefore only get diagnostics for given file. - var semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile); + let semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile); if (!program.getCompilerOptions().declaration) { return semanticDiagnostics; } // If '-d' is enabled, check for emitter error. One example of emitter error is export class implements non-export interface - var declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile); + let declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile); return semanticDiagnostics.concat(declarationDiagnostics); } @@ -2398,13 +2399,13 @@ module ts { /// Completion function getValidCompletionEntryDisplayName(symbol: Symbol, target: ScriptTarget): string { - var displayName = symbol.getName(); + let displayName = symbol.getName(); if (displayName && displayName.length > 0) { - var firstCharCode = displayName.charCodeAt(0); + let firstCharCode = displayName.charCodeAt(0); // First check of the displayName is not external module; if it is an external module, it is not valid entry if ((symbol.flags & SymbolFlags.Namespace) && (firstCharCode === CharacterCodes.singleQuote || firstCharCode === CharacterCodes.doubleQuote)) { // If the symbol is external module, don't show it in the completion list - // (i.e declare module "http" { var x; } | // <= request completion here, "http" should not be there) + // (i.e declare module "http" { let x; } | // <= request completion here, "http" should not be there) return undefined; } @@ -2415,8 +2416,8 @@ module ts { displayName = displayName.substring(1, displayName.length - 1); } - var isValid = isIdentifierStart(displayName.charCodeAt(0), target); - for (var i = 1, n = displayName.length; isValid && i < n; i++) { + let isValid = isIdentifierStart(displayName.charCodeAt(0), target); + for (let i = 1, n = displayName.length; isValid && i < n; i++) { isValid = isIdentifierPart(displayName.charCodeAt(i), target); } @@ -2433,7 +2434,7 @@ module ts { // Try to get a valid display name for this symbol, if we could not find one, then ignore it. // We would like to only show things that can be added after a dot, so for instance numeric properties can // not be accessed with a dot (a.1 <- invalid) - var displayName = getValidCompletionEntryDisplayName(symbol, program.getCompilerOptions().target); + let displayName = getValidCompletionEntryDisplayName(symbol, program.getCompilerOptions().target); if (!displayName) { return undefined; } @@ -2452,16 +2453,16 @@ module ts { function getCompletionsAtPosition(fileName: string, position: number) { synchronizeHostData(); - var syntacticStart = new Date().getTime(); - var sourceFile = getValidSourceFile(fileName); + let syntacticStart = new Date().getTime(); + let sourceFile = getValidSourceFile(fileName); - var start = new Date().getTime(); - var currentToken = getTokenAtPosition(sourceFile, position); + let start = new Date().getTime(); + let currentToken = getTokenAtPosition(sourceFile, position); log("getCompletionsAtPosition: Get current token: " + (new Date().getTime() - start)); - var start = new Date().getTime(); + start = new Date().getTime(); // Completion not allowed inside comments, bail out if this is the case - var insideComment = isInsideComment(sourceFile, currentToken, position); + let insideComment = isInsideComment(sourceFile, currentToken, position); log("getCompletionsAtPosition: Is inside comment: " + (new Date().getTime() - start)); if (insideComment) { @@ -2471,14 +2472,14 @@ module ts { // The decision to provide completion depends on the previous token, so find it // Note: previousToken can be undefined if we are the beginning of the file - var start = new Date().getTime(); - var previousToken = findPrecedingToken(position, sourceFile); + start = new Date().getTime(); + let previousToken = findPrecedingToken(position, sourceFile); log("getCompletionsAtPosition: Get previous token 1: " + (new Date().getTime() - start)); // 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 to the previous token if (previousToken && position <= previousToken.end && previousToken.kind === SyntaxKind.Identifier) { - var start = new Date().getTime(); + let start = new Date().getTime(); previousToken = findPrecedingToken(previousToken.pos, sourceFile); log("getCompletionsAtPosition: Get previous token 2: " + (new Date().getTime() - start)); } @@ -2491,8 +2492,8 @@ module ts { // Find the node where completion is requested on, in the case of a completion after a dot, it is the member access expression // other wise, it is a request for all visible symbols in the scope, and the node is the current location - var node: Node; - var isRightOfDot: boolean; + let node: Node; + let isRightOfDot: boolean; if (previousToken && previousToken.kind === SyntaxKind.DotToken && previousToken.parent.kind === SyntaxKind.PropertyAccessExpression) { node = (previousToken.parent).expression; isRightOfDot = true; @@ -2516,17 +2517,20 @@ module ts { }; log("getCompletionsAtPosition: Syntactic work: " + (new Date().getTime() - syntacticStart)); - var location = getTouchingPropertyName(sourceFile, position); + let location = getTouchingPropertyName(sourceFile, position); // Populate the completion list - var semanticStart = new Date().getTime(); + let semanticStart = new Date().getTime(); + let isMemberCompletion: boolean; + let isNewIdentifierLocation: boolean; + if (isRightOfDot) { // Right of dot member completion list - var symbols: Symbol[] = []; - var isMemberCompletion = true; - var isNewIdentifierLocation = false; + let symbols: Symbol[] = []; + isMemberCompletion = true; + isNewIdentifierLocation = false; if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName || node.kind === SyntaxKind.PropertyAccessExpression) { - var symbol = typeInfoResolver.getSymbolAtLocation(node); + let symbol = typeInfoResolver.getSymbolAtLocation(node); // This is an alias, follow what it aliases if (symbol && symbol.flags & SymbolFlags.Alias) { @@ -2543,7 +2547,7 @@ module ts { } } - var type = typeInfoResolver.getTypeAtLocation(node); + let type = typeInfoResolver.getTypeAtLocation(node); if (type) { // Filter private properties forEach(type.getApparentProperties(), symbol => { @@ -2556,21 +2560,21 @@ module ts { getCompletionEntriesFromSymbols(symbols, activeCompletionSession); } else { - var containingObjectLiteral = getContainingObjectLiteralApplicableForCompletion(previousToken); + let containingObjectLiteral = getContainingObjectLiteralApplicableForCompletion(previousToken); if (containingObjectLiteral) { // Object literal expression, look up possible property names from contextual type isMemberCompletion = true; isNewIdentifierLocation = true; - var contextualType = typeInfoResolver.getContextualType(containingObjectLiteral); + let contextualType = typeInfoResolver.getContextualType(containingObjectLiteral); if (!contextualType) { return undefined; } - var contextualTypeMembers = typeInfoResolver.getPropertiesOfType(contextualType); + let contextualTypeMembers = typeInfoResolver.getPropertiesOfType(contextualType); if (contextualTypeMembers && contextualTypeMembers.length > 0) { // Add filtered items to the completion list - var filteredMembers = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties); + let filteredMembers = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties); getCompletionEntriesFromSymbols(filteredMembers, activeCompletionSession); } } @@ -2580,10 +2584,10 @@ module ts { isMemberCompletion = true; isNewIdentifierLocation = true; if (showCompletionsInImportsClause(previousToken)) { - var importDeclaration = getAncestor(previousToken, SyntaxKind.ImportDeclaration); + let importDeclaration = getAncestor(previousToken, SyntaxKind.ImportDeclaration); Debug.assert(importDeclaration !== undefined); - var exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); - var filteredExports = filterModuleExports(exports, importDeclaration); + let exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); + let filteredExports = filterModuleExports(exports, importDeclaration); getCompletionEntriesFromSymbols(filteredExports, activeCompletionSession); } } @@ -2593,8 +2597,8 @@ module ts { isNewIdentifierLocation = isNewIdentifierDefinitionLocation(previousToken); /// TODO filter meaning based on the current context - var symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace | SymbolFlags.Alias; - var symbols = typeInfoResolver.getSymbolsInScope(node, symbolMeanings); + let symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace | SymbolFlags.Alias; + let symbols = typeInfoResolver.getSymbolsInScope(node, symbolMeanings); getCompletionEntriesFromSymbols(symbols, activeCompletionSession); } @@ -2614,11 +2618,11 @@ module ts { }; function getCompletionEntriesFromSymbols(symbols: Symbol[], session: CompletionSession): void { - var start = new Date().getTime(); + let start = new Date().getTime(); forEach(symbols, symbol => { - var entry = createCompletionEntry(symbol, session.typeChecker, location); + let entry = createCompletionEntry(symbol, session.typeChecker, location); if (entry) { - var id = escapeIdentifier(entry.name); + let id = escapeIdentifier(entry.name); if (!lookUp(session.symbols, id)) { session.entries.push(entry); session.symbols[id] = symbol; @@ -2629,8 +2633,8 @@ module ts { } function isCompletionListBlocker(previousToken: Node): boolean { - var start = new Date().getTime(); - var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || + let start = new Date().getTime(); + let result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); @@ -2651,21 +2655,21 @@ module ts { function isNewIdentifierDefinitionLocation(previousToken: Node): boolean { if (previousToken) { - var containingNodeKind = previousToken.parent.kind; + let containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case SyntaxKind.CommaToken: return containingNodeKind === SyntaxKind.CallExpression // func( a, | || containingNodeKind === SyntaxKind.Constructor // constructor( a, | public, protected, private keywords are allowed here, so show completion || containingNodeKind === SyntaxKind.NewExpression // new C(a, | || containingNodeKind === SyntaxKind.ArrayLiteralExpression // [a, | - || containingNodeKind === SyntaxKind.BinaryExpression; // var x = (a, | + || containingNodeKind === SyntaxKind.BinaryExpression; // let x = (a, | case SyntaxKind.OpenParenToken: return containingNodeKind === SyntaxKind.CallExpression // func( | || containingNodeKind === SyntaxKind.Constructor // constructor( | || containingNodeKind === SyntaxKind.NewExpression // new C(a| - || containingNodeKind === SyntaxKind.ParenthesizedExpression; // var x = (a| + || containingNodeKind === SyntaxKind.ParenthesizedExpression; // let x = (a| case SyntaxKind.OpenBracketToken: return containingNodeKind === SyntaxKind.ArrayLiteralExpression; // [ | @@ -2680,7 +2684,7 @@ module ts { return containingNodeKind === SyntaxKind.ClassDeclaration; // class A{ | case SyntaxKind.EqualsToken: - return containingNodeKind === SyntaxKind.VariableDeclaration // var x = a| + return containingNodeKind === SyntaxKind.VariableDeclaration // let x = a| || containingNodeKind === SyntaxKind.BinaryExpression; // x = a| case SyntaxKind.TemplateHead: @@ -2713,8 +2717,8 @@ module ts { || isTemplateLiteralKind(previousToken.kind)) { // The position has to be either: 1. entirely within the token text, or // 2. at the end position of an unterminated token. - var start = previousToken.getStart(); - var end = previousToken.getEnd(); + let start = previousToken.getStart(); + let end = previousToken.getEnd(); if (start < position && position < end) { return true; @@ -2731,11 +2735,11 @@ module ts { // The locations in an object literal expression that are applicable for completion are property name definition locations. if (previousToken) { - var parent = previousToken.parent; + let parent = previousToken.parent; switch (previousToken.kind) { - case SyntaxKind.OpenBraceToken: // var x = { | - case SyntaxKind.CommaToken: // var x = { a: 0, | + case SyntaxKind.OpenBraceToken: // let x = { | + case SyntaxKind.CommaToken: // let x = { a: 0, | if (parent && parent.kind === SyntaxKind.ObjectLiteralExpression) { return parent; } @@ -2765,7 +2769,7 @@ module ts { function isIdentifierDefinitionLocation(previousToken: Node): boolean { if (previousToken) { - var containingNodeKind = previousToken.parent.kind; + let containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case SyntaxKind.CommaToken: return containingNodeKind === SyntaxKind.VariableDeclaration || @@ -2792,13 +2796,13 @@ module ts { case SyntaxKind.OpenBraceToken: return containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { | containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface a { | - containingNodeKind === SyntaxKind.TypeLiteral || // var x : { | + containingNodeKind === SyntaxKind.TypeLiteral || // let x : { | containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x| case SyntaxKind.SemicolonToken: return containingNodeKind === SyntaxKind.PropertySignature && (previousToken.parent.parent.kind === SyntaxKind.InterfaceDeclaration || // interface a { f; | - previousToken.parent.parent.kind === SyntaxKind.TypeLiteral); // var x : { a; | + previousToken.parent.parent.kind === SyntaxKind.TypeLiteral); // let x : { a; | case SyntaxKind.LessThanToken: return containingNodeKind === SyntaxKind.ClassDeclaration || // class A< | @@ -2853,7 +2857,7 @@ module ts { function isRightOfIllegalDot(previousToken: Node): boolean { if (previousToken && previousToken.kind === SyntaxKind.NumericLiteral) { - var text = previousToken.getFullText(); + let text = previousToken.getFullText(); return text.charAt(text.length - 1) === "."; } @@ -2861,7 +2865,7 @@ module ts { } function filterModuleExports(exports: Symbol[], importDeclaration: ImportDeclaration): Symbol[] { - var exisingImports: Map = {}; + let exisingImports: Map = {}; if (!importDeclaration.importClause) { return exports; @@ -2871,7 +2875,7 @@ module ts { importDeclaration.importClause.namedBindings.kind === SyntaxKind.NamedImports) { forEach((importDeclaration.importClause.namedBindings).elements, el => { - var name = el.propertyName || el.name; + let name = el.propertyName || el.name; exisingImports[name.text] = true; }); } @@ -2887,7 +2891,7 @@ module ts { return contextualMemberSymbols; } - var existingMemberNames: Map = {}; + let existingMemberNames: Map = {}; forEach(existingMembers, m => { if (m.kind !== SyntaxKind.PropertyAssignment && m.kind !== SyntaxKind.ShorthandPropertyAssignment) { // Ignore omitted expressions for missing members in the object literal @@ -2903,7 +2907,7 @@ module ts { existingMemberNames[(m.name).text] = true; }); - var filteredMembers: Symbol[] = []; + let filteredMembers: Symbol[] = []; forEach(contextualMemberSymbols, s => { if (!existingMemberNames[s.name]) { filteredMembers.push(s); @@ -2917,25 +2921,25 @@ module ts { function getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails { // Note: No need to call synchronizeHostData, as we have captured all the data we need // in the getCompletionsAtPosition earlier - var sourceFile = getValidSourceFile(fileName); + let sourceFile = getValidSourceFile(fileName); - var session = activeCompletionSession; + let session = activeCompletionSession; // Ensure that the current active completion session is still valid for this request if (!session || session.fileName !== fileName || session.position !== position) { return undefined; } - var symbol = lookUp(activeCompletionSession.symbols, escapeIdentifier(entryName)); + let symbol = lookUp(activeCompletionSession.symbols, escapeIdentifier(entryName)); if (symbol) { - var location = getTouchingPropertyName(sourceFile, position); - var completionEntry = createCompletionEntry(symbol, session.typeChecker, location); + let location = getTouchingPropertyName(sourceFile, position); + let completionEntry = createCompletionEntry(symbol, session.typeChecker, location); // TODO(drosen): Right now we just permit *all* semantic meanings when calling 'getSymbolKind' // which is permissible given that it is backwards compatible; but really we should consider // passing the meaning for the node so that we don't report that a suggestion for a value is an interface. // We COULD also just do what 'getSymbolModifiers' does, which is to use the first declaration. Debug.assert(session.typeChecker.getTypeOfSymbolAtLocation(symbol, location) !== undefined, "Could not find type for symbol"); - var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location, session.typeChecker, location, SemanticMeaning.All); + let displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location, session.typeChecker, location, SemanticMeaning.All); return { name: entryName, kind: displayPartsDocumentationsAndSymbolKind.symbolKind, @@ -2958,7 +2962,7 @@ module ts { // TODO(drosen): use contextual SemanticMeaning. function getSymbolKind(symbol: Symbol, typeResolver: TypeChecker, location: Node): string { - var flags = symbol.getFlags(); + let flags = symbol.getFlags(); if (flags & SymbolFlags.Class) return ScriptElementKind.classElement; if (flags & SymbolFlags.Enum) return ScriptElementKind.enumElement; @@ -2966,7 +2970,7 @@ module ts { if (flags & SymbolFlags.Interface) return ScriptElementKind.interfaceElement; if (flags & SymbolFlags.TypeParameter) return ScriptElementKind.typeParameterElement; - var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, typeResolver, location); + let result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, typeResolver, location); if (result === ScriptElementKind.unknown) { if (flags & SymbolFlags.TypeParameter) return ScriptElementKind.typeParameterElement; if (flags & SymbolFlags.EnumMember) return ScriptElementKind.variableElement; @@ -3005,8 +3009,8 @@ module ts { if (flags & SymbolFlags.Property) { if (flags & SymbolFlags.UnionProperty) { // If union property is result of union of non method (property/accessors/variables), it is labeled as property - var unionPropertyKind = forEach(typeInfoResolver.getRootSymbols(symbol), rootSymbol => { - var rootSymbolFlags = rootSymbol.getFlags(); + let unionPropertyKind = forEach(typeInfoResolver.getRootSymbols(symbol), rootSymbol => { + let rootSymbolFlags = rootSymbol.getFlags(); if (rootSymbolFlags & (SymbolFlags.PropertyOrAccessor | SymbolFlags.Variable)) { return ScriptElementKind.memberVariableElement; } @@ -3015,7 +3019,7 @@ module ts { if (!unionPropertyKind) { // If this was union of all methods, //make sure it has call signatures before we can label it as method - var typeOfUnionProperty = typeInfoResolver.getTypeOfSymbolAtLocation(symbol, location); + let typeOfUnionProperty = typeInfoResolver.getTypeOfSymbolAtLocation(symbol, location); if (typeOfUnionProperty.getCallSignatures().length) { return ScriptElementKind.memberFunctionElement; } @@ -3030,7 +3034,7 @@ module ts { } function getTypeKind(type: Type): string { - var flags = type.getFlags(); + let flags = type.getFlags(); if (flags & TypeFlags.Enum) return ScriptElementKind.enumElement; if (flags & TypeFlags.Class) return ScriptElementKind.classElement; @@ -3052,11 +3056,12 @@ module ts { typeResolver: TypeChecker, location: Node, // TODO(drosen): Currently completion entry details passes the SemanticMeaning.All instead of using semanticMeaning of location semanticMeaning = getMeaningFromLocation(location)) { - var displayParts: SymbolDisplayPart[] = []; - var documentation: SymbolDisplayPart[]; - var symbolFlags = symbol.flags; - var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, typeResolver, location); - var hasAddedSymbolInfo: boolean; + let displayParts: SymbolDisplayPart[] = []; + let documentation: SymbolDisplayPart[]; + let symbolFlags = symbol.flags; + let symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, typeResolver, location); + let hasAddedSymbolInfo: boolean; + let type: Type; // Class at constructor site need to be shown as constructor apart from property,method, vars if (symbolKind !== ScriptElementKind.unknown || symbolFlags & SymbolFlags.Class || symbolFlags & SymbolFlags.Alias) { // If it is accessor they are allowed only if location is at name of the accessor @@ -3064,10 +3069,11 @@ module ts { symbolKind = ScriptElementKind.memberVariableElement; } - var type = typeResolver.getTypeOfSymbolAtLocation(symbol, location); + let signature: Signature; + type = typeResolver.getTypeOfSymbolAtLocation(symbol, location); if (type) { if (location.parent && location.parent.kind === SyntaxKind.PropertyAccessExpression) { - var right = (location.parent).name; + let right = (location.parent).name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { location = location.parent; @@ -3075,7 +3081,7 @@ module ts { } // try get the call/construct signature from the type if it matches - var callExpression: CallExpression; + let callExpression: CallExpression; if (location.kind === SyntaxKind.CallExpression || location.kind === SyntaxKind.NewExpression) { callExpression = location; } @@ -3084,15 +3090,15 @@ module ts { } if (callExpression) { - var candidateSignatures: Signature[] = []; + let candidateSignatures: Signature[] = []; signature = typeResolver.getResolvedSignature(callExpression, candidateSignatures); if (!signature && candidateSignatures.length) { // Use the first candidate: signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === SyntaxKind.NewExpression || callExpression.expression.kind === SyntaxKind.SuperKeyword; - var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); + let useConstructSignatures = callExpression.kind === SyntaxKind.NewExpression || callExpression.expression.kind === SyntaxKind.SuperKeyword; + let allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!contains(allSignatures, signature.target || signature)) { // Get the first signature if there @@ -3151,9 +3157,8 @@ module ts { else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & SymbolFlags.Accessor)) || // name of function declaration (location.kind === SyntaxKind.ConstructorKeyword && location.parent.kind === SyntaxKind.Constructor)) { // At constructor keyword of constructor declaration // get the signature from the declaration and write it - var signature: Signature; - var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === SyntaxKind.Constructor ? type.getConstructSignatures() : type.getCallSignatures(); + let functionDeclaration = location.parent; + let allSignatures = functionDeclaration.kind === SyntaxKind.Constructor ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeResolver.isImplementationOfOverload(functionDeclaration)) { signature = typeResolver.getSignatureFromDeclaration(functionDeclaration); } @@ -3233,8 +3238,8 @@ module ts { } else { // Method/function type parameter - var signatureDeclaration = getDeclarationOfKind(symbol, SyntaxKind.TypeParameter).parent; - var signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); + let signatureDeclaration = getDeclarationOfKind(symbol, SyntaxKind.TypeParameter).parent; + let signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); if (signatureDeclaration.kind === SyntaxKind.ConstructSignature) { displayParts.push(keywordPart(SyntaxKind.NewKeyword)); displayParts.push(spacePart()); @@ -3247,9 +3252,9 @@ module ts { } if (symbolFlags & SymbolFlags.EnumMember) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); - var declaration = symbol.declarations[0]; + let declaration = symbol.declarations[0]; if (declaration.kind === SyntaxKind.EnumMember) { - var constantValue = typeResolver.getConstantValue(declaration); + let constantValue = typeResolver.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(spacePart()); displayParts.push(operatorPart(SyntaxKind.EqualsToken)); @@ -3265,7 +3270,7 @@ module ts { addFullSymbolName(symbol); ts.forEach(symbol.declarations, declaration => { if (declaration.kind === SyntaxKind.ImportEqualsDeclaration) { - var importEqualsDeclaration = declaration; + let importEqualsDeclaration = declaration; if (isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(spacePart()); displayParts.push(operatorPart(SyntaxKind.EqualsToken)); @@ -3276,7 +3281,7 @@ module ts { displayParts.push(punctuationPart(SyntaxKind.CloseParenToken)); } else { - var internalAliasSymbol = typeResolver.getSymbolAtLocation(importEqualsDeclaration.moduleReference); + let internalAliasSymbol = typeResolver.getSymbolAtLocation(importEqualsDeclaration.moduleReference); if (internalAliasSymbol) { displayParts.push(spacePart()); displayParts.push(operatorPart(SyntaxKind.EqualsToken)); @@ -3300,7 +3305,7 @@ module ts { displayParts.push(spacePart()); // If the type is type parameter, format it specially if (type.symbol && type.symbol.flags & SymbolFlags.TypeParameter) { - var typeParameterParts = mapToDisplayParts(writer => { + let typeParameterParts = mapToDisplayParts(writer => { typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(type, writer, enclosingDeclaration); }); displayParts.push.apply(displayParts, typeParameterParts); @@ -3315,7 +3320,7 @@ module ts { symbolFlags & SymbolFlags.Signature || symbolFlags & SymbolFlags.Accessor || symbolKind === ScriptElementKind.memberFunctionElement) { - var allSignatures = type.getCallSignatures(); + let allSignatures = type.getCallSignatures(); addSignatureDisplayParts(allSignatures[0], allSignatures); } } @@ -3338,7 +3343,7 @@ module ts { } function addFullSymbolName(symbol: Symbol, enclosingDeclaration?: Node) { - var fullSymbolDisplayParts = symbolToDisplayParts(typeResolver, symbol, enclosingDeclaration || sourceFile, /*meaning*/ undefined, + let fullSymbolDisplayParts = symbolToDisplayParts(typeResolver, symbol, enclosingDeclaration || sourceFile, /*meaning*/ undefined, SymbolFormatFlags.WriteTypeParametersOrArguments | SymbolFormatFlags.UseOnlyExternalAliasing); displayParts.push.apply(displayParts, fullSymbolDisplayParts); } @@ -3369,7 +3374,7 @@ module ts { } function writeTypeParametersOfSymbol(symbol: Symbol, enclosingDeclaration: Node) { - var typeParameterParts = mapToDisplayParts(writer => { + let typeParameterParts = mapToDisplayParts(writer => { typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration); }); displayParts.push.apply(displayParts, typeParameterParts); @@ -3379,13 +3384,13 @@ module ts { function getQuickInfoAtPosition(fileName: string, position: number): QuickInfo { synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); - var node = getTouchingPropertyName(sourceFile, position); + let sourceFile = getValidSourceFile(fileName); + let node = getTouchingPropertyName(sourceFile, position); if (!node) { return undefined; } - var symbol = typeInfoResolver.getSymbolAtLocation(node); + let symbol = typeInfoResolver.getSymbolAtLocation(node); if (!symbol) { // Try getting just type at this position and show switch (node.kind) { @@ -3395,7 +3400,7 @@ module ts { case SyntaxKind.ThisKeyword: case SyntaxKind.SuperKeyword: // For the identifiers/this/super etc get the type at position - var type = typeInfoResolver.getTypeAtLocation(node); + let type = typeInfoResolver.getTypeAtLocation(node); if (type) { return { kind: ScriptElementKind.unknown, @@ -3410,7 +3415,7 @@ module ts { return undefined; } - var displayPartsDocumentationsAndKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, getContainerNode(node), typeInfoResolver, node); + let displayPartsDocumentationsAndKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, getContainerNode(node), typeInfoResolver, node); return { kind: displayPartsDocumentationsAndKind.symbolKind, kindModifiers: getSymbolModifiers(symbol), @@ -3424,24 +3429,24 @@ module ts { function getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] { synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); + let sourceFile = getValidSourceFile(fileName); - var node = getTouchingPropertyName(sourceFile, position); + let node = getTouchingPropertyName(sourceFile, position); if (!node) { return undefined; } // Labels if (isJumpStatementTarget(node)) { - var labelName = (node).text; - var label = getTargetLabel((node.parent), (node).text); + let labelName = (node).text; + let label = getTargetLabel((node.parent), (node).text); return label ? [getDefinitionInfo(label, ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; } /// Triple slash reference comments - var comment = forEach(sourceFile.referencedFiles, r => (r.pos <= position && position < r.end) ? r : undefined); + let comment = forEach(sourceFile.referencedFiles, r => (r.pos <= position && position < r.end) ? r : undefined); if (comment) { - var referenceFile = tryResolveScriptReference(program, sourceFile, comment); + let referenceFile = tryResolveScriptReference(program, sourceFile, comment); if (referenceFile) { return [{ fileName: referenceFile.fileName, @@ -3455,7 +3460,7 @@ module ts { return undefined; } - var symbol = typeInfoResolver.getSymbolAtLocation(node); + let symbol = typeInfoResolver.getSymbolAtLocation(node); // Could not find a symbol e.g. node is string or number keyword, // or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol @@ -3468,13 +3473,13 @@ module ts { // import {A, B} from "mod"; // to jump to the implementation directelly. if (symbol.flags & SymbolFlags.Alias) { - var declaration = symbol.declarations[0]; + let declaration = symbol.declarations[0]; if (node.kind === SyntaxKind.Identifier && node.parent === declaration) { symbol = typeInfoResolver.getAliasedSymbol(symbol); } } - var result: DefinitionInfo[] = []; + let result: DefinitionInfo[] = []; // Because name in short-hand property assignment has two different meanings: property name and property value, // using go-to-definition at such position should go to the variable declaration of the property value rather than @@ -3482,22 +3487,22 @@ module ts { // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. if (node.parent.kind === SyntaxKind.ShorthandPropertyAssignment) { - var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); - var shorthandDeclarations = shorthandSymbol.getDeclarations(); - var shorthandSymbolKind = getSymbolKind(shorthandSymbol, typeInfoResolver, node); - var shorthandSymbolName = typeInfoResolver.symbolToString(shorthandSymbol); - var shorthandContainerName = typeInfoResolver.symbolToString(symbol.parent, node); + let shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); + let shorthandDeclarations = shorthandSymbol.getDeclarations(); + let shorthandSymbolKind = getSymbolKind(shorthandSymbol, typeInfoResolver, node); + let shorthandSymbolName = typeInfoResolver.symbolToString(shorthandSymbol); + let shorthandContainerName = typeInfoResolver.symbolToString(symbol.parent, node); forEach(shorthandDeclarations, declaration => { result.push(getDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName)); }); return result } - var declarations = symbol.getDeclarations(); - var symbolName = typeInfoResolver.symbolToString(symbol); // Do not get scoped name, just the name of the symbol - var symbolKind = getSymbolKind(symbol, typeInfoResolver, node); - var containerSymbol = symbol.parent; - var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : ""; + let declarations = symbol.getDeclarations(); + let symbolName = typeInfoResolver.symbolToString(symbol); // Do not get scoped name, just the name of the symbol + let symbolKind = getSymbolKind(symbol, typeInfoResolver, node); + let containerSymbol = symbol.parent; + let containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : ""; if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { @@ -3521,8 +3526,8 @@ module ts { } function tryAddSignature(signatureDeclarations: Declaration[], selectConstructors: boolean, symbolKind: string, symbolName: string, containerName: string, result: DefinitionInfo[]) { - var declarations: Declaration[] = []; - var definition: Declaration; + let declarations: Declaration[] = []; + let definition: Declaration; forEach(signatureDeclarations, d => { if ((selectConstructors && d.kind === SyntaxKind.Constructor) || @@ -3549,7 +3554,7 @@ module ts { // and in either case the symbol has a construct signature definition, i.e. class if (isNewExpressionTarget(location) || location.kind === SyntaxKind.ConstructorKeyword) { if (symbol.flags & SymbolFlags.Class) { - var classDeclaration = symbol.getDeclarations()[0]; + let classDeclaration = symbol.getDeclarations()[0]; Debug.assert(classDeclaration && classDeclaration.kind === SyntaxKind.ClassDeclaration); return tryAddSignature(classDeclaration.members, /*selectConstructors*/ true, symbolKind, symbolName, containerName, result); @@ -3570,9 +3575,9 @@ module ts { function getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] { synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); + let sourceFile = getValidSourceFile(fileName); - var node = getTouchingWord(sourceFile, position); + let node = getTouchingWord(sourceFile, position); if (!node) { return undefined; } @@ -3660,7 +3665,7 @@ module ts { return undefined; function getIfElseOccurrences(ifStatement: IfStatement): ReferenceEntry[] { - var keywords: Node[] = []; + let keywords: Node[] = []; // Traverse upwards through all parent if-statements linked by their else-branches. while (hasKind(ifStatement.parent, SyntaxKind.IfStatement) && (ifStatement.parent).elseStatement === ifStatement) { @@ -3669,11 +3674,11 @@ module ts { // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. while (ifStatement) { - var children = ifStatement.getChildren(); + let children = ifStatement.getChildren(); pushKeywordIf(keywords, children[0], SyntaxKind.IfKeyword); // Generally the 'else' keyword is second-to-last, so we traverse backwards. - for (var i = children.length - 1; i >= 0; i--) { + for (let i = children.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, children[i], SyntaxKind.ElseKeyword)) { break; } @@ -3686,19 +3691,19 @@ module ts { ifStatement = ifStatement.elseStatement; } - var result: ReferenceEntry[] = []; + let result: ReferenceEntry[] = []; // We'd like to highlight else/ifs together if they are only separated by whitespace // (i.e. the keywords are separated by no comments, no newlines). - for (var i = 0; i < keywords.length; i++) { + for (let i = 0; i < keywords.length; i++) { if (keywords[i].kind === SyntaxKind.ElseKeyword && i < keywords.length - 1) { - var elseKeyword = keywords[i]; - var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. + let elseKeyword = keywords[i]; + let ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. - var shouldHighlightNextKeyword = true; + let shouldHighlightNextKeyword = true; // Avoid recalculating getStart() by iterating backwards. - for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { + for (let j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { if (!isWhiteSpace(sourceFile.text.charCodeAt(j))) { shouldHighlightNextKeyword = false; break; @@ -3724,14 +3729,14 @@ module ts { } function getReturnOccurrences(returnStatement: ReturnStatement): ReferenceEntry[] { - var func = getContainingFunction(returnStatement); + let func = getContainingFunction(returnStatement); // If we didn't find a containing function with a block body, bail out. if (!(func && hasKind(func.body, SyntaxKind.Block))) { return undefined; } - var keywords: Node[] = [] + let keywords: Node[] = [] forEachReturnStatement(func.body, returnStatement => { pushKeywordIf(keywords, returnStatement.getFirstToken(), SyntaxKind.ReturnKeyword); }); @@ -3745,13 +3750,13 @@ module ts { } function getThrowOccurrences(throwStatement: ThrowStatement) { - var owner = getThrowStatementOwner(throwStatement); + let owner = getThrowStatementOwner(throwStatement); if (!owner) { return undefined; } - var keywords: Node[] = []; + let keywords: Node[] = []; forEach(aggregateOwnedThrowStatements(owner), throwStatement => { pushKeywordIf(keywords, throwStatement.getFirstToken(), SyntaxKind.ThrowKeyword); @@ -3773,7 +3778,7 @@ module ts { * into function boundaries and try-blocks with catch-clauses. */ function aggregateOwnedThrowStatements(node: Node): ThrowStatement[] { - var statementAccumulator: ThrowStatement[] = [] + let statementAccumulator: ThrowStatement[] = [] aggregate(node); return statementAccumulator; @@ -3782,7 +3787,7 @@ module ts { statementAccumulator.push(node); } else if (node.kind === SyntaxKind.TryStatement) { - var tryStatement = node; + let tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -3810,10 +3815,10 @@ module ts { * function-block, or source file. */ function getThrowStatementOwner(throwStatement: ThrowStatement): Node { - var child: Node = throwStatement; + let child: Node = throwStatement; while (child.parent) { - var parent = child.parent; + let parent = child.parent; if (isFunctionBlock(parent) || parent.kind === SyntaxKind.SourceFile) { return parent; @@ -3822,7 +3827,7 @@ module ts { // A throw-statement is only owned by a try-statement if the try-statement has // a catch clause, and if the throw-statement occurs within the try block. if (parent.kind === SyntaxKind.TryStatement) { - var tryStatement = parent; + let tryStatement = parent; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -3836,7 +3841,7 @@ module ts { } function getTryCatchFinallyOccurrences(tryStatement: TryStatement): ReferenceEntry[] { - var keywords: Node[] = []; + let keywords: Node[] = []; pushKeywordIf(keywords, tryStatement.getFirstToken(), SyntaxKind.TryKeyword); @@ -3845,7 +3850,7 @@ module ts { } if (tryStatement.finallyBlock) { - var finallyKeyword = findChildOfKind(tryStatement, SyntaxKind.FinallyKeyword, sourceFile); + let finallyKeyword = findChildOfKind(tryStatement, SyntaxKind.FinallyKeyword, sourceFile); pushKeywordIf(keywords, finallyKeyword, SyntaxKind.FinallyKeyword); } @@ -3853,14 +3858,14 @@ module ts { } function getLoopBreakContinueOccurrences(loopNode: IterationStatement): ReferenceEntry[] { - var keywords: Node[] = []; + let keywords: Node[] = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), SyntaxKind.ForKeyword, SyntaxKind.WhileKeyword, SyntaxKind.DoKeyword)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. if (loopNode.kind === SyntaxKind.DoStatement) { - var loopTokens = loopNode.getChildren(); + let loopTokens = loopNode.getChildren(); - for (var i = loopTokens.length - 1; i >= 0; i--) { + for (let i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], SyntaxKind.WhileKeyword)) { break; } @@ -3868,7 +3873,7 @@ module ts { } } - var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + let breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); forEach(breaksAndContinues, statement => { if (ownsBreakOrContinueStatement(loopNode, statement)) { @@ -3880,7 +3885,7 @@ module ts { } function getSwitchCaseDefaultOccurrences(switchStatement: SwitchStatement) { - var keywords: Node[] = []; + let keywords: Node[] = []; pushKeywordIf(keywords, switchStatement.getFirstToken(), SyntaxKind.SwitchKeyword); @@ -3888,7 +3893,7 @@ module ts { forEach(switchStatement.caseBlock.clauses, clause => { pushKeywordIf(keywords, clause.getFirstToken(), SyntaxKind.CaseKeyword, SyntaxKind.DefaultKeyword); - var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); + let breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); forEach(breaksAndContinues, statement => { if (ownsBreakOrContinueStatement(switchStatement, statement)) { @@ -3901,7 +3906,7 @@ module ts { } function getBreakOrContinueStatementOccurences(breakOrContinueStatement: BreakOrContinueStatement): ReferenceEntry[] { - var owner = getBreakOrContinueOwner(breakOrContinueStatement); + let owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { @@ -3921,7 +3926,7 @@ module ts { } function aggregateAllBreakAndContinueStatements(node: Node): BreakOrContinueStatement[] { - var statementAccumulator: BreakOrContinueStatement[] = [] + let statementAccumulator: BreakOrContinueStatement[] = [] aggregate(node); return statementAccumulator; @@ -3937,13 +3942,13 @@ module ts { } function ownsBreakOrContinueStatement(owner: Node, statement: BreakOrContinueStatement): boolean { - var actualOwner = getBreakOrContinueOwner(statement); + let actualOwner = getBreakOrContinueOwner(statement); return actualOwner && actualOwner === owner; } function getBreakOrContinueOwner(statement: BreakOrContinueStatement): Node { - for (var node = statement.parent; node; node = node.parent) { + for (let node = statement.parent; node; node = node.parent) { switch (node.kind) { case SyntaxKind.SwitchStatement: if (statement.kind === SyntaxKind.ContinueStatement) { @@ -3972,9 +3977,9 @@ module ts { } function getConstructorOccurrences(constructorDeclaration: ConstructorDeclaration): ReferenceEntry[] { - var declarations = constructorDeclaration.symbol.getDeclarations() + let declarations = constructorDeclaration.symbol.getDeclarations() - var keywords: Node[] = []; + let keywords: Node[] = []; forEach(declarations, declaration => { forEach(declaration.getChildren(), token => { @@ -3986,7 +3991,7 @@ module ts { } function getGetAndSetOccurrences(accessorDeclaration: AccessorDeclaration): ReferenceEntry[] { - var keywords: Node[] = []; + let keywords: Node[] = []; tryPushAccessorKeyword(accessorDeclaration.symbol, SyntaxKind.GetAccessor); tryPushAccessorKeyword(accessorDeclaration.symbol, SyntaxKind.SetAccessor); @@ -3994,7 +3999,7 @@ module ts { return map(keywords, getReferenceEntryFromNode); function tryPushAccessorKeyword(accessorSymbol: Symbol, accessorKind: SyntaxKind): void { - var accessor = getDeclarationOfKind(accessorSymbol, accessorKind); + let accessor = getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { forEach(accessor.getChildren(), child => pushKeywordIf(keywords, child, SyntaxKind.GetKeyword, SyntaxKind.SetKeyword)); @@ -4003,7 +4008,7 @@ module ts { } function getModifierOccurrences(modifier: SyntaxKind, declaration: Node) { - var container = declaration.parent; + let container = declaration.parent; // Make sure we only highlight the keyword when it makes sense to do so. if (declaration.flags & NodeFlags.AccessibilityModifier) { @@ -4027,10 +4032,10 @@ module ts { return undefined; } - var keywords: Node[] = []; - var modifierFlag: NodeFlags = getFlagFromModifier(modifier); + let keywords: Node[] = []; + let modifierFlag: NodeFlags = getFlagFromModifier(modifier); - var nodes: Node[]; + let nodes: Node[]; switch (container.kind) { case SyntaxKind.ModuleBlock: case SyntaxKind.SourceFile: @@ -4046,7 +4051,7 @@ module ts { // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. if (modifierFlag & NodeFlags.AccessibilityModifier) { - var constructor = forEach((container).members, member => { + let constructor = forEach((container).members, member => { return member.kind === SyntaxKind.Constructor && member; }); @@ -4118,9 +4123,9 @@ module ts { function findReferences(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): ReferenceEntry[] { synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); + let sourceFile = getValidSourceFile(fileName); - var node = getTouchingPropertyName(sourceFile, position); + let node = getTouchingPropertyName(sourceFile, position); if (!node) { return undefined; } @@ -4142,7 +4147,7 @@ module ts { // Labels if (isLabelName(node)) { if (isJumpStatementTarget(node)) { - var labelDefinition = getTargetLabel((node.parent), (node).text); + let labelDefinition = getTargetLabel((node.parent), (node).text); // if we have a label definition, look within its statement for references, if not, then // the label is undefined, just return a set of one for the current node. return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [getReferenceEntryFromNode(node)]; @@ -4161,7 +4166,7 @@ module ts { return getReferencesForSuperKeyword(node); } - var symbol = typeInfoResolver.getSymbolAtLocation(node); + let symbol = typeInfoResolver.getSymbolAtLocation(node); // Could not find a symbol e.g. unknown identifier if (!symbol) { @@ -4170,24 +4175,24 @@ module ts { return [getReferenceEntryFromNode(node)]; } - var declarations = symbol.declarations; + let declarations = symbol.declarations; // The symbol was an internal symbol and does not have a declaration e.g.undefined symbol if (!declarations || !declarations.length) { return undefined; } - var result: ReferenceEntry[]; + let result: ReferenceEntry[]; // Compute the meaning from the location and the symbol it references - var searchMeaning = getIntersectingMeaningFromDeclarations(getMeaningFromLocation(node), declarations); + let searchMeaning = getIntersectingMeaningFromDeclarations(getMeaningFromLocation(node), declarations); // Get the text to search for, we need to normalize it as external module names will have quote - var declaredName = getDeclaredName(symbol, node); + let declaredName = getDeclaredName(symbol, node); // Try to get the smallest valid scope that we can limit our search to; // otherwise we'll need to search globally (i.e. include each file). - var scope = getSymbolScope(symbol); + let scope = getSymbolScope(symbol); if (scope) { result = []; @@ -4200,11 +4205,11 @@ module ts { getReferencesInNode(sourceFiles[0], symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result); } else { - var internedName = getInternedName(symbol, node, declarations) + let internedName = getInternedName(symbol, node, declarations) forEach(sourceFiles, sourceFile => { cancellationToken.throwIfCancellationRequested(); - var nameTable = getNameTable(sourceFile); + let nameTable = getNameTable(sourceFile); if (lookUp(nameTable, internedName)) { result = result || []; @@ -4230,15 +4235,16 @@ module ts { function getDeclaredName(symbol: Symbol, location: Node) { // Special case for function expressions, whose names are solely local to their bodies. - var functionExpression = forEach(symbol.declarations, d => d.kind === SyntaxKind.FunctionExpression ? d : undefined); + let functionExpression = forEach(symbol.declarations, d => d.kind === SyntaxKind.FunctionExpression ? d : undefined); // When a name gets interned into a SourceFile's 'identifiers' Map, // its name is escaped and stored in the same way its symbol name/identifier // name should be stored. Function expressions, however, are a special case, // because despite sometimes having a name, the binder unconditionally binds them // to a symbol with the name "__function". + let name: string; if (functionExpression && functionExpression.name) { - var name = functionExpression.name.text; + name = functionExpression.name.text; } // If this is an export or import specifier it could have been renamed using the as syntax. @@ -4248,7 +4254,7 @@ module ts { return location.getText(); } - var name = typeInfoResolver.symbolToString(symbol); + name = typeInfoResolver.symbolToString(symbol); return stripQuotes(name); } @@ -4262,25 +4268,22 @@ module ts { } // Special case for function expressions, whose names are solely local to their bodies. - var functionExpression = forEach(declarations, d => d.kind === SyntaxKind.FunctionExpression ? d : undefined); + let functionExpression = forEach(declarations, d => d.kind === SyntaxKind.FunctionExpression ? d : undefined); // When a name gets interned into a SourceFile's 'identifiers' Map, // its name is escaped and stored in the same way its symbol name/identifier // name should be stored. Function expressions, however, are a special case, // because despite sometimes having a name, the binder unconditionally binds them // to a symbol with the name "__function". - if (functionExpression && functionExpression.name) { - var name = functionExpression.name.text; - } - else { - var name = symbol.name; - } + let name = functionExpression && functionExpression.name + ? functionExpression.name.text + : symbol.name; return stripQuotes(name); } function stripQuotes(name: string) { - var length = name.length; + let length = name.length; if (length >= 2 && name.charCodeAt(0) === CharacterCodes.doubleQuote && name.charCodeAt(length - 1) === CharacterCodes.doubleQuote) { return name.substring(1, length - 1); }; @@ -4290,7 +4293,7 @@ module ts { function getSymbolScope(symbol: Symbol): Node { // If this is private property or method, the scope is the containing class if (symbol.flags & (SymbolFlags.Property | SymbolFlags.Method)) { - var privateDeclaration = forEach(symbol.getDeclarations(), d => (d.flags & NodeFlags.Private) ? d : undefined); + let privateDeclaration = forEach(symbol.getDeclarations(), d => (d.flags & NodeFlags.Private) ? d : undefined); if (privateDeclaration) { return getAncestor(privateDeclaration, SyntaxKind.ClassDeclaration); } @@ -4308,12 +4311,12 @@ module ts { return undefined; } - var scope: Node = undefined; + let scope: Node = undefined; - var declarations = symbol.getDeclarations(); + let declarations = symbol.getDeclarations(); if (declarations) { for (let declaration of declarations) { - var container = getContainerNode(declaration); + let container = getContainerNode(declaration); if (!container) { return undefined; @@ -4339,7 +4342,7 @@ module ts { } function getPossibleSymbolReferencePositions(sourceFile: SourceFile, symbolName: string, start: number, end: number): number[] { - var positions: number[] = []; + let positions: number[] = []; /// TODO: Cache symbol existence for files to save text search // Also, need to make this work for unicode escapes. @@ -4349,11 +4352,11 @@ module ts { return positions; } - var text = sourceFile.text; - var sourceLength = text.length; - var symbolNameLength = symbolName.length; + let text = sourceFile.text; + let sourceLength = text.length; + let symbolNameLength = symbolName.length; - var position = text.indexOf(symbolName, start); + let position = text.indexOf(symbolName, start); while (position >= 0) { cancellationToken.throwIfCancellationRequested(); @@ -4362,7 +4365,7 @@ module ts { // We found a match. Make sure it's not part of a larger word (i.e. the char // before and after it have to be a non-identifier char). - var endPosition = position + symbolNameLength; + let endPosition = position + symbolNameLength; if ((position === 0 || !isIdentifierPart(text.charCodeAt(position - 1), ScriptTarget.Latest)) && (endPosition === sourceLength || !isIdentifierPart(text.charCodeAt(endPosition), ScriptTarget.Latest))) { @@ -4376,14 +4379,14 @@ module ts { } function getLabelReferencesInNode(container: Node, targetLabel: Identifier): ReferenceEntry[] { - var result: ReferenceEntry[] = []; - var sourceFile = container.getSourceFile(); - var labelName = targetLabel.text; - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); + let result: ReferenceEntry[] = []; + let sourceFile = container.getSourceFile(); + let labelName = targetLabel.text; + let possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); forEach(possiblePositions, position => { cancellationToken.throwIfCancellationRequested(); - var node = getTouchingWord(sourceFile, position); + let node = getTouchingWord(sourceFile, position); if (!node || node.getWidth() !== labelName.length) { return; } @@ -4435,19 +4438,19 @@ module ts { findInStrings: boolean, findInComments: boolean, result: ReferenceEntry[]): void { - var sourceFile = container.getSourceFile(); - var tripleSlashDirectivePrefixRegex = /^\/\/\/\s* { cancellationToken.throwIfCancellationRequested(); - var referenceLocation = getTouchingPropertyName(sourceFile, position); + let referenceLocation = getTouchingPropertyName(sourceFile, position); if (!isValidReferencePosition(referenceLocation, searchText)) { // This wasn't the start of a token. Check to see if it might be a // match in a comment or string if that's what the caller is asking @@ -4467,10 +4470,10 @@ module ts { return; } - var referenceSymbol = typeInfoResolver.getSymbolAtLocation(referenceLocation); + let referenceSymbol = typeInfoResolver.getSymbolAtLocation(referenceLocation); if (referenceSymbol) { - var referenceSymbolDeclaration = referenceSymbol.valueDeclaration; - var shorthandValueSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); + let referenceSymbolDeclaration = referenceSymbol.valueDeclaration; + let shorthandValueSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(referenceSymbolDeclaration); if (isRelatableToSearchSet(searchSymbols, referenceSymbol, referenceLocation)) { result.push(getReferenceEntryFromNode(referenceLocation)); } @@ -4488,21 +4491,21 @@ module ts { } function isInString(position: number) { - var token = getTokenAtPosition(sourceFile, position); + let token = getTokenAtPosition(sourceFile, position); return token && token.kind === SyntaxKind.StringLiteral && position > token.getStart(); } function isInComment(position: number) { - var token = getTokenAtPosition(sourceFile, position); + let token = getTokenAtPosition(sourceFile, position); if (token && position < token.getStart()) { // First, we have to see if this position actually landed in a comment. - var commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos); + let commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos); // Then we want to make sure that it wasn't in a "///<" directive comment // We don't want to unintentionally update a file name. return forEach(commentRanges, c => { if (c.pos < position && position < c.end) { - var commentText = sourceFile.text.substring(c.pos, c.end); + let commentText = sourceFile.text.substring(c.pos, c.end); if (!tripleSlashDirectivePrefixRegex.test(commentText)) { return true; } @@ -4515,12 +4518,12 @@ module ts { } function getReferencesForSuperKeyword(superKeyword: Node): ReferenceEntry[] { - var searchSpaceNode = getSuperContainer(superKeyword, /*includeFunctions*/ false); + let searchSpaceNode = getSuperContainer(superKeyword, /*includeFunctions*/ false); if (!searchSpaceNode) { return undefined; } // Whether 'super' occurs in a static context within a class. - var staticFlag = NodeFlags.Static; + let staticFlag = NodeFlags.Static; switch (searchSpaceNode.kind) { case SyntaxKind.PropertyDeclaration: @@ -4537,20 +4540,20 @@ module ts { return undefined; } - var result: ReferenceEntry[] = []; + let result: ReferenceEntry[] = []; - var sourceFile = searchSpaceNode.getSourceFile(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + let sourceFile = searchSpaceNode.getSourceFile(); + let possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); forEach(possiblePositions, position => { cancellationToken.throwIfCancellationRequested(); - var node = getTouchingWord(sourceFile, position); + let node = getTouchingWord(sourceFile, position); if (!node || node.kind !== SyntaxKind.SuperKeyword) { return; } - var container = getSuperContainer(node, /*includeFunctions*/ false); + let container = getSuperContainer(node, /*includeFunctions*/ false); // If we have a 'super' container, we must have an enclosing class. // Now make sure the owning class is the same as the search-space @@ -4564,10 +4567,10 @@ module ts { } function getReferencesForThisKeyword(thisOrSuperKeyword: Node, sourceFiles: SourceFile[]): ReferenceEntry[] { - var searchSpaceNode = getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); + let searchSpaceNode = getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. - var staticFlag = NodeFlags.Static; + let staticFlag = NodeFlags.Static; switch (searchSpaceNode.kind) { case SyntaxKind.MethodDeclaration: @@ -4598,17 +4601,18 @@ module ts { return undefined; } - var result: ReferenceEntry[] = []; + let result: ReferenceEntry[] = []; + let possiblePositions: number[]; if (searchSpaceNode.kind === SyntaxKind.SourceFile) { forEach(sourceFiles, sourceFile => { - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, result); }); } else { - var sourceFile = searchSpaceNode.getSourceFile(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + let sourceFile = searchSpaceNode.getSourceFile(); + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result); } @@ -4618,12 +4622,12 @@ module ts { forEach(possiblePositions, position => { cancellationToken.throwIfCancellationRequested(); - var node = getTouchingWord(sourceFile, position); + let node = getTouchingWord(sourceFile, position); if (!node || node.kind !== SyntaxKind.ThisKeyword) { return; } - var container = getThisContainer(node, /* includeArrowFunctions */ false); + let container = getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { case SyntaxKind.FunctionExpression: @@ -4657,7 +4661,7 @@ module ts { function populateSearchSymbolSet(symbol: Symbol, location: Node): Symbol[] { // The search set contains at least the current symbol - var result = [symbol]; + let result = [symbol]; // If the symbol is an alias, add what it alaises to the list if (isImportOrExportSpecifierImportSymbol(symbol)) { @@ -4677,13 +4681,13 @@ module ts { * property name and variable declaration of the identifier. * Like in below example, when querying for all references for an identifier 'name', of the property assignment, the language service * should show both 'name' in 'obj' and 'name' in variable declaration - * var name = "Foo"; - * var obj = { name }; + * let name = "Foo"; + * let obj = { name }; * In order to do that, we will populate the search set with the value symbol of the identifier as a value of the property assignment * so that when matching with potential reference symbol, both symbols from property declaration and variable declaration * will be included correctly. */ - var shorthandValueSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(location.parent); + let shorthandValueSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(location.parent); if (shorthandValueSymbol) { result.push(shorthandValueSymbol); } @@ -4721,9 +4725,9 @@ module ts { function getPropertySymbolFromTypeReference(typeReference: TypeReferenceNode) { if (typeReference) { - var type = typeInfoResolver.getTypeAtLocation(typeReference); + let type = typeInfoResolver.getTypeAtLocation(typeReference); if (type) { - var propertySymbol = typeInfoResolver.getPropertyOfType(type, propertyName); + let propertySymbol = typeInfoResolver.getPropertyOfType(type, propertyName); if (propertySymbol) { result.push(propertySymbol); } @@ -4767,7 +4771,7 @@ module ts { // Finally, try all properties with the same name in any type the containing type extended or implemented, and // see if any is in the list if (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { - var result: Symbol[] = []; + let result: Symbol[] = []; getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); return forEach(result, s => searchSymbols.indexOf(s) >= 0); } @@ -4778,21 +4782,21 @@ module ts { function getPropertySymbolsFromContextualType(node: Node): Symbol[] { if (isNameOfPropertyAssignment(node)) { - var objectLiteral = node.parent.parent; - var contextualType = typeInfoResolver.getContextualType(objectLiteral); - var name = (node).text; + let objectLiteral = node.parent.parent; + let contextualType = typeInfoResolver.getContextualType(objectLiteral); + let name = (node).text; if (contextualType) { if (contextualType.flags & TypeFlags.Union) { // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) // if not, search the constituent types for the property - var unionProperty = contextualType.getProperty(name) + let unionProperty = contextualType.getProperty(name) if (unionProperty) { return [unionProperty]; } else { - var result: Symbol[] = []; + let result: Symbol[] = []; forEach((contextualType).types, t => { - var symbol = t.getProperty(name); + let symbol = t.getProperty(name); if (symbol) { result.push(symbol); } @@ -4801,7 +4805,7 @@ module ts { } } else { - var symbol = contextualType.getProperty(name); + let symbol = contextualType.getProperty(name); if (symbol) { return [symbol]; } @@ -4820,6 +4824,7 @@ module ts { */ function getIntersectingMeaningFromDeclarations(meaning: SemanticMeaning, declarations: Declaration[]): SemanticMeaning { if (declarations) { + let lastIterationMeaning: SemanticMeaning; do { // The result is order-sensitive, for instance if initialMeaning === Namespace, and declarations = [class, instantiated module] // we need to consider both as they initialMeaning intersects with the module in the namespace space, and the module @@ -4827,24 +4832,25 @@ module ts { // To achieve that we will keep iterating until the result stabilizes. // Remember the last meaning - var lastIterationMeaning = meaning; + lastIterationMeaning = meaning; for (let declaration of declarations) { - var declarationMeaning = getMeaningFromDeclaration(declaration); + let declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; } } - } while (meaning !== lastIterationMeaning); + } + while (meaning !== lastIterationMeaning); } return meaning; } } function getReferenceEntryFromNode(node: Node): ReferenceEntry { - var start = node.getStart(); - var end = node.getEnd(); + let start = node.getStart(); + let end = node.getEnd(); if (node.kind === SyntaxKind.StringLiteral) { start += 1; @@ -4864,13 +4870,13 @@ module ts { return true; } - var parent = node.parent; + let parent = node.parent; if (parent) { if (parent.kind === SyntaxKind.PostfixUnaryExpression || parent.kind === SyntaxKind.PrefixUnaryExpression) { return true; } else if (parent.kind === SyntaxKind.BinaryExpression && (parent).left === node) { - var operator = (parent).operatorToken.kind; + let operator = (parent).operatorToken.kind; return SyntaxKind.FirstAssignment <= operator && operator <= SyntaxKind.LastAssignment; } } @@ -4892,9 +4898,9 @@ module ts { function getEmitOutput(fileName: string): EmitOutput { synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); + let sourceFile = getValidSourceFile(fileName); - var outputFiles: OutputFile[] = []; + let outputFiles: OutputFile[] = []; function writeFile(fileName: string, data: string, writeByteOrderMark: boolean) { outputFiles.push({ @@ -4904,7 +4910,7 @@ module ts { }); } - var emitOutput = program.emit(sourceFile, writeFile); + let emitOutput = program.emit(sourceFile, writeFile); return { outputFiles, @@ -4981,8 +4987,8 @@ module ts { } function isNamespaceReference(node: Node): boolean { - var root = node; - var isLastClause = true; + let root = node; + let isLastClause = true; if (root.parent.kind === SyntaxKind.QualifiedName) { while (root.parent && root.parent.kind === SyntaxKind.QualifiedName) root = root.parent; @@ -5043,7 +5049,7 @@ module ts { function getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems { synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); + let sourceFile = getValidSourceFile(fileName); return SignatureHelp.getSignatureHelpItems(sourceFile, position, typeInfoResolver, cancellationToken); } @@ -5054,10 +5060,10 @@ module ts { } function getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan { - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + let sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Get node at the location - var node = getTouchingPropertyName(sourceFile, startPos); + let node = getTouchingPropertyName(sourceFile, startPos); if (!node) { return; @@ -5080,7 +5086,7 @@ module ts { return; } - var nodeForStartPos = node; + let nodeForStartPos = node; while (true) { if (isRightSideOfPropertyAccess(nodeForStartPos) || isRightSideOfQualifiedName(nodeForStartPos)) { // If on the span is in right side of the the property or qualified name, return the span from the qualified name pos to end of this node @@ -5111,13 +5117,13 @@ module ts { function getBreakpointStatementAtPosition(fileName: string, position: number) { // doesn't use compiler - no need to synchronize with host - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + let sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); return BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position); } function getNavigationBarItems(fileName: string): NavigationBarItem[]{ - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + let sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); return NavigationBar.getNavigationBarItems(sourceFile); } @@ -5125,15 +5131,15 @@ module ts { function getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] { synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); + let sourceFile = getValidSourceFile(fileName); - var result: ClassifiedSpan[] = []; + let result: ClassifiedSpan[] = []; processNode(sourceFile); return result; function classifySymbol(symbol: Symbol, meaningAtPosition: SemanticMeaning) { - var flags = symbol.getFlags(); + let flags = symbol.getFlags(); if (flags & SymbolFlags.Class) { return ClassificationTypeNames.className; @@ -5178,9 +5184,9 @@ module ts { // Only walk into nodes that intersect the requested span. if (node && textSpanIntersectsWith(span, node.getStart(), node.getWidth())) { if (node.kind === SyntaxKind.Identifier && node.getWidth() > 0) { - var symbol = typeInfoResolver.getSymbolAtLocation(node); + let symbol = typeInfoResolver.getSymbolAtLocation(node); if (symbol) { - var type = classifySymbol(symbol, getMeaningFromLocation(node)); + let type = classifySymbol(symbol, getMeaningFromLocation(node)); if (type) { result.push({ textSpan: createTextSpan(node.getStart(), node.getWidth()), @@ -5197,19 +5203,19 @@ module ts { function getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] { // doesn't use compiler - no need to synchronize with host - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + let sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Make a scanner we can get trivia from. - var triviaScanner = createScanner(ScriptTarget.Latest, /*skipTrivia:*/ false, sourceFile.text); - var mergeConflictScanner = createScanner(ScriptTarget.Latest, /*skipTrivia:*/ false, sourceFile.text); + let triviaScanner = createScanner(ScriptTarget.Latest, /*skipTrivia:*/ false, sourceFile.text); + let mergeConflictScanner = createScanner(ScriptTarget.Latest, /*skipTrivia:*/ false, sourceFile.text); - var result: ClassifiedSpan[] = []; + let result: ClassifiedSpan[] = []; processElement(sourceFile); return result; function classifyLeadingTrivia(token: Node): void { - var tokenStart = skipTrivia(sourceFile.text, token.pos, /*stopAfterLineBreak:*/ false); + let tokenStart = skipTrivia(sourceFile.text, token.pos, /*stopAfterLineBreak:*/ false); if (tokenStart === token.pos) { return; } @@ -5217,10 +5223,10 @@ module ts { // token has trivia. Classify them appropriately. triviaScanner.setTextPos(token.pos); while (true) { - var start = triviaScanner.getTextPos(); - var kind = triviaScanner.scan(); - var end = triviaScanner.getTextPos(); - var width = end - start; + let start = triviaScanner.getTextPos(); + let kind = triviaScanner.scan(); + let end = triviaScanner.getTextPos(); + let width = end - start; if (textSpanIntersectsWith(span, start, width)) { if (!isTrivia(kind)) { @@ -5237,8 +5243,8 @@ module ts { } if (kind === SyntaxKind.ConflictMarkerTrivia) { - var text = sourceFile.text; - var ch = text.charCodeAt(start); + let text = sourceFile.text; + let ch = text.charCodeAt(start); // for the <<<<<<< and >>>>>>> markers, we just add them in as comments // in the classification stream. @@ -5280,11 +5286,11 @@ module ts { } function classifyDisabledCodeToken() { - var start = mergeConflictScanner.getTextPos(); - var tokenKind = mergeConflictScanner.scan(); - var end = mergeConflictScanner.getTextPos(); + let start = mergeConflictScanner.getTextPos(); + let tokenKind = mergeConflictScanner.scan(); + let end = mergeConflictScanner.getTextPos(); - var type = classifyTokenType(tokenKind); + let type = classifyTokenType(tokenKind); if (type) { result.push({ textSpan: createTextSpanFromBounds(start, end), @@ -5297,7 +5303,7 @@ module ts { classifyLeadingTrivia(token); if (token.getWidth() > 0) { - var type = classifyTokenType(token.kind, token); + let type = classifyTokenType(token.kind, token); if (type) { result.push({ textSpan: createTextSpan(token.getStart(), token.getWidth()), @@ -5398,7 +5404,7 @@ module ts { function processElement(element: Node) { // Ignore nodes that don't intersect the original span to classify. if (textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { - var children = element.getChildren(); + let children = element.getChildren(); for (let child of children) { if (isToken(child)) { classifyToken(child); @@ -5414,28 +5420,28 @@ module ts { function getOutliningSpans(fileName: string): OutliningSpan[] { // doesn't use compiler - no need to synchronize with host - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + let sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); return OutliningElementsCollector.collectElements(sourceFile); } function getBraceMatchingAtPosition(fileName: string, position: number) { - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - var result: TextSpan[] = []; + let sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + let result: TextSpan[] = []; - var token = getTouchingToken(sourceFile, position); + let token = getTouchingToken(sourceFile, position); if (token.getStart(sourceFile) === position) { - var matchKind = getMatchingTokenKind(token); + let matchKind = getMatchingTokenKind(token); // Ensure that there is a corresponding token to match ours. if (matchKind) { - var parentElement = token.parent; + let parentElement = token.parent; - var childNodes = parentElement.getChildren(sourceFile); + let childNodes = parentElement.getChildren(sourceFile); for (let current of childNodes) { if (current.kind === matchKind) { - var range1 = createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); - var range2 = createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); + let range1 = createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); + let range2 = createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); // We want to order the braces when we return the result. if (range1.start < range2.start) { @@ -5470,30 +5476,30 @@ module ts { } function getIndentationAtPosition(fileName: string, position: number, editorOptions: EditorOptions) { - var start = new Date().getTime(); - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + let start = new Date().getTime(); + let sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); log("getIndentationAtPosition: getCurrentSourceFile: " + (new Date().getTime() - start)); - var start = new Date().getTime(); + start = new Date().getTime(); - var result = formatting.SmartIndenter.getIndentation(position, sourceFile, editorOptions); + let result = formatting.SmartIndenter.getIndentation(position, sourceFile, editorOptions); log("getIndentationAtPosition: computeIndentation : " + (new Date().getTime() - start)); return result; } function getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[] { - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + let sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); return formatting.formatSelection(start, end, sourceFile, getRuleProvider(options), options); } function getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[] { - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + let sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); return formatting.formatDocument(sourceFile, getRuleProvider(options), options); } function getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[] { - var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + let sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); if (key === "}") { return formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(options), options); @@ -5517,17 +5523,17 @@ module ts { // anything away. synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); + let sourceFile = getValidSourceFile(fileName); cancellationToken.throwIfCancellationRequested(); - var fileContents = sourceFile.text; - var result: TodoComment[] = []; + let fileContents = sourceFile.text; + let result: TodoComment[] = []; if (descriptors.length > 0) { - var regExp = getTodoCommentsRegExp(); + let regExp = getTodoCommentsRegExp(); - var matchArray: RegExpExecArray; + let matchArray: RegExpExecArray; while (matchArray = regExp.exec(fileContents)) { cancellationToken.throwIfCancellationRequested(); @@ -5548,21 +5554,21 @@ module ts { // // i.e. 'undefined' in position 3 above means TODO(jason) didn't match. // "hack" in position 4 means HACK did match. - var firstDescriptorCaptureIndex = 3; + let firstDescriptorCaptureIndex = 3; Debug.assert(matchArray.length === descriptors.length + firstDescriptorCaptureIndex); - var preamble = matchArray[1]; - var matchPosition = matchArray.index + preamble.length; + let preamble = matchArray[1]; + let matchPosition = matchArray.index + preamble.length; // OK, we have found a match in the file. This is only an acceptable match if // it is contained within a comment. - var token = getTokenAtPosition(sourceFile, matchPosition); + let token = getTokenAtPosition(sourceFile, matchPosition); if (!isInsideComment(sourceFile, token, matchPosition)) { continue; } - var descriptor: TodoCommentDescriptor = undefined; - for (var i = 0, n = descriptors.length; i < n; i++) { + let descriptor: TodoCommentDescriptor = undefined; + for (let i = 0, n = descriptors.length; i < n; i++) { if (matchArray[i + firstDescriptorCaptureIndex]) { descriptor = descriptors[i]; } @@ -5575,7 +5581,7 @@ module ts { continue; } - var message = matchArray[2]; + let message = matchArray[2]; result.push({ descriptor: descriptor, message: message, @@ -5606,14 +5612,14 @@ module ts { // // The following three regexps are used to match the start of the text up to the TODO // comment portion. - var singleLineCommentStart = /(?:\/\/+\s*)/.source; - var multiLineCommentStart = /(?:\/\*+\s*)/.source; - var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; + let singleLineCommentStart = /(?:\/\/+\s*)/.source; + let multiLineCommentStart = /(?:\/\*+\s*)/.source; + let anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; // Match any of the above three TODO comment start regexps. // Note that the outermost group *is* a capture group. We want to capture the preamble // so that we can determine the starting position of the TODO comment match. - var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + let preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; // Takes the descriptors and forms a regexp that matches them as if they were literals. // For example, if the descriptors are "TODO(jason)" and "HACK", then this will be: @@ -5623,17 +5629,17 @@ module ts { // Note that the outermost group is *not* a capture group, but the innermost groups // *are* capture groups. By capturing the inner literals we can determine after // matching which descriptor we are dealing with. - var literals = "(?:" + map(descriptors, d => "(" + escapeRegExp(d.text) + ")").join("|") + ")"; + let literals = "(?:" + map(descriptors, d => "(" + escapeRegExp(d.text) + ")").join("|") + ")"; // After matching a descriptor literal, the following regexp matches the rest of the // text up to the end of the line (or */). - var endOfLineOrEndOfComment = /(?:$|\*\/)/.source - var messageRemainder = /(?:.*?)/.source + let endOfLineOrEndOfComment = /(?:$|\*\/)/.source + let messageRemainder = /(?:.*?)/.source // This is the portion of the match we'll return as part of the TODO comment result. We // match the literal portion up to the end of the line or end of comment. - var messagePortion = "(" + literals + messageRemainder + ")"; - var regExpString = preamble + messagePortion + endOfLineOrEndOfComment; + let messagePortion = "(" + literals + messageRemainder + ")"; + let regExpString = preamble + messagePortion + endOfLineOrEndOfComment; // The final regexp will look like this: // /((?:\/\/+\s*)|(?:\/\*+\s*)|(?:^(?:\s|\*)*))((?:(TODO\(jason\))|(HACK))(?:.*?))(?:$|\*\/)/gim @@ -5659,30 +5665,30 @@ module ts { function getRenameInfo(fileName: string, position: number): RenameInfo { synchronizeHostData(); - var sourceFile = getValidSourceFile(fileName); + let sourceFile = getValidSourceFile(fileName); - var node = getTouchingWord(sourceFile, position); + let node = getTouchingWord(sourceFile, position); // Can only rename an identifier. if (node && node.kind === SyntaxKind.Identifier) { - var symbol = typeInfoResolver.getSymbolAtLocation(node); + let symbol = typeInfoResolver.getSymbolAtLocation(node); // Only allow a symbol to be renamed if it actually has at least one declaration. if (symbol) { - var declarations = symbol.getDeclarations(); + let declarations = symbol.getDeclarations(); if (declarations && declarations.length > 0) { // Disallow rename for elements that are defined in the standard TypeScript library. - var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); + let defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { for (let current of declarations) { - var sourceFile = current.getSourceFile(); + let sourceFile = current.getSourceFile(); if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); } } } - var kind = getSymbolKind(symbol, typeInfoResolver, node); + let kind = getSymbolKind(symbol, typeInfoResolver, node); if (kind) { return { canRename: true, @@ -5757,7 +5763,7 @@ module ts { } function initializeNameTable(sourceFile: SourceFile): void { - var nameTable: Map = {}; + let nameTable: Map = {}; walk(sourceFile); sourceFile.nameTable = nameTable; @@ -5795,13 +5801,13 @@ module ts { /// Classifier export function createClassifier(): Classifier { - var scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false); + let scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false); /// We do not have a full parser support to know when we should parse a regex or not /// If we consider every slash token to be a regex, we could be missing cases like "1/2/3", where /// we have a series of divide operator. this list allows us to be more accurate by ruling out /// locations where a regexp cannot exist. - var noRegexTable: boolean[] = []; + let noRegexTable: boolean[] = []; noRegexTable[SyntaxKind.Identifier] = true; noRegexTable[SyntaxKind.StringLiteral] = true; noRegexTable[SyntaxKind.NumericLiteral] = true; @@ -5835,7 +5841,7 @@ module ts { // // Where on the second line, you will get the 'return' keyword, // a string literal, and a template end consisting of '} } `'. - var templateStack: SyntaxKind[] = []; + let templateStack: SyntaxKind[] = []; function isAccessibilityModifier(kind: SyntaxKind) { switch (kind) { @@ -5874,9 +5880,9 @@ module ts { // If there is a syntactic classifier ('syntacticClassifierAbsent' is false), // we will be more conservative in order to avoid conflicting with the syntactic classifier. function getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult { - var offset = 0; - var token = SyntaxKind.Unknown; - var lastNonTriviaToken = SyntaxKind.Unknown; + let offset = 0; + let token = SyntaxKind.Unknown; + let lastNonTriviaToken = SyntaxKind.Unknown; // Empty out the template stack for reuse. while (templateStack.length > 0) { @@ -5916,7 +5922,7 @@ module ts { scanner.setText(text); - var result: ClassificationResult = { + let result: ClassificationResult = { finalLexState: EndOfLineState.Start, entries: [] }; @@ -5940,7 +5946,7 @@ module ts { // In order to determine if the user is potentially typing something generic, we use a // weak heuristic where we track < and > tokens. It's a weak heuristic, but should // work well enough in practice. - var angleBracketStack = 0; + let angleBracketStack = 0; do { token = scanner.scan(); @@ -5998,7 +6004,7 @@ module ts { // If we don't have anything on the template stack, // then we aren't trying to keep track of a previously scanned template head. if (templateStack.length > 0) { - var lastTemplateStackToken = lastOrUndefined(templateStack); + let lastTemplateStackToken = lastOrUndefined(templateStack); if (lastTemplateStackToken === SyntaxKind.TemplateHead) { token = scanner.reScanTemplateToken(); @@ -6028,26 +6034,26 @@ module ts { return result; function processToken(): void { - var start = scanner.getTokenPos(); - var end = scanner.getTextPos(); + let start = scanner.getTokenPos(); + let end = scanner.getTextPos(); addResult(end - start, classFromKind(token)); if (end >= text.length) { if (token === SyntaxKind.StringLiteral) { // Check to see if we finished up on a multiline string literal. - var tokenText = scanner.getTokenText(); + let tokenText = scanner.getTokenText(); if (scanner.isUnterminated()) { - var lastCharIndex = tokenText.length - 1; + let lastCharIndex = tokenText.length - 1; - var numBackslashes = 0; + let numBackslashes = 0; while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === CharacterCodes.backslash) { numBackslashes++; } // If we have an odd number of backslashes, then the multiline string is unclosed if (numBackslashes & 1) { - var quoteChar = tokenText.charCodeAt(0); + let quoteChar = tokenText.charCodeAt(0); result.finalLexState = quoteChar === CharacterCodes.doubleQuote ? EndOfLineState.InDoubleQuoteStringLiteral : EndOfLineState.InSingleQuoteStringLiteral; @@ -6192,7 +6198,7 @@ module ts { } /// getDefaultLibraryFilePath - declare var __dirname: string; + declare let __dirname: string; /** * Get the path of the default library file (lib.d.ts) as distributed with the typescript @@ -6213,7 +6219,7 @@ module ts { getNodeConstructor: kind => { function Node() { } - var proto = kind === SyntaxKind.SourceFile ? new SourceFileObject() : new NodeObject(); + let proto = kind === SyntaxKind.SourceFile ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 3a677c9506c..419d4819ba6 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -8,15 +8,15 @@ module ts.SignatureHelp { // will return the generic identifier that started the expression (e.g. "foo" in "foo[]; - var resolvedSignature = typeInfoResolver.getResolvedSignature(call, candidates); + let call = argumentInfo.invocation; + let candidates = []; + let resolvedSignature = typeInfoResolver.getResolvedSignature(call, candidates); cancellationToken.throwIfCancellationRequested(); if (!candidates.length) { @@ -211,7 +211,7 @@ module ts.SignatureHelp { */ function getImmediatelyContainingArgumentInfo(node: Node): ArgumentListInfo { if (node.parent.kind === SyntaxKind.CallExpression || node.parent.kind === SyntaxKind.NewExpression) { - var callExpression = node.parent; + let callExpression = node.parent; // There are 3 cases to handle: // 1. The token introduces a list, and should begin a sig help session // 2. The token is either not associated with a list, or ends a list, so the session should end @@ -230,8 +230,8 @@ module ts.SignatureHelp { node.kind === SyntaxKind.OpenParenToken) { // Find the list that starts right *after* the < or ( token. // If the user has just opened a list, consider this item 0. - var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); - var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; + let list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); + let isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; Debug.assert(list !== undefined); return { kind: isTypeArgList ? ArgumentListKind.TypeArguments : ArgumentListKind.CallArguments, @@ -248,13 +248,13 @@ module ts.SignatureHelp { // - Between the type arguments and the arguments (greater than token) // - On the target of the call (parent.func) // - On the 'new' keyword in a 'new' expression - var listItemInfo = findListItemInfo(node); + let listItemInfo = findListItemInfo(node); if (listItemInfo) { - var list = listItemInfo.list; - var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; + let list = listItemInfo.list; + let isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; - var argumentIndex = getArgumentIndex(list, node); - var argumentCount = getArgumentCount(list); + let argumentIndex = getArgumentIndex(list, node); + let argumentCount = getArgumentCount(list); Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, `argumentCount < argumentIndex, ${argumentCount} < ${argumentIndex}`); @@ -276,18 +276,18 @@ module ts.SignatureHelp { } } else if (node.kind === SyntaxKind.TemplateHead && node.parent.parent.kind === SyntaxKind.TaggedTemplateExpression) { - var templateExpression = node.parent; - var tagExpression = templateExpression.parent; + let templateExpression = node.parent; + let tagExpression = templateExpression.parent; Debug.assert(templateExpression.kind === SyntaxKind.TemplateExpression); - var argumentIndex = isInsideTemplateLiteral(node, position) ? 0 : 1; + let argumentIndex = isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } else if (node.parent.kind === SyntaxKind.TemplateSpan && node.parent.parent.parent.kind === SyntaxKind.TaggedTemplateExpression) { - var templateSpan = node.parent; - var templateExpression = templateSpan.parent; - var tagExpression = templateExpression.parent; + let templateSpan = node.parent; + let templateExpression = templateSpan.parent; + let tagExpression = templateExpression.parent; Debug.assert(templateExpression.kind === SyntaxKind.TemplateExpression); // If we're just after a template tail, don't show signature help. @@ -295,8 +295,8 @@ module ts.SignatureHelp { return undefined; } - var spanIndex = templateExpression.templateSpans.indexOf(templateSpan); - var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node); + let spanIndex = templateExpression.templateSpans.indexOf(templateSpan); + let argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node); return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } @@ -316,8 +316,8 @@ module ts.SignatureHelp { // on. In that case, even if we're after the trailing comma, we'll still see // that trailing comma in the list, and we'll have generated the appropriate // arg index. - var argumentIndex = 0; - var listChildren = argumentsList.getChildren(); + let argumentIndex = 0; + let listChildren = argumentsList.getChildren(); for (let child of listChildren) { if (child === node) { break; @@ -342,9 +342,9 @@ module ts.SignatureHelp { // we'll have: 'a' '' '' // That will give us 2 non-commas. We then add one for the last comma, givin us an // arg count of 3. - var listChildren = argumentsList.getChildren(); + let listChildren = argumentsList.getChildren(); - var argumentCount = countWhere(listChildren, arg => arg.kind !== SyntaxKind.CommaToken); + let argumentCount = countWhere(listChildren, arg => arg.kind !== SyntaxKind.CommaToken); if (listChildren.length > 0 && lastOrUndefined(listChildren).kind === SyntaxKind.CommaToken) { argumentCount++; } @@ -378,7 +378,7 @@ module ts.SignatureHelp { function getArgumentListInfoForTemplate(tagExpression: TaggedTemplateExpression, argumentIndex: number): ArgumentListInfo { // argumentCount is either 1 or (numSpans + 1) to account for the template strings array argument. - var argumentCount = tagExpression.template.kind === SyntaxKind.NoSubstitutionTemplateLiteral + let argumentCount = tagExpression.template.kind === SyntaxKind.NoSubstitutionTemplateLiteral ? 1 : (tagExpression.template).templateSpans.length + 1; @@ -402,15 +402,15 @@ module ts.SignatureHelp { // // The applicable span is from the first bar to the second bar (inclusive, // but not including parentheses) - var applicableSpanStart = argumentsList.getFullStart(); - var applicableSpanEnd = skipTrivia(sourceFile.text, argumentsList.getEnd(), /*stopAfterLineBreak*/ false); + let applicableSpanStart = argumentsList.getFullStart(); + let applicableSpanEnd = skipTrivia(sourceFile.text, argumentsList.getEnd(), /*stopAfterLineBreak*/ false); return createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getApplicableSpanForTaggedTemplate(taggedTemplate: TaggedTemplateExpression): TextSpan { - var template = taggedTemplate.template; - var applicableSpanStart = template.getStart(); - var applicableSpanEnd = template.getEnd(); + let template = taggedTemplate.template; + let applicableSpanStart = template.getStart(); + let applicableSpanEnd = template.getEnd(); // We need to adjust the end position for the case where the template does not have a tail. // Otherwise, we will not show signature help past the expression. @@ -422,7 +422,7 @@ module ts.SignatureHelp { // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. if (template.kind === SyntaxKind.TemplateExpression) { - var lastSpan = lastOrUndefined((template).templateSpans); + let lastSpan = lastOrUndefined((template).templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); } @@ -432,7 +432,7 @@ module ts.SignatureHelp { } function getContainingArgumentInfo(node: Node): ArgumentListInfo { - for (var n = node; n.kind !== SyntaxKind.SourceFile; n = n.parent) { + for (let n = node; n.kind !== SyntaxKind.SourceFile; n = n.parent) { if (isFunctionBlock(n)) { return undefined; } @@ -443,7 +443,7 @@ module ts.SignatureHelp { Debug.fail("Node of kind " + n.kind + " is not a subspan of its parent of kind " + n.parent.kind); } - var argumentInfo = getImmediatelyContainingArgumentInfo(n); + let argumentInfo = getImmediatelyContainingArgumentInfo(n); if (argumentInfo) { return argumentInfo; } @@ -455,8 +455,8 @@ module ts.SignatureHelp { } function getChildListThatStartsWithOpenerToken(parent: Node, openerToken: Node, sourceFile: SourceFile): Node { - var children = parent.getChildren(sourceFile); - var indexOfOpenerToken = children.indexOf(openerToken); + let children = parent.getChildren(sourceFile); + let indexOfOpenerToken = children.indexOf(openerToken); Debug.assert(indexOfOpenerToken >= 0 && children.length > indexOfOpenerToken + 1); return children[indexOfOpenerToken + 1]; } @@ -470,10 +470,10 @@ module ts.SignatureHelp { * or the one with the most parameters. */ function selectBestInvalidOverloadIndex(candidates: Signature[], argumentCount: number): number { - var maxParamsSignatureIndex = -1; - var maxParams = -1; - for (var i = 0; i < candidates.length; i++) { - var candidate = candidates[i]; + let maxParamsSignatureIndex = -1; + let maxParams = -1; + for (let i = 0; i < candidates.length; i++) { + let candidate = candidates[i]; if (candidate.hasRestParameter || candidate.parameters.length >= argumentCount) { return i; @@ -489,17 +489,17 @@ module ts.SignatureHelp { } function createSignatureHelpItems(candidates: Signature[], bestSignature: Signature, argumentListInfo: ArgumentListInfo): SignatureHelpItems { - var applicableSpan = argumentListInfo.argumentsSpan; - var isTypeParameterList = argumentListInfo.kind === ArgumentListKind.TypeArguments; + let applicableSpan = argumentListInfo.argumentsSpan; + let isTypeParameterList = argumentListInfo.kind === ArgumentListKind.TypeArguments; - var invocation = argumentListInfo.invocation; - var callTarget = getInvokedExpression(invocation) - var callTargetSymbol = typeInfoResolver.getSymbolAtLocation(callTarget); - var callTargetDisplayParts = callTargetSymbol && symbolToDisplayParts(typeInfoResolver, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined); - var items: SignatureHelpItem[] = map(candidates, candidateSignature => { - var signatureHelpParameters: SignatureHelpParameter[]; - var prefixDisplayParts: SymbolDisplayPart[] = []; - var suffixDisplayParts: SymbolDisplayPart[] = []; + let invocation = argumentListInfo.invocation; + let callTarget = getInvokedExpression(invocation) + let callTargetSymbol = typeInfoResolver.getSymbolAtLocation(callTarget); + let callTargetDisplayParts = callTargetSymbol && symbolToDisplayParts(typeInfoResolver, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined); + let items: SignatureHelpItem[] = map(candidates, candidateSignature => { + let signatureHelpParameters: SignatureHelpParameter[]; + let prefixDisplayParts: SymbolDisplayPart[] = []; + let suffixDisplayParts: SymbolDisplayPart[] = []; if (callTargetDisplayParts) { prefixDisplayParts.push.apply(prefixDisplayParts, callTargetDisplayParts); @@ -507,25 +507,25 @@ module ts.SignatureHelp { if (isTypeParameterList) { prefixDisplayParts.push(punctuationPart(SyntaxKind.LessThanToken)); - var typeParameters = candidateSignature.typeParameters; + let typeParameters = candidateSignature.typeParameters; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; suffixDisplayParts.push(punctuationPart(SyntaxKind.GreaterThanToken)); - var parameterParts = mapToDisplayParts(writer => + let parameterParts = mapToDisplayParts(writer => typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation)); suffixDisplayParts.push.apply(suffixDisplayParts, parameterParts); } else { - var typeParameterParts = mapToDisplayParts(writer => + let typeParameterParts = mapToDisplayParts(writer => typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation)); prefixDisplayParts.push.apply(prefixDisplayParts, typeParameterParts); prefixDisplayParts.push(punctuationPart(SyntaxKind.OpenParenToken)); - var parameters = candidateSignature.parameters; + let parameters = candidateSignature.parameters; signatureHelpParameters = parameters.length > 0 ? map(parameters, createSignatureHelpParameterForParameter) : emptyArray; suffixDisplayParts.push(punctuationPart(SyntaxKind.CloseParenToken)); } - var returnTypeParts = mapToDisplayParts(writer => + let returnTypeParts = mapToDisplayParts(writer => typeInfoResolver.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation)); suffixDisplayParts.push.apply(suffixDisplayParts, returnTypeParts); @@ -539,12 +539,12 @@ module ts.SignatureHelp { }; }); - var argumentIndex = argumentListInfo.argumentIndex; + let argumentIndex = argumentListInfo.argumentIndex; // argumentCount is the *apparent* number of arguments. - var argumentCount = argumentListInfo.argumentCount; + let argumentCount = argumentListInfo.argumentCount; - var selectedItemIndex = candidates.indexOf(bestSignature); + let selectedItemIndex = candidates.indexOf(bestSignature); if (selectedItemIndex < 0) { selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount); } @@ -560,10 +560,10 @@ module ts.SignatureHelp { }; function createSignatureHelpParameterForParameter(parameter: Symbol): SignatureHelpParameter { - var displayParts = mapToDisplayParts(writer => + let displayParts = mapToDisplayParts(writer => typeInfoResolver.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation)); - var isOptional = hasQuestionToken(parameter.valueDeclaration); + let isOptional = hasQuestionToken(parameter.valueDeclaration); return { name: parameter.name, @@ -574,7 +574,7 @@ module ts.SignatureHelp { } function createSignatureHelpParameterForTypeParameter(typeParameter: TypeParameter): SignatureHelpParameter { - var displayParts = mapToDisplayParts(writer => + let displayParts = mapToDisplayParts(writer => typeInfoResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation)); return { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 332ddffc910..452395f454a 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -7,18 +7,18 @@ module ts { export function getEndLinePosition(line: number, sourceFile: SourceFile): number { Debug.assert(line >= 0); - var lineStarts = sourceFile.getLineStarts(); + let lineStarts = sourceFile.getLineStarts(); - var lineIndex = line; + let lineIndex = line; if (lineIndex + 1 === lineStarts.length) { // last line - return EOF return sourceFile.text.length - 1; } else { // current line start - var start = lineStarts[lineIndex]; + let start = lineStarts[lineIndex]; // take the start position of the next line -1 = it should be some line break - var pos = lineStarts[lineIndex + 1] - 1; + let pos = lineStarts[lineIndex + 1] - 1; Debug.assert(isLineBreak(sourceFile.text.charCodeAt(pos))); // walk backwards skipping line breaks, stop the the beginning of current line. // i.e: @@ -32,8 +32,8 @@ module ts { } export function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number { - var lineStarts = sourceFile.getLineStarts(); - var line = sourceFile.getLineAndCharacterOfPosition(position).line; + let lineStarts = sourceFile.getLineStarts(); + let line = sourceFile.getLineAndCharacterOfPosition(position).line; return lineStarts[line]; } @@ -54,13 +54,13 @@ module ts { } export function startEndOverlapsWithStartEnd(start1: number, end1: number, start2: number, end2: number) { - var start = Math.max(start1, start2); - var end = Math.min(end1, end2); + let start = Math.max(start1, start2); + let end = Math.min(end1, end2); return start < end; } export function findListItemInfo(node: Node): ListItemInfo { - var list = findContainingList(node); + let list = findContainingList(node); // It is possible at this point for syntaxList to be undefined, either if // node.parent had no list child, or if none of its list children contained @@ -70,8 +70,8 @@ module ts { return undefined; } - var children = list.getChildren(); - var listItemIndex = indexOf(children, node); + let children = list.getChildren(); + let listItemIndex = indexOf(children, node); return { listItemIndex, @@ -88,7 +88,7 @@ module ts { // be parented by the container of the SyntaxList, not the SyntaxList itself. // In order to find the list item index, we first need to locate SyntaxList itself and then search // for the position of the relevant node (or comma). - var syntaxList = forEach(node.parent.getChildren(), c => { + let syntaxList = forEach(node.parent.getChildren(), c => { // find syntax list that covers the span of the node if (c.kind === SyntaxKind.SyntaxList && c.pos <= node.pos && c.end >= node.end) { return c; @@ -126,7 +126,7 @@ module ts { /** Get the token whose text contains the position */ function getTokenAtPositionWorker(sourceFile: SourceFile, position: number, allowPositionInLeadingTrivia: boolean, includeItemAtEndPosition: (n: Node) => boolean): Node { - var current: Node = sourceFile; + let current: Node = sourceFile; outer: while (true) { if (isToken(current)) { // exit early @@ -134,17 +134,17 @@ module ts { } // find the child that contains 'position' - for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { - var child = current.getChildAt(i); - var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile); + for (let i = 0, n = current.getChildCount(sourceFile); i < n; i++) { + let child = current.getChildAt(i); + let start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile); if (start <= position) { - var end = child.getEnd(); + let end = child.getEnd(); if (position < end || (position === end && child.kind === SyntaxKind.EndOfFileToken)) { current = child; continue outer; } else if (includeItemAtEndPosition && end === position) { - var previousToken = findPrecedingToken(position, sourceFile, child); + let previousToken = findPrecedingToken(position, sourceFile, child); if (previousToken && includeItemAtEndPosition(previousToken)) { return previousToken; } @@ -166,7 +166,7 @@ module ts { export function findTokenOnLeftOfPosition(file: SourceFile, position: number): Node { // Ideally, getTokenAtPosition should return a token. However, it is currently // broken, so we do a check to make sure the result was indeed a token. - var tokenAtPosition = getTokenAtPosition(file, position); + let tokenAtPosition = getTokenAtPosition(file, position); if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { return tokenAtPosition; } @@ -183,9 +183,9 @@ module ts { return n; } - var children = n.getChildren(); + let children = n.getChildren(); for (let child of children) { - var shouldDiveInChildNode = + let shouldDiveInChildNode = // previous token is enclosed somewhere in the child (child.pos <= previousToken.pos && child.end > previousToken.end) || // previous token ends exactly at the beginning of child @@ -208,8 +208,8 @@ module ts { return n; } - var children = n.getChildren(); - var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); + let children = n.getChildren(); + let candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); return candidate && findRightmostToken(candidate); } @@ -219,14 +219,14 @@ module ts { return n; } - var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; i++) { + let children = n.getChildren(); + for (let i = 0, len = children.length; i < len; i++) { let child = children[i]; if (nodeHasTokens(child)) { if (position <= child.end) { if (child.getStart(sourceFile) >= position) { // actual start of the node is past the position - previous token should be at the end of previous child - var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); + let candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); return candidate && findRightmostToken(candidate) } else { @@ -244,14 +244,14 @@ module ts { // Try to find the rightmost token in the file without filtering. // Namely we are skipping the check: 'position < node.end' if (children.length) { - var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); + let candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); return candidate && findRightmostToken(candidate); } } /// finds last node that is considered as candidate for search (isCandidate(node) === true) starting from 'exclusiveStartPosition' function findRightmostChildNodeWithTokens(children: Node[], exclusiveStartPosition: number): Node { - for (var i = exclusiveStartPosition - 1; i >= 0; --i) { + for (let i = exclusiveStartPosition - 1; i >= 0; --i) { if (nodeHasTokens(children[i])) { return children[i]; } @@ -266,8 +266,8 @@ module ts { } export function getNodeModifiers(node: Node): string { - var flags = getCombinedNodeFlags(node); - var result: string[] = []; + let flags = getCombinedNodeFlags(node); + let result: string[] = []; if (flags & NodeFlags.Private) result.push(ScriptElementKindModifier.privateMemberModifier); if (flags & NodeFlags.Protected) result.push(ScriptElementKindModifier.protectedMemberModifier); @@ -317,7 +317,7 @@ module ts { } export function compareDataObjects(dst: any, src: any): boolean { - for (var e in dst) { + for (let e in dst) { if (typeof dst[e] === "object") { if (!compareDataObjects(dst[e], src[e])) { return false; @@ -339,11 +339,11 @@ module ts { return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === SyntaxKind.Parameter; } - var displayPartWriter = getDisplayPartWriter(); + let displayPartWriter = getDisplayPartWriter(); function getDisplayPartWriter(): DisplayPartsSymbolWriter { - var displayParts: SymbolDisplayPart[]; - var lineStart: boolean; - var indent: number; + let displayParts: SymbolDisplayPart[]; + let lineStart: boolean; + let indent: number; resetWriter(); return { @@ -364,7 +364,7 @@ module ts { function writeIndent() { if (lineStart) { - var indentString = getIndentString(indent); + let indentString = getIndentString(indent); if (indentString) { displayParts.push(displayPart(indentString, SymbolDisplayPartKind.space)); } @@ -398,7 +398,7 @@ module ts { return displayPart(text, displayPartKind(symbol), symbol); function displayPartKind(symbol: Symbol): SymbolDisplayPartKind { - var flags = symbol.flags; + let flags = symbol.flags; if (flags & SymbolFlags.Variable) { return isFirstDeclarationOfSymbolParameter(symbol) ? SymbolDisplayPartKind.parameterName : SymbolDisplayPartKind.localName; @@ -455,7 +455,7 @@ module ts { export function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[] { writeDisplayParts(displayPartWriter); - var result = displayPartWriter.displayParts(); + let result = displayPartWriter.displayParts(); displayPartWriter.clear(); return result; } From e90a5dc5bb90c5bcf30505cb6c8d3b20b544e286 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 13:43:46 -0700 Subject: [PATCH 066/101] Update baselines. --- tests/baselines/reference/APISample_compile.js | 4 ++-- tests/baselines/reference/APISample_compile.types | 4 ++-- tests/baselines/reference/APISample_linter.js | 4 ++-- tests/baselines/reference/APISample_linter.types | 4 ++-- tests/baselines/reference/APISample_transform.js | 4 ++-- tests/baselines/reference/APISample_transform.types | 4 ++-- tests/baselines/reference/APISample_watcher.js | 4 ++-- tests/baselines/reference/APISample_watcher.types | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 6e6adb2cd45..a03f254e699 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1488,7 +1488,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the language service API */ - var servicesVersion: string; + let servicesVersion: string; interface Node { getSourceFile(): SourceFile; getChildCount(sourceFile?: SourceFile): number; @@ -1975,7 +1975,7 @@ declare module "typescript" { throwIfCancellationRequested(): void; } function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; - var disableIncrementalParsing: boolean; + let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createDocumentRegistry(): DocumentRegistry; function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 17ce175ebdf..bd19b3bbf9f 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -4768,7 +4768,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the language service API */ - var servicesVersion: string; + let servicesVersion: string; >servicesVersion : string interface Node { @@ -6118,7 +6118,7 @@ declare module "typescript" { >setNodeParents : boolean >SourceFile : SourceFile - var disableIncrementalParsing: boolean; + let disableIncrementalParsing: boolean; >disableIncrementalParsing : boolean function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 4f1fc899a89..99b7bc6d549 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1519,7 +1519,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the language service API */ - var servicesVersion: string; + let servicesVersion: string; interface Node { getSourceFile(): SourceFile; getChildCount(sourceFile?: SourceFile): number; @@ -2006,7 +2006,7 @@ declare module "typescript" { throwIfCancellationRequested(): void; } function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; - var disableIncrementalParsing: boolean; + let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createDocumentRegistry(): DocumentRegistry; function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index d1dcad98d85..0970d0cc2fb 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -4914,7 +4914,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the language service API */ - var servicesVersion: string; + let servicesVersion: string; >servicesVersion : string interface Node { @@ -6264,7 +6264,7 @@ declare module "typescript" { >setNodeParents : boolean >SourceFile : SourceFile - var disableIncrementalParsing: boolean; + let disableIncrementalParsing: boolean; >disableIncrementalParsing : boolean function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 3ef3d7bc0f5..105acc069be 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -1520,7 +1520,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the language service API */ - var servicesVersion: string; + let servicesVersion: string; interface Node { getSourceFile(): SourceFile; getChildCount(sourceFile?: SourceFile): number; @@ -2007,7 +2007,7 @@ declare module "typescript" { throwIfCancellationRequested(): void; } function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; - var disableIncrementalParsing: boolean; + let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createDocumentRegistry(): DocumentRegistry; function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 4bfac42f571..17cbd063332 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -4864,7 +4864,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the language service API */ - var servicesVersion: string; + let servicesVersion: string; >servicesVersion : string interface Node { @@ -6214,7 +6214,7 @@ declare module "typescript" { >setNodeParents : boolean >SourceFile : SourceFile - var disableIncrementalParsing: boolean; + let disableIncrementalParsing: boolean; >disableIncrementalParsing : boolean function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index c85be654c89..1d67d4df950 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1557,7 +1557,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the language service API */ - var servicesVersion: string; + let servicesVersion: string; interface Node { getSourceFile(): SourceFile; getChildCount(sourceFile?: SourceFile): number; @@ -2044,7 +2044,7 @@ declare module "typescript" { throwIfCancellationRequested(): void; } function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; - var disableIncrementalParsing: boolean; + let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createDocumentRegistry(): DocumentRegistry; function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index e4b53feeac0..7ecf2dca8ef 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -5037,7 +5037,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the language service API */ - var servicesVersion: string; + let servicesVersion: string; >servicesVersion : string interface Node { @@ -6387,7 +6387,7 @@ declare module "typescript" { >setNodeParents : boolean >SourceFile : SourceFile - var disableIncrementalParsing: boolean; + let disableIncrementalParsing: boolean; >disableIncrementalParsing : boolean function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; From eb8150cbe24b982502bbb867d4507a82cac2c532 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 14:12:39 -0700 Subject: [PATCH 067/101] Use 'let' in the services layer. --- src/services/formatting/tokenRange.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/formatting/tokenRange.ts b/src/services/formatting/tokenRange.ts index ff9cb91ce68..f1cdfebc978 100644 --- a/src/services/formatting/tokenRange.ts +++ b/src/services/formatting/tokenRange.ts @@ -27,7 +27,7 @@ module ts.formatting { constructor(from: SyntaxKind, to: SyntaxKind, except: SyntaxKind[]) { this.tokens = []; - for (var token = from; token <= to; token++) { + for (let token = from; token <= to; token++) { if (except.indexOf(token) < 0) { this.tokens.push(token); } @@ -74,8 +74,8 @@ module ts.formatting { export class TokenAllAccess implements ITokenAccess { public GetTokens(): SyntaxKind[] { - var result: SyntaxKind[] = []; - for (var token = SyntaxKind.FirstToken; token <= SyntaxKind.LastToken; token++) { + let result: SyntaxKind[] = []; + for (let token = SyntaxKind.FirstToken; token <= SyntaxKind.LastToken; token++) { result.push(token); } return result; From fd98f193630931101cc1eee277dff7dc0af5d21d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 14:15:20 -0700 Subject: [PATCH 068/101] Use 'let' in the services layer. --- src/services/formatting/rules.ts | 12 ++++---- src/services/formatting/rulesMap.ts | 36 ++++++++++++------------ src/services/formatting/rulesProvider.ts | 6 ++-- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 7eb5232af18..7d3509ef495 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -18,8 +18,8 @@ module ts.formatting { export class Rules { public getRuleName(rule: Rule) { - var o: ts.Map = this; - for (var name in o) { + let o: ts.Map = this; + for (let name in o) { if (o[name] === rule) { return name; } @@ -139,7 +139,7 @@ module ts.formatting { // Lambda expressions public SpaceAfterArrow: Rule; - // Optional parameters and var args + // Optional parameters and let args public NoSpaceAfterEllipsis: Rule; public NoSpaceAfterOptionalParameters: Rule; @@ -330,7 +330,7 @@ module ts.formatting { // Lambda expressions this.SpaceAfterArrow = new Rule(RuleDescriptor.create3(SyntaxKind.EqualsGreaterThanToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); - // Optional parameters and var args + // Optional parameters and let args this.NoSpaceAfterEllipsis = new Rule(RuleDescriptor.create1(SyntaxKind.DotDotDotToken, SyntaxKind.Identifier), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); this.NoSpaceAfterOptionalParameters = new Rule(RuleDescriptor.create3(SyntaxKind.QuestionToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.CommaToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), RuleAction.Delete)); @@ -462,7 +462,7 @@ module ts.formatting { // equal in import a = module('a'); case SyntaxKind.ImportEqualsDeclaration: - // equal in var a = 0; + // equal in let a = 0; case SyntaxKind.VariableDeclaration: // equal in p = 0; case SyntaxKind.Parameter: @@ -470,7 +470,7 @@ module ts.formatting { case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: return context.currentTokenSpan.kind === SyntaxKind.EqualsToken || context.nextTokenSpan.kind === SyntaxKind.EqualsToken; - // "in" keyword in for (var x in []) { } + // "in" keyword in for (let x in []) { } case SyntaxKind.ForInStatement: return context.currentTokenSpan.kind === SyntaxKind.InKeyword || context.nextTokenSpan.kind === SyntaxKind.InKeyword; // Technically, "of" is not a binary operator, but format it the same way as "in" diff --git a/src/services/formatting/rulesMap.ts b/src/services/formatting/rulesMap.ts index 634ec61de9c..b43e91424f8 100644 --- a/src/services/formatting/rulesMap.ts +++ b/src/services/formatting/rulesMap.ts @@ -26,7 +26,7 @@ module ts.formatting { } static create(rules: Rule[]): RulesMap { - var result = new RulesMap(); + let result = new RulesMap(); result.Initialize(rules); return result; } @@ -36,7 +36,7 @@ module ts.formatting { this.map = new Array(this.mapRowLength * this.mapRowLength);//new Array(this.mapRowLength * this.mapRowLength); // This array is used only during construction of the rulesbucket in the map - var rulesBucketConstructionStateList: RulesBucketConstructionState[] = new Array(this.map.length);//new Array(this.map.length); + let rulesBucketConstructionStateList: RulesBucketConstructionState[] = new Array(this.map.length);//new Array(this.map.length); this.FillRules(rules, rulesBucketConstructionStateList); return this.map; @@ -49,20 +49,20 @@ module ts.formatting { } private GetRuleBucketIndex(row: number, column: number): number { - var rulesBucketIndex = (row * this.mapRowLength) + column; + let rulesBucketIndex = (row * this.mapRowLength) + column; //Debug.Assert(rulesBucketIndex < this.map.Length, "Trying to access an index outside the array."); return rulesBucketIndex; } private FillRule(rule: Rule, rulesBucketConstructionStateList: RulesBucketConstructionState[]): void { - var specificRule = rule.Descriptor.LeftTokenRange != Shared.TokenRange.Any && + let specificRule = rule.Descriptor.LeftTokenRange != Shared.TokenRange.Any && rule.Descriptor.RightTokenRange != Shared.TokenRange.Any; rule.Descriptor.LeftTokenRange.GetTokens().forEach((left) => { rule.Descriptor.RightTokenRange.GetTokens().forEach((right) => { - var rulesBucketIndex = this.GetRuleBucketIndex(left, right); + let rulesBucketIndex = this.GetRuleBucketIndex(left, right); - var rulesBucket = this.map[rulesBucketIndex]; + let rulesBucket = this.map[rulesBucketIndex]; if (rulesBucket == undefined) { rulesBucket = this.map[rulesBucketIndex] = new RulesBucket(); } @@ -73,8 +73,8 @@ module ts.formatting { } public GetRule(context: FormattingContext): Rule { - var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); - var bucket = this.map[bucketIndex]; + let bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); + let bucket = this.map[bucketIndex]; if (bucket != null) { for (let rule of bucket.Rules()) { if (rule.Operation.Context.InContext(context)) { @@ -86,8 +86,8 @@ module ts.formatting { } } - var MaskBitSize = 5; - var Mask = 0x1f; + let MaskBitSize = 5; + let Mask = 0x1f; export enum RulesPosition { IgnoreRulesSpecific = 0, @@ -121,10 +121,10 @@ module ts.formatting { } public GetInsertionIndex(maskPosition: RulesPosition): number { - var index = 0; + let index = 0; - var pos = 0; - var indexBitmap = this.rulesInsertionIndexBitmap; + let pos = 0; + let indexBitmap = this.rulesInsertionIndexBitmap; while (pos <= maskPosition) { index += (indexBitmap & Mask); @@ -136,11 +136,11 @@ module ts.formatting { } public IncreaseInsertionIndex(maskPosition: RulesPosition): void { - var value = (this.rulesInsertionIndexBitmap >> maskPosition) & Mask; + let value = (this.rulesInsertionIndexBitmap >> maskPosition) & Mask; value++; Debug.assert((value & Mask) == value, "Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules."); - var temp = this.rulesInsertionIndexBitmap & ~(Mask << maskPosition); + let temp = this.rulesInsertionIndexBitmap & ~(Mask << maskPosition); temp |= value << maskPosition; this.rulesInsertionIndexBitmap = temp; @@ -159,7 +159,7 @@ module ts.formatting { } public AddRule(rule: Rule, specificTokens: boolean, constructionState: RulesBucketConstructionState[], rulesBucketIndex: number): void { - var position: RulesPosition; + let position: RulesPosition; if (rule.Operation.Action == RuleAction.Ignore) { position = specificTokens ? @@ -177,11 +177,11 @@ module ts.formatting { RulesPosition.NoContextRulesAny; } - var state = constructionState[rulesBucketIndex]; + let state = constructionState[rulesBucketIndex]; if (state === undefined) { state = constructionState[rulesBucketIndex] = new RulesBucketConstructionState(); } - var index = state.GetInsertionIndex(position); + let index = state.GetInsertionIndex(position); this.rules.splice(index, 0, rule); state.IncreaseInsertionIndex(position); } diff --git a/src/services/formatting/rulesProvider.ts b/src/services/formatting/rulesProvider.ts index 25b6f1ba772..5f63db8630b 100644 --- a/src/services/formatting/rulesProvider.ts +++ b/src/services/formatting/rulesProvider.ts @@ -40,8 +40,8 @@ module ts.formatting { public ensureUpToDate(options: ts.FormatCodeOptions) { if (this.options == null || !ts.compareDataObjects(this.options, options)) { - var activeRules = this.createActiveRules(options); - var rulesMap = RulesMap.create(activeRules); + let activeRules = this.createActiveRules(options); + let rulesMap = RulesMap.create(activeRules); this.activeRules = activeRules; this.rulesMap = rulesMap; @@ -50,7 +50,7 @@ module ts.formatting { } private createActiveRules(options: ts.FormatCodeOptions): Rule[] { - var rules = this.globalRules.HighPriorityCommonRules.slice(0); + let rules = this.globalRules.HighPriorityCommonRules.slice(0); if (options.InsertSpaceAfterCommaDelimiter) { rules.push(this.globalRules.SpaceAfterComma); From bf40a683ad972f974195ab32a068ef5703cc3cbe Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 14:22:03 -0700 Subject: [PATCH 069/101] Use 'let' in the services layer. --- src/services/formatting/ruleOperation.ts | 2 +- src/services/formatting/smartIndenter.ts | 86 ++++++++++++------------ 2 files changed, 45 insertions(+), 43 deletions(-) diff --git a/src/services/formatting/ruleOperation.ts b/src/services/formatting/ruleOperation.ts index c73e3b6bcf7..7bd092e9584 100644 --- a/src/services/formatting/ruleOperation.ts +++ b/src/services/formatting/ruleOperation.ts @@ -35,7 +35,7 @@ module ts.formatting { } static create2(context: RuleOperationContext, action: RuleAction) { - var result = new RuleOperation(); + let result = new RuleOperation(); result.Context = context; result.Action = action; return result; diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index f1d0935c132..e7beebf6866 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -12,13 +12,13 @@ module ts.formatting { return 0; // past EOF } - var precedingToken = findPrecedingToken(position, sourceFile); + let precedingToken = findPrecedingToken(position, sourceFile); if (!precedingToken) { return 0; } // no indentation in string \regex\template literals - var precedingTokenIsLiteral = + let precedingTokenIsLiteral = precedingToken.kind === SyntaxKind.StringLiteral || precedingToken.kind === SyntaxKind.RegularExpressionLiteral || precedingToken.kind === SyntaxKind.NoSubstitutionTemplateLiteral || @@ -29,11 +29,11 @@ module ts.formatting { return 0; } - var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + let lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; if (precedingToken.kind === SyntaxKind.CommaToken && precedingToken.parent.kind !== SyntaxKind.BinaryExpression) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it - var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); + let actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== Value.Unknown) { return actualIndentation; } @@ -41,10 +41,10 @@ module ts.formatting { // try to find node that can contribute to indentation and includes 'position' starting from 'precedingToken' // if such node is found - compute initial indentation for 'position' inside this node - var previous: Node; - var current = precedingToken; - var currentStart: LineAndCharacter; - var indentationDelta: number; + let previous: Node; + let current = precedingToken; + let currentStart: LineAndCharacter; + let indentationDelta: number; while (current) { if (positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current.kind, previous ? previous.kind : SyntaxKind.Unknown)) { @@ -61,7 +61,7 @@ module ts.formatting { } // check if current node is a list item - if yes, take indentation from it - var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + let actualIndentation = getActualIndentationForListItem(current, sourceFile, options); if (actualIndentation !== Value.Unknown) { return actualIndentation; } @@ -79,7 +79,7 @@ module ts.formatting { } export function getIndentationForNode(n: Node, ignoreActualIndentationRange: TextRange, sourceFile: SourceFile, options: FormatCodeOptions): number { - var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); + let start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, /*indentationDelta*/ 0, sourceFile, options); } @@ -91,33 +91,33 @@ module ts.formatting { sourceFile: SourceFile, options: EditorOptions): number { - var parent: Node = current.parent; - var parentStart: LineAndCharacter; + let parent: Node = current.parent; + let parentStart: LineAndCharacter; // walk upwards and collect indentations for pairs of parent-child nodes // indentation is not added if parent and child nodes start on the same line or if parent is IfStatement and child starts on the same line with 'else clause' while (parent) { - var useActualIndentation = true; + let useActualIndentation = true; if (ignoreActualIndentationRange) { - var start = current.getStart(sourceFile); + let start = current.getStart(sourceFile); useActualIndentation = start < ignoreActualIndentationRange.pos || start > ignoreActualIndentationRange.end; } if (useActualIndentation) { // check if current node is a list item - if yes, take indentation from it - var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + let actualIndentation = getActualIndentationForListItem(current, sourceFile, options); if (actualIndentation !== Value.Unknown) { return actualIndentation + indentationDelta; } } parentStart = getParentStart(parent, current, sourceFile); - var parentAndChildShareLine = + let parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); if (useActualIndentation) { // try to fetch actual indentation for current node from source text - var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); + let actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); if (actualIndentation !== Value.Unknown) { return actualIndentation + indentationDelta; } @@ -138,7 +138,7 @@ module ts.formatting { function getParentStart(parent: Node, child: Node, sourceFile: SourceFile): LineAndCharacter { - var containingList = getContainingList(child, sourceFile); + let containingList = getContainingList(child, sourceFile); if (containingList) { return sourceFile.getLineAndCharacterOfPosition(containingList.pos); } @@ -151,7 +151,7 @@ module ts.formatting { */ function getActualIndentationForListItemBeforeComma(commaToken: Node, sourceFile: SourceFile, options: EditorOptions): number { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it - var commaItemInfo = findListItemInfo(commaToken); + let commaItemInfo = findListItemInfo(commaToken); if (commaItemInfo && commaItemInfo.listItemIndex > 0) { return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options); } @@ -174,7 +174,7 @@ module ts.formatting { // actual indentation is used for statements\declarations if one of cases below is true: // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line - var useActualIndentation = + let useActualIndentation = (isDeclaration(current) || isStatement(current)) && (parent.kind === SyntaxKind.SourceFile || !parentAndChildShareLine); @@ -186,7 +186,7 @@ module ts.formatting { } function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken: Node, current: Node, lineAtPosition: number, sourceFile: SourceFile): boolean { - var nextToken = findNextToken(precedingToken, current); + let nextToken = findNextToken(precedingToken, current); if (!nextToken) { return false; } @@ -205,7 +205,7 @@ module ts.formatting { // class A { // $} - var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; + let nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; return lineAtPosition === nextTokenStartLine; } @@ -222,10 +222,10 @@ module ts.formatting { export function childStartsOnTheSameLineWithElseInIfStatement(parent: Node, child: TextRangeWithKind, childStartLine: number, sourceFile: SourceFile): boolean { if (parent.kind === SyntaxKind.IfStatement && (parent).elseStatement === child) { - var elseKeyword = findChildOfKind(parent, SyntaxKind.ElseKeyword, sourceFile); + let elseKeyword = findChildOfKind(parent, SyntaxKind.ElseKeyword, sourceFile); Debug.assert(elseKeyword !== undefined); - var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; + let elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; } @@ -251,8 +251,8 @@ module ts.formatting { case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: case SyntaxKind.CallSignature: - case SyntaxKind.ConstructSignature: - var start = node.getStart(sourceFile); + case SyntaxKind.ConstructSignature: { + let start = node.getStart(sourceFile); if ((node.parent).typeParameters && rangeContainsStartEnd((node.parent).typeParameters, start, node.getEnd())) { return (node.parent).typeParameters; @@ -261,9 +261,10 @@ module ts.formatting { return (node.parent).parameters; } break; + } case SyntaxKind.NewExpression: - case SyntaxKind.CallExpression: - var start = node.getStart(sourceFile); + case SyntaxKind.CallExpression: { + let start = node.getStart(sourceFile); if ((node.parent).typeArguments && rangeContainsStartEnd((node.parent).typeArguments, start, node.getEnd())) { return (node.parent).typeArguments; @@ -273,34 +274,35 @@ module ts.formatting { return (node.parent).arguments; } break; + } } } return undefined; } function getActualIndentationForListItem(node: Node, sourceFile: SourceFile, options: EditorOptions): number { - var containingList = getContainingList(node, sourceFile); + let containingList = getContainingList(node, sourceFile); return containingList ? getActualIndentationFromList(containingList) : Value.Unknown; function getActualIndentationFromList(list: Node[]): number { - var index = indexOf(list, node); + let index = indexOf(list, node); return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : Value.Unknown; } } function deriveActualIndentationFromList(list: Node[], index: number, sourceFile: SourceFile, options: EditorOptions): number { Debug.assert(index >= 0 && index < list.length); - var node = list[index]; + let node = list[index]; // walk toward the start of the list starting from current node and check if the line is the same for all items. // if end line for item [i - 1] differs from the start line for item [i] - find column of the first non-whitespace character on the line of item [i] - var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); - for (var i = index - 1; i >= 0; --i) { + let lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); + for (let i = index - 1; i >= 0; --i) { if (list[i].kind === SyntaxKind.CommaToken) { continue; } // skip list items that ends on the same line with the current list element - var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line; + let prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line; if (prevEndLine !== lineAndCharacter.line) { return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); } @@ -311,7 +313,7 @@ module ts.formatting { } function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter: LineAndCharacter, sourceFile: SourceFile, options: EditorOptions): number { - var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0); + let lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0); return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); } @@ -323,10 +325,10 @@ module ts.formatting { value of 'column' for '$' is 6 (assuming that tab size is 4) */ export function findFirstNonWhitespaceCharacterAndColumn(startPos: number, endPos: number, sourceFile: SourceFile, options: EditorOptions) { - var character = 0; - var column = 0; - for (var pos = startPos; pos < endPos; ++pos) { - var ch = sourceFile.text.charCodeAt(pos); + let character = 0; + let column = 0; + for (let pos = startPos; pos < endPos; ++pos) { + let ch = sourceFile.text.charCodeAt(pos); if (!isWhiteSpace(ch)) { break; } @@ -403,9 +405,9 @@ module ts.formatting { * If child at position 'length - 1' is 'SemicolonToken' it is skipped and 'expectedLastToken' is compared with child at position 'length - 2'. */ function nodeEndsWith(n: Node, expectedLastToken: SyntaxKind, sourceFile: SourceFile): boolean { - var children = n.getChildren(sourceFile); + let children = n.getChildren(sourceFile); if (children.length) { - var last = children[children.length - 1]; + let last = children[children.length - 1]; if (last.kind === expectedLastToken) { return true; } @@ -471,7 +473,7 @@ module ts.formatting { return isCompletedNode((n).statement, sourceFile); case SyntaxKind.DoStatement: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; - var hasWhileKeyword = findChildOfKind(n, SyntaxKind.WhileKeyword, sourceFile); + let hasWhileKeyword = findChildOfKind(n, SyntaxKind.WhileKeyword, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, SyntaxKind.CloseParenToken, sourceFile); } From 12d0bc4d30b248635e7c69486f71568347c61d93 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 14:24:40 -0700 Subject: [PATCH 070/101] Use 'let' in the services layer. --- src/services/formatting/formattingContext.ts | 16 ++++++++-------- src/services/formatting/ruleDescriptor.ts | 3 +-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/services/formatting/formattingContext.ts b/src/services/formatting/formattingContext.ts index 52de4105df6..8683a975777 100644 --- a/src/services/formatting/formattingContext.ts +++ b/src/services/formatting/formattingContext.ts @@ -71,8 +71,8 @@ module ts.formatting { public TokensAreOnSameLine(): boolean { if (this.tokensAreOnSameLine === undefined) { - var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; - var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; + let startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; + let endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; this.tokensAreOnSameLine = (startLine == endLine); } @@ -96,17 +96,17 @@ module ts.formatting { } private NodeIsOnOneLine(node: Node): boolean { - var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; - var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line; + let startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; + let endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line; return startLine == endLine; } private BlockIsOnOneLine(node: Node): boolean { - var openBrace = findChildOfKind(node, SyntaxKind.OpenBraceToken, this.sourceFile); - var closeBrace = findChildOfKind(node, SyntaxKind.CloseBraceToken, this.sourceFile); + let openBrace = findChildOfKind(node, SyntaxKind.OpenBraceToken, this.sourceFile); + let closeBrace = findChildOfKind(node, SyntaxKind.CloseBraceToken, this.sourceFile); if (openBrace && closeBrace) { - var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; - var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; + let startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; + let endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; return startLine === endLine; } return false; diff --git a/src/services/formatting/ruleDescriptor.ts b/src/services/formatting/ruleDescriptor.ts index e5b7d6f3186..031f88be00e 100644 --- a/src/services/formatting/ruleDescriptor.ts +++ b/src/services/formatting/ruleDescriptor.ts @@ -33,8 +33,7 @@ module ts.formatting { return RuleDescriptor.create4(left, Shared.TokenRange.FromToken(right)); } - static create3(left: SyntaxKind, right: Shared.TokenRange): RuleDescriptor - { + static create3(left: SyntaxKind, right: Shared.TokenRange): RuleDescriptor { return RuleDescriptor.create4(Shared.TokenRange.FromToken(left), right); } From b1996918430d57780c705c39a4f706a59ec615de Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 14:25:50 -0700 Subject: [PATCH 071/101] Use 'let' in the services layer. --- src/services/formatting/formattingScanner.ts | 36 ++++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index 962f142f609..f93739d6fb5 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -2,7 +2,7 @@ /// module ts.formatting { - var scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false); + let scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false); export interface FormattingScanner { advance(): void; @@ -24,13 +24,13 @@ module ts.formatting { scanner.setText(sourceFile.text); scanner.setTextPos(startPos); - var wasNewLine: boolean = true; - var leadingTrivia: TextRangeWithKind[]; - var trailingTrivia: TextRangeWithKind[]; + let wasNewLine: boolean = true; + let leadingTrivia: TextRangeWithKind[]; + let trailingTrivia: TextRangeWithKind[]; - var savedPos: number; - var lastScanAction: ScanAction; - var lastTokenInfo: TokenInfo; + let savedPos: number; + let lastScanAction: ScanAction; + let lastTokenInfo: TokenInfo; return { advance: advance, @@ -45,7 +45,7 @@ module ts.formatting { function advance(): void { lastTokenInfo = undefined; - var isStarted = scanner.getStartPos() !== startPos; + let isStarted = scanner.getStartPos() !== startPos; if (isStarted) { if (trailingTrivia) { @@ -64,19 +64,19 @@ module ts.formatting { scanner.scan(); } - var t: SyntaxKind; - var pos = scanner.getStartPos(); + let t: SyntaxKind; + let pos = scanner.getStartPos(); // Read leading trivia and token while (pos < endPos) { - var t = scanner.getToken(); + let t = scanner.getToken(); if (!isTrivia(t)) { break; } // consume leading trivia scanner.scan(); - var item = { + let item = { pos: pos, end: scanner.getStartPos(), kind: t @@ -133,7 +133,7 @@ module ts.formatting { // normally scanner returns the smallest available token // check the kind of context node to determine if scanner should have more greedy behavior and consume more text. - var expectedScanAction = + let expectedScanAction = shouldRescanGreaterThanToken(n) ? ScanAction.RescanGreaterThanToken : shouldRescanSlashToken(n) @@ -159,7 +159,7 @@ module ts.formatting { scanner.scan(); } - var currentToken = scanner.getToken(); + let currentToken = scanner.getToken(); if (expectedScanAction === ScanAction.RescanGreaterThanToken && currentToken === SyntaxKind.GreaterThanToken) { currentToken = scanner.reScanGreaterToken(); @@ -179,7 +179,7 @@ module ts.formatting { lastScanAction = ScanAction.Scan; } - var token: TextRangeWithKind = { + let token: TextRangeWithKind = { pos: scanner.getStartPos(), end: scanner.getTextPos(), kind: currentToken @@ -194,7 +194,7 @@ module ts.formatting { if (!isTrivia(currentToken)) { break; } - var trivia = { + let trivia = { pos: scanner.getStartPos(), end: scanner.getTextPos(), kind: currentToken @@ -223,8 +223,8 @@ module ts.formatting { } function isOnToken(): boolean { - var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); - var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); + let current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); + let startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); return startPos < endPos && current !== SyntaxKind.EndOfFileToken && !isTrivia(current); } From 0675a92accb49b217b33941ca17f030a6d2bf6db Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Fri, 13 Mar 2015 14:34:10 -0700 Subject: [PATCH 072/101] consider binding elements as always initialized with doing shadow check --- src/compiler/checker.ts | 65 +++++++++++-------- ...ngViaLocalValueOrBindingElement.errors.txt | 28 ++++++++ .../shadowingViaLocalValueOrBindingElement.js | 31 +++++++++ .../shadowingViaLocalValueOrBindingElement.ts | 10 +++ 4 files changed, 107 insertions(+), 27 deletions(-) create mode 100644 tests/baselines/reference/shadowingViaLocalValueOrBindingElement.errors.txt create mode 100644 tests/baselines/reference/shadowingViaLocalValueOrBindingElement.js create mode 100644 tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 782ffccc0ed..000ee35d21f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8609,36 +8609,47 @@ module ts { // const x = 0; // localDeclarationSymbol obtained after name resolution will correspond to this declaration // var x = 0; // symbol for this declaration will be 'symbol' // } - if (node.initializer && (getCombinedNodeFlags(node) & NodeFlags.BlockScoped) === 0) { - var symbol = getSymbolOfNode(node); - if (symbol.flags & SymbolFlags.FunctionScopedVariable) { - var localDeclarationSymbol = resolveName(node, (node.name).text, SymbolFlags.Variable, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined); - if (localDeclarationSymbol && - localDeclarationSymbol !== symbol && - localDeclarationSymbol.flags & SymbolFlags.BlockScopedVariable) { - if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & NodeFlags.BlockScoped) { - var varDeclList = getAncestor(localDeclarationSymbol.valueDeclaration, SyntaxKind.VariableDeclarationList); - var container = - varDeclList.parent.kind === SyntaxKind.VariableStatement && - varDeclList.parent.parent; + // skip block-scoped variables and parameters + if ((getCombinedNodeFlags(node) & NodeFlags.BlockScoped) !== 0 || isParameterDeclaration(node)) { + return; + } - // names of block-scoped and function scoped variables can collide only - // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) - var namesShareScope = - container && - (container.kind === SyntaxKind.Block && isFunctionLike(container.parent) || - (container.kind === SyntaxKind.ModuleBlock && container.kind === SyntaxKind.ModuleDeclaration) || - container.kind === SyntaxKind.SourceFile); + // skip variable declarations that don't have initializers + // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern + // so we'll always treat binding elements as initialized + if (node.kind === SyntaxKind.VariableDeclaration && !node.initializer) { + return; + } - // here we know that function scoped variable is shadowed by block scoped one - // if they are defined in the same scope - binder has already reported redeclaration error - // otherwise if variable has an initializer - show error that initialization will fail - // since LHS will be block scoped name instead of function scoped - if (!namesShareScope) { - var name = symbolToString(localDeclarationSymbol); - error(node, Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); - } + var symbol = getSymbolOfNode(node); + if (symbol.flags & SymbolFlags.FunctionScopedVariable) { + var localDeclarationSymbol = resolveName(node, (node.name).text, SymbolFlags.Variable, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined); + if (localDeclarationSymbol && + localDeclarationSymbol !== symbol && + localDeclarationSymbol.flags & SymbolFlags.BlockScopedVariable) { + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & NodeFlags.BlockScoped) { + + var varDeclList = getAncestor(localDeclarationSymbol.valueDeclaration, SyntaxKind.VariableDeclarationList); + var container = + varDeclList.parent.kind === SyntaxKind.VariableStatement && + varDeclList.parent.parent; + + // names of block-scoped and function scoped variables can collide only + // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) + var namesShareScope = + container && + (container.kind === SyntaxKind.Block && isFunctionLike(container.parent) || + (container.kind === SyntaxKind.ModuleBlock && container.kind === SyntaxKind.ModuleDeclaration) || + container.kind === SyntaxKind.SourceFile); + + // here we know that function scoped variable is shadowed by block scoped one + // if they are defined in the same scope - binder has already reported redeclaration error + // otherwise if variable has an initializer - show error that initialization will fail + // since LHS will be block scoped name instead of function scoped + if (!namesShareScope) { + var name = symbolToString(localDeclarationSymbol); + error(node, Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); } } } diff --git a/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.errors.txt b/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.errors.txt new file mode 100644 index 00000000000..663f83c1ffb --- /dev/null +++ b/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.errors.txt @@ -0,0 +1,28 @@ +tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts(4,13): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts(5,15): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts(6,18): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts(7,15): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts(8,18): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. + + +==== tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts (5 errors) ==== + if (true) { + let x; + if (true) { + var x = 0; // Error + ~ +!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. + var { x = 0 } = { x: 0 }; // Error + ~ +!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. + var { x: x = 0 } = { x: 0 }; // Error + ~ +!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. + var { x } = { x: 0 }; // No error, even though the let x is being initialized + ~ +!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. + var { x: x } = { x: 0 }; // No error, even though the let x is being initialized + ~ +!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.js b/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.js new file mode 100644 index 00000000000..8d6319f5ea7 --- /dev/null +++ b/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.js @@ -0,0 +1,31 @@ +//// [shadowingViaLocalValueOrBindingElement.ts] +if (true) { + let x; + if (true) { + var x = 0; // Error + var { x = 0 } = { x: 0 }; // Error + var { x: x = 0 } = { x: 0 }; // Error + var { x } = { x: 0 }; // No error, even though the let x is being initialized + var { x: x } = { x: 0 }; // No error, even though the let x is being initialized + } +} + +//// [shadowingViaLocalValueOrBindingElement.js] +if (true) { + var _x; + if (true) { + var x = 0; // Error + var _a = ({ + _x: 0 + }).x, x = _a === void 0 ? 0 : _a; // Error + var _b = ({ + _x: 0 + }).x, x = _b === void 0 ? 0 : _b; // Error + var x = ({ + _x: 0 + }).x; // No error, even though the let x is being initialized + var x = ({ + _x: 0 + }).x; // No error, even though the let x is being initialized + } +} diff --git a/tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts b/tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts new file mode 100644 index 00000000000..9afeb79aa79 --- /dev/null +++ b/tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts @@ -0,0 +1,10 @@ +if (true) { + let x; + if (true) { + var x = 0; // Error + var { x = 0 } = { x: 0 }; // Error + var { x: x = 0 } = { x: 0 }; // Error + var { x } = { x: 0 }; // No error, even though the let x is being initialized + var { x: x } = { x: 0 }; // No error, even though the let x is being initialized + } +} \ No newline at end of file From 1ab0ef9f16bd83504cd38891ea7435ac791d7158 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 14:54:05 -0700 Subject: [PATCH 073/101] Use 'let' in the services layer. --- src/services/formatting/formatting.ts | 219 +++++++++++++------------- 1 file changed, 109 insertions(+), 110 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index b20d8fea22d..24ddabc2b2b 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -23,7 +23,7 @@ module ts.formatting { * Indentation for the scope that can be dynamically recomputed. * i.e * while(true) - * { var x; + * { let x; * } * Normally indentation is applied only to the first token in line so at glance 'var' should not be touched. * However if some format rule adds new line between '}' and 'var' 'var' will become @@ -67,12 +67,12 @@ module ts.formatting { } export function formatOnEnter(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] { - var line = sourceFile.getLineAndCharacterOfPosition(position).line; + let line = sourceFile.getLineAndCharacterOfPosition(position).line; if (line === 0) { return []; } // get the span for the previous\current line - var span = { + let span = { // get start position for the previous line pos: getStartPositionOfLine(line - 1, sourceFile), // get end position for the current line (end value is exclusive so add 1 to the result) @@ -90,7 +90,7 @@ module ts.formatting { } export function formatDocument(sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] { - var span = { + let span = { pos: 0, end: sourceFile.text.length }; @@ -99,7 +99,7 @@ module ts.formatting { export function formatSelection(start: number, end: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] { // format from the beginning of the line - var span = { + let span = { pos: getLineStartPositionForPosition(start, sourceFile), end: end }; @@ -107,11 +107,11 @@ module ts.formatting { } function formatOutermostParent(position: number, expectedLastToken: SyntaxKind, sourceFile: SourceFile, options: FormatCodeOptions, rulesProvider: RulesProvider, requestKind: FormattingRequestKind): TextChange[] { - var parent = findOutermostParent(position, expectedLastToken, sourceFile); + let parent = findOutermostParent(position, expectedLastToken, sourceFile); if (!parent) { return []; } - var span = { + let span = { pos: getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), end: parent.end }; @@ -119,7 +119,7 @@ module ts.formatting { } function findOutermostParent(position: number, expectedTokenKind: SyntaxKind, sourceFile: SourceFile): Node { - var precedingToken = findPrecedingToken(position, sourceFile); + let precedingToken = findPrecedingToken(position, sourceFile); // when it is claimed that trigger character was typed at given position // we verify that there is a token with a matching kind whose end is equal to position (because the character was just typed). @@ -134,13 +134,13 @@ module ts.formatting { // walk up and search for the parent node that ends at the same position with precedingToken. // for cases like this // - // var x = 1; + // let x = 1; // while (true) { // } // after typing close curly in while statement we want to reformat just the while statement. // However if we just walk upwards searching for the parent that has the same end value - // we'll end up with the whole source file. isListElement allows to stop on the list element level - var current = precedingToken; + let current = precedingToken; while (current && current.parent && current.parent.end === precedingToken.end && @@ -159,7 +159,7 @@ module ts.formatting { case SyntaxKind.InterfaceDeclaration: return rangeContainsRange((parent).members, node); case SyntaxKind.ModuleDeclaration: - var body = (parent).body; + let body = (parent).body; return body && body.kind === SyntaxKind.Block && rangeContainsRange((body).statements, node); case SyntaxKind.SourceFile: case SyntaxKind.Block: @@ -177,9 +177,9 @@ module ts.formatting { return find(sourceFile); function find(n: Node): Node { - var candidate = forEachChild(n, c => startEndContainsRange(c.getStart(sourceFile), c.end, range) && c); + let candidate = forEachChild(n, c => startEndContainsRange(c.getStart(sourceFile), c.end, range) && c); if (candidate) { - var result = find(candidate); + let result = find(candidate); if (result) { return result; } @@ -199,7 +199,7 @@ module ts.formatting { } // pick only errors that fall in range - var sorted = errors + let sorted = errors .filter(d => rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length)) .sort((e1, e2) => e1.start - e2.start); @@ -207,7 +207,7 @@ module ts.formatting { return rangeHasNoErrors; } - var index = 0; + let index = 0; return r => { // in current implementation sequence of arguments [r1, r2...] is monotonically increasing. @@ -218,7 +218,7 @@ module ts.formatting { return false; } - var error = sorted[index]; + let error = sorted[index]; if (r.end <= error.start) { // specified range ends before the error refered by 'index' - no error in range return false; @@ -244,12 +244,12 @@ module ts.formatting { * and return its end as start position for the scanner. */ function getScanStartPosition(enclosingNode: Node, originalRange: TextRange, sourceFile: SourceFile): number { - var start = enclosingNode.getStart(sourceFile); + let start = enclosingNode.getStart(sourceFile); if (start === originalRange.pos && enclosingNode.end === originalRange.end) { return start; } - var precedingToken = findPrecedingToken(originalRange.pos, sourceFile); + let precedingToken = findPrecedingToken(originalRange.pos, sourceFile); if (!precedingToken) { // no preceding token found - start from the beginning of enclosing node return enclosingNode.pos; @@ -280,10 +280,10 @@ module ts.formatting { * to the initial indentation. */ function getOwnOrInheritedDelta(n: Node, options: FormatCodeOptions, sourceFile: SourceFile): number { - var previousLine = Constants.Unknown; - var childKind = SyntaxKind.Unknown; + let previousLine = Constants.Unknown; + let childKind = SyntaxKind.Unknown; while (n) { - var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; + let line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== Constants.Unknown && line !== previousLine) { break; } @@ -305,30 +305,30 @@ module ts.formatting { rulesProvider: RulesProvider, requestKind: FormattingRequestKind): TextChange[] { - var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange); + let rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange); // formatting context is used by rules provider - var formattingContext = new FormattingContext(sourceFile, requestKind); + let formattingContext = new FormattingContext(sourceFile, requestKind); // find the smallest node that fully wraps the range and compute the initial indentation for the node - var enclosingNode = findEnclosingNode(originalRange, sourceFile); + let enclosingNode = findEnclosingNode(originalRange, sourceFile); - var formattingScanner = getFormattingScanner(sourceFile, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end); + let formattingScanner = getFormattingScanner(sourceFile, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end); - var initialIndentation = SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options); + let initialIndentation = SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options); - var previousRangeHasError: boolean; - var previousRange: TextRangeWithKind; - var previousParent: Node; - var previousRangeStartLine: number; + let previousRangeHasError: boolean; + let previousRange: TextRangeWithKind; + let previousParent: Node; + let previousRangeStartLine: number; - var edits: TextChange[] = []; + let edits: TextChange[] = []; formattingScanner.advance(); if (formattingScanner.isOnToken()) { - var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; - var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); + let startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; + let delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta); } @@ -357,9 +357,9 @@ module ts.formatting { } } else { - var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; - var startLinePosition = getLineStartPositionForPosition(startPos, sourceFile); - var column = SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); + let startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; + let startLinePosition = getLineStartPositionForPosition(startPos, sourceFile); + let column = SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); if (startLine !== parentStartLine || startPos === column) { return column } @@ -376,7 +376,7 @@ module ts.formatting { parentDynamicIndentation: DynamicIndentation, effectiveParentStartLine: number): Indentation { - var indentation = inheritedIndentation; + let indentation = inheritedIndentation; if (indentation === Constants.Unknown) { if (isSomeBlock(node.kind)) { // blocks should be indented in @@ -475,7 +475,7 @@ module ts.formatting { return; } - var nodeDynamicIndentation = getDynamicIndentation(node, nodeStartLine, indentation, delta); + let nodeDynamicIndentation = getDynamicIndentation(node, nodeStartLine, indentation, delta); // a useful observations when tracking context node // / @@ -489,7 +489,7 @@ module ts.formatting { // context node is set to parent node value after processing every child node // context node is set to parent of the token after processing every token - var childContextNode = contextNode; + let childContextNode = contextNode; // if there are any tokens that logically belong to node and interleave child nodes // such tokens will be consumed in processChildNode for for the child that follows them @@ -504,7 +504,7 @@ module ts.formatting { // proceed any tokens in the node that are located after child nodes while (formattingScanner.isOnToken()) { - var tokenInfo = formattingScanner.readTokenInfo(node); + let tokenInfo = formattingScanner.readTokenInfo(node); if (tokenInfo.token.end > node.end) { break; } @@ -519,12 +519,12 @@ module ts.formatting { parentStartLine: number, isListItem: boolean): number { - var childStartPos = child.getStart(sourceFile); + let childStartPos = child.getStart(sourceFile); - var childStart = sourceFile.getLineAndCharacterOfPosition(childStartPos); + let childStart = sourceFile.getLineAndCharacterOfPosition(childStartPos); // if child is a list item - try to get its indentation - var childIndentationAmount = Constants.Unknown; + let childIndentationAmount = Constants.Unknown; if (isListItem) { childIndentationAmount = tryComputeIndentationForListItem(childStartPos, child.end, parentStartLine, originalRange, inheritedIndentation); if (childIndentationAmount !== Constants.Unknown) { @@ -543,7 +543,7 @@ module ts.formatting { while (formattingScanner.isOnToken()) { // proceed any parent tokens that are located prior to child.getStart() - var tokenInfo = formattingScanner.readTokenInfo(node); + let tokenInfo = formattingScanner.readTokenInfo(node); if (tokenInfo.token.end > childStartPos) { // stop when formatting scanner advances past the beginning of the child break; @@ -558,13 +558,13 @@ module ts.formatting { if (isToken(child)) { // if child node is a token, it does not impact indentation, proceed it using parent indentation scope rules - var tokenInfo = formattingScanner.readTokenInfo(child); + let tokenInfo = formattingScanner.readTokenInfo(child); Debug.assert(tokenInfo.token.end === child.end); consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); return inheritedIndentation; } - var childIndentation = computeIndentation(child, childStart.line, childIndentationAmount, node, parentDynamicIndentation, parentStartLine); + let childIndentation = computeIndentation(child, childStart.line, childIndentationAmount, node, parentDynamicIndentation, parentStartLine); processNode(child, childContextNode, childStart.line, childIndentation.indentation, childIndentation.delta); @@ -578,16 +578,16 @@ module ts.formatting { parentStartLine: number, parentDynamicIndentation: DynamicIndentation): void { - var listStartToken = getOpenTokenForList(parent, nodes); - var listEndToken = getCloseTokenForOpenToken(listStartToken); + let listStartToken = getOpenTokenForList(parent, nodes); + let listEndToken = getCloseTokenForOpenToken(listStartToken); - var listDynamicIndentation = parentDynamicIndentation; - var startLine = parentStartLine; + let listDynamicIndentation = parentDynamicIndentation; + let startLine = parentStartLine; if (listStartToken !== SyntaxKind.Unknown) { // introduce a new indentation scope for lists (including list start and end tokens) while (formattingScanner.isOnToken()) { - var tokenInfo = formattingScanner.readTokenInfo(parent); + let tokenInfo = formattingScanner.readTokenInfo(parent); if (tokenInfo.token.end > nodes.pos) { // stop when formatting scanner moves past the beginning of node list break; @@ -595,7 +595,7 @@ module ts.formatting { else if (tokenInfo.token.kind === listStartToken) { // consume list start token startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; - var indentation = + let indentation = computeIndentation(tokenInfo.token, startLine, Constants.Unknown, parent, parentDynamicIndentation, startLine); listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation.indentation, indentation.delta); @@ -608,14 +608,14 @@ module ts.formatting { } } - var inheritedIndentation = Constants.Unknown; + let inheritedIndentation = Constants.Unknown; for (let child of nodes) { inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, /*isListElement*/ true) } if (listEndToken !== SyntaxKind.Unknown) { if (formattingScanner.isOnToken()) { - var tokenInfo = formattingScanner.readTokenInfo(parent); + let tokenInfo = formattingScanner.readTokenInfo(parent); // consume the list end token only if it is still belong to the parent // there might be the case when current token matches end token but does not considered as one // function (x: function) <-- @@ -631,21 +631,21 @@ module ts.formatting { function consumeTokenAndAdvanceScanner(currentTokenInfo: TokenInfo, parent: Node, dynamicIndentation: DynamicIndentation): void { Debug.assert(rangeContainsRange(parent, currentTokenInfo.token)); - var lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine(); - var indentToken = false; + let lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine(); + let indentToken = false; if (currentTokenInfo.leadingTrivia) { processTrivia(currentTokenInfo.leadingTrivia, parent, childContextNode, dynamicIndentation); } - var lineAdded: boolean; - var isTokenInRange = rangeContainsRange(originalRange, currentTokenInfo.token); + let lineAdded: boolean; + let isTokenInRange = rangeContainsRange(originalRange, currentTokenInfo.token); - var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos); + let tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos); if (isTokenInRange) { - var rangeHasError = rangeContainsError(currentTokenInfo.token); + let rangeHasError = rangeContainsError(currentTokenInfo.token); // save prevStartLine since processRange will overwrite this value with current ones - var prevStartLine = previousRangeStartLine; + let prevStartLine = previousRangeStartLine; lineAdded = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation); if (rangeHasError) { // do not indent comments\token if token range overlaps with some error @@ -666,23 +666,23 @@ module ts.formatting { } if (indentToken) { - var indentNextTokenOrTrivia = true; + let indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { for (let triviaItem of currentTokenInfo.leadingTrivia) { if (!rangeContainsRange(originalRange, triviaItem)) { continue; } - var triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line; + let triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line; switch (triviaItem.kind) { case SyntaxKind.MultiLineCommentTrivia: - var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); + let commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); indentMultilineComment(triviaItem, commentIndentation, /*firstLineIsIndented*/ !indentNextTokenOrTrivia); indentNextTokenOrTrivia = false; break; case SyntaxKind.SingleLineCommentTrivia: if (indentNextTokenOrTrivia) { - var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); + let commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); insertIndentation(triviaItem.pos, commentIndentation, /*lineAdded*/ false); indentNextTokenOrTrivia = false; } @@ -696,7 +696,7 @@ module ts.formatting { // indent token only if is it is in target range and does not overlap with any error ranges if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) { - var tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind); + let tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind); insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); } } @@ -710,7 +710,7 @@ module ts.formatting { function processTrivia(trivia: TextRangeWithKind[], parent: Node, contextNode: Node, dynamicIndentation: DynamicIndentation): void { for (let triviaItem of trivia) { if (isComment(triviaItem.kind) && rangeContainsRange(originalRange, triviaItem)) { - var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); + let triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); } } @@ -722,12 +722,12 @@ module ts.formatting { contextNode: Node, dynamicIndentation: DynamicIndentation): boolean { - var rangeHasError = rangeContainsError(range); - var lineAdded: boolean; + let rangeHasError = rangeContainsError(range); + let lineAdded: boolean; if (!rangeHasError && !previousRangeHasError) { if (!previousRange) { // trim whitespaces starting from the beginning of the span up to the current line - var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos); + let originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos); trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { @@ -755,10 +755,10 @@ module ts.formatting { formattingContext.updateContext(previousItem, previousParent, currentItem, currentParent, contextNode); - var rule = rulesProvider.getRulesMap().GetRule(formattingContext); + let rule = rulesProvider.getRulesMap().GetRule(formattingContext); - var trimTrailingWhitespaces: boolean; - var lineAdded: boolean; + let trimTrailingWhitespaces: boolean; + let lineAdded: boolean; if (rule) { applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine); @@ -798,16 +798,16 @@ module ts.formatting { } function insertIndentation(pos: number, indentation: number, lineAdded: boolean): void { - var indentationString = getIndentationString(indentation, options); + let indentationString = getIndentationString(indentation, options); if (lineAdded) { // new line is added before the token by the formatting rules // insert indentation string at the very beginning of the token recordReplace(pos, 0, indentationString); } else { - var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); + let tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); if (indentation !== tokenStart.character) { - var startLinePosition = getStartPositionOfLine(tokenStart.line, sourceFile); + let startLinePosition = getStartPositionOfLine(tokenStart.line, sourceFile); recordReplace(startLinePosition, tokenStart.character, indentationString); } } @@ -815,9 +815,9 @@ module ts.formatting { function indentMultilineComment(commentRange: TextRange, indentation: number, firstLineIsIndented: boolean) { // split comment in lines - var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; - var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; - + let startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; + let endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; + let parts: TextRange[]; if (startLine === endLine) { if (!firstLineIsIndented) { // treat as single line comment @@ -826,10 +826,10 @@ module ts.formatting { return; } else { - var parts: TextRange[] = []; - var startPos = commentRange.pos; - for (var line = startLine; line < endLine; ++line) { - var endOfLine = getEndLinePosition(line, sourceFile); + parts = []; + let startPos = commentRange.pos; + for (let line = startLine; line < endLine; ++line) { + let endOfLine = getEndLinePosition(line, sourceFile); parts.push({ pos: startPos, end: endOfLine }); startPos = getStartPositionOfLine(line + 1, sourceFile); } @@ -837,33 +837,33 @@ module ts.formatting { parts.push({ pos: startPos, end: commentRange.end }); } - var startLinePos = getStartPositionOfLine(startLine, sourceFile); + let startLinePos = getStartPositionOfLine(startLine, sourceFile); - var nonWhitespaceColumnInFirstPart = + let nonWhitespaceColumnInFirstPart = SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options); if (indentation === nonWhitespaceColumnInFirstPart.column) { return; } - var startIndex = 0; + let startIndex = 0; if (firstLineIsIndented) { startIndex = 1; startLine++; } // shift all parts on the delta size - var delta = indentation - nonWhitespaceColumnInFirstPart.column; - for (var i = startIndex, len = parts.length; i < len; ++i, ++startLine) { - var startLinePos = getStartPositionOfLine(startLine, sourceFile); - var nonWhitespaceCharacterAndColumn = + let delta = indentation - nonWhitespaceColumnInFirstPart.column; + for (let i = startIndex, len = parts.length; i < len; ++i, ++startLine) { + let startLinePos = getStartPositionOfLine(startLine, sourceFile); + let nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart : SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); - var newIndentation = nonWhitespaceCharacterAndColumn.column + delta; + let newIndentation = nonWhitespaceCharacterAndColumn.column + delta; if (newIndentation > 0) { - var indentationString = getIndentationString(newIndentation, options); + let indentationString = getIndentationString(newIndentation, options); recordReplace(startLinePos, nonWhitespaceCharacterAndColumn.character, indentationString); } else { @@ -873,16 +873,16 @@ module ts.formatting { } function trimTrailingWhitespacesForLines(line1: number, line2: number, range?: TextRangeWithKind) { - for (var line = line1; line < line2; ++line) { - var lineStartPosition = getStartPositionOfLine(line, sourceFile); - var lineEndPosition = getEndLinePosition(line, sourceFile); + for (let line = line1; line < line2; ++line) { + let lineStartPosition = getStartPositionOfLine(line, sourceFile); + let lineEndPosition = getEndLinePosition(line, sourceFile); // do not trim whitespaces in comments if (range && isComment(range.kind) && range.pos <= lineEndPosition && range.end > lineEndPosition) { continue; } - var pos = lineEndPosition; + let pos = lineEndPosition; while (pos >= lineStartPosition && isWhiteSpace(sourceFile.text.charCodeAt(pos))) { pos--; } @@ -915,7 +915,7 @@ module ts.formatting { currentRange: TextRangeWithKind, currentStartLine: number): void { - var between: TextRange; + let between: TextRange; switch (rule.Operation.Action) { case RuleAction.Ignore: // no action required @@ -935,7 +935,7 @@ module ts.formatting { } // edit should not be applied only if we have one line feed between elements - var lineDelta = currentStartLine - previousStartLine; + let lineDelta = currentStartLine - previousStartLine; if (lineDelta !== 1) { recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.NewLineCharacter); } @@ -946,7 +946,7 @@ module ts.formatting { return; } - var posDelta = currentRange.pos - previousRange.end; + let posDelta = currentRange.pos - previousRange.end; if (posDelta !== 1 || sourceFile.text.charCodeAt(previousRange.end) !== CharacterCodes.space) { recordReplace(previousRange.end, currentRange.pos - previousRange.end, " "); } @@ -1008,15 +1008,15 @@ module ts.formatting { return SyntaxKind.Unknown; } - var internedTabsIndentation: string[]; - var internedSpacesIndentation: string[]; + let internedTabsIndentation: string[]; + let internedSpacesIndentation: string[]; export function getIndentationString(indentation: number, options: FormatCodeOptions): string { if (!options.ConvertTabsToSpaces) { - var tabs = Math.floor(indentation / options.TabSize); - var spaces = indentation - tabs * options.TabSize; + let tabs = Math.floor(indentation / options.TabSize); + let spaces = indentation - tabs * options.TabSize; - var tabString: string; + let tabString: string; if (!internedTabsIndentation) { internedTabsIndentation = []; } @@ -1031,9 +1031,9 @@ module ts.formatting { return spaces ? tabString + repeat(" ", spaces) : tabString; } else { - var spacesString: string; - var quotient = Math.floor(indentation / options.IndentSize); - var remainder = indentation % options.IndentSize; + let spacesString: string; + let quotient = Math.floor(indentation / options.IndentSize); + let remainder = indentation % options.IndentSize; if (!internedSpacesIndentation) { internedSpacesIndentation = []; } @@ -1046,13 +1046,12 @@ module ts.formatting { spacesString = internedSpacesIndentation[quotient]; } - return remainder ? spacesString + repeat(" ", remainder) : spacesString; } function repeat(value: string, count: number): string { - var s = ""; - for (var i = 0; i < count; ++i) { + let s = ""; + for (let i = 0; i < count; ++i) { s += value; } From 2e8eb4e17a3ec49daecf702d48c224430dc993d5 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 15:03:17 -0700 Subject: [PATCH 074/101] Use 'let' in the ompiler layer. --- src/compiler/program.ts | 122 +++++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 59 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 9b933cacf74..b6bff3c0937 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2,15 +2,15 @@ /// module ts { - /* @internal */ export var emitTime = 0; - /* @internal */ export var ioReadTime = 0; + /* @internal */ export let emitTime = 0; + /* @internal */ export let ioReadTime = 0; /** The version of the TypeScript compiler release */ - export var version = "1.5.0.0"; + export let version = "1.5.0.0"; export function createCompilerHost(options: CompilerOptions): CompilerHost { - var currentDirectory: string; - var existingDirectories: Map = {}; + let currentDirectory: string; + let existingDirectories: Map = {}; function getCanonicalFileName(fileName: string): string { // if underlying system can distinguish between two files whose names differs only in cases then file name already in canonical form. @@ -19,12 +19,13 @@ module ts { } // returned by CScript sys environment - var unsupportedFileEncodingErrorCode = -2147024809; + let unsupportedFileEncodingErrorCode = -2147024809; function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile { + let text: string; try { - var start = new Date().getTime(); - var text = sys.readFile(fileName, options.charset); + let start = new Date().getTime(); + text = sys.readFile(fileName, options.charset); ioReadTime += new Date().getTime() - start; } catch (e) { @@ -53,7 +54,7 @@ module ts { function ensureDirectoriesExist(directoryPath: string) { if (directoryPath.length > getRootLength(directoryPath) && !directoryExists(directoryPath)) { - var parentDirectory = getDirectoryPath(directoryPath); + let parentDirectory = getDirectoryPath(directoryPath); ensureDirectoriesExist(parentDirectory); sys.createDirectory(directoryPath); } @@ -82,7 +83,7 @@ module ts { } export function getPreEmitDiagnostics(program: Program): Diagnostic[] { - var diagnostics = program.getSyntacticDiagnostics().concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics()); + let diagnostics = program.getSyntacticDiagnostics().concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics()); return sortAndDeduplicateDiagnostics(diagnostics); } @@ -91,15 +92,15 @@ module ts { return messageText; } else { - var diagnosticChain = messageText; - var result = ""; + let diagnosticChain = messageText; + let result = ""; - var indent = 0; + let indent = 0; while (diagnosticChain) { if (indent) { result += newLine; - for (var i = 0; i < indent; i++) { + for (let i = 0; i < indent; i++) { result += " "; } } @@ -113,12 +114,12 @@ module ts { } export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program { - var program: Program; - var files: SourceFile[] = []; - var filesByName: Map = {}; - var diagnostics = createDiagnosticCollection(); - var seenNoDefaultLib = options.noLib; - var commonSourceDirectory: string; + let program: Program; + let files: SourceFile[] = []; + let filesByName: Map = {}; + let diagnostics = createDiagnosticCollection(); + let seenNoDefaultLib = options.noLib; + let commonSourceDirectory: string; host = host || createCompilerHost(options); forEach(rootNames, name => processRootFile(name, false)); @@ -127,8 +128,8 @@ module ts { } verifyCompilerOptions(); - var diagnosticsProducingTypeChecker: TypeChecker; - var noDiagnosticsTypeChecker: TypeChecker; + let diagnosticsProducingTypeChecker: TypeChecker; + let noDiagnosticsTypeChecker: TypeChecker; program = { getSourceFile: getSourceFile, @@ -172,7 +173,7 @@ module ts { } function getDeclarationDiagnostics(targetSourceFile: SourceFile): Diagnostic[] { - var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(targetSourceFile); + let resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(targetSourceFile); return ts.getDeclarationDiagnostics(getEmitHost(), resolver, targetSourceFile); } @@ -186,11 +187,11 @@ module ts { // Create the emit resolver outside of the "emitTime" tracking code below. That way // any cost associated with it (like type checking) are appropriate associated with // the type-checking counter. - var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); + let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); - var start = new Date().getTime(); + let start = new Date().getTime(); - var emitResult = emitFiles( + let emitResult = emitFiles( emitResolver, getEmitHost(writeFileCallback), sourceFile); @@ -209,7 +210,7 @@ module ts { return getDiagnostics(sourceFile); } - var allDiagnostics: Diagnostic[] = []; + let allDiagnostics: Diagnostic[] = []; forEach(program.getSourceFiles(), sourceFile => { addRange(allDiagnostics, getDiagnostics(sourceFile)); }); @@ -230,20 +231,20 @@ module ts { } function getSemanticDiagnosticsForFile(sourceFile: SourceFile): Diagnostic[] { - var typeChecker = getDiagnosticsProducingTypeChecker(); + let typeChecker = getDiagnosticsProducingTypeChecker(); Debug.assert(!!sourceFile.bindDiagnostics); - var bindDiagnostics = sourceFile.bindDiagnostics; - var checkDiagnostics = typeChecker.getDiagnostics(sourceFile); - var programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); + let bindDiagnostics = sourceFile.bindDiagnostics; + let checkDiagnostics = typeChecker.getDiagnostics(sourceFile); + let programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics); } function getGlobalDiagnostics(): Diagnostic[] { - var typeChecker = getDiagnosticsProducingTypeChecker(); + let typeChecker = getDiagnosticsProducingTypeChecker(); - var allDiagnostics: Diagnostic[] = []; + let allDiagnostics: Diagnostic[] = []; addRange(allDiagnostics, typeChecker.getGlobalDiagnostics()); addRange(allDiagnostics, diagnostics.getGlobalDiagnostics()); @@ -259,11 +260,13 @@ module ts { } function processSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) { + let start: number; + let length: number; if (refEnd !== undefined && refPos !== undefined) { - var start = refPos; - var length = refEnd - refPos; + start = refPos; + length = refEnd - refPos; } - var diagnostic: DiagnosticMessage; + let diagnostic: DiagnosticMessage; if (hasExtension(fileName)) { if (!options.allowNonTsExtensions && !fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) { diagnostic = Diagnostics.File_0_must_have_extension_ts_or_d_ts; @@ -297,20 +300,20 @@ module ts { // Get source file from normalized fileName function findSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refStart?: number, refLength?: number): SourceFile { - var canonicalName = host.getCanonicalFileName(fileName); + let canonicalName = host.getCanonicalFileName(fileName); if (hasProperty(filesByName, canonicalName)) { // We've already looked for this file, use cached result return getSourceFileFromCache(fileName, canonicalName, /*useAbsolutePath*/ false); } else { - var normalizedAbsolutePath = getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); - var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath); + let normalizedAbsolutePath = getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + let canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath); if (hasProperty(filesByName, canonicalAbsolutePath)) { return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, /*useAbsolutePath*/ true); } // We haven't looked for this file, do so now and cache result - var file = filesByName[canonicalName] = host.getSourceFile(fileName, options.target, hostErrorMessage => { + let file = filesByName[canonicalName] = host.getSourceFile(fileName, options.target, hostErrorMessage => { if (refFile) { diagnostics.add(createFileDiagnostic(refFile, refStart, refLength, Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); @@ -326,7 +329,7 @@ module ts { filesByName[canonicalAbsolutePath] = file; if (!options.noResolve) { - var basePath = getDirectoryPath(fileName); + let basePath = getDirectoryPath(fileName); processReferencedFiles(file, basePath); processImportedModules(file, basePath); } @@ -337,13 +340,14 @@ module ts { files.push(file); } } + + return file; } - return file; function getSourceFileFromCache(fileName: string, canonicalName: string, useAbsolutePath: boolean): SourceFile { - var file = filesByName[canonicalName]; + let file = filesByName[canonicalName]; if (file && host.useCaseSensitiveFileNames()) { - var sourceFileName = useAbsolutePath ? getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; + let sourceFileName = useAbsolutePath ? getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; if (canonicalName !== sourceFileName) { diagnostics.add(createFileDiagnostic(refFile, refStart, refLength, Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); @@ -355,7 +359,7 @@ module ts { function processReferencedFiles(file: SourceFile, basePath: string) { forEach(file.referencedFiles, ref => { - var referencedFileName = isRootedDiskPath(ref.fileName) ? ref.fileName : combinePaths(basePath, ref.fileName); + let referencedFileName = isRootedDiskPath(ref.fileName) ? ref.fileName : combinePaths(basePath, ref.fileName); processSourceFile(normalizePath(referencedFileName), /* isDefaultLib */ false, file, ref.pos, ref.end); }); } @@ -363,17 +367,17 @@ module ts { function processImportedModules(file: SourceFile, basePath: string) { forEach(file.statements, node => { if (node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ImportEqualsDeclaration || node.kind === SyntaxKind.ExportDeclaration) { - var moduleNameExpr = getExternalModuleName(node); + let moduleNameExpr = getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === SyntaxKind.StringLiteral) { - var moduleNameText = (moduleNameExpr).text; + let moduleNameText = (moduleNameExpr).text; if (moduleNameText) { - var searchPath = basePath; + let searchPath = basePath; while (true) { - var searchName = normalizePath(combinePaths(searchPath, moduleNameText)); + let searchName = normalizePath(combinePaths(searchPath, moduleNameText)); if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) { break; } - var parentPath = getDirectoryPath(searchPath); + let parentPath = getDirectoryPath(searchPath); if (parentPath === searchPath) { break; } @@ -392,14 +396,14 @@ module ts { if (isExternalModuleImportEqualsDeclaration(node) && getExternalModuleImportEqualsDeclarationExpression(node).kind === SyntaxKind.StringLiteral) { - var nameLiteral = getExternalModuleImportEqualsDeclarationExpression(node); - var moduleName = nameLiteral.text; + let nameLiteral = getExternalModuleImportEqualsDeclarationExpression(node); + let moduleName = nameLiteral.text; if (moduleName) { // TypeScript 1.0 spec (April 2014): 12.1.6 // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules // only through top - level external module names. Relative external module names are not permitted. - var searchName = normalizePath(combinePaths(basePath, moduleName)); - var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); + let searchName = normalizePath(combinePaths(basePath, moduleName)); + let tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); if (!tsFile) { findModuleSourceFile(searchName + ".d.ts", nameLiteral); } @@ -426,10 +430,10 @@ module ts { return; } - var firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined); + let firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined); if (firstExternalModuleSourceFile && !options.module) { // We cannot use createDiagnosticFromNode because nodes do not have parents yet - var span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); + let span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } @@ -440,15 +444,15 @@ module ts { (options.mapRoot && // there is --mapRoot Specified and there would be multiple js files generated (!options.out || firstExternalModuleSourceFile !== undefined))) { - var commonPathComponents: string[]; + let commonPathComponents: string[]; forEach(files, sourceFile => { // Each file contributes into common source file path if (!(sourceFile.flags & NodeFlags.DeclarationFile) && !fileExtensionIs(sourceFile.fileName, ".js")) { - var sourcePathComponents = getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); + let sourcePathComponents = getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); sourcePathComponents.pop(); // FileName is not part of directory if (commonPathComponents) { - for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { + for (let i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { if (commonPathComponents[i] !== sourcePathComponents[i]) { if (i === 0) { diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); From b51d33e262a8ac5f55ac1a80254bdec9204474d1 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 15:07:40 -0700 Subject: [PATCH 075/101] Use 'let' in the compiler layer. --- src/compiler/utilities.ts | 148 +++++++++--------- .../baselines/reference/APISample_compile.js | 2 +- .../reference/APISample_compile.types | 2 +- tests/baselines/reference/APISample_linter.js | 2 +- .../reference/APISample_linter.types | 2 +- .../reference/APISample_transform.js | 2 +- .../reference/APISample_transform.types | 2 +- .../baselines/reference/APISample_watcher.js | 2 +- .../reference/APISample_watcher.types | 2 +- 9 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index ea362eb2220..4fce9c928f7 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -14,7 +14,7 @@ module ts { } export function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration { - var declarations = symbol.declarations; + let declarations = symbol.declarations; for (let declaration of declarations) { if (declaration.kind === kind) { return declaration; @@ -39,12 +39,12 @@ module ts { } // Pool writers to avoid needing to allocate them for every symbol we write. - var stringWriters: StringSymbolWriter[] = []; + let stringWriters: StringSymbolWriter[] = []; export function getSingleLineStringWriter(): StringSymbolWriter { if (stringWriters.length == 0) { - var str = ""; + let str = ""; - var writeText: (text: string) => void = text => str += text; + let writeText: (text: string) => void = text => str += text; return { string: () => str, writeKeyword: writeText, @@ -88,7 +88,7 @@ module ts { // A node is considered to contain a parse error if: // a) the parser explicitly marked that it had an error // b) any of it's children reported that it had an error. - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & ParserContextFlags.ThisNodeHasError) !== 0) || + let thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & ParserContextFlags.ThisNodeHasError) !== 0) || forEachChild(node, containsParseError); // If so, mark ourselves accordingly. @@ -117,8 +117,8 @@ module ts { // This is a useful function for debugging purposes. export function nodePosToString(node: Node): string { - var file = getSourceFileOfNode(node); - var loc = getLineAndCharacterOfPosition(file, node.pos); + let file = getSourceFileOfNode(node); + let loc = getLineAndCharacterOfPosition(file, node.pos); return `${ file.fileName }(${ loc.line + 1 },${ loc.character + 1 })`; } @@ -132,7 +132,7 @@ module ts { // missing. This happens whenever the parser knows it needs to parse something, but can't // get anything in the source code that it expects at that location. For example: // - // var a: ; + // let a: ; // // Here, the Type in the Type-Annotation is not-optional (as there is a colon in the source // code). So the parser will attempt to parse out a type, and will create an actual node. @@ -165,7 +165,7 @@ module ts { return ""; } - var text = sourceFile.text; + let text = sourceFile.text; return text.substring(skipTrivia(text, node.pos), node.end); } @@ -203,7 +203,7 @@ module ts { } export function getEnclosingBlockScopeContainer(node: Node): Node { - var current = node; + let current = node; while (current) { if (isFunctionLike(current)) { return current; @@ -244,14 +244,14 @@ module ts { } export function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic { - var sourceFile = getSourceFileOfNode(node); - var span = getErrorSpanForNode(sourceFile, node); + let sourceFile = getSourceFileOfNode(node); + let span = getErrorSpanForNode(sourceFile, node); return createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2); } export function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain): Diagnostic { - var sourceFile = getSourceFileOfNode(node); - var span = getErrorSpanForNode(sourceFile, node); + let sourceFile = getSourceFileOfNode(node); + let span = getErrorSpanForNode(sourceFile, node); return { file: sourceFile, start: span.start, @@ -264,15 +264,15 @@ module ts { /* @internal */ export function getSpanOfTokenAtPosition(sourceFile: SourceFile, pos: number): TextSpan { - var scanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/ true, sourceFile.text); + let scanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/ true, sourceFile.text); scanner.setTextPos(pos); scanner.scan(); - var start = scanner.getTokenPos(); + let start = scanner.getTokenPos(); return createTextSpanFromBounds(start, scanner.getTextPos()); } export function getErrorSpanForNode(sourceFile: SourceFile, node: Node): TextSpan { - var errorNode = node; + let errorNode = node; switch (node.kind) { // This list is a work in progress. Add missing node kinds to improve their error // spans. @@ -295,7 +295,7 @@ module ts { return getSpanOfTokenAtPosition(sourceFile, node.pos); } - var pos = nodeIsMissing(errorNode) + let pos = nodeIsMissing(errorNode) ? errorNode.pos : skipTrivia(sourceFile.text, errorNode.pos); @@ -332,7 +332,7 @@ module ts { export function getCombinedNodeFlags(node: Node): NodeFlags { node = walkUpBindingElementsAndPatterns(node); - var flags = node.flags; + let flags = node.flags; if (node.kind === SyntaxKind.VariableDeclaration) { node = node.parent; } @@ -389,7 +389,7 @@ module ts { } } - export var fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/ + export let fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/ // Warning: This has the same semantics as the forEach family of functions, @@ -619,7 +619,7 @@ module ts { // fall through case SyntaxKind.NumericLiteral: case SyntaxKind.StringLiteral: - var parent = node.parent; + let parent = node.parent; switch (parent.kind) { case SyntaxKind.VariableDeclaration: case SyntaxKind.Parameter: @@ -641,13 +641,13 @@ module ts { case SyntaxKind.SwitchStatement: return (parent).expression === node; case SyntaxKind.ForStatement: - var forStatement = parent; + let forStatement = parent; return (forStatement.initializer === node && forStatement.initializer.kind !== SyntaxKind.VariableDeclarationList) || forStatement.condition === node || forStatement.iterator === node; case SyntaxKind.ForInStatement: case SyntaxKind.ForOfStatement: - var forInStatement = parent; + let forInStatement = parent; return (forInStatement.initializer === node && forInStatement.initializer.kind !== SyntaxKind.VariableDeclarationList) || forInStatement.expression === node; case SyntaxKind.TypeAssertionExpression: @@ -666,7 +666,7 @@ module ts { } export function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean) { - var moduleState = getModuleInstanceState(node) + let moduleState = getModuleInstanceState(node) return moduleState === ModuleInstanceState.Instantiated || (preserveConstEnums && moduleState === ModuleInstanceState.ConstEnumOnly); } @@ -689,7 +689,7 @@ module ts { return (node).moduleSpecifier; } if (node.kind === SyntaxKind.ImportEqualsDeclaration) { - var reference = (node).moduleReference; + let reference = (node).moduleReference; if (reference.kind === SyntaxKind.ExternalModuleReference) { return (reference).expression; } @@ -820,7 +820,7 @@ module ts { return false; } - var parent = name.parent; + let parent = name.parent; if (parent.kind === SyntaxKind.ImportSpecifier || parent.kind === SyntaxKind.ExportSpecifier) { if ((parent).propertyName) { return true; @@ -835,17 +835,17 @@ module ts { } export function getClassBaseTypeNode(node: ClassDeclaration) { - var heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword); + let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } export function getClassImplementedTypeNodes(node: ClassDeclaration) { - var heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ImplementsKeyword); + let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ImplementsKeyword); return heritageClause ? heritageClause.types : undefined; } export function getInterfaceBaseTypeNodes(node: InterfaceDeclaration) { - var heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword); + let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword); return heritageClause ? heritageClause.types : undefined; } @@ -863,7 +863,7 @@ module ts { export function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference) { if (!host.getCompilerOptions().noResolve) { - var referenceFileName = isRootedDiskPath(reference.fileName) ? reference.fileName : combinePaths(getDirectoryPath(sourceFile.fileName), reference.fileName); + let referenceFileName = isRootedDiskPath(reference.fileName) ? reference.fileName : combinePaths(getDirectoryPath(sourceFile.fileName), reference.fileName); referenceFileName = getNormalizedAbsolutePath(referenceFileName, host.getCurrentDirectory()); return host.getSourceFile(referenceFileName); } @@ -880,8 +880,8 @@ module ts { } export function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult { - var simpleReferenceRegEx = /^\/\/\/\s*/gim; + let simpleReferenceRegEx = /^\/\/\/\s*/gim; if (simpleReferenceRegEx.exec(comment)) { if (isNoDefaultLibRegEx.exec(comment)) { return { @@ -889,10 +889,10 @@ module ts { } } else { - var matchResult = fullTripleSlashReferencePathRegEx.exec(comment); + let matchResult = fullTripleSlashReferencePathRegEx.exec(comment); if (matchResult) { - var start = commentRange.pos; - var end = commentRange.end; + let start = commentRange.pos; + let end = commentRange.end; return { fileReference: { pos: start, @@ -949,9 +949,9 @@ module ts { return (name).text; } if (name.kind === SyntaxKind.ComputedPropertyName) { - var nameExpression = (name).expression; + let nameExpression = (name).expression; if (isWellKnownSymbolSyntactically(nameExpression)) { - var rightHandSideName = (nameExpression).name.text; + let rightHandSideName = (nameExpression).name.text; return getPropertyNameForKnownSymbolName(rightHandSideName); } } @@ -1003,14 +1003,14 @@ module ts { } export function textSpanOverlapsWith(span: TextSpan, other: TextSpan) { - var overlapStart = Math.max(span.start, other.start); - var overlapEnd = Math.min(textSpanEnd(span), textSpanEnd(other)); + let overlapStart = Math.max(span.start, other.start); + let overlapEnd = Math.min(textSpanEnd(span), textSpanEnd(other)); return overlapStart < overlapEnd; } export function textSpanOverlap(span1: TextSpan, span2: TextSpan) { - var overlapStart = Math.max(span1.start, span2.start); - var overlapEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2)); + let overlapStart = Math.max(span1.start, span2.start); + let overlapEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2)); if (overlapStart < overlapEnd) { return createTextSpanFromBounds(overlapStart, overlapEnd); } @@ -1022,7 +1022,7 @@ module ts { } export function textSpanIntersectsWith(span: TextSpan, start: number, length: number) { - var end = start + length; + let end = start + length; return start <= textSpanEnd(span) && end >= span.start; } @@ -1031,8 +1031,8 @@ module ts { } export function textSpanIntersection(span1: TextSpan, span2: TextSpan) { - var intersectStart = Math.max(span1.start, span2.start); - var intersectEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2)); + let intersectStart = Math.max(span1.start, span2.start); + let intersectEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2)); if (intersectStart <= intersectEnd) { return createTextSpanFromBounds(intersectStart, intersectEnd); } @@ -1070,7 +1070,7 @@ module ts { return { span, newLength }; } - export var unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); + export let unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); /** * Called to merge all the changes that occurred across several versions of a script snapshot @@ -1091,14 +1091,14 @@ module ts { // We change from talking about { { oldStart, oldLength }, newLength } to { oldStart, oldEnd, newEnd } // as it makes things much easier to reason about. - var change0 = changes[0]; + let change0 = changes[0]; - var oldStartN = change0.span.start; - var oldEndN = textSpanEnd(change0.span); - var newEndN = oldStartN + change0.newLength; + let oldStartN = change0.span.start; + let oldEndN = textSpanEnd(change0.span); + let newEndN = oldStartN + change0.newLength; - for (var i = 1; i < changes.length; i++) { - var nextChange = changes[i]; + for (let i = 1; i < changes.length; i++) { + let nextChange = changes[i]; // Consider the following case: // i.e. two edits. The first represents the text change range { { 10, 50 }, 30 }. i.e. The span starting @@ -1180,13 +1180,13 @@ module ts { // newEnd3 : Max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)) // } - var oldStart1 = oldStartN; - var oldEnd1 = oldEndN; - var newEnd1 = newEndN; + let oldStart1 = oldStartN; + let oldEnd1 = oldEndN; + let newEnd1 = newEndN; - var oldStart2 = nextChange.span.start; - var oldEnd2 = textSpanEnd(nextChange.span); - var newEnd2 = oldStart2 + nextChange.newLength; + let oldStart2 = nextChange.span.start; + let oldEnd2 = textSpanEnd(nextChange.span); + let newEnd2 = oldStart2 + nextChange.newLength; oldStartN = Math.min(oldStart1, oldStart2); oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)); @@ -1205,7 +1205,7 @@ module ts { } export function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node { - var node = createNode(kind); + let node = createNode(kind); node.pos = -1; node.end = -1; node.startsOnNewLine = startsOnNewLine; @@ -1215,7 +1215,7 @@ module ts { export function generateUniqueName(baseName: string, isExistingName: (name: string) => boolean): string { // First try '_name' if (baseName.charCodeAt(0) !== CharacterCodes._) { - var baseName = "_" + baseName; + baseName = "_" + baseName; if (!isExistingName(baseName)) { return baseName; } @@ -1224,9 +1224,9 @@ module ts { if (baseName.charCodeAt(baseName.length - 1) !== CharacterCodes._) { baseName += "_"; } - var i = 1; + let i = 1; while (true) { - var name = baseName + i; + let name = baseName + i; if (!isExistingName(name)) { return name; } @@ -1236,11 +1236,11 @@ module ts { // @internal export function createDiagnosticCollection(): DiagnosticCollection { - var nonFileDiagnostics: Diagnostic[] = []; - var fileDiagnostics: Map = {}; + let nonFileDiagnostics: Diagnostic[] = []; + let fileDiagnostics: Map = {}; - var diagnosticsModified = false; - var modificationCount = 0; + let diagnosticsModified = false; + let modificationCount = 0; return { add, @@ -1254,7 +1254,7 @@ module ts { } function add(diagnostic: Diagnostic): void { - var diagnostics: Diagnostic[]; + let diagnostics: Diagnostic[]; if (diagnostic.file) { diagnostics = fileDiagnostics[diagnostic.file.fileName]; if (!diagnostics) { @@ -1282,14 +1282,14 @@ module ts { return fileDiagnostics[fileName] || []; } - var allDiagnostics: Diagnostic[] = []; + let allDiagnostics: Diagnostic[] = []; function pushDiagnostic(d: Diagnostic) { allDiagnostics.push(d); } forEach(nonFileDiagnostics, pushDiagnostic); - for (var key in fileDiagnostics) { + for (let key in fileDiagnostics) { if (hasProperty(fileDiagnostics, key)) { forEach(fileDiagnostics[key], pushDiagnostic); } @@ -1306,7 +1306,7 @@ module ts { diagnosticsModified = false; nonFileDiagnostics = sortAndDeduplicateDiagnostics(nonFileDiagnostics); - for (var key in fileDiagnostics) { + for (let key in fileDiagnostics) { if (hasProperty(fileDiagnostics, key)) { fileDiagnostics[key] = sortAndDeduplicateDiagnostics(fileDiagnostics[key]); } @@ -1319,8 +1319,8 @@ module ts { // the language service. These characters should be escaped when printing, and if any characters are added, // the map below must be updated. Note that this regexp *does not* include the 'delete' character. // There is no reason for this other than that JSON.stringify does not handle it either. - var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; - var escapedCharsMap: Map = { + let escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; + let escapedCharsMap: Map = { "\0": "\\0", "\t": "\\t", "\v": "\\v", @@ -1351,12 +1351,12 @@ module ts { } function get16BitUnicodeEscapeSequence(charCode: number): string { - var hexCharCode = charCode.toString(16).toUpperCase(); - var paddedHexCode = ("0000" + hexCharCode).slice(-4); + let hexCharCode = charCode.toString(16).toUpperCase(); + let paddedHexCode = ("0000" + hexCharCode).slice(-4); return "\\u" + paddedHexCode; } - var nonAsciiCharacters = /[^\u0000-\u007F]/g; + let nonAsciiCharacters = /[^\u0000-\u007F]/g; export function escapeNonAsciiCharacters(s: string): string { // Replace non-ASCII characters with '\uNNNN' escapes if any exist. // Otherwise just return the original string. diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index a03f254e699..eb2153aafc7 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1480,7 +1480,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the TypeScript compiler release */ - var version: string; + let version: string; function createCompilerHost(options: CompilerOptions): CompilerHost; function getPreEmitDiagnostics(program: Program): Diagnostic[]; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index bd19b3bbf9f..d09e4f983cc 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -4736,7 +4736,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the TypeScript compiler release */ - var version: string; + let version: string; >version : string function createCompilerHost(options: CompilerOptions): CompilerHost; diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 99b7bc6d549..0c1f84bc359 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1511,7 +1511,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the TypeScript compiler release */ - var version: string; + let version: string; function createCompilerHost(options: CompilerOptions): CompilerHost; function getPreEmitDiagnostics(program: Program): Diagnostic[]; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 0970d0cc2fb..53e61101078 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -4882,7 +4882,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the TypeScript compiler release */ - var version: string; + let version: string; >version : string function createCompilerHost(options: CompilerOptions): CompilerHost; diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 105acc069be..5f62d8757c4 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -1512,7 +1512,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the TypeScript compiler release */ - var version: string; + let version: string; function createCompilerHost(options: CompilerOptions): CompilerHost; function getPreEmitDiagnostics(program: Program): Diagnostic[]; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 17cbd063332..381c90b8333 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -4832,7 +4832,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the TypeScript compiler release */ - var version: string; + let version: string; >version : string function createCompilerHost(options: CompilerOptions): CompilerHost; diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 1d67d4df950..240123d8177 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1549,7 +1549,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the TypeScript compiler release */ - var version: string; + let version: string; function createCompilerHost(options: CompilerOptions): CompilerHost; function getPreEmitDiagnostics(program: Program): Diagnostic[]; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 7ecf2dca8ef..0bbaee0062f 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -5005,7 +5005,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the TypeScript compiler release */ - var version: string; + let version: string; >version : string function createCompilerHost(options: CompilerOptions): CompilerHost; From d7e218b3a1bdb3994cb0407a4e00abd06dc532d0 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 15:20:11 -0700 Subject: [PATCH 076/101] Use 'let' in the compiler layer. --- src/compiler/checker.ts | 152 ++++++++++++++++++++++++---------------- 1 file changed, 92 insertions(+), 60 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 97611288ba8..0dacb20ece4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -22,6 +22,9 @@ module ts { let emitResolver = createResolver(); + let undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined"); + let argumentsSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "arguments"); + let checker: TypeChecker = { getNodeCount: () => sum(host.getSourceFiles(), "nodeCount"), getIdentifierCount: () => sum(host.getSourceFiles(), "identifierCount"), @@ -59,8 +62,6 @@ module ts { getExportsOfExternalModule, }; - var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined"); - var argumentsSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "arguments"); let unknownSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "unknown"); let resolvingSymbol = createSymbol(SymbolFlags.Transient, "__resolving__"); @@ -673,8 +674,10 @@ module ts { if (getFullWidth(name) === 0) { return undefined; } + + let symbol: Symbol; if (name.kind === SyntaxKind.Identifier) { - var symbol = resolveName(name, (name).text, meaning, Diagnostics.Cannot_find_name_0, name); + symbol = resolveName(name, (name).text, meaning, Diagnostics.Cannot_find_name_0, name); if (!symbol) { return undefined; } @@ -685,7 +688,7 @@ module ts { return undefined; } let right = (name).right; - var symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); + symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { error(right, Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), declarationNameToString(right)); return undefined; @@ -721,12 +724,20 @@ module ts { return symbol; } } + + let sourceFile: SourceFile; while (true) { let fileName = normalizePath(combinePaths(searchPath, moduleName)); - var sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); - if (sourceFile || isRelative) break; + sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + if (sourceFile || isRelative) { + break; + } + let parentPath = getDirectoryPath(searchPath); - if (parentPath === searchPath) break; + if (parentPath === searchPath) { + break; + } + searchPath = parentPath; } if (sourceFile) { @@ -1711,11 +1722,12 @@ module ts { function isUsedInExportAssignment(node: Node) { // Get source File and see if it is external module and has export assigned symbol let externalModule = getContainingExternalModule(node); + let exportAssignmentSymbol: Symbol; + let resolvedExportSymbol: Symbol; if (externalModule) { // This is export assigned symbol node let externalModuleSymbol = getSymbolOfNode(externalModule); - var exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); - var resolvedExportSymbol: Symbol; + exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); let symbolOfNode = getSymbolOfNode(node); if (isSymbolUsedInExportAssignment(symbolOfNode)) { return true; @@ -1868,12 +1880,14 @@ module ts { } return parentType; } + + let type: Type; if (pattern.kind === SyntaxKind.ObjectBindingPattern) { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) let name = declaration.propertyName || declaration.name; // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. - var type = getTypeOfPropertyOfType(parentType, name.text) || + type = getTypeOfPropertyOfType(parentType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, IndexKind.Number) || getIndexTypeOfType(parentType, IndexKind.String); if (!type) { @@ -1890,7 +1904,7 @@ module ts { if (!declaration.dotDotDotToken) { // Use specific property type when parent is a tuple or numeric index type when parent is an array let propName = "" + indexOf(pattern.elements, declaration); - var type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, IndexKind.Number); + type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, IndexKind.Number); if (!type) { if (isTupleType(parentType)) { error(declaration, Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), (parentType).elementTypes.length, pattern.elements.length); @@ -1903,7 +1917,7 @@ module ts { } else { // Rest element has an array type with the same element type as the parent type - var type = createArrayType(getIndexTypeOfType(parentType, IndexKind.Number)); + type = createArrayType(getIndexTypeOfType(parentType, IndexKind.Number)); } } return type; @@ -2580,18 +2594,24 @@ module ts { function resolveAnonymousTypeMembers(type: ObjectType) { let symbol = type.symbol; + let members: SymbolTable; + let callSignatures: Signature[]; + let constructSignatures: Signature[]; + let stringIndexType: Type; + let numberIndexType: Type; + if (symbol.flags & SymbolFlags.TypeLiteral) { - var members = symbol.members; - var callSignatures = getSignaturesOfSymbol(members["__call"]); - var constructSignatures = getSignaturesOfSymbol(members["__new"]); - var stringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String); - var numberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number); + members = symbol.members; + callSignatures = getSignaturesOfSymbol(members["__call"]); + constructSignatures = getSignaturesOfSymbol(members["__new"]); + stringIndexType = getIndexTypeOfSymbol(symbol, IndexKind.String); + numberIndexType = getIndexTypeOfSymbol(symbol, IndexKind.Number); } else { // Combinations of function, class, enum and module - var members = emptySymbols; - var callSignatures: Signature[] = emptyArray; - var constructSignatures: Signature[] = emptyArray; + members = emptySymbols; + callSignatures = emptyArray; + constructSignatures = emptyArray; if (symbol.flags & SymbolFlags.HasExports) { members = getExportsOfSymbol(symbol); } @@ -2609,8 +2629,8 @@ module ts { addInheritedMembers(members, getPropertiesOfObjectType(getTypeOfSymbol(classType.baseTypes[0].symbol))); } } - var stringIndexType: Type = undefined; - var numberIndexType: Type = (symbol.flags & SymbolFlags.Enum) ? stringType : undefined; + stringIndexType = undefined; + numberIndexType = (symbol.flags & SymbolFlags.Enum) ? stringType : undefined; } setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } @@ -2917,14 +2937,15 @@ module ts { function getReturnTypeOfSignature(signature: Signature): Type { if (!signature.resolvedReturnType) { signature.resolvedReturnType = resolvingType; + let type: Type; if (signature.target) { - var type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); + type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); } else if (signature.unionSignatures) { - var type = getUnionType(map(signature.unionSignatures, getReturnTypeOfSignature)); + type = getUnionType(map(signature.unionSignatures, getReturnTypeOfSignature)); } else { - var type = getReturnTypeFromBody(signature.declaration); + type = getReturnTypeFromBody(signature.declaration); } if (signature.resolvedReturnType === resolvingType) { signature.resolvedReturnType = type; @@ -3128,8 +3149,8 @@ module ts { let links = getNodeLinks(node); if (!links.resolvedType) { let symbol = resolveEntityName(node.typeName, SymbolFlags.Type); + let type: Type; if (symbol) { - var type: Type; if ((symbol.flags & SymbolFlags.TypeParameter) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { // TypeScript 1.0 spec (April 2014): 3.4.1 // Type parameters declared in a particular type parameter list @@ -3513,8 +3534,9 @@ module ts { } function instantiateSignature(signature: Signature, mapper: TypeMapper, eraseTypeParameters?: boolean): Signature { + let freshTypeParameters: TypeParameter[]; if (signature.typeParameters && !eraseTypeParameters) { - var freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); + freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); } let result = createSignature(signature.declaration, freshTypeParameters, @@ -4224,12 +4246,13 @@ module ts { } return Ternary.False; } + let related: Ternary; if (sourceStringType && sourceNumberType) { // If we know for sure we're testing both string and numeric index types then only report errors from the second one - var related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); + related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); } else { - var related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); + related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); } if (!related) { if (reportErrors) { @@ -4469,13 +4492,14 @@ module ts { function reportImplicitAnyError(declaration: Declaration, type: Type) { let typeAsString = typeToString(getWidenedType(type)); + let diagnostic: DiagnosticMessage; switch (declaration.kind) { case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: - var diagnostic = Diagnostics.Member_0_implicitly_has_an_1_type; + diagnostic = Diagnostics.Member_0_implicitly_has_an_1_type; break; case SyntaxKind.Parameter: - var diagnostic = (declaration).dotDotDotToken ? + diagnostic = (declaration).dotDotDotToken ? Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : Diagnostics.Parameter_0_implicitly_has_an_1_type; break; @@ -4490,10 +4514,10 @@ module ts { error(declaration, Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; } - var diagnostic = Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; + diagnostic = Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; default: - var diagnostic = Diagnostics.Variable_0_implicitly_has_an_1_type; + diagnostic = Diagnostics.Variable_0_implicitly_has_an_1_type; } error(declaration, diagnostic, declarationNameToString(declaration.name), typeAsString); } @@ -5256,6 +5280,7 @@ module ts { if (container) { let canUseSuperExpression = false; + let needToCaptureLexicalThis: boolean; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes @@ -5268,7 +5293,7 @@ module ts { // - In a static member function or static member accessor // super property access might appear in arrow functions with arbitrary deep nesting - var needToCaptureLexicalThis = false; + needToCaptureLexicalThis = false; while (container && container.kind === SyntaxKind.ArrowFunction) { container = getSuperContainer(container, /*includeFunctions*/ true); needToCaptureLexicalThis = true; @@ -5794,15 +5819,16 @@ module ts { if (memberDecl.kind === SyntaxKind.PropertyAssignment || memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment || isObjectLiteralMethod(memberDecl)) { + let type: Type; if (memberDecl.kind === SyntaxKind.PropertyAssignment) { - var type = checkPropertyAssignment(memberDecl, contextualMapper); + type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === SyntaxKind.MethodDeclaration) { - var type = checkObjectLiteralMethod(memberDecl, contextualMapper); + type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { Debug.assert(memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment); - var type = memberDecl.name.kind === SyntaxKind.ComputedPropertyName + type = memberDecl.name.kind === SyntaxKind.ComputedPropertyName ? unknownType : checkExpression(memberDecl.name, contextualMapper); } @@ -6319,14 +6345,15 @@ module ts { let arg = args[i]; if (arg.kind !== SyntaxKind.OmittedExpression) { let paramType = getTypeAtPosition(signature, arg.kind === SyntaxKind.SpreadElementExpression ? -1 : i); + let argType: Type; if (i === 0 && args[i].parent.kind === SyntaxKind.TaggedTemplateExpression) { - var argType = globalTemplateStringsArrayType; + argType = globalTemplateStringsArrayType; } else { // For context sensitive arguments we pass the identityMapper, which is a signal to treat all // context sensitive function expressions as wildcards let mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; - var argType = checkExpressionWithContextualType(arg, paramType, mapper); + argType = checkExpressionWithContextualType(arg, paramType, mapper); } inferTypes(context, argType, paramType); } @@ -6598,12 +6625,12 @@ module ts { let originalCandidate = current; let inferenceResult: InferenceContext; - + let candidate: Signature; + let typeArgumentsAreValid: boolean; while (true) { - var candidate = originalCandidate; + candidate = originalCandidate; if (candidate.typeParameters) { let typeArgumentTypes: Type[]; - var typeArgumentsAreValid: boolean; if (typeArguments) { typeArgumentTypes = new Array(candidate.typeParameters.length); typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, /*reportErrors*/ false) @@ -6885,9 +6912,9 @@ module ts { if (!func.body) { return unknownType; } - + let type: Type; if (func.body.kind !== SyntaxKind.Block) { - var type = checkExpressionCached(func.body, contextualMapper); + type = checkExpressionCached(func.body, contextualMapper); } else { // Aggregate the types of expressions within all the return statements. @@ -6897,7 +6924,7 @@ module ts { } // When return statements are contextually typed we allow the return type to be a union type. Otherwise we require the // return expressions to have a best common supertype. - var type = contextualSignature ? getUnionType(types) : getCommonSupertype(types); + type = contextualSignature ? getUnionType(types) : getCommonSupertype(types); if (!type) { error(func, Diagnostics.No_best_common_type_exists_among_return_expressions); return unknownType; @@ -7066,18 +7093,20 @@ module ts { // and property accesses(section 4.10). // All other expression constructs described in this chapter are classified as values. switch (n.kind) { - case SyntaxKind.Identifier: - var symbol = findSymbol(n); + case SyntaxKind.Identifier: { + let symbol = findSymbol(n); // TypeScript 1.0 spec (April 2014): 4.3 // An identifier expression that references a variable or parameter is classified as a reference. // An identifier expression that references any other kind of entity is classified as a value(and therefore cannot be the target of an assignment). return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & SymbolFlags.Variable) !== 0; - case SyntaxKind.PropertyAccessExpression: - var symbol = findSymbol(n); + } + case SyntaxKind.PropertyAccessExpression: { + let symbol = findSymbol(n); // TypeScript 1.0 spec (April 2014): 4.10 // A property access expression is always classified as a reference. // NOTE (not in spec): assignment to enum members should not be allowed return !symbol || symbol === unknownSymbol || (symbol.flags & ~SymbolFlags.EnumMember) !== 0; + } case SyntaxKind.ElementAccessExpression: // old compiler doesn't check indexed assess return true; @@ -7091,12 +7120,13 @@ module ts { function isConstVariableReference(n: Node): boolean { switch (n.kind) { case SyntaxKind.Identifier: - case SyntaxKind.PropertyAccessExpression: - var symbol = findSymbol(n); + case SyntaxKind.PropertyAccessExpression: { + let symbol = findSymbol(n); return symbol && (symbol.flags & SymbolFlags.Variable) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & NodeFlags.Const) !== 0; - case SyntaxKind.ElementAccessExpression: + } + case SyntaxKind.ElementAccessExpression: { let index = (n).argumentExpression; - var symbol = findSymbol((n).expression); + let symbol = findSymbol((n).expression); if (symbol && index && index.kind === SyntaxKind.StringLiteral) { let name = (index).text; @@ -7104,6 +7134,7 @@ module ts { return prop && (prop.flags & SymbolFlags.Variable) !== 0 && (getDeclarationFlagsFromSymbol(prop) & NodeFlags.Const) !== 0; } return false; + } case SyntaxKind.ParenthesizedExpression: return isConstVariableReference((n).expression); default: @@ -8332,13 +8363,11 @@ module ts { return; } - var symbol: Symbol; - // Exports should be checked only if enclosing module contains both exported and non exported declarations. // In case if all declarations are non-exported check is unnecessary. // if localSymbol is defined on node then node itself is exported - check is required - var symbol = node.localSymbol; + let symbol = node.localSymbol; if (!symbol) { // local symbol is undefined => this declaration is non-exported. // however symbol might contain other declarations that are exported @@ -8650,10 +8679,13 @@ module ts { // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node: VariableLikeDeclaration): void { - if (getRootDeclaration(node).kind === SyntaxKind.Parameter) { - var func = getContainingFunction(node); - visit(node.initializer); + if (getRootDeclaration(node).kind !== SyntaxKind.Parameter) { + return; } + + let func = getContainingFunction(node); + visit(node.initializer); + function visit(n: Node) { if (n.kind === SyntaxKind.Identifier) { let referencedSymbol = getNodeLinks(n).resolvedSymbol; @@ -10729,7 +10761,7 @@ module ts { // Return the list of properties of the given type, augmented with properties from Function // if the type has call or construct signatures function getAugmentedPropertiesOfType(type: Type): Symbol[] { - var type = getApparentType(type); + type = getApparentType(type); let propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, SignatureKind.Call).length || getSignaturesOfType(type, SignatureKind.Construct).length) { forEach(getPropertiesOfType(globalFunctionType), p => { From b99761ac054673f578ebf5b919bb83efb4717fad Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 15:27:05 -0700 Subject: [PATCH 077/101] Use 'let' in the compiler layer. --- src/compiler/scanner.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 835a5b838d0..fbcadab8c1d 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -959,7 +959,7 @@ module ts { if (pos >= len) { return token = SyntaxKind.EndOfFileToken; } - var ch = text.charCodeAt(pos); + let ch = text.charCodeAt(pos); switch (ch) { case CharacterCodes.lineFeed: case CharacterCodes.carriageReturn: @@ -1248,10 +1248,10 @@ module ts { case CharacterCodes.tilde: return pos++, token = SyntaxKind.TildeToken; case CharacterCodes.backslash: - var ch = peekUnicodeEscape(); - if (ch >= 0 && isIdentifierStart(ch)) { + let cookedChar = peekUnicodeEscape(); + if (cookedChar >= 0 && isIdentifierStart(cookedChar)) { pos += 6; - tokenValue = String.fromCharCode(ch) + scanIdentifierParts(); + tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); return token = getIdentifierToken(); } error(Diagnostics.Invalid_character); From bed79ccd5222129907cfcbcb9d2ca8823d6f71c5 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 15:48:42 -0700 Subject: [PATCH 078/101] Update LKG --- bin/tsc.js | 8794 ++++++++++++++++++++------ bin/tsserver.js | 2113 ++++--- bin/typescript.d.ts | 6 +- bin/typescript.js | 2103 +++--- bin/typescriptServices.d.ts | 6 +- bin/typescriptServices.js | 2103 +++--- bin/typescriptServices_internal.d.ts | 10 +- bin/typescript_internal.d.ts | 10 +- 8 files changed, 10072 insertions(+), 5073 deletions(-) diff --git a/bin/tsc.js b/bin/tsc.js index a19101dc546..47dd801eadc 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -44,8 +44,9 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + if (v === value) { return true; } } @@ -67,8 +68,9 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var i = 0, len = array.length; i < len; i++) { - if (predicate(array[i])) { + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + if (predicate(v)) { count++; } } @@ -77,12 +79,13 @@ var ts; } ts.countWhere = countWhere; function filter(array, f) { + var result; if (array) { - var result = []; - for (var i = 0, len = array.length; i < len; i++) { - var item = array[i]; - if (f(item)) { - result.push(item); + result = []; + for (var _i = 0; _i < array.length; _i++) { + var _item = array[_i]; + if (f(_item)) { + result.push(_item); } } } @@ -90,10 +93,12 @@ var ts; } ts.filter = filter; function map(array, f) { + var result; if (array) { - var result = []; - for (var i = 0, len = array.length; i < len; i++) { - result.push(f(array[i])); + result = []; + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + result.push(f(v)); } } return result; @@ -108,12 +113,14 @@ var ts; } ts.concatenate = concatenate; function deduplicate(array) { + var result; if (array) { - var result = []; - for (var i = 0, len = array.length; i < len; i++) { - var item = array[i]; - if (!contains(result, item)) - result.push(item); + result = []; + for (var _i = 0; _i < array.length; _i++) { + var _item = array[_i]; + if (!contains(result, _item)) { + result.push(_item); + } } } return result; @@ -121,15 +128,17 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var i = 0; i < array.length; i++) { - result += array[i][prop]; + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + result += v[prop]; } return result; } ts.sum = sum; function addRange(to, from) { - for (var i = 0, n = from.length; i < n; i++) { - to.push(from[i]); + for (var _i = 0; _i < from.length; _i++) { + var v = from[_i]; + to.push(v); } } ts.addRange = addRange; @@ -190,9 +199,9 @@ var ts; for (var id in first) { result[id] = first[id]; } - for (var id in second) { - if (!hasProperty(result, id)) { - result[id] = second[id]; + for (var _id in second) { + if (!hasProperty(result, _id)) { + result[_id] = second[_id]; } } return result; @@ -244,13 +253,13 @@ var ts; ts.arrayToMap = arrayToMap; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); + return text.replace(/{(\d+)}/g, function (match, index) { + return args[+index + baseIndex]; + }); } ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { - return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] - ? ts.localizedDiagnosticMessages[message] - : message; + return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] ? ts.localizedDiagnosticMessages[message] : message; } ts.getLocaleSpecificMessage = getLocaleSpecificMessage; function createFileDiagnostic(file, start, length, message) { @@ -321,12 +330,7 @@ var ts; return diagnostic.file ? diagnostic.file.fileName : undefined; } function compareDiagnostics(d1, d2) { - return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || - compareValues(d1.start, d2.start) || - compareValues(d1.length, d2.length) || - compareValues(d1.code, d2.code) || - compareMessageText(d1.messageText, d2.messageText) || - 0; + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0; } ts.compareDiagnostics = compareDiagnostics; function compareMessageText(text1, text2) { @@ -353,7 +357,9 @@ var ts; if (diagnostics.length < 2) { return diagnostics; } - var newDiagnostics = [diagnostics[0]]; + var newDiagnostics = [ + diagnostics[0] + ]; var previousDiagnostic = diagnostics[0]; for (var i = 1; i < diagnostics.length; i++) { var currentDiagnostic = diagnostics[i]; @@ -394,8 +400,8 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var i = 0; i < parts.length; i++) { - var part = parts[i]; + for (var _i = 0; _i < parts.length; _i++) { + var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { normalized.pop(); @@ -410,7 +416,7 @@ var ts; return normalized; } function normalizePath(path) { - var path = normalizeSlashes(path); + path = normalizeSlashes(path); var rootLength = getRootLength(path); var normalized = getNormalizedParts(path, rootLength); return path.substr(0, rootLength) + normalized.join(ts.directorySeparator); @@ -430,10 +436,12 @@ var ts; ts.isRootedDiskPath = isRootedDiskPath; function normalizedPathComponents(path, rootLength) { var normalizedParts = getNormalizedParts(path, rootLength); - return [path.substr(0, rootLength)].concat(normalizedParts); + return [ + path.substr(0, rootLength) + ].concat(normalizedParts); } function getNormalizedPathComponents(path, currentDirectory) { - var path = normalizeSlashes(path); + path = normalizeSlashes(path); var rootLength = getRootLength(path); if (rootLength == 0) { path = combinePaths(normalizeSlashes(currentDirectory), path); @@ -464,7 +472,9 @@ var ts; } } if (rootLength === urlLength) { - return [url]; + return [ + url + ]; } var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); if (indexOfNextSlash !== -1) { @@ -472,7 +482,9 @@ var ts; return normalizedPathComponents(url, rootLength); } else { - return [url + ts.directorySeparator]; + return [ + url + ts.directorySeparator + ]; } } function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { @@ -534,10 +546,14 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [".d.ts", ".ts", ".js"]; + var supportedExtensions = [ + ".d.ts", + ".ts", + ".js" + ]; function removeFileExtension(path) { - for (var i = 0; i < supportedExtensions.length; i++) { - var ext = supportedExtensions[i]; + for (var _i = 0; _i < supportedExtensions.length; _i++) { + var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -588,9 +604,15 @@ var ts; }; return Node; }, - getSymbolConstructor: function () { return Symbol; }, - getTypeConstructor: function () { return Type; }, - getSignatureConstructor: function () { return Signature; } + getSymbolConstructor: function () { + return Symbol; + }, + getTypeConstructor: function () { + return Type; + }, + getSignatureConstructor: function () { + return Signature; + } }; var Debug; (function (Debug) { @@ -688,15 +710,16 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var i = 0; i < files.length; i++) { - var name = files[i]; - if (!extension || ts.fileExtensionIs(name, extension)) { - result.push(ts.combinePaths(path, name)); + for (var _i = 0; _i < files.length; _i++) { + var _name = files[_i]; + if (!extension || ts.fileExtensionIs(_name, extension)) { + result.push(ts.combinePaths(path, _name)); } } var subfolders = getNames(folder.subfolders); - for (var i = 0; i < subfolders.length; i++) { - visitDirectory(ts.combinePaths(path, subfolders[i])); + for (var _a = 0; _a < subfolders.length; _a++) { + var current = subfolders[_a]; + visitDirectory(ts.combinePaths(path, current)); } } } @@ -781,8 +804,9 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var i = 0; i < files.length; i++) { - var name = ts.combinePaths(path, files[i]); + for (var _i = 0; _i < files.length; _i++) { + var current = files[_i]; + var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); if (stat.isFile()) { if (!extension || ts.fileExtensionIs(name, extension)) { @@ -793,8 +817,9 @@ var ts; directories.push(name); } } - for (var i = 0; i < directories.length; i++) { - visitDirectory(directories[i]); + for (var _a = 0; _a < directories.length; _a++) { + var _current = directories[_a]; + visitDirectory(_current); } } } @@ -808,9 +833,14 @@ var ts; readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { - _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + _fs.watchFile(fileName, { + persistent: true, + interval: 250 + }, fileChanged); return { - close: function () { _fs.unwatchFile(fileName, fileChanged); } + close: function () { + _fs.unwatchFile(fileName, fileChanged); + } }; function fileChanged(curr, prev) { if (+curr.mtime <= +prev.mtime) { @@ -866,491 +896,2431 @@ var ts; var ts; (function (ts) { ts.Diagnostics = { - Unterminated_string_literal: { code: 1002, category: 1, key: "Unterminated string literal." }, - Identifier_expected: { code: 1003, category: 1, key: "Identifier expected." }, - _0_expected: { code: 1005, category: 1, key: "'{0}' expected." }, - A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1, key: "A file cannot have a reference to itself." }, - Trailing_comma_not_allowed: { code: 1009, category: 1, key: "Trailing comma not allowed." }, - Asterisk_Slash_expected: { code: 1010, category: 1, key: "'*/' expected." }, - Unexpected_token: { code: 1012, category: 1, key: "Unexpected token." }, - A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1, key: "A rest parameter must be last in a parameter list." }, - Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1, key: "Parameter cannot have question mark and initializer." }, - A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1, key: "A required parameter cannot follow an optional parameter." }, - An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1, key: "An index signature cannot have a rest parameter." }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1, key: "An index signature parameter cannot have an accessibility modifier." }, - An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1, key: "An index signature parameter cannot have a question mark." }, - An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1, key: "An index signature parameter cannot have an initializer." }, - An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1, key: "An index signature must have a type annotation." }, - An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1, key: "An index signature parameter must have a type annotation." }, - An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1, key: "An index signature parameter type must be 'string' or 'number'." }, - A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1, key: "A class or interface declaration can only have one 'extends' clause." }, - An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1, key: "An 'extends' clause must precede an 'implements' clause." }, - A_class_can_only_extend_a_single_class: { code: 1026, category: 1, key: "A class can only extend a single class." }, - A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1, key: "A class declaration can only have one 'implements' clause." }, - Accessibility_modifier_already_seen: { code: 1028, category: 1, key: "Accessibility modifier already seen." }, - _0_modifier_must_precede_1_modifier: { code: 1029, category: 1, key: "'{0}' modifier must precede '{1}' modifier." }, - _0_modifier_already_seen: { code: 1030, category: 1, key: "'{0}' modifier already seen." }, - _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1, key: "'{0}' modifier cannot appear on a class element." }, - An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1, key: "An interface declaration cannot have an 'implements' clause." }, - super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1, key: "'super' must be followed by an argument list or member access." }, - Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1, key: "Only ambient modules can use quoted names." }, - Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1, key: "Statements are not allowed in ambient contexts." }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1, key: "A 'declare' modifier cannot be used in an already ambient context." }, - Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1, key: "Initializers are not allowed in ambient contexts." }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1, key: "'{0}' modifier cannot appear on a module element." }, - A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1, key: "A 'declare' modifier cannot be used with an interface declaration." }, - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, - A_rest_parameter_cannot_be_optional: { code: 1047, category: 1, key: "A rest parameter cannot be optional." }, - A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1, key: "A rest parameter cannot have an initializer." }, - A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1, key: "A 'set' accessor must have exactly one parameter." }, - A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1, key: "A 'set' accessor cannot have an optional parameter." }, - A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1, key: "A 'set' accessor parameter cannot have an initializer." }, - A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1, key: "A 'set' accessor cannot have rest parameter." }, - A_get_accessor_cannot_have_parameters: { code: 1054, category: 1, key: "A 'get' accessor cannot have parameters." }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, - Enum_member_must_have_initializer: { code: 1061, category: 1, key: "Enum member must have initializer." }, - An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1, key: "An export assignment cannot be used in an internal module." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1, key: "Ambient enum elements can only have integer literal initializers." }, - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, - A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1, key: "A 'declare' modifier cannot be used with an import declaration." }, - Invalid_reference_directive_syntax: { code: 1084, category: 1, key: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, - An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1, key: "An accessor cannot be declared in an ambient context." }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1, key: "'{0}' modifier cannot appear on a constructor declaration." }, - _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1, key: "'{0}' modifier cannot appear on a parameter." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1, key: "Type parameters cannot appear on a constructor declaration." }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1, key: "Type annotation cannot appear on a constructor declaration." }, - An_accessor_cannot_have_type_parameters: { code: 1094, category: 1, key: "An accessor cannot have type parameters." }, - A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1, key: "A 'set' accessor cannot have a return type annotation." }, - An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1, key: "An index signature must have exactly one parameter." }, - _0_list_cannot_be_empty: { code: 1097, category: 1, key: "'{0}' list cannot be empty." }, - Type_parameter_list_cannot_be_empty: { code: 1098, category: 1, key: "Type parameter list cannot be empty." }, - Type_argument_list_cannot_be_empty: { code: 1099, category: 1, key: "Type argument list cannot be empty." }, - Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1, key: "Invalid use of '{0}' in strict mode." }, - with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1, key: "'with' statements are not allowed in strict mode." }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1, key: "'delete' cannot be called on an identifier in strict mode." }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, - Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1, key: "Jump target cannot cross function boundary." }, - A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1, key: "A 'return' statement can only be used within a function body." }, - Expression_expected: { code: 1109, category: 1, key: "Expression expected." }, - Type_expected: { code: 1110, category: 1, key: "Type expected." }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: 1, key: "A class member cannot be declared optional." }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: 1, key: "Duplicate label '{0}'" }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1, key: "A 'break' statement can only jump to a label of an enclosing statement." }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1, key: "An object literal cannot have multiple properties with the same name in strict mode." }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1, key: "An object literal cannot have multiple get/set accessors with the same name." }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1, key: "An object literal cannot have property and accessor with the same name." }, - An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1, key: "An export assignment cannot have modifiers." }, - Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1, key: "Octal literals are not allowed in strict mode." }, - A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1, key: "A tuple type element list cannot be empty." }, - Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1, key: "Variable declaration list cannot be empty." }, - Digit_expected: { code: 1124, category: 1, key: "Digit expected." }, - Hexadecimal_digit_expected: { code: 1125, category: 1, key: "Hexadecimal digit expected." }, - Unexpected_end_of_text: { code: 1126, category: 1, key: "Unexpected end of text." }, - Invalid_character: { code: 1127, category: 1, key: "Invalid character." }, - Declaration_or_statement_expected: { code: 1128, category: 1, key: "Declaration or statement expected." }, - Statement_expected: { code: 1129, category: 1, key: "Statement expected." }, - case_or_default_expected: { code: 1130, category: 1, key: "'case' or 'default' expected." }, - Property_or_signature_expected: { code: 1131, category: 1, key: "Property or signature expected." }, - Enum_member_expected: { code: 1132, category: 1, key: "Enum member expected." }, - Type_reference_expected: { code: 1133, category: 1, key: "Type reference expected." }, - Variable_declaration_expected: { code: 1134, category: 1, key: "Variable declaration expected." }, - Argument_expression_expected: { code: 1135, category: 1, key: "Argument expression expected." }, - Property_assignment_expected: { code: 1136, category: 1, key: "Property assignment expected." }, - Expression_or_comma_expected: { code: 1137, category: 1, key: "Expression or comma expected." }, - Parameter_declaration_expected: { code: 1138, category: 1, key: "Parameter declaration expected." }, - Type_parameter_declaration_expected: { code: 1139, category: 1, key: "Type parameter declaration expected." }, - Type_argument_expected: { code: 1140, category: 1, key: "Type argument expected." }, - String_literal_expected: { code: 1141, category: 1, key: "String literal expected." }, - Line_break_not_permitted_here: { code: 1142, category: 1, key: "Line break not permitted here." }, - or_expected: { code: 1144, category: 1, key: "'{' or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1, key: "Modifiers not permitted on index signature members." }, - Declaration_expected: { code: 1146, category: 1, key: "Declaration expected." }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1, key: "Import declarations in an internal module cannot reference an external module." }, - Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1, key: "Cannot compile external modules unless the '--module' flag is provided." }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: 1, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - var_let_or_const_expected: { code: 1152, category: 1, key: "'var', 'let' or 'const' expected." }, - let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_must_be_initialized: { code: 1155, category: 1, key: "'const' declarations must be initialized" }, - const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1, key: "'const' declarations can only be declared inside a block." }, - let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1, key: "'let' declarations can only be declared inside a block." }, - Unterminated_template_literal: { code: 1160, category: 1, key: "Unterminated template literal." }, - Unterminated_regular_expression_literal: { code: 1161, category: 1, key: "Unterminated regular expression literal." }, - An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, - yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, - Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, - A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, - Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, - A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, - A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, - extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, - extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, - Classes_can_only_extend_a_single_class: { code: 1174, category: 1, key: "Classes can only extend a single class." }, - implements_clause_already_seen: { code: 1175, category: 1, key: "'implements' clause already seen." }, - Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1, key: "Interface declaration cannot have 'implements' clause." }, - Binary_digit_expected: { code: 1177, category: 1, key: "Binary digit expected." }, - Octal_digit_expected: { code: 1178, category: 1, key: "Octal digit expected." }, - Unexpected_token_expected: { code: 1179, category: 1, key: "Unexpected token. '{' expected." }, - Property_destructuring_pattern_expected: { code: 1180, category: 1, key: "Property destructuring pattern expected." }, - Array_element_destructuring_pattern_expected: { code: 1181, category: 1, key: "Array element destructuring pattern expected." }, - A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: 1, key: "A destructuring declaration must have an initializer." }, - Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: 1, key: "Destructuring declarations are not allowed in ambient contexts." }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: 1, key: "An implementation cannot be declared in ambient contexts." }, - Modifiers_cannot_appear_here: { code: 1184, category: 1, key: "Modifiers cannot appear here." }, - Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, - A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, - A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, - The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, - The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, - An_import_declaration_cannot_have_modifiers: { code: 1191, category: 1, key: "An import declaration cannot have modifiers." }, - External_module_0_has_no_default_export_or_export_assignment: { code: 1192, category: 1, key: "External module '{0}' has no default export or export assignment." }, - An_export_declaration_cannot_have_modifiers: { code: 1193, category: 1, key: "An export declaration cannot have modifiers." }, - Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: 1, key: "Export declarations are not permitted in an internal module." }, - Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: 1, key: "Catch clause variable name must be an identifier." }, - Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: 1, key: "Catch clause variable cannot have a type annotation." }, - Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: 1, key: "Catch clause variable cannot have an initializer." }, - An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: 1, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, - Unterminated_Unicode_escape_sequence: { code: 1199, category: 1, key: "Unterminated Unicode escape sequence." }, - Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, - Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1, key: "Static members cannot reference class type parameters." }, - Circular_definition_of_import_alias_0: { code: 2303, category: 1, key: "Circular definition of import alias '{0}'." }, - Cannot_find_name_0: { code: 2304, category: 1, key: "Cannot find name '{0}'." }, - Module_0_has_no_exported_member_1: { code: 2305, category: 1, key: "Module '{0}' has no exported member '{1}'." }, - File_0_is_not_an_external_module: { code: 2306, category: 1, key: "File '{0}' is not an external module." }, - Cannot_find_external_module_0: { code: 2307, category: 1, key: "Cannot find external module '{0}'." }, - A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1, key: "A module cannot have more than one export assignment." }, - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1, key: "An export assignment cannot be used in a module with other exported elements." }, - Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1, key: "Type '{0}' recursively references itself as a base type." }, - A_class_may_only_extend_another_class: { code: 2311, category: 1, key: "A class may only extend another class." }, - An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1, key: "An interface may only extend a class or another interface." }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, - Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1, key: "Generic type '{0}' requires {1} type argument(s)." }, - Type_0_is_not_generic: { code: 2315, category: 1, key: "Type '{0}' is not generic." }, - Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, - Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, - Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, - Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, - Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, - Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, - Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, - Property_0_is_missing_in_type_1: { code: 2324, category: 1, key: "Property '{0}' is missing in type '{1}'." }, - Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, - Types_of_property_0_are_incompatible: { code: 2326, category: 1, key: "Types of property '{0}' are incompatible." }, - Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, - Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1, key: "Types of parameters '{0}' and '{1}' are incompatible." }, - Index_signature_is_missing_in_type_0: { code: 2329, category: 1, key: "Index signature is missing in type '{0}'." }, - Index_signatures_are_incompatible: { code: 2330, category: 1, key: "Index signatures are incompatible." }, - this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1, key: "'this' cannot be referenced in a module body." }, - this_cannot_be_referenced_in_current_location: { code: 2332, category: 1, key: "'this' cannot be referenced in current location." }, - this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1, key: "'this' cannot be referenced in constructor arguments." }, - this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1, key: "'this' cannot be referenced in a static property initializer." }, - super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1, key: "'super' can only be referenced in a derived class." }, - super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1, key: "'super' cannot be referenced in constructor arguments." }, - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, - Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, - Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, - Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, - Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, - Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1, key: "Untyped function calls may not accept type arguments." }, - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1, key: "Cannot invoke an expression whose type lacks a call signature." }, - Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1, key: "Only a void function can be called with the 'new' keyword." }, - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, - No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1, key: "No best common type exists among return expressions." }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1, key: "Invalid left-hand side of assignment expression." }, - Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: 1, key: "Type parameter name cannot be '{0}'" }, - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1, key: "A parameter property is only allowed in a constructor implementation." }, - A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1, key: "A rest parameter must be of an array type." }, - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1, key: "A parameter initializer is only allowed in a function or constructor implementation." }, - Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1, key: "Parameter '{0}' cannot be referenced in its initializer." }, - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, - Duplicate_string_index_signature: { code: 2374, category: 1, key: "Duplicate string index signature." }, - Duplicate_number_index_signature: { code: 2375, category: 1, key: "Duplicate number index signature." }, - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, - Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1, key: "Constructors for derived classes must contain a 'super' call." }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, - Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1, key: "Getter and setter accessors do not agree in visibility." }, - get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1, key: "'get' and 'set' accessor must have the same type." }, - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1, key: "A signature with an implementation cannot use a string literal type." }, - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1, key: "Specialized overload signature is not assignable to any non-specialized signature." }, - Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1, key: "Overload signatures must all be exported or not exported." }, - Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1, key: "Overload signatures must all be ambient or non-ambient." }, - Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1, key: "Overload signatures must all be public, private or protected." }, - Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1, key: "Overload signatures must all be optional or required." }, - Function_overload_must_be_static: { code: 2387, category: 1, key: "Function overload must be static." }, - Function_overload_must_not_be_static: { code: 2388, category: 1, key: "Function overload must not be static." }, - Function_implementation_name_must_be_0: { code: 2389, category: 1, key: "Function implementation name must be '{0}'." }, - Constructor_implementation_is_missing: { code: 2390, category: 1, key: "Constructor implementation is missing." }, - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1, key: "Function implementation is missing or not immediately following the declaration." }, - Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1, key: "Multiple constructor implementations are not allowed." }, - Duplicate_function_implementation: { code: 2393, category: 1, key: "Duplicate function implementation." }, - Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1, key: "Overload signature is not compatible with function implementation." }, - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, - Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1, key: "Invalid left-hand side in 'for...in' statement." }, - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, - Setters_cannot_return_a_value: { code: 2408, category: 1, key: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1, key: "Return type of constructor signature must be assignable to the instance type of the class" }, - All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1, key: "All symbols within a 'with' block will be resolved to 'any'." }, - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: 1, key: "Class name cannot be '{0}'" }, - Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1, key: "Class '{0}' incorrectly extends base class '{1}'." }, - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, - Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1, key: "Class '{0}' incorrectly implements interface '{1}'." }, - A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1, key: "A class may only implement another class or interface." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: 1, key: "Interface name cannot be '{0}'" }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1, key: "All declarations of an interface must have identical type parameters." }, - Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1, key: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: 1, key: "Enum name cannot be '{0}'" }, - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, - A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, - Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1, key: "Ambient external modules cannot be nested in other modules." }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1, key: "Ambient external module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1, key: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: 1, key: "Import name cannot be '{0}'" }, - Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1, key: "Import declaration conflicts with local declaration of '{0}'" }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, - Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1, key: "Types have separate declarations of a private property '{0}'." }, - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, - Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, - Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1, key: "Block-scoped variable '{0}' used before its declaration." }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1, key: "The operand of an increment or decrement operator cannot be a constant." }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1, key: "Left-hand side of assignment expression cannot be a constant." }, - Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1, key: "Cannot redeclare block-scoped variable '{0}'." }, - An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1, key: "An enum member cannot have a numeric name." }, - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, - Type_alias_0_circularly_references_itself: { code: 2456, category: 1, key: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: 1, key: "Type alias name cannot be '{0}'" }, - An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1, key: "An AMD module cannot have multiple name assignments." }, - Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: 1, key: "Type '{0}' has no property '{1}' and no string index signature." }, - Type_0_has_no_property_1: { code: 2460, category: 1, key: "Type '{0}' has no property '{1}'." }, - Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, - this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, - super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, - Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, - The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, - Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, - A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, - The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, - Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: 1, key: "Export declaration conflicts with exported declaration of '{0}'" }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: 1, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, - Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: 1, key: "Invalid left-hand side in 'for...of' statement." }, - The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: 1, key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." }, - The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { code: 2489, category: 1, key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." }, - The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: 1, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, - Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: 1, key: "Cannot redeclare identifier '{0}' in catch clause" }, - Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: 1, key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, - Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: 1, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, - Type_0_is_not_an_array_type_or_a_string_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type or a string type." }, - Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, - Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1, key: "Exported variable '{0}' has or is using private name '{1}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, - Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1, key: "Return type of public static method from exported class has or is using private name '{0}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1, key: "Return type of public method from exported class has or is using private name '{0}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1, key: "Return type of method from exported interface has or is using private name '{0}'." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, - Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1, key: "Return type of exported function has or is using private name '{0}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, - Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { code: 4091, category: 1, key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." }, - The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, - Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: 1, key: "Unsupported file encoding." }, - Unknown_compiler_option_0: { code: 5023, category: 1, key: "Unknown compiler option '{0}'." }, - Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1, key: "Compiler option '{0}' requires a value of type {1}." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: 1, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: 1, key: "Option 'project' cannot be mixed with source files on a command line." }, - Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2, key: "Concatenate and emit output to single file." }, - Generates_corresponding_d_ts_file: { code: 6002, category: 2, key: "Generates corresponding '.d.ts' file." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2, key: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, - Watch_input_files: { code: 6005, category: 2, key: "Watch input files." }, - Redirect_output_structure_to_the_directory: { code: 6006, category: 2, key: "Redirect output structure to the directory." }, - Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2, key: "Do not emit outputs if any type checking errors were reported." }, - Do_not_emit_comments_to_output: { code: 6009, category: 2, key: "Do not emit comments to output." }, - Do_not_emit_outputs: { code: 6010, category: 2, key: "Do not emit outputs." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2, key: "Specify module code generation: 'commonjs' or 'amd'" }, - Print_this_message: { code: 6017, category: 2, key: "Print this message." }, - Print_the_compiler_s_version: { code: 6019, category: 2, key: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: 2, key: "Compile the project in the given directory." }, - Syntax_Colon_0: { code: 6023, category: 2, key: "Syntax: {0}" }, - options: { code: 6024, category: 2, key: "options" }, - file: { code: 6025, category: 2, key: "file" }, - Examples_Colon_0: { code: 6026, category: 2, key: "Examples: {0}" }, - Options_Colon: { code: 6027, category: 2, key: "Options:" }, - Version_0: { code: 6029, category: 2, key: "Version {0}" }, - Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2, key: "Insert command line options and files from a file." }, - File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2, key: "File change detected. Starting incremental compilation..." }, - KIND: { code: 6034, category: 2, key: "KIND" }, - FILE: { code: 6035, category: 2, key: "FILE" }, - VERSION: { code: 6036, category: 2, key: "VERSION" }, - LOCATION: { code: 6037, category: 2, key: "LOCATION" }, - DIRECTORY: { code: 6038, category: 2, key: "DIRECTORY" }, - Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2, key: "Compilation complete. Watching for file changes." }, - Generates_corresponding_map_file: { code: 6043, category: 2, key: "Generates corresponding '.map' file." }, - Compiler_option_0_expects_an_argument: { code: 6044, category: 1, key: "Compiler option '{0}' expects an argument." }, - Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, - Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, - Unsupported_locale_0: { code: 6049, category: 1, key: "Unsupported locale '{0}'." }, - Unable_to_open_file_0: { code: 6050, category: 1, key: "Unable to open file '{0}'." }, - Corrupted_locale_file_0: { code: 6051, category: 1, key: "Corrupted locale file {0}." }, - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2, key: "Raise error on expressions and declarations with an implied 'any' type." }, - File_0_not_found: { code: 6053, category: 1, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: 2, key: "Do not emit declarations for code that has an '@internal' annotation." }, - Preserve_new_lines_when_emitting_code: { code: 6057, category: 2, key: "Preserve new-lines when emitting code." }, - Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1, key: "Variable '{0}' implicitly has an '{1}' type." }, - Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1, key: "Parameter '{0}' implicitly has an '{1}' type." }, - Member_0_implicitly_has_an_1_type: { code: 7008, category: 1, key: "Member '{0}' implicitly has an '{1}' type." }, - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, - Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1, key: "Index signature of object type implicitly has an 'any' type." }, - Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, - Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, - _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - You_cannot_rename_this_element: { code: 8000, category: 1, key: "You cannot rename this element." }, - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, - yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, - Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." } + Unterminated_string_literal: { + code: 1002, + category: 1, + key: "Unterminated string literal." + }, + Identifier_expected: { + code: 1003, + category: 1, + key: "Identifier expected." + }, + _0_expected: { + code: 1005, + category: 1, + key: "'{0}' expected." + }, + A_file_cannot_have_a_reference_to_itself: { + code: 1006, + category: 1, + key: "A file cannot have a reference to itself." + }, + Trailing_comma_not_allowed: { + code: 1009, + category: 1, + key: "Trailing comma not allowed." + }, + Asterisk_Slash_expected: { + code: 1010, + category: 1, + key: "'*/' expected." + }, + Unexpected_token: { + code: 1012, + category: 1, + key: "Unexpected token." + }, + A_rest_parameter_must_be_last_in_a_parameter_list: { + code: 1014, + category: 1, + key: "A rest parameter must be last in a parameter list." + }, + Parameter_cannot_have_question_mark_and_initializer: { + code: 1015, + category: 1, + key: "Parameter cannot have question mark and initializer." + }, + A_required_parameter_cannot_follow_an_optional_parameter: { + code: 1016, + category: 1, + key: "A required parameter cannot follow an optional parameter." + }, + An_index_signature_cannot_have_a_rest_parameter: { + code: 1017, + category: 1, + key: "An index signature cannot have a rest parameter." + }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { + code: 1018, + category: 1, + key: "An index signature parameter cannot have an accessibility modifier." + }, + An_index_signature_parameter_cannot_have_a_question_mark: { + code: 1019, + category: 1, + key: "An index signature parameter cannot have a question mark." + }, + An_index_signature_parameter_cannot_have_an_initializer: { + code: 1020, + category: 1, + key: "An index signature parameter cannot have an initializer." + }, + An_index_signature_must_have_a_type_annotation: { + code: 1021, + category: 1, + key: "An index signature must have a type annotation." + }, + An_index_signature_parameter_must_have_a_type_annotation: { + code: 1022, + category: 1, + key: "An index signature parameter must have a type annotation." + }, + An_index_signature_parameter_type_must_be_string_or_number: { + code: 1023, + category: 1, + key: "An index signature parameter type must be 'string' or 'number'." + }, + A_class_or_interface_declaration_can_only_have_one_extends_clause: { + code: 1024, + category: 1, + key: "A class or interface declaration can only have one 'extends' clause." + }, + An_extends_clause_must_precede_an_implements_clause: { + code: 1025, + category: 1, + key: "An 'extends' clause must precede an 'implements' clause." + }, + A_class_can_only_extend_a_single_class: { + code: 1026, + category: 1, + key: "A class can only extend a single class." + }, + A_class_declaration_can_only_have_one_implements_clause: { + code: 1027, + category: 1, + key: "A class declaration can only have one 'implements' clause." + }, + Accessibility_modifier_already_seen: { + code: 1028, + category: 1, + key: "Accessibility modifier already seen." + }, + _0_modifier_must_precede_1_modifier: { + code: 1029, + category: 1, + key: "'{0}' modifier must precede '{1}' modifier." + }, + _0_modifier_already_seen: { + code: 1030, + category: 1, + key: "'{0}' modifier already seen." + }, + _0_modifier_cannot_appear_on_a_class_element: { + code: 1031, + category: 1, + key: "'{0}' modifier cannot appear on a class element." + }, + An_interface_declaration_cannot_have_an_implements_clause: { + code: 1032, + category: 1, + key: "An interface declaration cannot have an 'implements' clause." + }, + super_must_be_followed_by_an_argument_list_or_member_access: { + code: 1034, + category: 1, + key: "'super' must be followed by an argument list or member access." + }, + Only_ambient_modules_can_use_quoted_names: { + code: 1035, + category: 1, + key: "Only ambient modules can use quoted names." + }, + Statements_are_not_allowed_in_ambient_contexts: { + code: 1036, + category: 1, + key: "Statements are not allowed in ambient contexts." + }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { + code: 1038, + category: 1, + key: "A 'declare' modifier cannot be used in an already ambient context." + }, + Initializers_are_not_allowed_in_ambient_contexts: { + code: 1039, + category: 1, + key: "Initializers are not allowed in ambient contexts." + }, + _0_modifier_cannot_appear_on_a_module_element: { + code: 1044, + category: 1, + key: "'{0}' modifier cannot appear on a module element." + }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { + code: 1045, + category: 1, + key: "A 'declare' modifier cannot be used with an interface declaration." + }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { + code: 1046, + category: 1, + key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." + }, + A_rest_parameter_cannot_be_optional: { + code: 1047, + category: 1, + key: "A rest parameter cannot be optional." + }, + A_rest_parameter_cannot_have_an_initializer: { + code: 1048, + category: 1, + key: "A rest parameter cannot have an initializer." + }, + A_set_accessor_must_have_exactly_one_parameter: { + code: 1049, + category: 1, + key: "A 'set' accessor must have exactly one parameter." + }, + A_set_accessor_cannot_have_an_optional_parameter: { + code: 1051, + category: 1, + key: "A 'set' accessor cannot have an optional parameter." + }, + A_set_accessor_parameter_cannot_have_an_initializer: { + code: 1052, + category: 1, + key: "A 'set' accessor parameter cannot have an initializer." + }, + A_set_accessor_cannot_have_rest_parameter: { + code: 1053, + category: 1, + key: "A 'set' accessor cannot have rest parameter." + }, + A_get_accessor_cannot_have_parameters: { + code: 1054, + category: 1, + key: "A 'get' accessor cannot have parameters." + }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { + code: 1056, + category: 1, + key: "Accessors are only available when targeting ECMAScript 5 and higher." + }, + Enum_member_must_have_initializer: { + code: 1061, + category: 1, + key: "Enum member must have initializer." + }, + An_export_assignment_cannot_be_used_in_an_internal_module: { + code: 1063, + category: 1, + key: "An export assignment cannot be used in an internal module." + }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { + code: 1066, + category: 1, + key: "Ambient enum elements can only have integer literal initializers." + }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { + code: 1068, + category: 1, + key: "Unexpected token. A constructor, method, accessor, or property was expected." + }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { + code: 1079, + category: 1, + key: "A 'declare' modifier cannot be used with an import declaration." + }, + Invalid_reference_directive_syntax: { + code: 1084, + category: 1, + key: "Invalid 'reference' directive syntax." + }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { + code: 1085, + category: 1, + key: "Octal literals are not available when targeting ECMAScript 5 and higher." + }, + An_accessor_cannot_be_declared_in_an_ambient_context: { + code: 1086, + category: 1, + key: "An accessor cannot be declared in an ambient context." + }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { + code: 1089, + category: 1, + key: "'{0}' modifier cannot appear on a constructor declaration." + }, + _0_modifier_cannot_appear_on_a_parameter: { + code: 1090, + category: 1, + key: "'{0}' modifier cannot appear on a parameter." + }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { + code: 1091, + category: 1, + key: "Only a single variable declaration is allowed in a 'for...in' statement." + }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { + code: 1092, + category: 1, + key: "Type parameters cannot appear on a constructor declaration." + }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { + code: 1093, + category: 1, + key: "Type annotation cannot appear on a constructor declaration." + }, + An_accessor_cannot_have_type_parameters: { + code: 1094, + category: 1, + key: "An accessor cannot have type parameters." + }, + A_set_accessor_cannot_have_a_return_type_annotation: { + code: 1095, + category: 1, + key: "A 'set' accessor cannot have a return type annotation." + }, + An_index_signature_must_have_exactly_one_parameter: { + code: 1096, + category: 1, + key: "An index signature must have exactly one parameter." + }, + _0_list_cannot_be_empty: { + code: 1097, + category: 1, + key: "'{0}' list cannot be empty." + }, + Type_parameter_list_cannot_be_empty: { + code: 1098, + category: 1, + key: "Type parameter list cannot be empty." + }, + Type_argument_list_cannot_be_empty: { + code: 1099, + category: 1, + key: "Type argument list cannot be empty." + }, + Invalid_use_of_0_in_strict_mode: { + code: 1100, + category: 1, + key: "Invalid use of '{0}' in strict mode." + }, + with_statements_are_not_allowed_in_strict_mode: { + code: 1101, + category: 1, + key: "'with' statements are not allowed in strict mode." + }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { + code: 1102, + category: 1, + key: "'delete' cannot be called on an identifier in strict mode." + }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { + code: 1104, + category: 1, + key: "A 'continue' statement can only be used within an enclosing iteration statement." + }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { + code: 1105, + category: 1, + key: "A 'break' statement can only be used within an enclosing iteration or switch statement." + }, + Jump_target_cannot_cross_function_boundary: { + code: 1107, + category: 1, + key: "Jump target cannot cross function boundary." + }, + A_return_statement_can_only_be_used_within_a_function_body: { + code: 1108, + category: 1, + key: "A 'return' statement can only be used within a function body." + }, + Expression_expected: { + code: 1109, + category: 1, + key: "Expression expected." + }, + Type_expected: { + code: 1110, + category: 1, + key: "Type expected." + }, + A_class_member_cannot_be_declared_optional: { + code: 1112, + category: 1, + key: "A class member cannot be declared optional." + }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { + code: 1113, + category: 1, + key: "A 'default' clause cannot appear more than once in a 'switch' statement." + }, + Duplicate_label_0: { + code: 1114, + category: 1, + key: "Duplicate label '{0}'" + }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { + code: 1115, + category: 1, + key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." + }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { + code: 1116, + category: 1, + key: "A 'break' statement can only jump to a label of an enclosing statement." + }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { + code: 1117, + category: 1, + key: "An object literal cannot have multiple properties with the same name in strict mode." + }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { + code: 1118, + category: 1, + key: "An object literal cannot have multiple get/set accessors with the same name." + }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { + code: 1119, + category: 1, + key: "An object literal cannot have property and accessor with the same name." + }, + An_export_assignment_cannot_have_modifiers: { + code: 1120, + category: 1, + key: "An export assignment cannot have modifiers." + }, + Octal_literals_are_not_allowed_in_strict_mode: { + code: 1121, + category: 1, + key: "Octal literals are not allowed in strict mode." + }, + A_tuple_type_element_list_cannot_be_empty: { + code: 1122, + category: 1, + key: "A tuple type element list cannot be empty." + }, + Variable_declaration_list_cannot_be_empty: { + code: 1123, + category: 1, + key: "Variable declaration list cannot be empty." + }, + Digit_expected: { + code: 1124, + category: 1, + key: "Digit expected." + }, + Hexadecimal_digit_expected: { + code: 1125, + category: 1, + key: "Hexadecimal digit expected." + }, + Unexpected_end_of_text: { + code: 1126, + category: 1, + key: "Unexpected end of text." + }, + Invalid_character: { + code: 1127, + category: 1, + key: "Invalid character." + }, + Declaration_or_statement_expected: { + code: 1128, + category: 1, + key: "Declaration or statement expected." + }, + Statement_expected: { + code: 1129, + category: 1, + key: "Statement expected." + }, + case_or_default_expected: { + code: 1130, + category: 1, + key: "'case' or 'default' expected." + }, + Property_or_signature_expected: { + code: 1131, + category: 1, + key: "Property or signature expected." + }, + Enum_member_expected: { + code: 1132, + category: 1, + key: "Enum member expected." + }, + Type_reference_expected: { + code: 1133, + category: 1, + key: "Type reference expected." + }, + Variable_declaration_expected: { + code: 1134, + category: 1, + key: "Variable declaration expected." + }, + Argument_expression_expected: { + code: 1135, + category: 1, + key: "Argument expression expected." + }, + Property_assignment_expected: { + code: 1136, + category: 1, + key: "Property assignment expected." + }, + Expression_or_comma_expected: { + code: 1137, + category: 1, + key: "Expression or comma expected." + }, + Parameter_declaration_expected: { + code: 1138, + category: 1, + key: "Parameter declaration expected." + }, + Type_parameter_declaration_expected: { + code: 1139, + category: 1, + key: "Type parameter declaration expected." + }, + Type_argument_expected: { + code: 1140, + category: 1, + key: "Type argument expected." + }, + String_literal_expected: { + code: 1141, + category: 1, + key: "String literal expected." + }, + Line_break_not_permitted_here: { + code: 1142, + category: 1, + key: "Line break not permitted here." + }, + or_expected: { + code: 1144, + category: 1, + key: "'{' or ';' expected." + }, + Modifiers_not_permitted_on_index_signature_members: { + code: 1145, + category: 1, + key: "Modifiers not permitted on index signature members." + }, + Declaration_expected: { + code: 1146, + category: 1, + key: "Declaration expected." + }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { + code: 1147, + category: 1, + key: "Import declarations in an internal module cannot reference an external module." + }, + Cannot_compile_external_modules_unless_the_module_flag_is_provided: { + code: 1148, + category: 1, + key: "Cannot compile external modules unless the '--module' flag is provided." + }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { + code: 1149, + category: 1, + key: "File name '{0}' differs from already included file name '{1}' only in casing" + }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { + code: 1150, + category: 1, + key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." + }, + var_let_or_const_expected: { + code: 1152, + category: 1, + key: "'var', 'let' or 'const' expected." + }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1153, + category: 1, + key: "'let' declarations are only available when targeting ECMAScript 6 and higher." + }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1154, + category: 1, + key: "'const' declarations are only available when targeting ECMAScript 6 and higher." + }, + const_declarations_must_be_initialized: { + code: 1155, + category: 1, + key: "'const' declarations must be initialized" + }, + const_declarations_can_only_be_declared_inside_a_block: { + code: 1156, + category: 1, + key: "'const' declarations can only be declared inside a block." + }, + let_declarations_can_only_be_declared_inside_a_block: { + code: 1157, + category: 1, + key: "'let' declarations can only be declared inside a block." + }, + Unterminated_template_literal: { + code: 1160, + category: 1, + key: "Unterminated template literal." + }, + Unterminated_regular_expression_literal: { + code: 1161, + category: 1, + key: "Unterminated regular expression literal." + }, + An_object_member_cannot_be_declared_optional: { + code: 1162, + category: 1, + key: "An object member cannot be declared optional." + }, + yield_expression_must_be_contained_within_a_generator_declaration: { + code: 1163, + category: 1, + key: "'yield' expression must be contained_within a generator declaration." + }, + Computed_property_names_are_not_allowed_in_enums: { + code: 1164, + category: 1, + key: "Computed property names are not allowed in enums." + }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { + code: 1165, + category: 1, + key: "A computed property name in an ambient context must directly refer to a built-in symbol." + }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { + code: 1166, + category: 1, + key: "A computed property name in a class property declaration must directly refer to a built-in symbol." + }, + Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 1167, + category: 1, + key: "Computed property names are only available when targeting ECMAScript 6 and higher." + }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { + code: 1168, + category: 1, + key: "A computed property name in a method overload must directly refer to a built-in symbol." + }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { + code: 1169, + category: 1, + key: "A computed property name in an interface must directly refer to a built-in symbol." + }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { + code: 1170, + category: 1, + key: "A computed property name in a type literal must directly refer to a built-in symbol." + }, + A_comma_expression_is_not_allowed_in_a_computed_property_name: { + code: 1171, + category: 1, + key: "A comma expression is not allowed in a computed property name." + }, + extends_clause_already_seen: { + code: 1172, + category: 1, + key: "'extends' clause already seen." + }, + extends_clause_must_precede_implements_clause: { + code: 1173, + category: 1, + key: "'extends' clause must precede 'implements' clause." + }, + Classes_can_only_extend_a_single_class: { + code: 1174, + category: 1, + key: "Classes can only extend a single class." + }, + implements_clause_already_seen: { + code: 1175, + category: 1, + key: "'implements' clause already seen." + }, + Interface_declaration_cannot_have_implements_clause: { + code: 1176, + category: 1, + key: "Interface declaration cannot have 'implements' clause." + }, + Binary_digit_expected: { + code: 1177, + category: 1, + key: "Binary digit expected." + }, + Octal_digit_expected: { + code: 1178, + category: 1, + key: "Octal digit expected." + }, + Unexpected_token_expected: { + code: 1179, + category: 1, + key: "Unexpected token. '{' expected." + }, + Property_destructuring_pattern_expected: { + code: 1180, + category: 1, + key: "Property destructuring pattern expected." + }, + Array_element_destructuring_pattern_expected: { + code: 1181, + category: 1, + key: "Array element destructuring pattern expected." + }, + A_destructuring_declaration_must_have_an_initializer: { + code: 1182, + category: 1, + key: "A destructuring declaration must have an initializer." + }, + Destructuring_declarations_are_not_allowed_in_ambient_contexts: { + code: 1183, + category: 1, + key: "Destructuring declarations are not allowed in ambient contexts." + }, + An_implementation_cannot_be_declared_in_ambient_contexts: { + code: 1184, + category: 1, + key: "An implementation cannot be declared in ambient contexts." + }, + Modifiers_cannot_appear_here: { + code: 1184, + category: 1, + key: "Modifiers cannot appear here." + }, + Merge_conflict_marker_encountered: { + code: 1185, + category: 1, + key: "Merge conflict marker encountered." + }, + A_rest_element_cannot_have_an_initializer: { + code: 1186, + category: 1, + key: "A rest element cannot have an initializer." + }, + A_parameter_property_may_not_be_a_binding_pattern: { + code: 1187, + category: 1, + key: "A parameter property may not be a binding pattern." + }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { + code: 1188, + category: 1, + key: "Only a single variable declaration is allowed in a 'for...of' statement." + }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { + code: 1189, + category: 1, + key: "The variable declaration of a 'for...in' statement cannot have an initializer." + }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { + code: 1190, + category: 1, + key: "The variable declaration of a 'for...of' statement cannot have an initializer." + }, + An_import_declaration_cannot_have_modifiers: { + code: 1191, + category: 1, + key: "An import declaration cannot have modifiers." + }, + External_module_0_has_no_default_export_or_export_assignment: { + code: 1192, + category: 1, + key: "External module '{0}' has no default export or export assignment." + }, + An_export_declaration_cannot_have_modifiers: { + code: 1193, + category: 1, + key: "An export declaration cannot have modifiers." + }, + Export_declarations_are_not_permitted_in_an_internal_module: { + code: 1194, + category: 1, + key: "Export declarations are not permitted in an internal module." + }, + Catch_clause_variable_name_must_be_an_identifier: { + code: 1195, + category: 1, + key: "Catch clause variable name must be an identifier." + }, + Catch_clause_variable_cannot_have_a_type_annotation: { + code: 1196, + category: 1, + key: "Catch clause variable cannot have a type annotation." + }, + Catch_clause_variable_cannot_have_an_initializer: { + code: 1197, + category: 1, + key: "Catch clause variable cannot have an initializer." + }, + An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { + code: 1198, + category: 1, + key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." + }, + Unterminated_Unicode_escape_sequence: { + code: 1199, + category: 1, + key: "Unterminated Unicode escape sequence." + }, + Duplicate_identifier_0: { + code: 2300, + category: 1, + key: "Duplicate identifier '{0}'." + }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { + code: 2301, + category: 1, + key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." + }, + Static_members_cannot_reference_class_type_parameters: { + code: 2302, + category: 1, + key: "Static members cannot reference class type parameters." + }, + Circular_definition_of_import_alias_0: { + code: 2303, + category: 1, + key: "Circular definition of import alias '{0}'." + }, + Cannot_find_name_0: { + code: 2304, + category: 1, + key: "Cannot find name '{0}'." + }, + Module_0_has_no_exported_member_1: { + code: 2305, + category: 1, + key: "Module '{0}' has no exported member '{1}'." + }, + File_0_is_not_an_external_module: { + code: 2306, + category: 1, + key: "File '{0}' is not an external module." + }, + Cannot_find_external_module_0: { + code: 2307, + category: 1, + key: "Cannot find external module '{0}'." + }, + A_module_cannot_have_more_than_one_export_assignment: { + code: 2308, + category: 1, + key: "A module cannot have more than one export assignment." + }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { + code: 2309, + category: 1, + key: "An export assignment cannot be used in a module with other exported elements." + }, + Type_0_recursively_references_itself_as_a_base_type: { + code: 2310, + category: 1, + key: "Type '{0}' recursively references itself as a base type." + }, + A_class_may_only_extend_another_class: { + code: 2311, + category: 1, + key: "A class may only extend another class." + }, + An_interface_may_only_extend_a_class_or_another_interface: { + code: 2312, + category: 1, + key: "An interface may only extend a class or another interface." + }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { + code: 2313, + category: 1, + key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." + }, + Generic_type_0_requires_1_type_argument_s: { + code: 2314, + category: 1, + key: "Generic type '{0}' requires {1} type argument(s)." + }, + Type_0_is_not_generic: { + code: 2315, + category: 1, + key: "Type '{0}' is not generic." + }, + Global_type_0_must_be_a_class_or_interface_type: { + code: 2316, + category: 1, + key: "Global type '{0}' must be a class or interface type." + }, + Global_type_0_must_have_1_type_parameter_s: { + code: 2317, + category: 1, + key: "Global type '{0}' must have {1} type parameter(s)." + }, + Cannot_find_global_type_0: { + code: 2318, + category: 1, + key: "Cannot find global type '{0}'." + }, + Named_property_0_of_types_1_and_2_are_not_identical: { + code: 2319, + category: 1, + key: "Named property '{0}' of types '{1}' and '{2}' are not identical." + }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { + code: 2320, + category: 1, + key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." + }, + Excessive_stack_depth_comparing_types_0_and_1: { + code: 2321, + category: 1, + key: "Excessive stack depth comparing types '{0}' and '{1}'." + }, + Type_0_is_not_assignable_to_type_1: { + code: 2322, + category: 1, + key: "Type '{0}' is not assignable to type '{1}'." + }, + Property_0_is_missing_in_type_1: { + code: 2324, + category: 1, + key: "Property '{0}' is missing in type '{1}'." + }, + Property_0_is_private_in_type_1_but_not_in_type_2: { + code: 2325, + category: 1, + key: "Property '{0}' is private in type '{1}' but not in type '{2}'." + }, + Types_of_property_0_are_incompatible: { + code: 2326, + category: 1, + key: "Types of property '{0}' are incompatible." + }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { + code: 2327, + category: 1, + key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." + }, + Types_of_parameters_0_and_1_are_incompatible: { + code: 2328, + category: 1, + key: "Types of parameters '{0}' and '{1}' are incompatible." + }, + Index_signature_is_missing_in_type_0: { + code: 2329, + category: 1, + key: "Index signature is missing in type '{0}'." + }, + Index_signatures_are_incompatible: { + code: 2330, + category: 1, + key: "Index signatures are incompatible." + }, + this_cannot_be_referenced_in_a_module_body: { + code: 2331, + category: 1, + key: "'this' cannot be referenced in a module body." + }, + this_cannot_be_referenced_in_current_location: { + code: 2332, + category: 1, + key: "'this' cannot be referenced in current location." + }, + this_cannot_be_referenced_in_constructor_arguments: { + code: 2333, + category: 1, + key: "'this' cannot be referenced in constructor arguments." + }, + this_cannot_be_referenced_in_a_static_property_initializer: { + code: 2334, + category: 1, + key: "'this' cannot be referenced in a static property initializer." + }, + super_can_only_be_referenced_in_a_derived_class: { + code: 2335, + category: 1, + key: "'super' can only be referenced in a derived class." + }, + super_cannot_be_referenced_in_constructor_arguments: { + code: 2336, + category: 1, + key: "'super' cannot be referenced in constructor arguments." + }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { + code: 2337, + category: 1, + key: "Super calls are not permitted outside constructors or in nested functions inside constructors" + }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { + code: 2338, + category: 1, + key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" + }, + Property_0_does_not_exist_on_type_1: { + code: 2339, + category: 1, + key: "Property '{0}' does not exist on type '{1}'." + }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { + code: 2340, + category: 1, + key: "Only public and protected methods of the base class are accessible via the 'super' keyword" + }, + Property_0_is_private_and_only_accessible_within_class_1: { + code: 2341, + category: 1, + key: "Property '{0}' is private and only accessible within class '{1}'." + }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { + code: 2342, + category: 1, + key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." + }, + Type_0_does_not_satisfy_the_constraint_1: { + code: 2344, + category: 1, + key: "Type '{0}' does not satisfy the constraint '{1}'." + }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { + code: 2345, + category: 1, + key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." + }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { + code: 2346, + category: 1, + key: "Supplied parameters do not match any signature of call target." + }, + Untyped_function_calls_may_not_accept_type_arguments: { + code: 2347, + category: 1, + key: "Untyped function calls may not accept type arguments." + }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { + code: 2348, + category: 1, + key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" + }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { + code: 2349, + category: 1, + key: "Cannot invoke an expression whose type lacks a call signature." + }, + Only_a_void_function_can_be_called_with_the_new_keyword: { + code: 2350, + category: 1, + key: "Only a void function can be called with the 'new' keyword." + }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { + code: 2351, + category: 1, + key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." + }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { + code: 2352, + category: 1, + key: "Neither type '{0}' nor type '{1}' is assignable to the other." + }, + No_best_common_type_exists_among_return_expressions: { + code: 2354, + category: 1, + key: "No best common type exists among return expressions." + }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { + code: 2355, + category: 1, + key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." + }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { + code: 2356, + category: 1, + key: "An arithmetic operand must be of type 'any', 'number' or an enum type." + }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { + code: 2357, + category: 1, + key: "The operand of an increment or decrement operator must be a variable, property or indexer." + }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2358, + category: 1, + key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." + }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { + code: 2359, + category: 1, + key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." + }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { + code: 2360, + category: 1, + key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." + }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2361, + category: 1, + key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" + }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { + code: 2362, + category: 1, + key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." + }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { + code: 2363, + category: 1, + key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." + }, + Invalid_left_hand_side_of_assignment_expression: { + code: 2364, + category: 1, + key: "Invalid left-hand side of assignment expression." + }, + Operator_0_cannot_be_applied_to_types_1_and_2: { + code: 2365, + category: 1, + key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." + }, + Type_parameter_name_cannot_be_0: { + code: 2368, + category: 1, + key: "Type parameter name cannot be '{0}'" + }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { + code: 2369, + category: 1, + key: "A parameter property is only allowed in a constructor implementation." + }, + A_rest_parameter_must_be_of_an_array_type: { + code: 2370, + category: 1, + key: "A rest parameter must be of an array type." + }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { + code: 2371, + category: 1, + key: "A parameter initializer is only allowed in a function or constructor implementation." + }, + Parameter_0_cannot_be_referenced_in_its_initializer: { + code: 2372, + category: 1, + key: "Parameter '{0}' cannot be referenced in its initializer." + }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { + code: 2373, + category: 1, + key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." + }, + Duplicate_string_index_signature: { + code: 2374, + category: 1, + key: "Duplicate string index signature." + }, + Duplicate_number_index_signature: { + code: 2375, + category: 1, + key: "Duplicate number index signature." + }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { + code: 2376, + category: 1, + key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." + }, + Constructors_for_derived_classes_must_contain_a_super_call: { + code: 2377, + category: 1, + key: "Constructors for derived classes must contain a 'super' call." + }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { + code: 2378, + category: 1, + key: "A 'get' accessor must return a value or consist of a single 'throw' statement." + }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { + code: 2379, + category: 1, + key: "Getter and setter accessors do not agree in visibility." + }, + get_and_set_accessor_must_have_the_same_type: { + code: 2380, + category: 1, + key: "'get' and 'set' accessor must have the same type." + }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { + code: 2381, + category: 1, + key: "A signature with an implementation cannot use a string literal type." + }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { + code: 2382, + category: 1, + key: "Specialized overload signature is not assignable to any non-specialized signature." + }, + Overload_signatures_must_all_be_exported_or_not_exported: { + code: 2383, + category: 1, + key: "Overload signatures must all be exported or not exported." + }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { + code: 2384, + category: 1, + key: "Overload signatures must all be ambient or non-ambient." + }, + Overload_signatures_must_all_be_public_private_or_protected: { + code: 2385, + category: 1, + key: "Overload signatures must all be public, private or protected." + }, + Overload_signatures_must_all_be_optional_or_required: { + code: 2386, + category: 1, + key: "Overload signatures must all be optional or required." + }, + Function_overload_must_be_static: { + code: 2387, + category: 1, + key: "Function overload must be static." + }, + Function_overload_must_not_be_static: { + code: 2388, + category: 1, + key: "Function overload must not be static." + }, + Function_implementation_name_must_be_0: { + code: 2389, + category: 1, + key: "Function implementation name must be '{0}'." + }, + Constructor_implementation_is_missing: { + code: 2390, + category: 1, + key: "Constructor implementation is missing." + }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { + code: 2391, + category: 1, + key: "Function implementation is missing or not immediately following the declaration." + }, + Multiple_constructor_implementations_are_not_allowed: { + code: 2392, + category: 1, + key: "Multiple constructor implementations are not allowed." + }, + Duplicate_function_implementation: { + code: 2393, + category: 1, + key: "Duplicate function implementation." + }, + Overload_signature_is_not_compatible_with_function_implementation: { + code: 2394, + category: 1, + key: "Overload signature is not compatible with function implementation." + }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { + code: 2395, + category: 1, + key: "Individual declarations in merged declaration {0} must be all exported or all local." + }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { + code: 2396, + category: 1, + key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." + }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { + code: 2399, + category: 1, + key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." + }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { + code: 2400, + category: 1, + key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." + }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { + code: 2401, + category: 1, + key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." + }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { + code: 2402, + category: 1, + key: "Expression resolves to '_super' that compiler uses to capture base class reference." + }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { + code: 2403, + category: 1, + key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." + }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { + code: 2404, + category: 1, + key: "The left-hand side of a 'for...in' statement cannot use a type annotation." + }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { + code: 2405, + category: 1, + key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." + }, + Invalid_left_hand_side_in_for_in_statement: { + code: 2406, + category: 1, + key: "Invalid left-hand side in 'for...in' statement." + }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { + code: 2407, + category: 1, + key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." + }, + Setters_cannot_return_a_value: { + code: 2408, + category: 1, + key: "Setters cannot return a value." + }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { + code: 2409, + category: 1, + key: "Return type of constructor signature must be assignable to the instance type of the class" + }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { + code: 2410, + category: 1, + key: "All symbols within a 'with' block will be resolved to 'any'." + }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { + code: 2411, + category: 1, + key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." + }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { + code: 2412, + category: 1, + key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." + }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { + code: 2413, + category: 1, + key: "Numeric index type '{0}' is not assignable to string index type '{1}'." + }, + Class_name_cannot_be_0: { + code: 2414, + category: 1, + key: "Class name cannot be '{0}'" + }, + Class_0_incorrectly_extends_base_class_1: { + code: 2415, + category: 1, + key: "Class '{0}' incorrectly extends base class '{1}'." + }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { + code: 2417, + category: 1, + key: "Class static side '{0}' incorrectly extends base class static side '{1}'." + }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { + code: 2419, + category: 1, + key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." + }, + Class_0_incorrectly_implements_interface_1: { + code: 2420, + category: 1, + key: "Class '{0}' incorrectly implements interface '{1}'." + }, + A_class_may_only_implement_another_class_or_interface: { + code: 2422, + category: 1, + key: "A class may only implement another class or interface." + }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { + code: 2423, + category: 1, + key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." + }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { + code: 2424, + category: 1, + key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." + }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { + code: 2425, + category: 1, + key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." + }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { + code: 2426, + category: 1, + key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." + }, + Interface_name_cannot_be_0: { + code: 2427, + category: 1, + key: "Interface name cannot be '{0}'" + }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { + code: 2428, + category: 1, + key: "All declarations of an interface must have identical type parameters." + }, + Interface_0_incorrectly_extends_interface_1: { + code: 2430, + category: 1, + key: "Interface '{0}' incorrectly extends interface '{1}'." + }, + Enum_name_cannot_be_0: { + code: 2431, + category: 1, + key: "Enum name cannot be '{0}'" + }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { + code: 2432, + category: 1, + key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." + }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { + code: 2433, + category: 1, + key: "A module declaration cannot be in a different file from a class or function with which it is merged" + }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { + code: 2434, + category: 1, + key: "A module declaration cannot be located prior to a class or function with which it is merged" + }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { + code: 2435, + category: 1, + key: "Ambient external modules cannot be nested in other modules." + }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { + code: 2436, + category: 1, + key: "Ambient external module declaration cannot specify relative module name." + }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { + code: 2437, + category: 1, + key: "Module '{0}' is hidden by a local declaration with the same name" + }, + Import_name_cannot_be_0: { + code: 2438, + category: 1, + key: "Import name cannot be '{0}'" + }, + Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { + code: 2439, + category: 1, + key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." + }, + Import_declaration_conflicts_with_local_declaration_of_0: { + code: 2440, + category: 1, + key: "Import declaration conflicts with local declaration of '{0}'" + }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { + code: 2441, + category: 1, + key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." + }, + Types_have_separate_declarations_of_a_private_property_0: { + code: 2442, + category: 1, + key: "Types have separate declarations of a private property '{0}'." + }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { + code: 2443, + category: 1, + key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." + }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { + code: 2444, + category: 1, + key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." + }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { + code: 2445, + category: 1, + key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." + }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { + code: 2446, + category: 1, + key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." + }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { + code: 2447, + category: 1, + key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." + }, + Block_scoped_variable_0_used_before_its_declaration: { + code: 2448, + category: 1, + key: "Block-scoped variable '{0}' used before its declaration." + }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { + code: 2449, + category: 1, + key: "The operand of an increment or decrement operator cannot be a constant." + }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { + code: 2450, + category: 1, + key: "Left-hand side of assignment expression cannot be a constant." + }, + Cannot_redeclare_block_scoped_variable_0: { + code: 2451, + category: 1, + key: "Cannot redeclare block-scoped variable '{0}'." + }, + An_enum_member_cannot_have_a_numeric_name: { + code: 2452, + category: 1, + key: "An enum member cannot have a numeric name." + }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { + code: 2453, + category: 1, + key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." + }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { + code: 2455, + category: 1, + key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." + }, + Type_alias_0_circularly_references_itself: { + code: 2456, + category: 1, + key: "Type alias '{0}' circularly references itself." + }, + Type_alias_name_cannot_be_0: { + code: 2457, + category: 1, + key: "Type alias name cannot be '{0}'" + }, + An_AMD_module_cannot_have_multiple_name_assignments: { + code: 2458, + category: 1, + key: "An AMD module cannot have multiple name assignments." + }, + Type_0_has_no_property_1_and_no_string_index_signature: { + code: 2459, + category: 1, + key: "Type '{0}' has no property '{1}' and no string index signature." + }, + Type_0_has_no_property_1: { + code: 2460, + category: 1, + key: "Type '{0}' has no property '{1}'." + }, + Type_0_is_not_an_array_type: { + code: 2461, + category: 1, + key: "Type '{0}' is not an array type." + }, + A_rest_element_must_be_last_in_an_array_destructuring_pattern: { + code: 2462, + category: 1, + key: "A rest element must be last in an array destructuring pattern" + }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { + code: 2463, + category: 1, + key: "A binding pattern parameter cannot be optional in an implementation signature." + }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { + code: 2464, + category: 1, + key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." + }, + this_cannot_be_referenced_in_a_computed_property_name: { + code: 2465, + category: 1, + key: "'this' cannot be referenced in a computed property name." + }, + super_cannot_be_referenced_in_a_computed_property_name: { + code: 2466, + category: 1, + key: "'super' cannot be referenced in a computed property name." + }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { + code: 2467, + category: 1, + key: "A computed property name cannot reference a type parameter from its containing type." + }, + Cannot_find_global_value_0: { + code: 2468, + category: 1, + key: "Cannot find global value '{0}'." + }, + The_0_operator_cannot_be_applied_to_type_symbol: { + code: 2469, + category: 1, + key: "The '{0}' operator cannot be applied to type 'symbol'." + }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { + code: 2470, + category: 1, + key: "'Symbol' reference does not refer to the global Symbol constructor object." + }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { + code: 2471, + category: 1, + key: "A computed property name of the form '{0}' must be of type 'symbol'." + }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { + code: 2472, + category: 1, + key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." + }, + Enum_declarations_must_all_be_const_or_non_const: { + code: 2473, + category: 1, + key: "Enum declarations must all be const or non-const." + }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { + code: 2474, + category: 1, + key: "In 'const' enum declarations member initializer must be constant expression." + }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { + code: 2475, + category: 1, + key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." + }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { + code: 2476, + category: 1, + key: "A const enum member can only be accessed using a string literal." + }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { + code: 2477, + category: 1, + key: "'const' enum member initializer was evaluated to a non-finite value." + }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { + code: 2478, + category: 1, + key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." + }, + Property_0_does_not_exist_on_const_enum_1: { + code: 2479, + category: 1, + key: "Property '{0}' does not exist on 'const' enum '{1}'." + }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { + code: 2480, + category: 1, + key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." + }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { + code: 2481, + category: 1, + key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." + }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { + code: 2483, + category: 1, + key: "The left-hand side of a 'for...of' statement cannot use a type annotation." + }, + Export_declaration_conflicts_with_exported_declaration_of_0: { + code: 2484, + category: 1, + key: "Export declaration conflicts with exported declaration of '{0}'" + }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { + code: 2485, + category: 1, + key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." + }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { + code: 2486, + category: 1, + key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." + }, + Invalid_left_hand_side_in_for_of_statement: { + code: 2487, + category: 1, + key: "Invalid left-hand side in 'for...of' statement." + }, + The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { + code: 2488, + category: 1, + key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." + }, + The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { + code: 2489, + category: 1, + key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." + }, + The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { + code: 2490, + category: 1, + key: "The type returned by the 'next()' method of an iterator must have a 'value' property." + }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { + code: 2491, + category: 1, + key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." + }, + Cannot_redeclare_identifier_0_in_catch_clause: { + code: 2492, + category: 1, + key: "Cannot redeclare identifier '{0}' in catch clause" + }, + Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { + code: 2493, + category: 1, + key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." + }, + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { + code: 2494, + category: 1, + key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." + }, + Type_0_is_not_an_array_type_or_a_string_type: { + code: 2461, + category: 1, + key: "Type '{0}' is not an array type or a string type." + }, + Import_declaration_0_is_using_private_name_1: { + code: 4000, + category: 1, + key: "Import declaration '{0}' is using private name '{1}'." + }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4002, + category: 1, + key: "Type parameter '{0}' of exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { + code: 4004, + category: 1, + key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4006, + category: 1, + key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4008, + category: 1, + key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4010, + category: 1, + key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4012, + category: 1, + key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." + }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { + code: 4014, + category: 1, + key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." + }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { + code: 4016, + category: 1, + key: "Type parameter '{0}' of exported function has or is using private name '{1}'." + }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { + code: 4019, + category: 1, + key: "Implements clause of exported class '{0}' has or is using private name '{1}'." + }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { + code: 4020, + category: 1, + key: "Extends clause of exported class '{0}' has or is using private name '{1}'." + }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { + code: 4022, + category: 1, + key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." + }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4023, + category: 1, + key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." + }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { + code: 4024, + category: 1, + key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." + }, + Exported_variable_0_has_or_is_using_private_name_1: { + code: 4025, + category: 1, + key: "Exported variable '{0}' has or is using private name '{1}'." + }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4026, + category: 1, + key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4027, + category: 1, + key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." + }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4028, + category: 1, + key: "Public static property '{0}' of exported class has or is using private name '{1}'." + }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4029, + category: 1, + key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4030, + category: 1, + key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." + }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { + code: 4031, + category: 1, + key: "Public property '{0}' of exported class has or is using private name '{1}'." + }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4032, + category: 1, + key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." + }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { + code: 4033, + category: 1, + key: "Property '{0}' of exported interface has or is using private name '{1}'." + }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4034, + category: 1, + key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { + code: 4035, + category: 1, + key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." + }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4036, + category: 1, + key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { + code: 4037, + category: 1, + key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4038, + category: 1, + key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4039, + category: 1, + key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { + code: 4040, + category: 1, + key: "Return type of public static property getter from exported class has or is using private name '{0}'." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4041, + category: 1, + key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4042, + category: 1, + key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { + code: 4043, + category: 1, + key: "Return type of public property getter from exported class has or is using private name '{0}'." + }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4044, + category: 1, + key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4045, + category: 1, + key: "Return type of constructor signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4046, + category: 1, + key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4047, + category: 1, + key: "Return type of call signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4048, + category: 1, + key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { + code: 4049, + category: 1, + key: "Return type of index signature from exported interface has or is using private name '{0}'." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4050, + category: 1, + key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4051, + category: 1, + key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { + code: 4052, + category: 1, + key: "Return type of public static method from exported class has or is using private name '{0}'." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4053, + category: 1, + key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { + code: 4054, + category: 1, + key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { + code: 4055, + category: 1, + key: "Return type of public method from exported class has or is using private name '{0}'." + }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { + code: 4056, + category: 1, + key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { + code: 4057, + category: 1, + key: "Return type of method from exported interface has or is using private name '{0}'." + }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { + code: 4058, + category: 1, + key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." + }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { + code: 4059, + category: 1, + key: "Return type of exported function has or is using name '{0}' from private module '{1}'." + }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { + code: 4060, + category: 1, + key: "Return type of exported function has or is using private name '{0}'." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4061, + category: 1, + key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4062, + category: 1, + key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { + code: 4063, + category: 1, + key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." + }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4064, + category: 1, + key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4065, + category: 1, + key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4066, + category: 1, + key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { + code: 4067, + category: 1, + key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4068, + category: 1, + key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4069, + category: 1, + key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4070, + category: 1, + key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4071, + category: 1, + key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { + code: 4072, + category: 1, + key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { + code: 4073, + category: 1, + key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." + }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { + code: 4074, + category: 1, + key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { + code: 4075, + category: 1, + key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." + }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { + code: 4076, + category: 1, + key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." + }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { + code: 4077, + category: 1, + key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." + }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { + code: 4078, + category: 1, + key: "Parameter '{0}' of exported function has or is using private name '{1}'." + }, + Exported_type_alias_0_has_or_is_using_private_name_1: { + code: 4081, + category: 1, + key: "Exported type alias '{0}' has or is using private name '{1}'." + }, + Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { + code: 4091, + category: 1, + key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." + }, + The_current_host_does_not_support_the_0_option: { + code: 5001, + category: 1, + key: "The current host does not support the '{0}' option." + }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { + code: 5009, + category: 1, + key: "Cannot find the common subdirectory path for the input files." + }, + Cannot_read_file_0_Colon_1: { + code: 5012, + category: 1, + key: "Cannot read file '{0}': {1}" + }, + Unsupported_file_encoding: { + code: 5013, + category: 1, + key: "Unsupported file encoding." + }, + Unknown_compiler_option_0: { + code: 5023, + category: 1, + key: "Unknown compiler option '{0}'." + }, + Compiler_option_0_requires_a_value_of_type_1: { + code: 5024, + category: 1, + key: "Compiler option '{0}' requires a value of type {1}." + }, + Could_not_write_file_0_Colon_1: { + code: 5033, + category: 1, + key: "Could not write file '{0}': {1}" + }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { + code: 5038, + category: 1, + key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." + }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { + code: 5039, + category: 1, + key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." + }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { + code: 5040, + category: 1, + key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." + }, + Option_noEmit_cannot_be_specified_with_option_declaration: { + code: 5041, + category: 1, + key: "Option 'noEmit' cannot be specified with option 'declaration'." + }, + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { + code: 5042, + category: 1, + key: "Option 'project' cannot be mixed with source files on a command line." + }, + Concatenate_and_emit_output_to_single_file: { + code: 6001, + category: 2, + key: "Concatenate and emit output to single file." + }, + Generates_corresponding_d_ts_file: { + code: 6002, + category: 2, + key: "Generates corresponding '.d.ts' file." + }, + Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { + code: 6003, + category: 2, + key: "Specifies the location where debugger should locate map files instead of generated locations." + }, + Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { + code: 6004, + category: 2, + key: "Specifies the location where debugger should locate TypeScript files instead of source locations." + }, + Watch_input_files: { + code: 6005, + category: 2, + key: "Watch input files." + }, + Redirect_output_structure_to_the_directory: { + code: 6006, + category: 2, + key: "Redirect output structure to the directory." + }, + Do_not_erase_const_enum_declarations_in_generated_code: { + code: 6007, + category: 2, + key: "Do not erase const enum declarations in generated code." + }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { + code: 6008, + category: 2, + key: "Do not emit outputs if any type checking errors were reported." + }, + Do_not_emit_comments_to_output: { + code: 6009, + category: 2, + key: "Do not emit comments to output." + }, + Do_not_emit_outputs: { + code: 6010, + category: 2, + key: "Do not emit outputs." + }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { + code: 6015, + category: 2, + key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" + }, + Specify_module_code_generation_Colon_commonjs_or_amd: { + code: 6016, + category: 2, + key: "Specify module code generation: 'commonjs' or 'amd'" + }, + Print_this_message: { + code: 6017, + category: 2, + key: "Print this message." + }, + Print_the_compiler_s_version: { + code: 6019, + category: 2, + key: "Print the compiler's version." + }, + Compile_the_project_in_the_given_directory: { + code: 6020, + category: 2, + key: "Compile the project in the given directory." + }, + Syntax_Colon_0: { + code: 6023, + category: 2, + key: "Syntax: {0}" + }, + options: { + code: 6024, + category: 2, + key: "options" + }, + file: { + code: 6025, + category: 2, + key: "file" + }, + Examples_Colon_0: { + code: 6026, + category: 2, + key: "Examples: {0}" + }, + Options_Colon: { + code: 6027, + category: 2, + key: "Options:" + }, + Version_0: { + code: 6029, + category: 2, + key: "Version {0}" + }, + Insert_command_line_options_and_files_from_a_file: { + code: 6030, + category: 2, + key: "Insert command line options and files from a file." + }, + File_change_detected_Starting_incremental_compilation: { + code: 6032, + category: 2, + key: "File change detected. Starting incremental compilation..." + }, + KIND: { + code: 6034, + category: 2, + key: "KIND" + }, + FILE: { + code: 6035, + category: 2, + key: "FILE" + }, + VERSION: { + code: 6036, + category: 2, + key: "VERSION" + }, + LOCATION: { + code: 6037, + category: 2, + key: "LOCATION" + }, + DIRECTORY: { + code: 6038, + category: 2, + key: "DIRECTORY" + }, + Compilation_complete_Watching_for_file_changes: { + code: 6042, + category: 2, + key: "Compilation complete. Watching for file changes." + }, + Generates_corresponding_map_file: { + code: 6043, + category: 2, + key: "Generates corresponding '.map' file." + }, + Compiler_option_0_expects_an_argument: { + code: 6044, + category: 1, + key: "Compiler option '{0}' expects an argument." + }, + Unterminated_quoted_string_in_response_file_0: { + code: 6045, + category: 1, + key: "Unterminated quoted string in response file '{0}'." + }, + Argument_for_module_option_must_be_commonjs_or_amd: { + code: 6046, + category: 1, + key: "Argument for '--module' option must be 'commonjs' or 'amd'." + }, + Argument_for_target_option_must_be_es3_es5_or_es6: { + code: 6047, + category: 1, + key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." + }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { + code: 6048, + category: 1, + key: "Locale must be of the form or -. For example '{0}' or '{1}'." + }, + Unsupported_locale_0: { + code: 6049, + category: 1, + key: "Unsupported locale '{0}'." + }, + Unable_to_open_file_0: { + code: 6050, + category: 1, + key: "Unable to open file '{0}'." + }, + Corrupted_locale_file_0: { + code: 6051, + category: 1, + key: "Corrupted locale file {0}." + }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { + code: 6052, + category: 2, + key: "Raise error on expressions and declarations with an implied 'any' type." + }, + File_0_not_found: { + code: 6053, + category: 1, + key: "File '{0}' not found." + }, + File_0_must_have_extension_ts_or_d_ts: { + code: 6054, + category: 1, + key: "File '{0}' must have extension '.ts' or '.d.ts'." + }, + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { + code: 6055, + category: 2, + key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." + }, + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { + code: 6056, + category: 2, + key: "Do not emit declarations for code that has an '@internal' annotation." + }, + Preserve_new_lines_when_emitting_code: { + code: 6057, + category: 2, + key: "Preserve new-lines when emitting code." + }, + Variable_0_implicitly_has_an_1_type: { + code: 7005, + category: 1, + key: "Variable '{0}' implicitly has an '{1}' type." + }, + Parameter_0_implicitly_has_an_1_type: { + code: 7006, + category: 1, + key: "Parameter '{0}' implicitly has an '{1}' type." + }, + Member_0_implicitly_has_an_1_type: { + code: 7008, + category: 1, + key: "Member '{0}' implicitly has an '{1}' type." + }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { + code: 7009, + category: 1, + key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." + }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { + code: 7010, + category: 1, + key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." + }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { + code: 7011, + category: 1, + key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." + }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { + code: 7013, + category: 1, + key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." + }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { + code: 7016, + category: 1, + key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." + }, + Index_signature_of_object_type_implicitly_has_an_any_type: { + code: 7017, + category: 1, + key: "Index signature of object type implicitly has an 'any' type." + }, + Object_literal_s_property_0_implicitly_has_an_1_type: { + code: 7018, + category: 1, + key: "Object literal's property '{0}' implicitly has an '{1}' type." + }, + Rest_parameter_0_implicitly_has_an_any_type: { + code: 7019, + category: 1, + key: "Rest parameter '{0}' implicitly has an 'any[]' type." + }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { + code: 7020, + category: 1, + key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." + }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { + code: 7021, + category: 1, + key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." + }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { + code: 7022, + category: 1, + key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." + }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { + code: 7023, + category: 1, + key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." + }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { + code: 7024, + category: 1, + key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." + }, + You_cannot_rename_this_element: { + code: 8000, + category: 1, + key: "You cannot rename this element." + }, + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { + code: 8001, + category: 1, + key: "You cannot rename elements that are defined in the standard TypeScript library." + }, + yield_expressions_are_not_currently_supported: { + code: 9000, + category: 1, + key: "'yield' expressions are not currently supported." + }, + Generators_are_not_currently_supported: { + code: 9001, + category: 1, + key: "Generators are not currently supported." + }, + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { + code: 9002, + category: 1, + key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." + } }; })(ts || (ts = {})); var ts; @@ -1467,10 +3437,2806 @@ var ts; "|=": 62, "^=": 63 }; - var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierStart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 543, + 546, + 563, + 592, + 685, + 688, + 696, + 699, + 705, + 720, + 721, + 736, + 740, + 750, + 750, + 890, + 890, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 974, + 976, + 983, + 986, + 1011, + 1024, + 1153, + 1164, + 1220, + 1223, + 1224, + 1227, + 1228, + 1232, + 1269, + 1272, + 1273, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1488, + 1514, + 1520, + 1522, + 1569, + 1594, + 1600, + 1610, + 1649, + 1747, + 1749, + 1749, + 1765, + 1766, + 1786, + 1788, + 1808, + 1808, + 1810, + 1836, + 1920, + 1957, + 2309, + 2361, + 2365, + 2365, + 2384, + 2384, + 2392, + 2401, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2524, + 2525, + 2527, + 2529, + 2544, + 2545, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2649, + 2652, + 2654, + 2654, + 2674, + 2676, + 2693, + 2699, + 2701, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2749, + 2749, + 2768, + 2768, + 2784, + 2784, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2870, + 2873, + 2877, + 2877, + 2908, + 2909, + 2911, + 2913, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 2997, + 2999, + 3001, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3168, + 3169, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3294, + 3294, + 3296, + 3297, + 3333, + 3340, + 3342, + 3344, + 3346, + 3368, + 3370, + 3385, + 3424, + 3425, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3585, + 3632, + 3634, + 3635, + 3648, + 3654, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3760, + 3762, + 3763, + 3773, + 3773, + 3776, + 3780, + 3782, + 3782, + 3804, + 3805, + 3840, + 3840, + 3904, + 3911, + 3913, + 3946, + 3976, + 3979, + 4096, + 4129, + 4131, + 4135, + 4137, + 4138, + 4176, + 4181, + 4256, + 4293, + 4304, + 4342, + 4352, + 4441, + 4447, + 4514, + 4520, + 4601, + 4608, + 4614, + 4616, + 4678, + 4680, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4742, + 4744, + 4744, + 4746, + 4749, + 4752, + 4782, + 4784, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4814, + 4816, + 4822, + 4824, + 4846, + 4848, + 4878, + 4880, + 4880, + 4882, + 4885, + 4888, + 4894, + 4896, + 4934, + 4936, + 4954, + 5024, + 5108, + 5121, + 5740, + 5743, + 5750, + 5761, + 5786, + 5792, + 5866, + 6016, + 6067, + 6176, + 6263, + 6272, + 6312, + 7680, + 7835, + 7840, + 7929, + 7936, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8319, + 8319, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8497, + 8499, + 8505, + 8544, + 8579, + 12293, + 12295, + 12321, + 12329, + 12337, + 12341, + 12344, + 12346, + 12353, + 12436, + 12445, + 12446, + 12449, + 12538, + 12540, + 12542, + 12549, + 12588, + 12593, + 12686, + 12704, + 12727, + 13312, + 19893, + 19968, + 40869, + 40960, + 42124, + 44032, + 55203, + 63744, + 64045, + 64256, + 64262, + 64275, + 64279, + 64285, + 64285, + 64287, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65136, + 65138, + 65140, + 65140, + 65142, + 65276, + 65313, + 65338, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES3IdentifierPart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 543, + 546, + 563, + 592, + 685, + 688, + 696, + 699, + 705, + 720, + 721, + 736, + 740, + 750, + 750, + 768, + 846, + 864, + 866, + 890, + 890, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 974, + 976, + 983, + 986, + 1011, + 1024, + 1153, + 1155, + 1158, + 1164, + 1220, + 1223, + 1224, + 1227, + 1228, + 1232, + 1269, + 1272, + 1273, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1425, + 1441, + 1443, + 1465, + 1467, + 1469, + 1471, + 1471, + 1473, + 1474, + 1476, + 1476, + 1488, + 1514, + 1520, + 1522, + 1569, + 1594, + 1600, + 1621, + 1632, + 1641, + 1648, + 1747, + 1749, + 1756, + 1759, + 1768, + 1770, + 1773, + 1776, + 1788, + 1808, + 1836, + 1840, + 1866, + 1920, + 1968, + 2305, + 2307, + 2309, + 2361, + 2364, + 2381, + 2384, + 2388, + 2392, + 2403, + 2406, + 2415, + 2433, + 2435, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2492, + 2492, + 2494, + 2500, + 2503, + 2504, + 2507, + 2509, + 2519, + 2519, + 2524, + 2525, + 2527, + 2531, + 2534, + 2545, + 2562, + 2562, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2620, + 2620, + 2622, + 2626, + 2631, + 2632, + 2635, + 2637, + 2649, + 2652, + 2654, + 2654, + 2662, + 2676, + 2689, + 2691, + 2693, + 2699, + 2701, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2748, + 2757, + 2759, + 2761, + 2763, + 2765, + 2768, + 2768, + 2784, + 2784, + 2790, + 2799, + 2817, + 2819, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2870, + 2873, + 2876, + 2883, + 2887, + 2888, + 2891, + 2893, + 2902, + 2903, + 2908, + 2909, + 2911, + 2913, + 2918, + 2927, + 2946, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 2997, + 2999, + 3001, + 3006, + 3010, + 3014, + 3016, + 3018, + 3021, + 3031, + 3031, + 3047, + 3055, + 3073, + 3075, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3134, + 3140, + 3142, + 3144, + 3146, + 3149, + 3157, + 3158, + 3168, + 3169, + 3174, + 3183, + 3202, + 3203, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3262, + 3268, + 3270, + 3272, + 3274, + 3277, + 3285, + 3286, + 3294, + 3294, + 3296, + 3297, + 3302, + 3311, + 3330, + 3331, + 3333, + 3340, + 3342, + 3344, + 3346, + 3368, + 3370, + 3385, + 3390, + 3395, + 3398, + 3400, + 3402, + 3405, + 3415, + 3415, + 3424, + 3425, + 3430, + 3439, + 3458, + 3459, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3530, + 3530, + 3535, + 3540, + 3542, + 3542, + 3544, + 3551, + 3570, + 3571, + 3585, + 3642, + 3648, + 3662, + 3664, + 3673, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3769, + 3771, + 3773, + 3776, + 3780, + 3782, + 3782, + 3784, + 3789, + 3792, + 3801, + 3804, + 3805, + 3840, + 3840, + 3864, + 3865, + 3872, + 3881, + 3893, + 3893, + 3895, + 3895, + 3897, + 3897, + 3902, + 3911, + 3913, + 3946, + 3953, + 3972, + 3974, + 3979, + 3984, + 3991, + 3993, + 4028, + 4038, + 4038, + 4096, + 4129, + 4131, + 4135, + 4137, + 4138, + 4140, + 4146, + 4150, + 4153, + 4160, + 4169, + 4176, + 4185, + 4256, + 4293, + 4304, + 4342, + 4352, + 4441, + 4447, + 4514, + 4520, + 4601, + 4608, + 4614, + 4616, + 4678, + 4680, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4742, + 4744, + 4744, + 4746, + 4749, + 4752, + 4782, + 4784, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4814, + 4816, + 4822, + 4824, + 4846, + 4848, + 4878, + 4880, + 4880, + 4882, + 4885, + 4888, + 4894, + 4896, + 4934, + 4936, + 4954, + 4969, + 4977, + 5024, + 5108, + 5121, + 5740, + 5743, + 5750, + 5761, + 5786, + 5792, + 5866, + 6016, + 6099, + 6112, + 6121, + 6160, + 6169, + 6176, + 6263, + 6272, + 6313, + 7680, + 7835, + 7840, + 7929, + 7936, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8255, + 8256, + 8319, + 8319, + 8400, + 8412, + 8417, + 8417, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8497, + 8499, + 8505, + 8544, + 8579, + 12293, + 12295, + 12321, + 12335, + 12337, + 12341, + 12344, + 12346, + 12353, + 12436, + 12441, + 12442, + 12445, + 12446, + 12449, + 12542, + 12549, + 12588, + 12593, + 12686, + 12704, + 12727, + 13312, + 19893, + 19968, + 40869, + 40960, + 42124, + 44032, + 55203, + 63744, + 64045, + 64256, + 64262, + 64275, + 64279, + 64285, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65056, + 65059, + 65075, + 65076, + 65101, + 65103, + 65136, + 65138, + 65140, + 65140, + 65142, + 65276, + 65296, + 65305, + 65313, + 65338, + 65343, + 65343, + 65345, + 65370, + 65381, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES5IdentifierStart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 705, + 710, + 721, + 736, + 740, + 748, + 748, + 750, + 750, + 880, + 884, + 886, + 887, + 890, + 893, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 1013, + 1015, + 1153, + 1162, + 1319, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1488, + 1514, + 1520, + 1522, + 1568, + 1610, + 1646, + 1647, + 1649, + 1747, + 1749, + 1749, + 1765, + 1766, + 1774, + 1775, + 1786, + 1788, + 1791, + 1791, + 1808, + 1808, + 1810, + 1839, + 1869, + 1957, + 1969, + 1969, + 1994, + 2026, + 2036, + 2037, + 2042, + 2042, + 2048, + 2069, + 2074, + 2074, + 2084, + 2084, + 2088, + 2088, + 2112, + 2136, + 2208, + 2208, + 2210, + 2220, + 2308, + 2361, + 2365, + 2365, + 2384, + 2384, + 2392, + 2401, + 2417, + 2423, + 2425, + 2431, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2493, + 2493, + 2510, + 2510, + 2524, + 2525, + 2527, + 2529, + 2544, + 2545, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2649, + 2652, + 2654, + 2654, + 2674, + 2676, + 2693, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2749, + 2749, + 2768, + 2768, + 2784, + 2785, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2869, + 2873, + 2877, + 2877, + 2908, + 2909, + 2911, + 2913, + 2929, + 2929, + 2947, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 3001, + 3024, + 3024, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3133, + 3133, + 3160, + 3161, + 3168, + 3169, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3261, + 3261, + 3294, + 3294, + 3296, + 3297, + 3313, + 3314, + 3333, + 3340, + 3342, + 3344, + 3346, + 3386, + 3389, + 3389, + 3406, + 3406, + 3424, + 3425, + 3450, + 3455, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3585, + 3632, + 3634, + 3635, + 3648, + 3654, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3760, + 3762, + 3763, + 3773, + 3773, + 3776, + 3780, + 3782, + 3782, + 3804, + 3807, + 3840, + 3840, + 3904, + 3911, + 3913, + 3948, + 3976, + 3980, + 4096, + 4138, + 4159, + 4159, + 4176, + 4181, + 4186, + 4189, + 4193, + 4193, + 4197, + 4198, + 4206, + 4208, + 4213, + 4225, + 4238, + 4238, + 4256, + 4293, + 4295, + 4295, + 4301, + 4301, + 4304, + 4346, + 4348, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4744, + 4746, + 4749, + 4752, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4822, + 4824, + 4880, + 4882, + 4885, + 4888, + 4954, + 4992, + 5007, + 5024, + 5108, + 5121, + 5740, + 5743, + 5759, + 5761, + 5786, + 5792, + 5866, + 5870, + 5872, + 5888, + 5900, + 5902, + 5905, + 5920, + 5937, + 5952, + 5969, + 5984, + 5996, + 5998, + 6000, + 6016, + 6067, + 6103, + 6103, + 6108, + 6108, + 6176, + 6263, + 6272, + 6312, + 6314, + 6314, + 6320, + 6389, + 6400, + 6428, + 6480, + 6509, + 6512, + 6516, + 6528, + 6571, + 6593, + 6599, + 6656, + 6678, + 6688, + 6740, + 6823, + 6823, + 6917, + 6963, + 6981, + 6987, + 7043, + 7072, + 7086, + 7087, + 7098, + 7141, + 7168, + 7203, + 7245, + 7247, + 7258, + 7293, + 7401, + 7404, + 7406, + 7409, + 7413, + 7414, + 7424, + 7615, + 7680, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8305, + 8305, + 8319, + 8319, + 8336, + 8348, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8505, + 8508, + 8511, + 8517, + 8521, + 8526, + 8526, + 8544, + 8584, + 11264, + 11310, + 11312, + 11358, + 11360, + 11492, + 11499, + 11502, + 11506, + 11507, + 11520, + 11557, + 11559, + 11559, + 11565, + 11565, + 11568, + 11623, + 11631, + 11631, + 11648, + 11670, + 11680, + 11686, + 11688, + 11694, + 11696, + 11702, + 11704, + 11710, + 11712, + 11718, + 11720, + 11726, + 11728, + 11734, + 11736, + 11742, + 11823, + 11823, + 12293, + 12295, + 12321, + 12329, + 12337, + 12341, + 12344, + 12348, + 12353, + 12438, + 12445, + 12447, + 12449, + 12538, + 12540, + 12543, + 12549, + 12589, + 12593, + 12686, + 12704, + 12730, + 12784, + 12799, + 13312, + 19893, + 19968, + 40908, + 40960, + 42124, + 42192, + 42237, + 42240, + 42508, + 42512, + 42527, + 42538, + 42539, + 42560, + 42606, + 42623, + 42647, + 42656, + 42735, + 42775, + 42783, + 42786, + 42888, + 42891, + 42894, + 42896, + 42899, + 42912, + 42922, + 43000, + 43009, + 43011, + 43013, + 43015, + 43018, + 43020, + 43042, + 43072, + 43123, + 43138, + 43187, + 43250, + 43255, + 43259, + 43259, + 43274, + 43301, + 43312, + 43334, + 43360, + 43388, + 43396, + 43442, + 43471, + 43471, + 43520, + 43560, + 43584, + 43586, + 43588, + 43595, + 43616, + 43638, + 43642, + 43642, + 43648, + 43695, + 43697, + 43697, + 43701, + 43702, + 43705, + 43709, + 43712, + 43712, + 43714, + 43714, + 43739, + 43741, + 43744, + 43754, + 43762, + 43764, + 43777, + 43782, + 43785, + 43790, + 43793, + 43798, + 43808, + 43814, + 43816, + 43822, + 43968, + 44002, + 44032, + 55203, + 55216, + 55238, + 55243, + 55291, + 63744, + 64109, + 64112, + 64217, + 64256, + 64262, + 64275, + 64279, + 64285, + 64285, + 64287, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65136, + 65140, + 65142, + 65276, + 65313, + 65338, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; + var unicodeES5IdentifierPart = [ + 170, + 170, + 181, + 181, + 186, + 186, + 192, + 214, + 216, + 246, + 248, + 705, + 710, + 721, + 736, + 740, + 748, + 748, + 750, + 750, + 768, + 884, + 886, + 887, + 890, + 893, + 902, + 902, + 904, + 906, + 908, + 908, + 910, + 929, + 931, + 1013, + 1015, + 1153, + 1155, + 1159, + 1162, + 1319, + 1329, + 1366, + 1369, + 1369, + 1377, + 1415, + 1425, + 1469, + 1471, + 1471, + 1473, + 1474, + 1476, + 1477, + 1479, + 1479, + 1488, + 1514, + 1520, + 1522, + 1552, + 1562, + 1568, + 1641, + 1646, + 1747, + 1749, + 1756, + 1759, + 1768, + 1770, + 1788, + 1791, + 1791, + 1808, + 1866, + 1869, + 1969, + 1984, + 2037, + 2042, + 2042, + 2048, + 2093, + 2112, + 2139, + 2208, + 2208, + 2210, + 2220, + 2276, + 2302, + 2304, + 2403, + 2406, + 2415, + 2417, + 2423, + 2425, + 2431, + 2433, + 2435, + 2437, + 2444, + 2447, + 2448, + 2451, + 2472, + 2474, + 2480, + 2482, + 2482, + 2486, + 2489, + 2492, + 2500, + 2503, + 2504, + 2507, + 2510, + 2519, + 2519, + 2524, + 2525, + 2527, + 2531, + 2534, + 2545, + 2561, + 2563, + 2565, + 2570, + 2575, + 2576, + 2579, + 2600, + 2602, + 2608, + 2610, + 2611, + 2613, + 2614, + 2616, + 2617, + 2620, + 2620, + 2622, + 2626, + 2631, + 2632, + 2635, + 2637, + 2641, + 2641, + 2649, + 2652, + 2654, + 2654, + 2662, + 2677, + 2689, + 2691, + 2693, + 2701, + 2703, + 2705, + 2707, + 2728, + 2730, + 2736, + 2738, + 2739, + 2741, + 2745, + 2748, + 2757, + 2759, + 2761, + 2763, + 2765, + 2768, + 2768, + 2784, + 2787, + 2790, + 2799, + 2817, + 2819, + 2821, + 2828, + 2831, + 2832, + 2835, + 2856, + 2858, + 2864, + 2866, + 2867, + 2869, + 2873, + 2876, + 2884, + 2887, + 2888, + 2891, + 2893, + 2902, + 2903, + 2908, + 2909, + 2911, + 2915, + 2918, + 2927, + 2929, + 2929, + 2946, + 2947, + 2949, + 2954, + 2958, + 2960, + 2962, + 2965, + 2969, + 2970, + 2972, + 2972, + 2974, + 2975, + 2979, + 2980, + 2984, + 2986, + 2990, + 3001, + 3006, + 3010, + 3014, + 3016, + 3018, + 3021, + 3024, + 3024, + 3031, + 3031, + 3046, + 3055, + 3073, + 3075, + 3077, + 3084, + 3086, + 3088, + 3090, + 3112, + 3114, + 3123, + 3125, + 3129, + 3133, + 3140, + 3142, + 3144, + 3146, + 3149, + 3157, + 3158, + 3160, + 3161, + 3168, + 3171, + 3174, + 3183, + 3202, + 3203, + 3205, + 3212, + 3214, + 3216, + 3218, + 3240, + 3242, + 3251, + 3253, + 3257, + 3260, + 3268, + 3270, + 3272, + 3274, + 3277, + 3285, + 3286, + 3294, + 3294, + 3296, + 3299, + 3302, + 3311, + 3313, + 3314, + 3330, + 3331, + 3333, + 3340, + 3342, + 3344, + 3346, + 3386, + 3389, + 3396, + 3398, + 3400, + 3402, + 3406, + 3415, + 3415, + 3424, + 3427, + 3430, + 3439, + 3450, + 3455, + 3458, + 3459, + 3461, + 3478, + 3482, + 3505, + 3507, + 3515, + 3517, + 3517, + 3520, + 3526, + 3530, + 3530, + 3535, + 3540, + 3542, + 3542, + 3544, + 3551, + 3570, + 3571, + 3585, + 3642, + 3648, + 3662, + 3664, + 3673, + 3713, + 3714, + 3716, + 3716, + 3719, + 3720, + 3722, + 3722, + 3725, + 3725, + 3732, + 3735, + 3737, + 3743, + 3745, + 3747, + 3749, + 3749, + 3751, + 3751, + 3754, + 3755, + 3757, + 3769, + 3771, + 3773, + 3776, + 3780, + 3782, + 3782, + 3784, + 3789, + 3792, + 3801, + 3804, + 3807, + 3840, + 3840, + 3864, + 3865, + 3872, + 3881, + 3893, + 3893, + 3895, + 3895, + 3897, + 3897, + 3902, + 3911, + 3913, + 3948, + 3953, + 3972, + 3974, + 3991, + 3993, + 4028, + 4038, + 4038, + 4096, + 4169, + 4176, + 4253, + 4256, + 4293, + 4295, + 4295, + 4301, + 4301, + 4304, + 4346, + 4348, + 4680, + 4682, + 4685, + 4688, + 4694, + 4696, + 4696, + 4698, + 4701, + 4704, + 4744, + 4746, + 4749, + 4752, + 4784, + 4786, + 4789, + 4792, + 4798, + 4800, + 4800, + 4802, + 4805, + 4808, + 4822, + 4824, + 4880, + 4882, + 4885, + 4888, + 4954, + 4957, + 4959, + 4992, + 5007, + 5024, + 5108, + 5121, + 5740, + 5743, + 5759, + 5761, + 5786, + 5792, + 5866, + 5870, + 5872, + 5888, + 5900, + 5902, + 5908, + 5920, + 5940, + 5952, + 5971, + 5984, + 5996, + 5998, + 6000, + 6002, + 6003, + 6016, + 6099, + 6103, + 6103, + 6108, + 6109, + 6112, + 6121, + 6155, + 6157, + 6160, + 6169, + 6176, + 6263, + 6272, + 6314, + 6320, + 6389, + 6400, + 6428, + 6432, + 6443, + 6448, + 6459, + 6470, + 6509, + 6512, + 6516, + 6528, + 6571, + 6576, + 6601, + 6608, + 6617, + 6656, + 6683, + 6688, + 6750, + 6752, + 6780, + 6783, + 6793, + 6800, + 6809, + 6823, + 6823, + 6912, + 6987, + 6992, + 7001, + 7019, + 7027, + 7040, + 7155, + 7168, + 7223, + 7232, + 7241, + 7245, + 7293, + 7376, + 7378, + 7380, + 7414, + 7424, + 7654, + 7676, + 7957, + 7960, + 7965, + 7968, + 8005, + 8008, + 8013, + 8016, + 8023, + 8025, + 8025, + 8027, + 8027, + 8029, + 8029, + 8031, + 8061, + 8064, + 8116, + 8118, + 8124, + 8126, + 8126, + 8130, + 8132, + 8134, + 8140, + 8144, + 8147, + 8150, + 8155, + 8160, + 8172, + 8178, + 8180, + 8182, + 8188, + 8204, + 8205, + 8255, + 8256, + 8276, + 8276, + 8305, + 8305, + 8319, + 8319, + 8336, + 8348, + 8400, + 8412, + 8417, + 8417, + 8421, + 8432, + 8450, + 8450, + 8455, + 8455, + 8458, + 8467, + 8469, + 8469, + 8473, + 8477, + 8484, + 8484, + 8486, + 8486, + 8488, + 8488, + 8490, + 8493, + 8495, + 8505, + 8508, + 8511, + 8517, + 8521, + 8526, + 8526, + 8544, + 8584, + 11264, + 11310, + 11312, + 11358, + 11360, + 11492, + 11499, + 11507, + 11520, + 11557, + 11559, + 11559, + 11565, + 11565, + 11568, + 11623, + 11631, + 11631, + 11647, + 11670, + 11680, + 11686, + 11688, + 11694, + 11696, + 11702, + 11704, + 11710, + 11712, + 11718, + 11720, + 11726, + 11728, + 11734, + 11736, + 11742, + 11744, + 11775, + 11823, + 11823, + 12293, + 12295, + 12321, + 12335, + 12337, + 12341, + 12344, + 12348, + 12353, + 12438, + 12441, + 12442, + 12445, + 12447, + 12449, + 12538, + 12540, + 12543, + 12549, + 12589, + 12593, + 12686, + 12704, + 12730, + 12784, + 12799, + 13312, + 19893, + 19968, + 40908, + 40960, + 42124, + 42192, + 42237, + 42240, + 42508, + 42512, + 42539, + 42560, + 42607, + 42612, + 42621, + 42623, + 42647, + 42655, + 42737, + 42775, + 42783, + 42786, + 42888, + 42891, + 42894, + 42896, + 42899, + 42912, + 42922, + 43000, + 43047, + 43072, + 43123, + 43136, + 43204, + 43216, + 43225, + 43232, + 43255, + 43259, + 43259, + 43264, + 43309, + 43312, + 43347, + 43360, + 43388, + 43392, + 43456, + 43471, + 43481, + 43520, + 43574, + 43584, + 43597, + 43600, + 43609, + 43616, + 43638, + 43642, + 43643, + 43648, + 43714, + 43739, + 43741, + 43744, + 43759, + 43762, + 43766, + 43777, + 43782, + 43785, + 43790, + 43793, + 43798, + 43808, + 43814, + 43816, + 43822, + 43968, + 44010, + 44012, + 44013, + 44016, + 44025, + 44032, + 55203, + 55216, + 55238, + 55243, + 55291, + 63744, + 64109, + 64112, + 64217, + 64256, + 64262, + 64275, + 64279, + 64285, + 64296, + 64298, + 64310, + 64312, + 64316, + 64318, + 64318, + 64320, + 64321, + 64323, + 64324, + 64326, + 64433, + 64467, + 64829, + 64848, + 64911, + 64914, + 64967, + 65008, + 65019, + 65024, + 65039, + 65056, + 65062, + 65075, + 65076, + 65101, + 65103, + 65136, + 65140, + 65142, + 65276, + 65296, + 65305, + 65313, + 65338, + 65343, + 65343, + 65345, + 65370, + 65382, + 65470, + 65474, + 65479, + 65482, + 65487, + 65490, + 65495, + 65498, + 65500, + ]; function lookupInUnicodeMap(code, map) { if (code < map[0]) { return false; @@ -1494,21 +6260,17 @@ var ts; return false; } function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierStart) : - lookupInUnicodeMap(code, unicodeES3IdentifierStart); + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); } ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierPart) : - lookupInUnicodeMap(code, unicodeES3IdentifierPart); + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); } function makeReverseMap(source) { var result = []; - for (var name in source) { - if (source.hasOwnProperty(name)) { - result[source[name]] = name; + for (var _name in source) { + if (source.hasOwnProperty(_name)) { + result[source[_name]] = _name; } } return result; @@ -1575,9 +6337,7 @@ var ts; ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { - return ch === 32 || ch === 9 || ch === 11 || ch === 12 || - ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || - ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { @@ -1664,8 +6424,7 @@ var ts; return false; } } - return ch === 61 || - text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + return ch === 61 || text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } return false; @@ -1684,8 +6443,8 @@ var ts; else { ts.Debug.assert(ch === 61); while (pos < len) { - var ch = text.charCodeAt(pos); - if (ch === 62 && isConflictMarkerTrivia(text, pos)) { + var _ch = text.charCodeAt(pos); + if (_ch === 62 && isConflictMarkerTrivia(text, pos)) { break; } pos++; @@ -1745,7 +6504,11 @@ var ts; if (collecting) { if (!result) result = []; - result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); + result.push({ + pos: startPos, + end: pos, + hasTrailingNewLine: hasTrailingNewLine + }); } continue; } @@ -1772,15 +6535,11 @@ var ts; } ts.getTrailingCommentRanges = getTrailingCommentRanges; function isIdentifierStart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } ts.isIdentifierStart = isIdentifierStart; function isIdentifierPart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; function createScanner(languageVersion, skipTrivia, text, onError) { @@ -1799,14 +6558,10 @@ var ts; } } function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } function isIdentifierPart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } function scanNumber() { var start = pos; @@ -2083,8 +6838,8 @@ var ts; return result; } function getIdentifierToken() { - var len = tokenValue.length; - if (len >= 2 && len <= 11) { + var _len = tokenValue.length; + if (_len >= 2 && _len <= 11) { var ch = tokenValue.charCodeAt(0); if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { return token = textToToken[tokenValue]; @@ -2236,13 +6991,13 @@ var ts; pos += 2; var commentClosed = false; while (pos < len) { - var ch = text.charCodeAt(pos); - if (ch === 42 && text.charCodeAt(pos + 1) === 47) { + var _ch = text.charCodeAt(pos); + if (_ch === 42 && text.charCodeAt(pos + 1) === 47) { pos += 2; commentClosed = true; break; } - if (isLineBreak(ch)) { + if (isLineBreak(_ch)) { precedingLineBreak = true; } pos++; @@ -2275,22 +7030,22 @@ var ts; } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { pos += 2; - var value = scanBinaryOrOctalDigits(2); - if (value < 0) { + var _value = scanBinaryOrOctalDigits(2); + if (_value < 0) { error(ts.Diagnostics.Binary_digit_expected); - value = 0; + _value = 0; } - tokenValue = "" + value; + tokenValue = "" + _value; return token = 7; } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { pos += 2; - var value = scanBinaryOrOctalDigits(8); - if (value < 0) { + var _value_1 = scanBinaryOrOctalDigits(8); + if (_value_1 < 0) { error(ts.Diagnostics.Octal_digit_expected); - value = 0; + _value_1 = 0; } - tokenValue = "" + value; + tokenValue = "" + _value_1; return token = 7; } if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { @@ -2389,10 +7144,10 @@ var ts; case 126: return pos++, token = 47; case 92: - var ch = peekUnicodeEscape(); - if (ch >= 0 && isIdentifierStart(ch)) { + var cookedChar = peekUnicodeEscape(); + if (cookedChar >= 0 && isIdentifierStart(cookedChar)) { pos += 6; - tokenValue = String.fromCharCode(ch) + scanIdentifierParts(); + tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); return token = getIdentifierToken(); } error(ts.Diagnostics.Invalid_character); @@ -2529,17 +7284,39 @@ var ts; } setText(text); return { - getStartPos: function () { return startPos; }, - getTextPos: function () { return pos; }, - getToken: function () { return token; }, - getTokenPos: function () { return tokenPos; }, - getTokenText: function () { return text.substring(tokenPos, pos); }, - getTokenValue: function () { return tokenValue; }, - hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, - hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 64 || token > 100; }, - isReservedWord: function () { return token >= 65 && token <= 100; }, - isUnterminated: function () { return tokenIsUnterminated; }, + getStartPos: function () { + return startPos; + }, + getTextPos: function () { + return pos; + }, + getToken: function () { + return token; + }, + getTokenPos: function () { + return tokenPos; + }, + getTokenText: function () { + return text.substring(tokenPos, pos); + }, + getTokenValue: function () { + return tokenValue; + }, + hasExtendedUnicodeEscape: function () { + return hasExtendedUnicodeEscape; + }, + hasPrecedingLineBreak: function () { + return precedingLineBreak; + }, + isIdentifier: function () { + return token === 64 || token > 100; + }, + isReservedWord: function () { + return token >= 65 && token <= 100; + }, + isUnterminated: function () { + return tokenIsUnterminated; + }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, @@ -2556,8 +7333,8 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var declaration = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; } @@ -2569,9 +7346,13 @@ var ts; function getSingleLineStringWriter() { if (stringWriters.length == 0) { var str = ""; - var writeText = function (text) { return str += text; }; + var writeText = function (text) { + return str += text; + }; return { - string: function () { return str; }, + string: function () { + return str; + }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -2579,11 +7360,18 @@ var ts; writeStringLiteral: writeText, writeParameter: writeText, writeSymbol: writeText, - writeLine: function () { return str += " "; }, - increaseIndent: function () { }, - decreaseIndent: function () { }, - clear: function () { return str = ""; }, - trackSymbol: function () { } + writeLine: function () { + return str += " "; + }, + increaseIndent: function () { + }, + decreaseIndent: function () { + }, + clear: function () { + return str = ""; + }, + trackSymbol: function () { + } }; } return stringWriters.pop(); @@ -2605,8 +7393,7 @@ var ts; ts.containsParseError = containsParseError; function aggregateChildData(node) { if (!(node.parserContextFlags & 64)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || - ts.forEachChild(node, containsParseError); + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { node.parserContextFlags |= 32; } @@ -2685,8 +7472,7 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 12288) !== 0 || - isCatchClauseVariableDeclaration(declaration); + return (getCombinedNodeFlags(declaration) & 12288) !== 0 || isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function getEnclosingBlockScopeContainer(node) { @@ -2714,10 +7500,7 @@ var ts; } ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { - return declaration && - declaration.kind === 193 && - declaration.parent && - declaration.parent.kind === 217; + return declaration && declaration.kind === 193 && declaration.parent && declaration.parent.kind === 217; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -2769,9 +7552,7 @@ var ts; if (errorNode === undefined) { return getSpanOfTokenAtPosition(sourceFile, node.pos); } - var pos = nodeIsMissing(errorNode) - ? errorNode.pos - : ts.skipTrivia(sourceFile.text, errorNode.pos); + var pos = nodeIsMissing(errorNode) ? errorNode.pos : ts.skipTrivia(sourceFile.text, errorNode.pos); return createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; @@ -2834,9 +7615,7 @@ var ts; function getJsDocComments(node, sourceFileOfNode) { return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); function isJsDocComment(comment) { - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && - sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; + return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; } } ts.getJsDocComments = getJsDocComments; @@ -3039,8 +7818,8 @@ var ts; } case 7: case 8: - var parent = node.parent; - switch (parent.kind) { + var _parent = node.parent; + switch (_parent.kind) { case 193: case 128: case 130: @@ -3048,7 +7827,7 @@ var ts; case 220: case 218: case 150: - return parent.initializer === node; + return _parent.initializer === node; case 177: case 178: case 179: @@ -3059,25 +7838,22 @@ var ts; case 214: case 190: case 188: - return parent.expression === node; + return _parent.expression === node; case 181: - var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || - forStatement.condition === node || - forStatement.iterator === node; + var forStatement = _parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || forStatement.condition === node || forStatement.iterator === node; case 182: case 183: - var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || - forInStatement.expression === node; + var forInStatement = _parent; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || forInStatement.expression === node; case 158: - return node === parent.expression; + return node === _parent.expression; case 173: - return node === parent.expression; + return node === _parent.expression; case 126: - return node === parent.expression; + return node === _parent.expression; default: - if (isExpression(parent)) { + if (isExpression(_parent)) { return true; } } @@ -3087,8 +7863,7 @@ var ts; ts.isExpression = isExpression; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 || - (preserveConstEnums && moduleState === 2); + return moduleState === 1 || (preserveConstEnums && moduleState === 2); } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { @@ -3236,14 +8011,14 @@ var ts; if (name.kind !== 64 && name.kind !== 8 && name.kind !== 7) { return false; } - var parent = name.parent; - if (parent.kind === 208 || parent.kind === 212) { - if (parent.propertyName) { + var _parent = name.parent; + if (_parent.kind === 208 || _parent.kind === 212) { + if (_parent.propertyName) { return true; } } - if (isDeclaration(parent)) { - return parent.name === name; + if (isDeclaration(_parent)) { + return _parent.name === name; } return false; } @@ -3265,9 +8040,10 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var i = 0, n = clauses.length; i < n; i++) { - if (clauses[i].token === kind) { - return clauses[i]; + for (var _i = 0; _i < clauses.length; _i++) { + var clause = clauses[_i]; + if (clause.token === kind) { + return clause; } } } @@ -3335,9 +8111,7 @@ var ts; } ts.isTrivia = isTrivia; function hasDynamicName(declaration) { - return declaration.name && - declaration.name.kind === 126 && - !isWellKnownSymbolSyntactically(declaration.name.expression); + return declaration.name && declaration.name.kind === 126 && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { @@ -3441,7 +8215,10 @@ var ts; if (length < 0) { throw new Error("length < 0"); } - return { start: start, length: length }; + return { + start: start, + length: length + }; } ts.createTextSpan = createTextSpan; function createTextSpanFromBounds(start, end) { @@ -3460,7 +8237,10 @@ var ts; if (newLength < 0) { throw new Error("newLength < 0"); } - return { span: span, newLength: newLength }; + return { + span: span, + newLength: newLength + }; } ts.createTextChangeRange = createTextChangeRange; ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); @@ -3508,7 +8288,7 @@ var ts; ts.createSynthesizedNode = createSynthesizedNode; function generateUniqueName(baseName, isExistingName) { if (baseName.charCodeAt(0) !== 95) { - var baseName = "_" + baseName; + baseName = "_" + baseName; if (!isExistingName(baseName)) { return baseName; } @@ -3518,9 +8298,9 @@ var ts; } var i = 1; while (true) { - var name = baseName + i; - if (!isExistingName(name)) { - return name; + var _name = baseName + i; + if (!isExistingName(_name)) { + return _name; } i++; } @@ -3621,9 +8401,9 @@ var ts; } var nonAsciiCharacters = /[^\u0000-\u007F]/g; function escapeNonAsciiCharacters(s) { - return nonAsciiCharacters.test(s) ? - s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) : - s; + return nonAsciiCharacters.test(s) ? s.replace(nonAsciiCharacters, function (c) { + return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); + }) : s; } ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters; })(ts || (ts = {})); @@ -3651,8 +8431,9 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var i = 0, len = nodes.length; i < len; i++) { - var result = cbNode(nodes[i]); + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; + var result = cbNode(node); if (result) { return result; } @@ -3667,12 +8448,9 @@ var ts; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { case 125: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); case 127: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); case 128: case 130: case 129: @@ -3680,22 +8458,13 @@ var ts; case 219: case 193: case 150: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); case 140: case 141: case 136: case 137: case 138: - return visitNodes(cbNodes, node.modifiers) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); case 132: case 131: case 133: @@ -3704,17 +8473,9 @@ var ts; case 160: case 195: case 161: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); case 139: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNodes, node.typeArguments); + return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); case 142: return visitNode(cbNode, node.exprName); case 143: @@ -3735,23 +8496,16 @@ var ts; case 152: return visitNodes(cbNodes, node.properties); case 153: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.dotToken) || - visitNode(cbNode, node.name); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); case 154: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.argumentExpression); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); case 155: case 156: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.typeArguments) || - visitNodes(cbNodes, node.arguments); + return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); case 157: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.template); + return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); case 158: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); case 159: return visitNode(cbNode, node.expression); case 162: @@ -3763,142 +8517,91 @@ var ts; case 165: return visitNode(cbNode, node.operand); case 170: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); case 166: return visitNode(cbNode, node.operand); case 167: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); case 168: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); + return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); case 171: return visitNode(cbNode, node.expression); case 174: case 201: return visitNodes(cbNodes, node.statements); case 221: - return visitNodes(cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); + return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 175: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); case 194: return visitNodes(cbNodes, node.declarations); case 177: return visitNode(cbNode, node.expression); case 178: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); case 179: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); case 180: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 181: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.iterator) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); case 182: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 183: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 184: case 185: return visitNode(cbNode, node.label); case 186: return visitNode(cbNode, node.expression); case 187: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 188: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); case 202: return visitNodes(cbNodes, node.clauses); case 214: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.statements); + return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); case 215: return visitNodes(cbNodes, node.statements); case 189: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); + return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); case 190: return visitNode(cbNode, node.expression); case 191: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); + return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); case 217: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); + return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); case 196: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); case 197: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); case 198: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); case 199: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); case 220: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); + return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 200: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); case 203: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); case 204: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); case 205: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); + return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); case 206: return visitNode(cbNode, node.name); case 207: case 211: return visitNodes(cbNodes, node.elements); case 210: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); case 208: case 212: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); + return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); case 209: - return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); + return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 169: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); case 173: @@ -3914,55 +8617,84 @@ var ts; ts.forEachChild = forEachChild; function parsingContextErrors(context) { switch (context) { - case 0: return ts.Diagnostics.Declaration_or_statement_expected; - case 1: return ts.Diagnostics.Declaration_or_statement_expected; - case 2: return ts.Diagnostics.Statement_expected; - case 3: return ts.Diagnostics.case_or_default_expected; - case 4: return ts.Diagnostics.Statement_expected; - case 5: return ts.Diagnostics.Property_or_signature_expected; - case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; - case 7: return ts.Diagnostics.Enum_member_expected; - case 8: return ts.Diagnostics.Type_reference_expected; - case 9: return ts.Diagnostics.Variable_declaration_expected; - case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; - case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; - case 12: return ts.Diagnostics.Argument_expression_expected; - case 13: return ts.Diagnostics.Property_assignment_expected; - case 14: return ts.Diagnostics.Expression_or_comma_expected; - case 15: return ts.Diagnostics.Parameter_declaration_expected; - case 16: return ts.Diagnostics.Type_parameter_declaration_expected; - case 17: return ts.Diagnostics.Type_argument_expected; - case 18: return ts.Diagnostics.Type_expected; - case 19: return ts.Diagnostics.Unexpected_token_expected; - case 20: return ts.Diagnostics.Identifier_expected; + case 0: + return ts.Diagnostics.Declaration_or_statement_expected; + case 1: + return ts.Diagnostics.Declaration_or_statement_expected; + case 2: + return ts.Diagnostics.Statement_expected; + case 3: + return ts.Diagnostics.case_or_default_expected; + case 4: + return ts.Diagnostics.Statement_expected; + case 5: + return ts.Diagnostics.Property_or_signature_expected; + case 6: + return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7: + return ts.Diagnostics.Enum_member_expected; + case 8: + return ts.Diagnostics.Type_reference_expected; + case 9: + return ts.Diagnostics.Variable_declaration_expected; + case 10: + return ts.Diagnostics.Property_destructuring_pattern_expected; + case 11: + return ts.Diagnostics.Array_element_destructuring_pattern_expected; + case 12: + return ts.Diagnostics.Argument_expression_expected; + case 13: + return ts.Diagnostics.Property_assignment_expected; + case 14: + return ts.Diagnostics.Expression_or_comma_expected; + case 15: + return ts.Diagnostics.Parameter_declaration_expected; + case 16: + return ts.Diagnostics.Type_parameter_declaration_expected; + case 17: + return ts.Diagnostics.Type_argument_expected; + case 18: + return ts.Diagnostics.Type_expected; + case 19: + return ts.Diagnostics.Unexpected_token_expected; + case 20: + return ts.Diagnostics.Identifier_expected; } } ; function modifierToFlag(token) { switch (token) { - case 109: return 128; - case 108: return 16; - case 107: return 64; - case 106: return 32; - case 77: return 1; - case 114: return 2; - case 69: return 8192; - case 72: return 256; + case 109: + return 128; + case 108: + return 16; + case 107: + return 64; + case 106: + return 32; + case 77: + return 1; + case 114: + return 2; + case 69: + return 8192; + case 72: + return 256; } return 0; } ts.modifierToFlag = modifierToFlag; function fixupParentReferences(sourceFile) { - var parent = sourceFile; + var _parent = sourceFile; forEachChild(sourceFile, visitNode); return; function visitNode(n) { - if (n.parent !== parent) { - n.parent = parent; - var saveParent = parent; - parent = n; + if (n.parent !== _parent) { + n.parent = _parent; + var saveParent = _parent; + _parent = n; forEachChild(n, visitNode); - parent = saveParent; + _parent = saveParent; } } } @@ -4000,8 +8732,9 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var i = 0, n = array.length; i < n; i++) { - visitNode(array[i]); + for (var _i = 0; _i < array.length; _i++) { + var node = array[_i]; + visitNode(node); } } } @@ -4063,8 +8796,9 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var i = 0, n = array.length; i < n; i++) { - visitNode(array[i]); + for (var _i = 0; _i < array.length; _i++) { + var node = array[_i]; + visitNode(node); } return; } @@ -4178,8 +8912,7 @@ var ts; } ts.updateSourceFile = updateSourceFile; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 64 && - (node.text === "eval" || node.text === "arguments"); + return node.kind === 64 && (node.text === "eval" || node.text === "arguments"); } ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; function isUseStrictPrologueDirective(sourceFile, node) { @@ -4357,8 +9090,8 @@ var ts; } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); - var length = scanner.getTextPos() - start; - parseErrorAtPosition(start, length, message, arg0); + var _length = scanner.getTextPos() - start; + parseErrorAtPosition(start, _length, message, arg0); } function parseErrorAtPosition(start, length, message, arg0) { var lastError = ts.lastOrUndefined(sourceFile.parseDiagnostics); @@ -4397,9 +9130,7 @@ var ts; var saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; var saveContextFlags = contextFlags; - var result = isLookAhead - ? scanner.lookAhead(callback) - : scanner.tryScan(callback); + var result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); ts.Debug.assert(saveContextFlags === contextFlags); if (!result || isLookAhead) { token = saveToken; @@ -4450,8 +9181,7 @@ var ts; return undefined; } function parseExpectedToken(t, reportAtCurrentPosition, diagnosticMessage, arg0) { - return parseOptionalToken(t) || - createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); + return parseOptionalToken(t) || createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); } function parseTokenNode() { var node = createNode(token); @@ -4528,9 +9258,7 @@ var ts; return createIdentifier(isIdentifierOrKeyword()); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || - token === 8 || - token === 7; + return isIdentifierOrKeyword() || token === 8 || token === 7; } function parsePropertyName() { if (token === 8 || token === 7) { @@ -4583,10 +9311,7 @@ var ts; return canFollowModifier(); } function canFollowModifier() { - return token === 18 - || token === 14 - || token === 35 - || isLiteralPropertyName(); + return token === 18 || token === 14 || token === 35 || isLiteralPropertyName(); } function nextTokenIsClassOrFunction() { nextToken(); @@ -4644,8 +9369,7 @@ var ts; return isIdentifier(); } function isNotHeritageClauseTypeName() { - if (token === 102 || - token === 78) { + if (token === 102 || token === 78) { return lookAhead(nextTokenIsIdentifier); } return false; @@ -5026,9 +9750,7 @@ var ts; var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - if (node.kind === 7 - && sourceText.charCodeAt(tokenPos) === 48 - && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + if (node.kind === 7 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { node.flags |= 16384; } return node; @@ -5067,9 +9789,7 @@ var ts; } function parseParameterType() { if (parseOptional(51)) { - return token === 8 - ? parseLiteralNode(true) - : parseType(); + return token === 8 ? parseLiteralNode(true) : parseType(); } return undefined; } @@ -5184,11 +9904,11 @@ var ts; } function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); - var name = parsePropertyName(); + var _name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (token === 16 || token === 24) { var method = createNode(131, fullStart); - method.name = name; + method.name = _name; method.questionToken = questionToken; fillSignature(51, false, false, method); parseTypeMemberSemicolon(); @@ -5196,7 +9916,7 @@ var ts; } else { var property = createNode(129, fullStart); - property.name = name; + property.name = _name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); parseTypeMemberSemicolon(); @@ -5227,11 +9947,7 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 || - token === 24 || - token === 50 || - token === 51 || - canParseSemicolon(); + return token === 16 || token === 24 || token === 50 || token === 51 || canParseSemicolon(); } function parseTypeMember() { switch (token) { @@ -5239,9 +9955,7 @@ var ts; case 24: return parseSignatureMember(136); case 18: - return isIndexSignature() - ? parseIndexSignatureDeclaration(undefined) - : parsePropertyOrMethodSignature(); + return isIndexSignature() ? parseIndexSignatureDeclaration(undefined) : parsePropertyOrMethodSignature(); case 87: if (lookAhead(isStartOfConstructSignature)) { return parseSignatureMember(137); @@ -5263,9 +9977,7 @@ var ts; } function parseIndexSignatureWithModifiers() { var modifiers = parseModifiers(); - return isIndexSignature() - ? parseIndexSignatureDeclaration(modifiers) - : undefined; + return isIndexSignature() ? parseIndexSignatureDeclaration(modifiers) : undefined; } function isStartOfConstructSignature() { nextToken(); @@ -5371,7 +10083,9 @@ var ts; function parseUnionTypeOrHigher() { var type = parseArrayTypeOrHigher(); if (token === 44) { - var types = [type]; + var types = [ + type + ]; types.pos = type.pos; while (parseOptional(44)) { types.push(parseArrayTypeOrHigher()); @@ -5396,9 +10110,7 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 51 || token === 23 || - token === 50 || token === 52 || - isIdentifier() || ts.isModifier(token)) { + if (token === 51 || token === 23 || token === 50 || token === 52 || isIdentifier() || ts.isModifier(token)) { return true; } if (token === 17) { @@ -5523,11 +10235,14 @@ var ts; nextToken(); return !scanner.hasPrecedingLineBreak() && isIdentifier(); } + function nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() { + nextToken(); + return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 14 || token === 18); + } function parseYieldExpression() { var node = createNode(170); nextToken(); - if (!scanner.hasPrecedingLineBreak() && - (token === 35 || isStartOfExpression())) { + if (!scanner.hasPrecedingLineBreak() && (token === 35 || isStartOfExpression())) { node.asteriskToken = parseOptionalToken(35); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); @@ -5542,7 +10257,9 @@ var ts; var parameter = createNode(128, identifier.pos); parameter.name = identifier; finishNode(parameter); - node.parameters = [parameter]; + node.parameters = [ + parameter + ]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; parseExpected(32); @@ -5554,9 +10271,7 @@ var ts; if (triState === 0) { return undefined; } - var arrowFunction = triState === 1 - ? parseParenthesizedArrowFunctionExpressionHead(true) - : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + var arrowFunction = triState === 1 ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); if (!arrowFunction) { return undefined; } @@ -5778,9 +10493,7 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 90 - ? parseSuperExpression() - : parseMemberExpressionOrHigher(); + var expression = token === 90 ? parseSuperExpression() : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); } function parseMemberExpressionOrHigher() { @@ -5834,9 +10547,7 @@ var ts; if (token === 10 || token === 11) { var tagExpression = createNode(157, expression.pos); tagExpression.tag = expression; - tagExpression.template = token === 10 - ? parseLiteralNode() - : parseTemplateExpression(); + tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); expression = finishNode(tagExpression); continue; } @@ -5859,10 +10570,10 @@ var ts; continue; } else if (token === 16) { - var callExpr = createNode(155, expression.pos); - callExpr.expression = expression; - callExpr.arguments = parseArgumentList(); - expression = finishNode(callExpr); + var _callExpr = createNode(155, expression.pos); + _callExpr.expression = expression; + _callExpr.arguments = parseArgumentList(); + expression = finishNode(_callExpr); continue; } return expression; @@ -5882,9 +10593,7 @@ var ts; if (!parseExpected(25)) { return undefined; } - return typeArguments && canFollowTypeArgumentsInExpression() - ? typeArguments - : undefined; + return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; } function canFollowTypeArgumentsInExpression() { switch (token) { @@ -5959,9 +10668,7 @@ var ts; return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(172) : - parseAssignmentExpressionOrHigher(); + return token === 21 ? parseSpreadElement() : token === 23 ? createNode(172) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return allowInAnd(parseArgumentOrArrayLiteralElement); @@ -6516,15 +11223,15 @@ var ts; } function parsePropertyOrMethodDeclaration(fullStart, modifiers) { var asteriskToken = parseOptionalToken(35); - var name = parsePropertyName(); + var _name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (asteriskToken || token === 16 || token === 24) { - return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); + return parseMethodDeclaration(fullStart, modifiers, asteriskToken, _name, questionToken, ts.Diagnostics.or_expected); } else { var property = createNode(130, fullStart); setModifiers(property, modifiers); - property.name = name; + property.name = _name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); property.initializer = allowInAnd(parseNonParameterInitializer); @@ -6611,11 +11318,7 @@ var ts; if (isIndexSignature()) { return parseIndexSignatureDeclaration(modifiers); } - if (isIdentifierOrKeyword() || - token === 8 || - token === 7 || - token === 35 || - token === 18) { + if (isIdentifierOrKeyword() || token === 8 || token === 7 || token === 35 || token === 18) { return parsePropertyOrMethodDeclaration(fullStart, modifiers); } ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -6628,9 +11331,7 @@ var ts; node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); if (parseExpected(14)) { - node.members = inGeneratorParameterContext() - ? doOutsideOfYieldContext(parseClassMembers) - : parseClassMembers(); + node.members = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); parseExpected(15); } else { @@ -6640,9 +11341,7 @@ var ts; } function parseHeritageClauses(isClassHeritageClause) { if (isHeritageClause()) { - return isClassHeritageClause && inGeneratorParameterContext() - ? doOutsideOfYieldContext(parseHeritageClausesWorker) - : parseHeritageClausesWorker(); + return isClassHeritageClause && inGeneratorParameterContext() ? doOutsideOfYieldContext(parseHeritageClausesWorker) : parseHeritageClausesWorker(); } return undefined; } @@ -6721,9 +11420,7 @@ var ts; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(20) - ? parseInternalModuleTail(getNodePos(), undefined, 1) - : parseModuleBlock(); + node.body = parseOptional(20) ? parseInternalModuleTail(getNodePos(), undefined, 1) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { @@ -6735,21 +11432,17 @@ var ts; } function parseModuleDeclaration(fullStart, modifiers) { parseExpected(116); - return token === 8 - ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) - : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); + return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); } function isExternalModuleReference() { - return token === 117 && - lookAhead(nextTokenIsOpenParen); + return token === 117 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 16; } function nextTokenIsCommaOrFromKeyword() { nextToken(); - return token === 23 || - token === 123; + return token === 23 || token === 123; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, modifiers) { parseExpected(84); @@ -6769,9 +11462,7 @@ var ts; } var importDeclaration = createNode(204, fullStart); setModifiers(importDeclaration, modifiers); - if (identifier || - token === 35 || - token === 14) { + if (identifier || token === 35 || token === 14) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); parseExpected(123); } @@ -6784,16 +11475,13 @@ var ts; if (identifier) { importClause.name = identifier; } - if (!importClause.name || - parseOptional(23)) { + if (!importClause.name || parseOptional(23)) { importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(207); } return finishNode(importClause); } function parseModuleReference() { - return isExternalModuleReference() - ? parseExternalModuleReference() - : parseEntityName(false); + return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); } function parseExternalModuleReference() { var node = createNode(213); @@ -6881,7 +11569,7 @@ var ts; return finishNode(node); } function isLetDeclaration() { - return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOnSameLine); + return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine); } function isDeclarationStart() { switch (token) { @@ -6923,13 +11611,11 @@ var ts; } function nextTokenCanFollowImportKeyword() { nextToken(); - return isIdentifierOrKeyword() || token === 8 || - token === 35 || token === 14; + return isIdentifierOrKeyword() || token === 8 || token === 35 || token === 14; } function nextTokenCanFollowExportKeyword() { nextToken(); - return token === 52 || token === 35 || - token === 14 || token === 72 || isDeclarationStart(); + return token === 52 || token === 35 || token === 14 || token === 72 || isDeclarationStart(); } function nextTokenIsDeclarationStart() { nextToken(); @@ -6983,9 +11669,7 @@ var ts; return parseSourceElementOrModuleElement(); } function parseSourceElementOrModuleElement() { - return isDeclarationStart() - ? parseDeclaration() - : parseStatement(); + return isDeclarationStart() ? parseDeclaration() : parseStatement(); } function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, sourceText); @@ -7000,7 +11684,10 @@ var ts; if (kind !== 2) { break; } - var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; + var range = { + pos: triviaScanner.getTokenPos(), + end: triviaScanner.getTextPos() + }; var comment = sourceText.substring(range.pos, range.end); var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { @@ -7031,7 +11718,10 @@ var ts; var pathMatchResult = pathRegex.exec(comment); var nameMatchResult = nameRegex.exec(comment); if (pathMatchResult) { - var amdDependency = { path: pathMatchResult[2], name: nameMatchResult ? nameMatchResult[2] : undefined }; + var amdDependency = { + path: pathMatchResult[2], + name: nameMatchResult ? nameMatchResult[2] : undefined + }; amdDependencies.push(amdDependency); } } @@ -7043,13 +11733,7 @@ var ts; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 1 - || node.kind === 203 && node.moduleReference.kind === 213 - || node.kind === 204 - || node.kind === 209 - || node.kind === 210 - ? node - : undefined; + return node.flags & 1 || node.kind === 203 && node.moduleReference.kind === 213 || node.kind === 204 || node.kind === 209 || node.kind === 210 ? node : undefined; }); } } @@ -7204,21 +11888,20 @@ var ts; } function declareSymbol(symbols, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); - var name = node.flags & 256 && parent ? "default" : getDeclarationName(node); - if (name !== undefined) { - var symbol = ts.hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); + var _name = node.flags & 256 && parent ? "default" : getDeclarationName(node); + var symbol; + if (_name !== undefined) { + symbol = ts.hasProperty(symbols, _name) ? symbols[_name] : (symbols[_name] = createSymbol(0, _name)); if (symbol.flags & excludes) { if (node.name) { node.name.parent = node; } - var message = symbol.flags & 2 - ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 - : ts.Diagnostics.Duplicate_identifier_0; + var message = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); - symbol = createSymbol(0, name); + symbol = createSymbol(0, _name); } } else { @@ -7259,9 +11942,7 @@ var ts; } else { if (hasExportModifier || isAmbientContext(container)) { - var exportKind = (symbolKind & 107455 ? 1048576 : 0) | - (symbolKind & 793056 ? 2097152 : 0) | - (symbolKind & 1536 ? 4194304 : 0); + var exportKind = (symbolKind & 107455 ? 1048576 : 0) | (symbolKind & 793056 ? 2097152 : 0) | (symbolKind & 1536 ? 4194304 : 0); var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); node.localSymbol = local; @@ -7541,9 +12222,7 @@ var ts; else { bindDeclaration(node, 1, 107455, false); } - if (node.flags & 112 && - node.parent.kind === 133 && - node.parent.parent.kind === 196) { + if (node.flags & 112 && node.parent.kind === 133 && node.parent.parent.kind === 196) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -7574,13 +12253,27 @@ var ts; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0; var emitResolver = createResolver(); + var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); + var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var checker = { - getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, - getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, - getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, - getTypeCount: function () { return typeCount; }, - isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, - isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + getNodeCount: function () { + return ts.sum(host.getSourceFiles(), "nodeCount"); + }, + getIdentifierCount: function () { + return ts.sum(host.getSourceFiles(), "identifierCount"); + }, + getSymbolCount: function () { + return ts.sum(host.getSourceFiles(), "symbolCount"); + }, + getTypeCount: function () { + return typeCount; + }, + isUndefinedSymbol: function (symbol) { + return symbol === undefinedSymbol; + }, + isArgumentsSymbol: function (symbol) { + return symbol === argumentsSymbol; + }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, @@ -7610,8 +12303,6 @@ var ts; getEmitResolver: getEmitResolver, getExportsOfExternalModule: getExportsOfExternalModule }; - var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); - var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var unknownSymbol = createSymbol(4 | 67108864, "unknown"); var resolvingSymbol = createSymbol(67108864, "__resolving__"); var anyType = createIntrinsicType(1, "any"); @@ -7676,9 +12367,7 @@ var ts; return emitResolver; } function error(location, message, arg0, arg1, arg2) { - var diagnostic = location - ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) - : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); + var diagnostic = location ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); diagnostics.add(diagnostic); } function createSymbol(flags, name) { @@ -7764,8 +12453,7 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 || source.flags & 2 - ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { error(node.name ? node.name : node, message, symbolToString(source)); }); @@ -7952,18 +12640,18 @@ var ts; } function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert((result.flags & 2) !== 0); - var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); + var declaration = ts.forEach(result.declarations, function (d) { + return ts.isBlockOrCatchScoped(d) ? d : undefined; + }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { var variableDeclaration = ts.getAncestor(declaration, 193); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 175 || - variableDeclaration.parent.parent.kind === 181) { + if (variableDeclaration.parent.parent.kind === 175 || variableDeclaration.parent.parent.kind === 181) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 183 || - variableDeclaration.parent.parent.kind === 182) { + else if (variableDeclaration.parent.parent.kind === 183 || variableDeclaration.parent.parent.kind === 182) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -7984,15 +12672,12 @@ var ts; return false; } function isAliasSymbolDeclaration(node) { - return node.kind === 203 || - node.kind === 205 && !!node.name || - node.kind === 206 || - node.kind === 208 || - node.kind === 212 || - node.kind === 209; + return node.kind === 203 || node.kind === 205 && !!node.name || node.kind === 206 || node.kind === 208 || node.kind === 212 || node.kind === 209; } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { return isAliasSymbolDeclaration(d) ? d : undefined; }); + return ts.forEach(symbol.declarations, function (d) { + return isAliasSymbolDeclaration(d) ? d : undefined; + }); } function getTargetOfImportEqualsDeclaration(node) { if (node.moduleReference.kind === 213) { @@ -8018,11 +12703,11 @@ var ts; function getExternalModuleMember(node, specifier) { var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); if (moduleSymbol) { - var name = specifier.propertyName || specifier.name; - if (name.text) { - var symbol = getSymbol(getExportsOfSymbol(moduleSymbol), name.text, 107455 | 793056 | 1536); + var _name = specifier.propertyName || specifier.name; + if (_name.text) { + var symbol = getSymbol(getExportsOfSymbol(moduleSymbol), _name.text, 107455 | 793056 | 1536); if (!symbol) { - error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name)); + error(_name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(_name)); return; } return symbol.flags & (107455 | 793056 | 1536) ? symbol : resolveAlias(symbol); @@ -8033,9 +12718,7 @@ var ts; return getExternalModuleMember(node.parent.parent.parent, node); } function getTargetOfExportSpecifier(node) { - return node.parent.parent.moduleSpecifier ? - getExternalModuleMember(node.parent.parent, node) : - resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); + return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); } function getTargetOfExportAssignment(node) { return resolveEntityName(node.expression, 107455 | 793056 | 1536); @@ -8121,8 +12804,9 @@ var ts; if (ts.getFullWidth(name) === 0) { return undefined; } + var symbol; if (name.kind === 64) { - var symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); if (!symbol) { return undefined; } @@ -8133,7 +12817,7 @@ var ts; return undefined; } var right = name.right; - var symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); + symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { error(right, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); return undefined; @@ -8161,14 +12845,17 @@ var ts; return symbol; } } + var sourceFile; while (true) { var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - var sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); - if (sourceFile || isRelative) + sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + if (sourceFile || isRelative) { break; + } var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) + if (parentPath === searchPath) { break; + } searchPath = parentPath; } if (sourceFile) { @@ -8250,9 +12937,7 @@ var ts; return getMergedSymbol(symbol.parent); } function getExportSymbolOfValueSymbolIfExported(symbol) { - return symbol && (symbol.flags & 1048576) !== 0 - ? getMergedSymbol(symbol.exportSymbol) - : symbol; + return symbol && (symbol.flags & 1048576) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; } function symbolIsValue(symbol) { if (symbol.flags & 16777216) { @@ -8268,8 +12953,8 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var i = 0; i < members.length; i++) { - var member = members[i]; + for (var _i = 0; _i < members.length; _i++) { + var member = members[_i]; if (member.kind === 133 && ts.nodeIsPresent(member.body)) { return member; } @@ -8291,10 +12976,7 @@ var ts; return type; } function isReservedMemberName(name) { - return name.charCodeAt(0) === 95 && - name.charCodeAt(1) === 95 && - name.charCodeAt(2) !== 95 && - name.charCodeAt(2) !== 64; + return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && name.charCodeAt(2) !== 95 && name.charCodeAt(2) !== 64; } function getNamedMembers(members) { var result; @@ -8328,25 +13010,25 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var location = enclosingDeclaration; location; location = location.parent) { - if (location.locals && !isGlobalSourceFile(location)) { - if (result = callback(location.locals)) { + for (var _location = enclosingDeclaration; _location; _location = _location.parent) { + if (_location.locals && !isGlobalSourceFile(_location)) { + if (result = callback(_location.locals)) { return result; } } - switch (location.kind) { + switch (_location.kind) { case 221: - if (!ts.isExternalModule(location)) { + if (!ts.isExternalModule(_location)) { break; } case 200: - if (result = callback(getSymbolOfNode(location).exports)) { + if (result = callback(getSymbolOfNode(_location).exports)) { return result; } break; case 196: case 197: - if (result = callback(getSymbolOfNode(location).members)) { + if (result = callback(getSymbolOfNode(_location).members)) { return result; } break; @@ -8368,24 +13050,28 @@ var ts; } function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { - return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && - canQualifySymbol(symbolFromSymbolTable, meaning); + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); } } if (isAccessible(ts.lookUp(symbols, symbol.name))) { - return [symbol]; + return [ + symbol + ]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608) { - if (!useOnlyExternalAliasing || - ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [symbolFromSymbolTable]; + return [ + symbolFromSymbolTable + ]; } var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + return [ + symbolFromSymbolTable + ].concat(accessibleSymbolsFromExports); } } } @@ -8450,7 +13136,9 @@ var ts; errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) }; } - return { accessibility: 0 }; + return { + accessibility: 0 + }; function getExternalModuleContainer(declaration) { for (; declaration; declaration = declaration.parent) { if (hasExternalModuleSymbol(declaration)) { @@ -8460,20 +13148,22 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 200 && declaration.name.kind === 8) || - (declaration.kind === 221 && ts.isExternalModule(declaration)); + return (declaration.kind === 200 && declaration.name.kind === 8) || (declaration.kind === 221 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; - if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { + if (ts.forEach(symbol.declarations, function (declaration) { + return !getIsDeclarationVisible(declaration); + })) { return undefined; } - return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; + return { + accessibility: 0, + aliasesToMakeVisible: aliasesToMakeVisible + }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 203 && - !(declaration.flags & 1) && - isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 203 && !(declaration.flags & 1) && isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -8481,7 +13171,9 @@ var ts; } } else { - aliasesToMakeVisible = [declaration]; + aliasesToMakeVisible = [ + declaration + ]; } return true; } @@ -8495,8 +13187,7 @@ var ts; if (entityName.parent.kind === 142) { meaning = 107455 | 1048576; } - else if (entityName.kind === 125 || - entityName.parent.kind === 203) { + else if (entityName.kind === 125 || entityName.parent.kind === 203) { meaning = 1536; } else { @@ -8582,13 +13273,13 @@ var ts; function walkSymbol(symbol, meaning) { if (symbol) { var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); - if (!accessibleSymbolChain || - needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var i = 0, n = accessibleSymbolChain.length; i < n; i++) { - appendParentTypeArgumentsAndSymbolName(accessibleSymbolChain[i]); + for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { + var accessibleSymbol = accessibleSymbolChain[_i]; + appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } } else { @@ -8615,8 +13306,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { if (type.flags & 1048703) { - writer.writeKeyword(!(globalFlags & 16) && - (type.flags & 1) ? "any" : type.intrinsicName); + writer.writeKeyword(!(globalFlags & 16) && (type.flags & 1) ? "any" : type.intrinsicName); } else if (type.flags & 4096) { writeTypeReference(type, flags); @@ -8709,16 +13399,14 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && - ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && - (type.symbol.parent || - ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 221 || declaration.parent.kind === 201; - })); + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.flags & 128; + })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.parent.kind === 221 || declaration.parent.kind === 201; + })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { - return !!(flags & 2) || - (typeStack && ts.contains(typeStack, type)); + return !!(flags & 2) || (typeStack && ts.contains(typeStack, type)); } } } @@ -8770,15 +13458,17 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var i = 0; i < resolved.callSignatures.length; i++) { - buildSignatureDisplay(resolved.callSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { + var signature = _a[_i]; + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var i = 0; i < resolved.constructSignatures.length; i++) { + for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { + var _signature = _c[_b]; writeKeyword(writer, 87); writeSpace(writer); - buildSignatureDisplay(resolved.constructSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + buildSignatureDisplay(_signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } @@ -8808,17 +13498,18 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var i = 0; i < resolved.properties.length; i++) { - var p = resolved.properties[i]; + for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { + var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var j = 0; j < signatures.length; j++) { + for (var _f = 0; _f < signatures.length; _f++) { + var _signature_1 = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); } - buildSignatureDisplay(signatures[j], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + buildSignatureDisplay(_signature_1, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } @@ -8956,10 +13647,11 @@ var ts; } function isUsedInExportAssignment(node) { var externalModule = getContainingExternalModule(node); + var exportAssignmentSymbol; + var resolvedExportSymbol; if (externalModule) { var externalModuleSymbol = getSymbolOfNode(externalModule); - var exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); - var resolvedExportSymbol; + exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); var symbolOfNode = getSymbolOfNode(node); if (isSymbolUsedInExportAssignment(symbolOfNode)) { return true; @@ -8999,12 +13691,11 @@ var ts; case 195: case 199: case 203: - var parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 203 && parent.kind !== 221 && ts.isInAmbientContext(parent))) { - return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); + var _parent = getDeclarationContainer(node); + if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 203 && _parent.kind !== 221 && ts.isInAmbientContext(_parent))) { + return isGlobalSourceFile(_parent) || isUsedInExportAssignment(node); } - return isDeclarationVisible(parent); + return isDeclarationVisible(_parent); case 130: case 129: case 134: @@ -9056,7 +13747,9 @@ var ts; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); - return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; + return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { + return anyType; + })) : classType; } function getTypeOfPropertyOfType(type, name) { var prop = getPropertyOfType(type, name); @@ -9074,13 +13767,12 @@ var ts; } return parentType; } + var type; if (pattern.kind === 148) { - var name = declaration.propertyName || declaration.name; - var type = getTypeOfPropertyOfType(parentType, name.text) || - isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || - getIndexTypeOfType(parentType, 0); + var _name = declaration.propertyName || declaration.name; + type = getTypeOfPropertyOfType(parentType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); + error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(_name)); return unknownType; } } @@ -9091,7 +13783,7 @@ var ts; } if (!declaration.dotDotDotToken) { var propName = "" + ts.indexOf(pattern.elements, declaration); - var type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1); + type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1); if (!type) { if (isTupleType(parentType)) { error(declaration, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), parentType.elementTypes.length, pattern.elements.length); @@ -9103,7 +13795,7 @@ var ts; } } else { - var type = createArrayType(getIndexTypeOfType(parentType, 1)); + type = createArrayType(getIndexTypeOfType(parentType, 1)); } } return type; @@ -9155,8 +13847,8 @@ var ts; var members = {}; ts.forEach(pattern.elements, function (e) { var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); - var name = e.propertyName || e.name; - var symbol = createSymbol(flags, name.text); + var _name = e.propertyName || e.name; + var symbol = createSymbol(flags, _name.text); symbol.type = getTypeFromBindingElement(e); members[symbol.name] = symbol; }); @@ -9174,9 +13866,7 @@ var ts; return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 148 - ? getTypeFromObjectBindingPattern(pattern) - : getTypeFromArrayBindingPattern(pattern); + return pattern.kind === 148 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -9220,9 +13910,7 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : - ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); } } @@ -9283,8 +13971,8 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 134); - error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + var _getter = ts.getDeclarationOfKind(symbol, 134); + error(_getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } } @@ -9356,7 +14044,9 @@ var ts; ts.forEach(declaration.typeParameters, function (node) { var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); if (!result) { - result = [tp]; + result = [ + tp + ]; } else if (!ts.contains(result, tp)) { result.push(tp); @@ -9461,8 +14151,8 @@ var ts; } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 198); - error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + var _declaration = ts.getDeclarationOfKind(symbol, 198); + error(_declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; } @@ -9518,23 +14208,23 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var i = 0; i < symbols.length; i++) { - var symbol = symbols[i]; + for (var _i = 0; _i < symbols.length; _i++) { + var symbol = symbols[_i]; result[symbol.name] = symbol; } return result; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var i = 0; i < symbols.length; i++) { - var symbol = symbols[i]; + for (var _i = 0; _i < symbols.length; _i++) { + var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var i = 0; i < baseSymbols.length; i++) { - var s = baseSymbols[i]; + for (var _i = 0; _i < baseSymbols.length; _i++) { + var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; } @@ -9542,8 +14232,9 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var i = 0; i < baseSignatures.length; i++) { - signatures.push(baseSignatures[i]); + for (var _i = 0; _i < baseSignatures.length; _i++) { + var signature = baseSignatures[_i]; + signatures.push(signature); } } } @@ -9602,14 +14293,15 @@ var ts; var baseType = classType.baseTypes[0]; var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1); return ts.map(baseSignatures, function (baseSignature) { - var signature = baseType.flags & 4096 ? - getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); + var signature = baseType.flags & 4096 ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); signature.typeParameters = classType.typeParameters; signature.resolvedReturnType = classType; return signature; }); } - return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; + return [ + createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false) + ]; } function createTupleTypeMemberSymbols(memberTypes) { var members = {}; @@ -9638,15 +14330,18 @@ var ts; return true; } function getUnionSignatures(types, kind) { - var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); + var signatureLists = ts.map(types, function (t) { + return getSignaturesOfType(t, kind); + }); var signatures = signatureLists[0]; - for (var i = 0; i < signatures.length; i++) { - if (signatures[i].typeParameters) { + for (var _i = 0; _i < signatures.length; _i++) { + var signature = signatures[_i]; + if (signature.typeParameters) { return emptyArray; } } - for (var i = 1; i < signatureLists.length; i++) { - if (!signatureListsIdentical(signatures, signatureLists[i])) { + for (var _i_1 = 1; _i_1 < signatureLists.length; _i_1++) { + if (!signatureListsIdentical(signatures, signatureLists[_i_1])) { return emptyArray; } } @@ -9654,14 +14349,17 @@ var ts; for (var i = 0; i < result.length; i++) { var s = result[i]; s.resolvedReturnType = undefined; - s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); + s.unionSignatures = ts.map(signatureLists, function (signatures) { + return signatures[i]; + }); } return result; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var i = 0; i < types.length; i++) { - var indexType = getIndexTypeOfType(types[i], kind); + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + var indexType = getIndexTypeOfType(type, kind); if (!indexType) { return undefined; } @@ -9678,17 +14376,22 @@ var ts; } function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; + var members; + var callSignatures; + var constructSignatures; + var stringIndexType; + var numberIndexType; if (symbol.flags & 2048) { - var members = symbol.members; - var callSignatures = getSignaturesOfSymbol(members["__call"]); - var constructSignatures = getSignaturesOfSymbol(members["__new"]); - var stringIndexType = getIndexTypeOfSymbol(symbol, 0); - var numberIndexType = getIndexTypeOfSymbol(symbol, 1); + members = symbol.members; + callSignatures = getSignaturesOfSymbol(members["__call"]); + constructSignatures = getSignaturesOfSymbol(members["__new"]); + stringIndexType = getIndexTypeOfSymbol(symbol, 0); + numberIndexType = getIndexTypeOfSymbol(symbol, 1); } else { - var members = emptySymbols; - var callSignatures = emptyArray; - var constructSignatures = emptyArray; + members = emptySymbols; + callSignatures = emptyArray; + constructSignatures = emptyArray; if (symbol.flags & 1952) { members = getExportsOfSymbol(symbol); } @@ -9706,8 +14409,8 @@ var ts; addInheritedMembers(members, getPropertiesOfObjectType(getTypeOfSymbol(classType.baseTypes[0].symbol))); } } - var stringIndexType = undefined; - var numberIndexType = (symbol.flags & 384) ? stringType : undefined; + stringIndexType = undefined; + numberIndexType = (symbol.flags & 384) ? stringType : undefined; } setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } @@ -9790,15 +14493,18 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var i = 0; i < types.length; i++) { - var type = getApparentType(types[i]); + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); if (!prop) { return undefined; } if (!props) { - props = [prop]; + props = [ + prop + ]; } else { props.push(prop); @@ -9807,12 +14513,12 @@ var ts; } var propTypes = []; var declarations = []; - for (var i = 0; i < props.length; i++) { - var prop = props[i]; - if (prop.declarations) { - declarations.push.apply(declarations, prop.declarations); + for (var _a = 0; _a < props.length; _a++) { + var _prop = props[_a]; + if (_prop.declarations) { + declarations.push.apply(declarations, _prop.declarations); } - propTypes.push(getTypeOfSymbol(prop)); + propTypes.push(getTypeOfSymbol(_prop)); } var result = createSymbol(4 | 67108864 | 268435456, name); result.unionType = unionType; @@ -9849,9 +14555,9 @@ var ts; } } if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) { - var symbol = getPropertyOfObjectType(globalFunctionType, name); - if (symbol) - return symbol; + var _symbol = getPropertyOfObjectType(globalFunctionType, name); + if (_symbol) + return _symbol; } return getPropertyOfObjectType(globalObjectType, name); } @@ -9898,8 +14604,7 @@ var ts; var links = getNodeLinks(declaration); if (!links.resolvedSignature) { var classType = declaration.kind === 133 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; - var typeParameters = classType ? classType.typeParameters : - declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; + var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; @@ -9972,14 +14677,15 @@ var ts; function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { signature.resolvedReturnType = resolvingType; + var type; if (signature.target) { - var type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); + type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); } else if (signature.unionSignatures) { - var type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature)); + type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature)); } else { - var type = getReturnTypeFromBody(signature.declaration); + type = getReturnTypeFromBody(signature.declaration); } if (signature.resolvedReturnType === resolvingType) { signature.resolvedReturnType = type; @@ -10030,8 +14736,12 @@ var ts; var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; - type.callSignatures = !isConstructor ? [signature] : emptyArray; - type.constructSignatures = isConstructor ? [signature] : emptyArray; + type.callSignatures = !isConstructor ? [ + signature + ] : emptyArray; + type.constructSignatures = isConstructor ? [ + signature + ] : emptyArray; signature.isolatedSignatureType = type; } return signature.isolatedSignatureType; @@ -10044,8 +14754,9 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var i = 0; i < len; i++) { - var node = indexSymbol.declarations[i]; + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var node = decl; if (node.parameters.length === 1) { var parameter = node.parameters[0]; if (parameter && parameter.type && parameter.type.kind === syntaxKind) { @@ -10058,9 +14769,7 @@ var ts; } function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); - return declaration - ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType - : undefined; + return declaration ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType : undefined; } function getConstraintOfTypeParameter(type) { if (!type.constraint) { @@ -10083,8 +14792,9 @@ var ts; default: var result = ""; for (var i = 0; i < types.length; i++) { - if (i > 0) + if (i > 0) { result += ","; + } result += types[i].id; } return result; @@ -10092,8 +14802,9 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var i = 0; i < types.length; i++) { - result |= types[i].flags; + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + result |= type.flags; } return result & 786432; } @@ -10114,7 +14825,9 @@ var ts; return links.isIllegalTypeReferenceInConstraint; } var currentNode = typeReferenceNode; - while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { + while (!ts.forEach(typeParameterSymbol.declarations, function (d) { + return d.parent === currentNode.parent; + })) { currentNode = currentNode.parent; } links.isIllegalTypeReferenceInConstraint = currentNode.kind === 127; @@ -10128,7 +14841,9 @@ var ts; if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); if (symbol && (symbol.flags & 262144)) { - links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); + links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { + return d.parent == typeParameter.parent; + }); } } if (links.isIllegalTypeReferenceInConstraint) { @@ -10146,8 +14861,8 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { var symbol = resolveEntityName(node.typeName, 793056); + var type; if (symbol) { - var type; if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { type = unknownType; } @@ -10185,8 +14900,8 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var declaration = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; switch (declaration.kind) { case 196: case 197: @@ -10227,7 +14942,9 @@ var ts; } function createArrayType(elementType) { var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); - return arrayType !== emptyObjectType ? createTypeReference(arrayType, [elementType]) : emptyObjectType; + return arrayType !== emptyObjectType ? createTypeReference(arrayType, [ + elementType + ]) : emptyObjectType; } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); @@ -10268,13 +14985,15 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var i = 0, len = types.length; i < len; i++) { - addTypeToSortedSet(sortedTypes, types[i]); + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -10290,8 +15009,9 @@ var ts; } } function containsAnyType(types) { - for (var i = 0; i < types.length; i++) { - if (types[i].flags & 1) { + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + if (type.flags & 1) { return true; } } @@ -10405,47 +15125,63 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var i = 0; i < items.length; i++) { - result.push(instantiator(items[i], mapper)); + for (var _i = 0; _i < items.length; _i++) { + var v = items[_i]; + result.push(instantiator(v, mapper)); } return result; } return items; } function createUnaryTypeMapper(source, target) { - return function (t) { return t === source ? target : t; }; + return function (t) { + return t === source ? target : t; + }; } function createBinaryTypeMapper(source1, target1, source2, target2) { - return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; + return function (t) { + return t === source1 ? target1 : t === source2 ? target2 : t; + }; } function createTypeMapper(sources, targets) { switch (sources.length) { - case 1: return createUnaryTypeMapper(sources[0], targets[0]); - case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); + case 1: + return createUnaryTypeMapper(sources[0], targets[0]); + case 2: + return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); } return function (t) { for (var i = 0; i < sources.length; i++) { - if (t === sources[i]) + if (t === sources[i]) { return targets[i]; + } } return t; }; } function createUnaryTypeEraser(source) { - return function (t) { return t === source ? anyType : t; }; + return function (t) { + return t === source ? anyType : t; + }; } function createBinaryTypeEraser(source1, source2) { - return function (t) { return t === source1 || t === source2 ? anyType : t; }; + return function (t) { + return t === source1 || t === source2 ? anyType : t; + }; } function createTypeEraser(sources) { switch (sources.length) { - case 1: return createUnaryTypeEraser(sources[0]); - case 2: return createBinaryTypeEraser(sources[0], sources[1]); + case 1: + return createUnaryTypeEraser(sources[0]); + case 2: + return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var i = 0; i < sources.length; i++) { - if (t === sources[i]) + for (var _i = 0; _i < sources.length; _i++) { + var source = sources[_i]; + if (t === source) { return anyType; + } } return t; }; @@ -10464,7 +15200,9 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return mapper2(mapper1(t)); }; + return function (t) { + return mapper2(mapper1(t)); + }; } function instantiateTypeParameter(typeParameter, mapper) { var result = createType(512); @@ -10479,8 +15217,9 @@ var ts; return result; } function instantiateSignature(signature, mapper, eraseTypeParameters) { + var freshTypeParameters; if (signature.typeParameters && !eraseTypeParameters) { - var freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); + freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); } var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), signature.resolvedReturnType ? instantiateType(signature.resolvedReturnType, mapper) : undefined, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); @@ -10524,8 +15263,7 @@ var ts; return mapper(type); } if (type.flags & 32768) { - return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? - instantiateAnonymousType(type, mapper) : type; + return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096) { return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); @@ -10550,11 +15288,9 @@ var ts; case 151: return ts.forEach(node.elements, isContextSensitive); case 168: - return isContextSensitive(node.whenTrue) || - isContextSensitive(node.whenFalse); + return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); case 167: - return node.operatorToken.kind === 49 && - (isContextSensitive(node.left) || isContextSensitive(node.right)); + return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); case 218: return isContextSensitive(node.initializer); case 132: @@ -10566,7 +15302,9 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { + return p.type; + }); } function getTypeWithoutConstructors(type) { if (type.flags & 48128) { @@ -10637,7 +15375,7 @@ var ts; } function isRelatedTo(source, target, reportErrors, headMessage, elaborateErrors) { if (elaborateErrors === void 0) { elaborateErrors = false; } - var result; + var _result; if (source === target) return -1; if (relation !== identityRelation) { @@ -10661,54 +15399,53 @@ var ts; if (source.flags & 16384 || target.flags & 16384) { if (relation === identityRelation) { if (source.flags & 16384 && target.flags & 16384) { - if (result = unionTypeRelatedToUnionType(source, target)) { - if (result &= unionTypeRelatedToUnionType(target, source)) { - return result; + if (_result = unionTypeRelatedToUnionType(source, target)) { + if (_result &= unionTypeRelatedToUnionType(target, source)) { + return _result; } } } else if (source.flags & 16384) { - if (result = unionTypeRelatedToType(source, target, reportErrors)) { - return result; + if (_result = unionTypeRelatedToType(source, target, reportErrors)) { + return _result; } } else { - if (result = unionTypeRelatedToType(target, source, reportErrors)) { - return result; + if (_result = unionTypeRelatedToType(target, source, reportErrors)) { + return _result; } } } else { if (source.flags & 16384) { - if (result = unionTypeRelatedToType(source, target, reportErrors)) { - return result; + if (_result = unionTypeRelatedToType(source, target, reportErrors)) { + return _result; } } else { - if (result = typeRelatedToUnionType(source, target, reportErrors)) { - return result; + if (_result = typeRelatedToUnionType(source, target, reportErrors)) { + return _result; } } } } else if (source.flags & 512 && target.flags & 512) { - if (result = typeParameterRelatedTo(source, target, reportErrors)) { - return result; + if (_result = typeParameterRelatedTo(source, target, reportErrors)) { + return _result; } } else { var saveErrorInfo = errorInfo; if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { - return result; + if (_result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return _result; } } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && - (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (_result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; - return result; + return _result; } } if (reportErrors) { @@ -10724,16 +15461,17 @@ var ts; return 0; } function unionTypeRelatedToUnionType(source, target) { - var result = -1; + var _result = -1; var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { - var related = typeRelatedToUnionType(sourceTypes[i], target, false); + for (var _i = 0; _i < sourceTypes.length; _i++) { + var sourceType = sourceTypes[_i]; + var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function typeRelatedToUnionType(source, target, reportErrors) { var targetTypes = target.types; @@ -10746,27 +15484,28 @@ var ts; return 0; } function unionTypeRelatedToType(source, target, reportErrors) { - var result = -1; + var _result = -1; var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { - var related = isRelatedTo(sourceTypes[i], target, reportErrors); + for (var _i = 0; _i < sourceTypes.length; _i++) { + var sourceType = sourceTypes[_i]; + var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function typesRelatedTo(sources, targets, reportErrors) { - var result = -1; + var _result = -1; for (var i = 0, len = sources.length; i < len; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function typeParameterRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { @@ -10832,19 +15571,20 @@ var ts; expandingFlags |= 1; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) expandingFlags |= 2; + var _result; if (expandingFlags === 3) { - var result = 1; + _result = 1; } else { - var result = propertiesRelatedTo(source, target, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 0, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 1, reportErrors); - if (result) { - result &= stringIndexTypesRelatedTo(source, target, reportErrors); - if (result) { - result &= numberIndexTypesRelatedTo(source, target, reportErrors); + _result = propertiesRelatedTo(source, target, reportErrors); + if (_result) { + _result &= signaturesRelatedTo(source, target, 0, reportErrors); + if (_result) { + _result &= signaturesRelatedTo(source, target, 1, reportErrors); + if (_result) { + _result &= stringIndexTypesRelatedTo(source, target, reportErrors); + if (_result) { + _result &= numberIndexTypesRelatedTo(source, target, reportErrors); } } } @@ -10852,23 +15592,23 @@ var ts; } expandingFlags = saveExpandingFlags; depth--; - if (result) { + if (_result) { var maybeCache = maybeStack[depth]; - var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; + var destinationCache = (_result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; ts.copyMap(maybeCache, destinationCache); } else { relation[id] = reportErrors ? 3 : 2; } - return result; + return _result; } function isDeeplyNestedGeneric(type, stack) { if (type.flags & 4096 && depth >= 10) { - var target = type.target; + var _target = type.target; var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & 4096 && t.target === target) { + if (t.flags & 4096 && t.target === _target) { count++; if (count >= 10) return true; @@ -10881,11 +15621,11 @@ var ts; if (relation === identityRelation) { return propertiesIdenticalTo(source, target); } - var result = -1; + var _result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var i = 0; i < properties.length; i++) { - var targetProp = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { @@ -10936,7 +15676,7 @@ var ts; } return 0; } - result &= related; + _result &= related; if (sourceProp.flags & 536870912 && !(targetProp.flags & 536870912)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); @@ -10946,7 +15686,7 @@ var ts; } } } - return result; + return _result; } function propertiesIdenticalTo(source, target) { var sourceProperties = getPropertiesOfObjectType(source); @@ -10954,9 +15694,9 @@ var ts; if (sourceProperties.length !== targetProperties.length) { return 0; } - var result = -1; - for (var i = 0, len = sourceProperties.length; i < len; ++i) { - var sourceProp = sourceProperties[i]; + var _result = -1; + for (var _i = 0; _i < sourceProperties.length; _i++) { + var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { return 0; @@ -10965,9 +15705,9 @@ var ts; if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function signaturesRelatedTo(source, target, kind, reportErrors) { if (relation === identityRelation) { @@ -10978,18 +15718,18 @@ var ts; } var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); - var result = -1; + var _result = -1; var saveErrorInfo = errorInfo; - outer: for (var i = 0; i < targetSignatures.length; i++) { - var t = targetSignatures[i]; + outer: for (var _i = 0; _i < targetSignatures.length; _i++) { + var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var j = 0; j < sourceSignatures.length; j++) { - var s = sourceSignatures[j]; + for (var _a = 0; _a < sourceSignatures.length; _a++) { + var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); if (related) { - result &= related; + _result &= related; errorInfo = saveErrorInfo; continue outer; } @@ -10999,7 +15739,7 @@ var ts; return 0; } } - return result; + return _result; } function signatureRelatedTo(source, target, reportErrors) { if (source === target) { @@ -11029,14 +15769,14 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); - var result = -1; + var _result = -1; for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + var _s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + var _t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); var saveErrorInfo = errorInfo; - var related = isRelatedTo(s, t, reportErrors); + var related = isRelatedTo(_s, _t, reportErrors); if (!related) { - related = isRelatedTo(t, s, false); + related = isRelatedTo(_t, _s, false); if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); @@ -11045,13 +15785,13 @@ var ts; } errorInfo = saveErrorInfo; } - result &= related; + _result &= related; } var t = getReturnTypeOfSignature(target); if (t === voidType) - return result; + return _result; var s = getReturnTypeOfSignature(source); - return result & isRelatedTo(s, t, reportErrors); + return _result & isRelatedTo(s, t, reportErrors); } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); @@ -11059,15 +15799,15 @@ var ts; if (sourceSignatures.length !== targetSignatures.length) { return 0; } - var result = -1; + var _result = -1; for (var i = 0, len = sourceSignatures.length; i < len; ++i) { var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function stringIndexTypesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { @@ -11107,11 +15847,12 @@ var ts; } return 0; } + var related; if (sourceStringType && sourceNumberType) { - var related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); + related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); } else { - var related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); + related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); } if (!related) { if (reportErrors) { @@ -11163,9 +15904,7 @@ var ts; if (source === target) { return -1; } - if (source.parameters.length !== target.parameters.length || - source.minArgumentCount !== target.minArgumentCount || - source.hasRestParameter !== target.hasRestParameter) { + if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { return 0; } var result = -1; @@ -11186,14 +15925,14 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); - for (var i = 0, len = source.parameters.length; i < len; i++) { - var s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); - var related = compareTypes(s, t); - if (!related) { + for (var _i = 0, _len = source.parameters.length; _i < _len; _i++) { + var s = source.hasRestParameter && _i === _len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[_i]); + var t = target.hasRestParameter && _i === _len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[_i]); + var _related = compareTypes(s, t); + if (!_related) { return 0; } - result &= related; + result &= _related; } if (compareReturnTypes) { result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); @@ -11201,14 +15940,17 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && !isTypeSubtypeOf(types[i], candidate)) + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; } return true; } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + return ts.forEach(types, function (t) { + return isSupertypeOfEach(t, types) ? t : undefined; + }); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { var bestSupertype; @@ -11305,31 +16047,30 @@ var ts; return reportWideningErrorsInType(type.typeArguments[0]); } if (type.flags & 131072) { - var errorReported = false; + var _errorReported = false; ts.forEach(getPropertiesOfObjectType(type), function (p) { var t = getTypeOfSymbol(p); if (t.flags & 262144) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); } - errorReported = true; + _errorReported = true; } }); - return errorReported; + return _errorReported; } return false; } function reportImplicitAnyError(declaration, type) { var typeAsString = typeToString(getWidenedType(type)); + var diagnostic; switch (declaration.kind) { case 130: case 129: - var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; + diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; case 128: - var diagnostic = declaration.dotDotDotToken ? - ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : - ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; case 195: case 132: @@ -11342,10 +16083,10 @@ var ts; error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; } - var diagnostic = ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; + diagnostic = ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; default: - var diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type; + diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type; } error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } @@ -11384,8 +16125,12 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var i = 0; i < typeParameters.length; i++) { - inferences.push({ primary: undefined, secondary: undefined }); + for (var _i = 0; _i < typeParameters.length; _i++) { + var unused = typeParameters[_i]; + inferences.push({ + primary: undefined, + secondary: undefined + }); } return { typeParameters: typeParameters, @@ -11403,19 +16148,21 @@ var ts; inferFromTypes(source, target); function isInProcess(source, target) { for (var i = 0; i < depth; i++) { - if (source === sourceStack[i] && target === targetStack[i]) + if (source === sourceStack[i] && target === targetStack[i]) { return true; + } } return false; } function isWithinDepthLimit(type, stack) { if (depth >= 5) { - var target = type.target; + var _target = type.target; var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & 4096 && t.target === target) + if (t.flags & 4096 && t.target === _target) { count++; + } } return count < 5; } @@ -11430,9 +16177,7 @@ var ts; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { var inferences = context.inferences[i]; - var candidates = inferiority ? - inferences.secondary || (inferences.secondary = []) : - inferences.primary || (inferences.primary = []); + var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); if (!ts.contains(candidates, source)) candidates.push(source); break; @@ -11442,16 +16187,16 @@ var ts; else if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { var sourceTypes = source.typeArguments; var targetTypes = target.typeArguments; - for (var i = 0; i < sourceTypes.length; i++) { - inferFromTypes(sourceTypes[i], targetTypes[i]); + for (var _i = 0; _i < sourceTypes.length; _i++) { + inferFromTypes(sourceTypes[_i], targetTypes[_i]); } } else if (target.flags & 16384) { - var targetTypes = target.types; + var _targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var i = 0; i < targetTypes.length; i++) { - var t = targetTypes[i]; + for (var _a = 0; _a < _targetTypes.length; _a++) { + var t = _targetTypes[_a]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; @@ -11467,13 +16212,13 @@ var ts; } } else if (source.flags & 16384) { - var sourceTypes = source.types; - for (var i = 0; i < sourceTypes.length; i++) { - inferFromTypes(sourceTypes[i], target); + var _sourceTypes = source.types; + for (var _b = 0; _b < _sourceTypes.length; _b++) { + var sourceType = _sourceTypes[_b]; + inferFromTypes(sourceType, target); } } - else if (source.flags & 48128 && (target.flags & (4096 | 8192) || - (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -11494,8 +16239,8 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var i = 0; i < properties.length; i++) { - var targetProp = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -11583,8 +16328,12 @@ var ts; function removeTypesFromUnionType(type, typeKind, isOfTypeKind, allowEmptyUnionResult) { if (type.flags & 16384) { var types = type.types; - if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { - var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); + if (ts.forEach(types, function (t) { + return !!(t.flags & typeKind) === isOfTypeKind; + })) { + var narrowedType = getUnionType(ts.filter(types, function (t) { + return !(t.flags & typeKind) === isOfTypeKind; + })); if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { return narrowedType; } @@ -11677,13 +16426,14 @@ var ts; } function resolveLocation(node) { var containerNodes = []; - for (var parent = node.parent; parent; parent = parent.parent) { - if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && - isContextSensitive(parent)) { - containerNodes.unshift(parent); + for (var _parent = node.parent; _parent; _parent = _parent.parent) { + if ((ts.isExpression(_parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(_parent)) { + containerNodes.unshift(_parent); } } - ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); + ts.forEach(containerNodes, function (node) { + getTypeOfNode(node); + }); } function getSymbolAtLocation(node) { resolveLocation(node); @@ -11812,7 +16562,9 @@ var ts; return targetType; } if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + return getUnionType(ts.filter(type.types, function (t) { + return isTypeSubtypeOf(t, targetType); + })); } return type; } @@ -11868,9 +16620,7 @@ var ts; return false; } function checkBlockScopedBindingCapturedInLoop(node, symbol) { - if (languageVersion >= 2 || - (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 217) { + if (languageVersion >= 2 || (symbol.flags & 2) === 0 || symbol.valueDeclaration.parent.kind === 217) { return; } var container = symbol.valueDeclaration; @@ -11966,32 +16716,22 @@ var ts; var container = ts.getSuperContainer(node, true); if (container) { var canUseSuperExpression = false; + var needToCaptureLexicalThis; if (isCallExpression) { canUseSuperExpression = container.kind === 133; } else { - var needToCaptureLexicalThis = false; + needToCaptureLexicalThis = false; while (container && container.kind === 161) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; } if (container && container.parent && container.parent.kind === 196) { if (container.flags & 128) { - canUseSuperExpression = - container.kind === 132 || - container.kind === 131 || - container.kind === 134 || - container.kind === 135; + canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135; } else { - canUseSuperExpression = - container.kind === 132 || - container.kind === 131 || - container.kind === 134 || - container.kind === 135 || - container.kind === 130 || - container.kind === 129 || - container.kind === 133; + canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135 || container.kind === 130 || container.kind === 129 || container.kind === 133; } } } @@ -12038,8 +16778,7 @@ var ts; if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } - if (indexOfParameter === (func.parameters.length - 1) && - funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); } } @@ -12117,14 +16856,18 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var i = 0; i < types.length; i++) { - var t = mapper(types[i]); + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + var t = mapper(current); if (t) { if (!mappedType) { mappedType = t; } else if (!mappedTypes) { - mappedTypes = [mappedType, t]; + mappedTypes = [ + mappedType, + t + ]; } else { mappedTypes.push(t); @@ -12140,13 +16883,17 @@ var ts; }); } function getIndexTypeOfContextualType(type, kind) { - return applyToContextualType(type, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }); + return applyToContextualType(type, function (t) { + return getIndexTypeOfObjectOrUnionType(t, kind); + }); } function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } function contextualTypeHasIndexSignature(type, kind) { - return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); + return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { + return getIndexTypeOfObjectOrUnionType(t, kind); + }) : getIndexTypeOfObjectOrUnionType(type, kind)); } function getContextualTypeForObjectLiteralMethod(node) { ts.Debug.assert(ts.isObjectLiteralMethod(node)); @@ -12166,8 +16913,7 @@ var ts; return propertyType; } } - return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || - getIndexTypeOfContextualType(type, 0); + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || getIndexTypeOfContextualType(type, 0); } return undefined; } @@ -12176,9 +16922,7 @@ var ts; var type = getContextualType(arrayLiteral); if (type) { var index = ts.indexOf(arrayLiteral.elements, node); - return getTypeOfPropertyOfContextualType(type, "" + index) - || getIndexTypeOfContextualType(type, 1) - || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); + return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1) || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); } return undefined; } @@ -12193,8 +16937,8 @@ var ts; if (node.contextualType) { return node.contextualType; } - var parent = node.parent; - switch (parent.kind) { + var _parent = node.parent; + switch (_parent.kind) { case 193: case 128: case 130: @@ -12206,22 +16950,22 @@ var ts; return getContextualTypeForReturnExpression(node); case 155: case 156: - return getContextualTypeForArgument(parent, node); + return getContextualTypeForArgument(_parent, node); case 158: - return getTypeFromTypeNode(parent.type); + return getTypeFromTypeNode(_parent.type); case 167: return getContextualTypeForBinaryOperand(node); case 218: - return getContextualTypeForObjectLiteralElement(parent); + return getContextualTypeForObjectLiteralElement(_parent); case 151: return getContextualTypeForElementExpression(node); case 168: return getContextualTypeForConditionalOperand(node); case 173: - ts.Debug.assert(parent.parent.kind === 169); - return getContextualTypeForSubstitutionExpression(parent.parent, node); + ts.Debug.assert(_parent.parent.kind === 169); + return getContextualTypeForSubstitutionExpression(_parent.parent, node); case 159: - return getContextualType(parent); + return getContextualType(_parent); } return undefined; } @@ -12242,9 +16986,7 @@ var ts; } function getContextualSignature(node) { ts.Debug.assert(node.kind !== 132 || ts.isObjectLiteralMethod(node)); - var type = ts.isObjectLiteralMethod(node) - ? getContextualTypeForObjectLiteralMethod(node) - : getContextualType(node); + var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); if (!type) { return undefined; } @@ -12253,15 +16995,17 @@ var ts; } var signatureList; var types = type.types; - for (var i = 0; i < types.length; i++) { - if (signatureList && - getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; } - var signature = getNonGenericSignature(types[i]); + var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { - signatureList = [signature]; + signatureList = [ + signature + ]; } else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { return undefined; @@ -12283,15 +17027,15 @@ var ts; return mapper && mapper !== identityMapper; } function isAssignmentTarget(node) { - var parent = node.parent; - if (parent.kind === 167 && parent.operatorToken.kind === 52 && parent.left === node) { + var _parent = node.parent; + if (_parent.kind === 167 && _parent.operatorToken.kind === 52 && _parent.left === node) { return true; } - if (parent.kind === 218) { - return isAssignmentTarget(parent.parent); + if (_parent.kind === 218) { + return isAssignmentTarget(_parent.parent); } - if (parent.kind === 151) { - return isAssignmentTarget(parent); + if (_parent.kind === 151) { + return isAssignmentTarget(_parent); } return false; } @@ -12356,23 +17100,20 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var i = 0; i < node.properties.length; i++) { - var memberDecl = node.properties[i]; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 218 || - memberDecl.kind === 219 || - ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { + var type = void 0; if (memberDecl.kind === 218) { - var type = checkPropertyAssignment(memberDecl, contextualMapper); + type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 132) { - var type = checkObjectLiteralMethod(memberDecl, contextualMapper); + type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { ts.Debug.assert(memberDecl.kind === 219); - var type = memberDecl.name.kind === 126 - ? unknownType - : checkExpression(memberDecl.name, contextualMapper); + type = memberDecl.name.kind === 126 ? unknownType : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -12405,15 +17146,15 @@ var ts; for (var i = 0; i < propertiesArray.length; i++) { var propertyDecl = node.properties[i]; if (kind === 0 || isNumericName(propertyDecl.name)) { - var type = getTypeOfSymbol(propertiesArray[i]); - if (!ts.contains(propTypes, type)) { - propTypes.push(type); + var _type = getTypeOfSymbol(propertiesArray[i]); + if (!ts.contains(propTypes, _type)) { + propTypes.push(_type); } } } - var result = propTypes.length ? getUnionType(propTypes) : undefinedType; - typeFlags |= result.flags; - return result; + var _result = propTypes.length ? getUnionType(propTypes) : undefinedType; + typeFlags |= _result.flags; + return _result; } return undefined; } @@ -12488,9 +17229,7 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 153 - ? node.expression - : node.left; + var left = node.kind === 153 ? node.expression : node.left; var type = checkExpressionOrQualifiedName(left); if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); @@ -12516,9 +17255,9 @@ var ts; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); } else { - var start = node.end - "]".length; - var end = node.end; - grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected); + var _start = node.end - "]".length; + var _end = node.end; + grammarErrorAtPos(sourceFile, _start, _end - _start, ts.Diagnostics.Expression_expected); } } var objectType = getApparentType(checkExpression(node.expression)); @@ -12527,21 +17266,20 @@ var ts; return unknownType; } var isConstEnum = isConstEnumObjectType(objectType); - if (isConstEnum && - (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } if (node.argumentExpression) { - var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); - if (name !== undefined) { - var prop = getPropertyOfType(objectType, name); + var _name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (_name !== undefined) { + var prop = getPropertyOfType(objectType, _name); if (prop) { getNodeLinks(node).resolvedSymbol = prop; return getTypeOfSymbol(prop); } else if (isConstEnum) { - error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name, symbolToString(objectType.symbol)); + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, _name, symbolToString(objectType.symbol)); return unknownType; } } @@ -12628,22 +17366,22 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var i = 0; i < signatures.length; i++) { - var signature = signatures[i]; + for (var _i = 0; _i < signatures.length; _i++) { + var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent = signature.declaration && signature.declaration.parent; + var _parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent === lastParent) { + if (lastParent && _parent === lastParent) { index++; } else { - lastParent = parent; + lastParent = _parent; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent; + lastParent = _parent; } lastSymbol = symbol; if (signature.hasStringLiterals) { @@ -12695,8 +17433,7 @@ var ts; callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; } - var hasRightNumberOfTypeArgs = !typeArguments || - (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); if (!hasRightNumberOfTypeArgs) { return false; } @@ -12713,8 +17450,7 @@ var ts; function getSingleCallSignature(type) { if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); - if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && - resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { return resolved.callSignatures[0]; } } @@ -12735,30 +17471,31 @@ var ts; var arg = args[i]; if (arg.kind !== 172) { var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); + var argType = void 0; if (i === 0 && args[i].parent.kind === 157) { - var argType = globalTemplateStringsArrayType; + argType = globalTemplateStringsArrayType; } else { var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; - var argType = checkExpressionWithContextualType(arg, paramType, mapper); + argType = checkExpressionWithContextualType(arg, paramType, mapper); } inferTypes(context, argType, paramType); } } if (excludeArgument) { - for (var i = 0; i < args.length; i++) { - if (excludeArgument[i] === false) { - var arg = args[i]; - var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + for (var _i = 0; _i < args.length; _i++) { + if (excludeArgument[_i] === false) { + var _arg = args[_i]; + var _paramType = getTypeAtPosition(signature, _arg.kind === 171 ? -1 : _i); + inferTypes(context, checkExpressionWithContextualType(_arg, _paramType, inferenceMapper), _paramType); } } } var inferredTypes = getInferredTypes(context); context.failedTypeParameterIndex = ts.indexOf(inferredTypes, inferenceFailureType); - for (var i = 0; i < inferredTypes.length; i++) { - if (inferredTypes[i] === inferenceFailureType) { - inferredTypes[i] = unknownType; + for (var _i_1 = 0; _i_1 < inferredTypes.length; _i_1++) { + if (inferredTypes[_i_1] === inferenceFailureType) { + inferredTypes[_i_1] = unknownType; } } return context; @@ -12784,9 +17521,7 @@ var ts; var arg = args[i]; if (arg.kind !== 172) { var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); - var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : - arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : - checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { return false; } @@ -12798,7 +17533,9 @@ var ts; var args; if (node.kind === 157) { var template = node.template; - args = [template]; + args = [ + template + ]; if (template.kind === 169) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); @@ -12880,50 +17617,53 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var i = 0, n = candidates.length; i < n; i++) { - if (hasCorrectArity(node, args, candidates[i])) { - return candidates[i]; + for (var _i = 0; _i < candidates.length; _i++) { + var candidate = candidates[_i]; + if (hasCorrectArity(node, args, candidate)) { + return candidate; } } } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var i = 0; i < candidates.length; i++) { - if (!hasCorrectArity(node, args, candidates[i])) { + for (var _a = 0; _a < candidates.length; _a++) { + var current = candidates[_a]; + if (!hasCorrectArity(node, args, current)) { continue; } - var originalCandidate = candidates[i]; - var inferenceResult; + var originalCandidate = current; + var inferenceResult = void 0; + var _candidate = void 0; + var typeArgumentsAreValid = void 0; while (true) { - var candidate = originalCandidate; - if (candidate.typeParameters) { - var typeArgumentTypes; - var typeArgumentsAreValid; + _candidate = originalCandidate; + if (_candidate.typeParameters) { + var typeArgumentTypes = void 0; if (typeArguments) { - typeArgumentTypes = new Array(candidate.typeParameters.length); - typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); + typeArgumentTypes = new Array(_candidate.typeParameters.length); + typeArgumentsAreValid = checkTypeArguments(_candidate, typeArguments, typeArgumentTypes, false); } else { - inferenceResult = inferTypeArguments(candidate, args, excludeArgument); + inferenceResult = inferTypeArguments(_candidate, args, excludeArgument); typeArgumentsAreValid = inferenceResult.failedTypeParameterIndex < 0; typeArgumentTypes = inferenceResult.inferredTypes; } if (!typeArgumentsAreValid) { break; } - candidate = getSignatureInstantiation(candidate, typeArgumentTypes); + _candidate = getSignatureInstantiation(_candidate, typeArgumentTypes); } - if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { + if (!checkApplicableSignature(node, args, _candidate, relation, excludeArgument, false)) { break; } var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; if (index < 0) { - return candidate; + return _candidate; } excludeArgument[index] = false; } if (originalCandidate.typeParameters) { - var instantiatedCandidate = candidate; + var instantiatedCandidate = _candidate; if (typeArgumentsAreValid) { candidateForArgumentError = instantiatedCandidate; } @@ -12935,7 +17675,7 @@ var ts; } } else { - ts.Debug.assert(originalCandidate === candidate); + ts.Debug.assert(originalCandidate === _candidate); candidateForArgumentError = originalCandidate; } } @@ -13050,10 +17790,7 @@ var ts; } if (node.kind === 156) { var declaration = signature.declaration; - if (declaration && - declaration.kind !== 133 && - declaration.kind !== 137 && - declaration.kind !== 141) { + if (declaration && declaration.kind !== 133 && declaration.kind !== 137 && declaration.kind !== 141) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -13078,13 +17815,9 @@ var ts; } function getTypeAtPosition(signature, pos) { if (pos >= 0) { - return signature.hasRestParameter ? - pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : - pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; } - return signature.hasRestParameter ? - getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : - anyArrayType; + return signature.hasRestParameter ? getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : anyArrayType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -13094,9 +17827,9 @@ var ts; links.type = instantiateType(getTypeAtPosition(context, i), mapper); } if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { - var parameter = signature.parameters[signature.parameters.length - 1]; - var links = getSymbolLinks(parameter); - links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); + var _parameter = signature.parameters[signature.parameters.length - 1]; + var _links = getSymbolLinks(_parameter); + _links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); } } function getReturnTypeFromBody(func, contextualMapper) { @@ -13104,15 +17837,16 @@ var ts; if (!func.body) { return unknownType; } + var type; if (func.body.kind !== 174) { - var type = checkExpressionCached(func.body, contextualMapper); + type = checkExpressionCached(func.body, contextualMapper); } else { var types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper); if (types.length === 0) { return voidType; } - var type = contextualSignature ? getUnionType(types) : getCommonSupertype(types); + type = contextualSignature ? getUnionType(types) : getCommonSupertype(types); if (!type) { error(func, ts.Diagnostics.No_best_common_type_exists_among_return_expressions); return unknownType; @@ -13233,11 +17967,15 @@ var ts; function isReferenceOrErrorExpression(n) { switch (n.kind) { case 64: - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + { + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + } case 153: - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; + { + var _symbol = findSymbol(n); + return !_symbol || _symbol === unknownSymbol || (_symbol.flags & ~8) !== 0; + } case 154: return true; case 159: @@ -13250,17 +17988,21 @@ var ts; switch (n.kind) { case 64: case 153: - var symbol = findSymbol(n); - return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; + { + var symbol = findSymbol(n); + return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; + } case 154: - var index = n.argumentExpression; - var symbol = findSymbol(n.expression); - if (symbol && index && index.kind === 8) { - var name = index.text; - var prop = getPropertyOfType(getTypeOfSymbol(symbol), name); - return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; + { + var index = n.argumentExpression; + var _symbol = findSymbol(n.expression); + if (_symbol && index && index.kind === 8) { + var _name = index.text; + var prop = getPropertyOfType(getTypeOfSymbol(_symbol), _name); + return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; + } + return false; } - return false; case 159: return isConstVariableReference(n.expression); default: @@ -13332,8 +18074,9 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var i = 0; i < types.length; i++) { - if (types[i].flags & kind) { + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + if (current.flags & kind) { return true; } } @@ -13347,8 +18090,9 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var i = 0; i < types.length; i++) { - if (!(types[i].flags & kind)) { + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + if (!(current.flags & kind)) { return false; } } @@ -13382,19 +18126,16 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var i = 0; i < properties.length; i++) { - var p = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { - var name = p.name; - var type = sourceType.flags & 1 ? sourceType : - getTypeOfPropertyOfType(sourceType, name.text) || - isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || - getIndexTypeOfType(sourceType, 0); + var _name = p.name; + var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { - checkDestructuringAssignment(p.initializer || name, type); + checkDestructuringAssignment(p.initializer || _name, type); } else { - error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name)); + error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(_name)); } } else { @@ -13414,9 +18155,7 @@ var ts; if (e.kind !== 172) { if (e.kind !== 171) { var propName = "" + i; - var type = sourceType.flags & 1 ? sourceType : - isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : - getIndexTypeOfType(sourceType, 1); + var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); if (type) { checkDestructuringAssignment(e, type, contextualMapper); } @@ -13497,9 +18236,7 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var suggestedOperator; - if ((leftType.flags & 8) && - (rightType.flags & 8) && - (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { @@ -13561,7 +18298,10 @@ var ts; case 48: return rightType; case 49: - return getUnionType([leftType, rightType]); + return getUnionType([ + leftType, + rightType + ]); case 52: checkAssignmentOperator(rightType); return rightType; @@ -13569,9 +18309,7 @@ var ts; return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : - someConstituentTypeHasKind(rightType, 1048576) ? node.right : - undefined; + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); return false; @@ -13617,7 +18355,10 @@ var ts; checkExpression(node.condition); var type1 = checkExpression(node.whenTrue, contextualMapper); var type2 = checkExpression(node.whenFalse, contextualMapper); - return getUnionType([type1, type2]); + return getUnionType([ + type1, + type2 + ]); } function checkTemplateExpression(node) { ts.forEach(node.templateSpans, function (templateSpan) { @@ -13681,9 +18422,7 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 153 && node.parent.expression === node) || - (node.parent.kind === 154 && node.parent.expression === node) || - ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 153 && node.parent.expression === node) || (node.parent.kind === 154 && node.parent.expression === node) || ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -13793,9 +18532,7 @@ var ts; if (node.kind === 138) { checkGrammarIndexSignature(node); } - else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || - node.kind === 136 || node.kind === 133 || - node.kind === 137) { + else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || node.kind === 136 || node.kind === 133 || node.kind === 137) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -13829,8 +18566,9 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var i = 0, len = indexSymbol.declarations.length; i < len; ++i) { - var declaration = indexSymbol.declarations[i]; + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { case 120: @@ -13888,8 +18626,10 @@ var ts; case 160: case 195: case 161: - case 152: return false; - default: return ts.forEachChild(n, containsSuperCall); + case 152: + return false; + default: + return ts.forEachChild(n, containsSuperCall); } } function markThisReferencesAsErrors(n) { @@ -13901,14 +18641,13 @@ var ts; } } function isInstancePropertyWithInitializer(n) { - return n.kind === 130 && - !(n.flags & 128) && - !!n.initializer; + return n.kind === 130 && !(n.flags & 128) && !!n.initializer; } if (ts.getClassBaseTypeNode(node.parent)) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { + return p.flags & (16 | 32 | 64); + }); if (superCallShouldBeFirst) { var statements = node.body.statements; if (!statements.length || statements[0].kind !== 177 || !isSuperCallExpression(statements[0].expression)) { @@ -14017,8 +18756,8 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var i = 0; i < signaturesToCheck.length; i++) { - var otherSignature = signaturesToCheck[i]; + for (var _i = 0; _i < signaturesToCheck.length; _i++) { + var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; } @@ -14098,16 +18837,16 @@ var ts; }); if (subsequentNode) { if (subsequentNode.kind === node.kind) { - var errorNode = subsequentNode.name || subsequentNode; + var _errorNode = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { ts.Debug.assert(node.kind === 132 || node.kind === 131); ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; - error(errorNode, diagnostic); + error(_errorNode, diagnostic); return; } else if (ts.nodeIsPresent(subsequentNode.body)) { - error(errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); + error(_errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); return; } } @@ -14123,8 +18862,9 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var i = 0; i < declarations.length; i++) { - var node = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var current = declarations[_i]; + var node = current; var inAmbientContext = ts.isInAmbientContext(node); var inAmbientContextOrInterface = node.parent.kind === 197 || node.parent.kind === 143 || inAmbientContext; if (inAmbientContextOrInterface) { @@ -14181,9 +18921,10 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var i = 0, len = signatures.length; i < len; ++i) { - if (!signatures[i].hasStringLiterals && !isSignatureAssignableTo(bodySignature, signatures[i])) { - error(signatures[i].declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + for (var _a = 0; _a < signatures.length; _a++) { + var signature = signatures[_a]; + if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { + error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; } } @@ -14195,7 +18936,6 @@ var ts; if (!produceDiagnostics) { return; } - var symbol; var symbol = node.localSymbol; if (!symbol) { symbol = getSymbolOfNode(node); @@ -14230,16 +18970,16 @@ var ts; case 197: return 2097152; case 200: - return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 - ? 4194304 | 1048576 - : 4194304; + return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; case 196: case 199: return 2097152 | 1048576; case 203: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); + ts.forEach(target.declarations, function (d) { + result |= getDeclarationSpaces(d); + }); return result; default: return 1048576; @@ -14248,10 +18988,7 @@ var ts; } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || - checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || - checkGrammarFunctionName(node.name) || - checkGrammarForGenerator(node); + checkFunctionLikeDeclaration(node) || checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -14306,12 +19043,7 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 130 || - node.kind === 129 || - node.kind === 132 || - node.kind === 131 || - node.kind === 134 || - node.kind === 135) { + if (node.kind === 130 || node.kind === 129 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135) { return false; } if (ts.isInAmbientContext(node)) { @@ -14332,8 +19064,8 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4) { - var isDeclaration = node.kind !== 64; - if (isDeclaration) { + var _isDeclaration = node.kind !== 64; + if (_isDeclaration) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } else { @@ -14353,8 +19085,8 @@ var ts; return; } if (ts.getClassBaseTypeNode(enclosingClass)) { - var isDeclaration = node.kind !== 64; - if (isDeclaration) { + var _isDeclaration = node.kind !== 64; + if (_isDeclaration) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -14369,8 +19101,8 @@ var ts; if (node.kind === 200 && ts.getModuleInstanceState(node) !== 1) { return; } - var parent = getDeclarationContainer(node); - if (parent.kind === 221 && ts.isExternalModule(parent)) { + var _parent = getDeclarationContainer(node); + if (_parent.kind === 221 && ts.isExternalModule(_parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -14379,20 +19111,14 @@ var ts; var symbol = getSymbolOfNode(node); if (symbol.flags & 1) { var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); - if (localDeclarationSymbol && - localDeclarationSymbol !== symbol && - localDeclarationSymbol.flags & 2) { + if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 194); - var container = varDeclList.parent.kind === 175 && - varDeclList.parent.parent; - var namesShareScope = container && - (container.kind === 174 && ts.isFunctionLike(container.parent) || - (container.kind === 201 && container.kind === 200) || - container.kind === 221); + var container = varDeclList.parent.kind === 175 && varDeclList.parent.parent; + var namesShareScope = container && (container.kind === 174 && ts.isFunctionLike(container.parent) || (container.kind === 201 && container.kind === 200) || container.kind === 221); if (!namesShareScope) { - var name = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); + var _name = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, _name, _name); } } } @@ -14406,10 +19132,11 @@ var ts; return node.kind === 128; } function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind === 128) { - var func = ts.getContainingFunction(node); - visit(node.initializer); + if (getRootDeclaration(node).kind !== 128) { + return; } + var func = ts.getContainingFunction(node); + visit(node.initializer); function visit(n) { if (n.kind === 64) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; @@ -14605,17 +19332,15 @@ var ts; } function checkRightHandSideOfForOf(rhsExpression) { var expressionType = getTypeOfExpression(rhsExpression); - return languageVersion >= 2 - ? checkIteratedType(expressionType, rhsExpression) - : checkElementTypeOfArrayOrString(expressionType, rhsExpression); + return languageVersion >= 2 ? checkIteratedType(expressionType, rhsExpression) : checkElementTypeOfArrayOrString(expressionType, rhsExpression); } function checkIteratedType(iterable, expressionForError) { ts.Debug.assert(languageVersion >= 2); var iteratedType = getIteratedType(iterable, expressionForError); if (expressionForError && iteratedType) { - var completeIterableType = globalIterableType !== emptyObjectType - ? createTypeReference(globalIterableType, [iteratedType]) - : emptyObjectType; + var completeIterableType = globalIterableType !== emptyObjectType ? createTypeReference(globalIterableType, [ + iteratedType + ]) : emptyObjectType; checkTypeAssignableTo(iterable, completeIterableType, expressionForError); } return iteratedType; @@ -14679,9 +19404,7 @@ var ts; } if (!isArrayLikeType(arrayType)) { if (!reportedError) { - var diagnostic = hasStringConstituent - ? ts.Diagnostics.Type_0_is_not_an_array_type - : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + var diagnostic = hasStringConstituent ? ts.Diagnostics.Type_0_is_not_an_array_type : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; error(expressionForError, diagnostic, typeToString(arrayType)); } return hasStringConstituent ? stringType : unknownType; @@ -14691,7 +19414,10 @@ var ts; if (arrayElementType.flags & 258) { return stringType; } - return getUnionType([arrayElementType, stringType]); + return getUnionType([ + arrayElementType, + stringType + ]); } return arrayElementType; } @@ -14839,8 +19565,8 @@ var ts; }); if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 196) { var classDeclaration = type.symbol.valueDeclaration; - for (var i = 0; i < classDeclaration.members.length; i++) { - var member = classDeclaration.members[i]; + for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { + var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0); @@ -14853,7 +19579,9 @@ var ts; if (stringIndexType && numberIndexType) { errorNode = declaredNumberIndexer || declaredStringIndexer; if (!errorNode && (type.flags & 2048)) { - var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); }); + var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { + return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); + }); errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; } } @@ -14867,22 +19595,22 @@ var ts; if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { return; } - var errorNode; + var _errorNode; if (prop.valueDeclaration.name.kind === 126 || prop.parent === containingType.symbol) { - errorNode = prop.valueDeclaration; + _errorNode = prop.valueDeclaration; } else if (indexDeclaration) { - errorNode = indexDeclaration; + _errorNode = indexDeclaration; } else if (containingType.flags & 2048) { - var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); - errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { + return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); + }); + _errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } - if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { - var errorMessage = indexKind === 0 - ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 - : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; - error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); + if (_errorNode && !isTypeAssignableTo(propertyType, indexType)) { + var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + error(_errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); } } } @@ -14899,7 +19627,7 @@ var ts; } function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { - for (var i = 0; i < typeParameterDeclarations.length; i++) { + for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { var node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { @@ -14971,8 +19699,9 @@ var ts; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); - for (var i = 0, len = baseProperties.length; i < len; ++i) { - var base = getTargetSymbol(baseProperties[i]); + for (var _i = 0; _i < baseProperties.length; _i++) { + var baseProperty = baseProperties[_i]; + var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { continue; } @@ -14989,7 +19718,7 @@ var ts; if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) { continue; } - var errorMessage; + var errorMessage = void 0; if (base.flags & 8192) { if (derived.flags & 98304) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; @@ -15045,15 +19774,23 @@ var ts; return true; } var seen = {}; - ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + ts.forEach(type.declaredProperties, function (p) { + seen[p.name] = { + prop: p, + containingType: type + }; + }); var ok = true; - for (var i = 0, len = type.baseTypes.length; i < len; ++i) { - var base = type.baseTypes[i]; + for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { + var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var j = 0, proplen = properties.length; j < proplen; ++j) { - var prop = properties[j]; + for (var _b = 0; _b < properties.length; _b++) { + var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { - seen[prop.name] = { prop: prop, containingType: base }; + seen[prop.name] = { + prop: prop, + containingType: base + }; } else { var existing = seen[prop.name]; @@ -15106,8 +19843,8 @@ var ts; checkSourceElement(node.type); } function computeEnumMemberValues(node) { - var nodeLinks = getNodeLinks(node); - if (!(nodeLinks.flags & 128)) { + var _nodeLinks = getNodeLinks(node); + if (!(_nodeLinks.flags & 128)) { var enumSymbol = getSymbolOfNode(node); var enumType = getDeclaredTypeOfSymbol(enumSymbol); var autoValue = 0; @@ -15144,7 +19881,7 @@ var ts; getNodeLinks(member).enumMemberValue = autoValue++; } }); - nodeLinks.flags |= 128; + _nodeLinks.flags |= 128; } function getConstantValueForEnumMemberInitializer(initializer, enumIsConst) { return evalConstant(initializer); @@ -15156,9 +19893,12 @@ var ts; return undefined; } switch (e.operator) { - case 33: return value; - case 34: return -value; - case 47: return enumIsConst ? ~value : undefined; + case 33: + return value; + case 34: + return -value; + case 47: + return enumIsConst ? ~value : undefined; } return undefined; case 167: @@ -15174,17 +19914,28 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 44: return left | right; - case 43: return left & right; - case 41: return left >> right; - case 42: return left >>> right; - case 40: return left << right; - case 45: return left ^ right; - case 35: return left * right; - case 36: return left / right; - case 33: return left + right; - case 34: return left - right; - case 37: return left % right; + case 44: + return left | right; + case 43: + return left & right; + case 41: + return left >> right; + case 42: + return left >>> right; + case 40: + return left << right; + case 45: + return left ^ right; + case 35: + return left * right; + case 36: + return left / right; + case 33: + return left + right; + case 34: + return left - right; + case 37: + return left % right; } return undefined; case 7: @@ -15199,33 +19950,32 @@ var ts; } var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); - var enumType; + var _enumType; var propertyName; if (e.kind === 64) { - enumType = currentType; + _enumType = currentType; propertyName = e.text; } else { if (e.kind === 154) { - if (e.argumentExpression === undefined || - e.argumentExpression.kind !== 8) { + if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { return undefined; } - var enumType = getTypeOfNode(e.expression); + _enumType = getTypeOfNode(e.expression); propertyName = e.argumentExpression.text; } else { - var enumType = getTypeOfNode(e.expression); + _enumType = getTypeOfNode(e.expression); propertyName = e.name.text; } - if (enumType !== currentType) { + if (_enumType !== currentType) { return undefined; } } if (propertyName === undefined) { return undefined; } - var property = getPropertyOfObjectType(enumType, propertyName); + var property = getPropertyOfObjectType(_enumType, propertyName); if (!property || !(property.flags & 8)) { return undefined; } @@ -15285,8 +20035,8 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var declaration = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; if ((declaration.kind === 196 || (declaration.kind === 195 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -15304,10 +20054,7 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - if (symbol.flags & 512 - && symbol.declarations.length > 1 - && !ts.isInAmbientContext(node) - && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -15343,9 +20090,7 @@ var ts; } var inAmbientExternalModule = node.parent.kind === 201 && node.parent.parent.name.kind === 8; if (node.parent.kind !== 221 && !inAmbientExternalModule) { - error(moduleName, node.kind === 210 ? - ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : - ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + error(moduleName, node.kind === 210 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { @@ -15358,13 +20103,9 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | - (symbol.flags & 793056 ? 793056 : 0) | - (symbol.flags & 1536 ? 1536 : 0); + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 212 ? - ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : - ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; + var message = node.kind === 212 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); } } @@ -15462,18 +20203,19 @@ var ts; } function hasExportedMembers(moduleSymbol) { var declarations = moduleSymbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var statements = getModuleStatements(declarations[i]); - for (var j = 0; j < statements.length; j++) { - var node = statements[j]; + for (var _i = 0; _i < declarations.length; _i++) { + var current = declarations[_i]; + var statements = getModuleStatements(current); + for (var _a = 0; _a < statements.length; _a++) { + var node = statements[_a]; if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; } var specifiers = exportClause.elements; - for (var k = 0; k < specifiers.length; k++) { - var specifier = specifiers[k]; + for (var _b = 0; _b < specifiers.length; _b++) { + var specifier = specifiers[_b]; if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) { return true; } @@ -15797,9 +20539,7 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 64 && - isTypeDeclaration(name.parent) && - name.parent.name === name; + return name.kind == 64 && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { @@ -15838,21 +20578,21 @@ var ts; } case 125: ts.Debug.assert(node.kind === 64 || node.kind === 125, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); - var parent = node.parent; - if (parent.kind === 142) { + var _parent = node.parent; + if (_parent.kind === 142) { return false; } - if (139 <= parent.kind && parent.kind <= 147) { + if (139 <= _parent.kind && _parent.kind <= 147) { return true; } - switch (parent.kind) { + switch (_parent.kind) { case 127: - return node === parent.constraint; + return node === _parent.constraint; case 130: case 129: case 128: case 193: - return node === parent.type; + return node === _parent.type; case 195: case 160: case 161: @@ -15861,16 +20601,16 @@ var ts; case 131: case 134: case 135: - return node === parent.type; + return node === _parent.type; case 136: case 137: case 138: - return node === parent.type; + return node === _parent.type; case 158: - return node === parent.type; + return node === _parent.type; case 155: case 156: - return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + return _parent.typeArguments && ts.indexOf(_parent.typeArguments, node) >= 0; case 157: return false; } @@ -15893,8 +20633,7 @@ var ts; return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 125 && node.parent.right === node) || - (node.parent.kind === 153 && node.parent.name === node); + return (node.parent.kind === 125 && node.parent.right === node) || (node.parent.kind === 153 && node.parent.name === node); } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { @@ -15927,17 +20666,17 @@ var ts; return getNodeLinks(entityName).resolvedSymbol; } else if (entityName.kind === 125) { - var symbol = getNodeLinks(entityName).resolvedSymbol; - if (!symbol) { + var _symbol = getNodeLinks(entityName).resolvedSymbol; + if (!_symbol) { checkQualifiedName(entityName); } return getNodeLinks(entityName).resolvedSymbol; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 139 ? 793056 : 1536; - meaning |= 8388608; - return resolveEntityName(entityName, meaning); + var _meaning = entityName.parent.kind === 139 ? 793056 : 1536; + _meaning |= 8388608; + return resolveEntityName(entityName, _meaning); } return undefined; } @@ -15949,9 +20688,7 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 64 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 209 - ? getSymbolOfEntityNameOrPropertyAccessExpression(node) - : getSymbolOfPartOfRightHandSideOfImportEquals(node); + return node.parent.kind === 209 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } switch (node.kind) { case 64: @@ -15970,10 +20707,7 @@ var ts; return undefined; case 8: var moduleName; - if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && - ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 204 || node.parent.kind === 210) && - node.parent.moduleSpecifier === node)) { + if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || ((node.parent.kind === 204 || node.parent.kind === 210) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 7: @@ -16011,21 +20745,21 @@ var ts; return getDeclaredTypeOfSymbol(symbol); } if (isTypeDeclarationName(node)) { - var symbol = getSymbolInfo(node); - return symbol && getDeclaredTypeOfSymbol(symbol); + var _symbol = getSymbolInfo(node); + return _symbol && getDeclaredTypeOfSymbol(_symbol); } if (ts.isDeclaration(node)) { - var symbol = getSymbolOfNode(node); - return getTypeOfSymbol(symbol); + var _symbol_1 = getSymbolOfNode(node); + return getTypeOfSymbol(_symbol_1); } if (ts.isDeclarationName(node)) { - var symbol = getSymbolInfo(node); - return symbol && getTypeOfSymbol(symbol); + var _symbol_2 = getSymbolInfo(node); + return _symbol_2 && getTypeOfSymbol(_symbol_2); } if (isInRightSideOfImportOrExportAssignment(node)) { - var symbol = getSymbolInfo(node); - var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); - return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); + var _symbol_3 = getSymbolInfo(node); + var declaredType = _symbol_3 && getDeclaredTypeOfSymbol(_symbol_3); + return declaredType !== unknownType ? declaredType : getTypeOfSymbol(_symbol_3); } return unknownType; } @@ -16036,7 +20770,7 @@ var ts; return checkExpression(expr); } function getAugmentedPropertiesOfType(type) { - var type = getApparentType(type); + type = getApparentType(type); var propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { @@ -16050,19 +20784,23 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456) { var symbols = []; - var name = symbol.name; + var _name = symbol.name; ts.forEach(getSymbolLinks(symbol).unionType.types, function (t) { - symbols.push(getPropertyOfType(t, name)); + symbols.push(getPropertyOfType(t, _name)); }); return symbols; } else if (symbol.flags & 67108864) { var target = getSymbolLinks(symbol).target; if (target) { - return [target]; + return [ + target + ]; } } - return [symbol]; + return [ + symbol + ]; } function isExternalModuleSymbol(symbol) { return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 221; @@ -16125,8 +20863,8 @@ var ts; return ts.hasProperty(globals, name) || ts.hasProperty(sourceFile.identifiers, name) || ts.hasProperty(generatedNames, name); } function makeUniqueName(baseName) { - var name = ts.generateUniqueName(baseName, isExistingName); - return generatedNames[name] = name; + var _name = ts.generateUniqueName(baseName, isExistingName); + return generatedNames[_name] = _name; } function assignGeneratedName(node, name) { getNodeLinks(node).generatedName = ts.unescapeIdentifier(name); @@ -16138,14 +20876,13 @@ var ts; } function generateNameForModuleOrEnum(node) { if (node.name.kind === 64) { - var name = node.name.text; - assignGeneratedName(node, isUniqueLocalName(name, node) ? name : makeUniqueName(name)); + var _name = node.name.text; + assignGeneratedName(node, isUniqueLocalName(_name, node) ? _name : makeUniqueName(_name)); } } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 8 ? - ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + var baseName = expr.kind === 8 ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; assignGeneratedName(node, makeUniqueName(baseName)); } function generateNameForImportDeclaration(node) { @@ -16243,8 +20980,7 @@ var ts; if (ts.nodeIsPresent(node.body)) { var symbol = getSymbolOfNode(node); var signaturesOfSymbol = getSignaturesOfSymbol(symbol); - return signaturesOfSymbol.length > 1 || - (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); } return false; } @@ -16271,9 +21007,7 @@ var ts; } function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { var symbol = getSymbolOfNode(declaration); - var type = symbol && !(symbol.flags & (2048 | 131072)) - ? getTypeOfSymbol(symbol) - : unknownType; + var type = symbol && !(symbol.flags & (2048 | 131072)) ? getTypeOfSymbol(symbol) : unknownType; getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -16282,29 +21016,19 @@ var ts; } function isUnknownIdentifier(location, name) { ts.Debug.assert(!ts.nodeIsSynthesized(location), "isUnknownIdentifier called with a synthesized location"); - return !resolveName(location, name, 107455, undefined, undefined) && - !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); + return !resolveName(location, name, 107455, undefined, undefined) && !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - if (n.parent.kind === 153 && - n.parent.name === n) { + if (n.parent.kind === 153 && n.parent.name === n) { return undefined; } - if (n.parent.kind === 150 && - n.parent.propertyName === n) { + if (n.parent.kind === 150 && n.parent.propertyName === n) { return undefined; } - var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || - n.parent.kind === 150 - ? getSymbolOfNode(n.parent) - : undefined; - var symbol = declarationSymbol || - getNodeLinks(n).resolvedSymbol || - resolveName(n, n.text, 2 | 8388608, undefined, undefined); - var isLetOrConst = symbol && - (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 217; + var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || n.parent.kind === 150 ? getSymbolOfNode(n.parent) : undefined; + var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); + var isLetOrConst = symbol && (symbol.flags & 2) && symbol.valueDeclaration.parent.kind !== 217; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -16395,13 +21119,13 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var i = 0, n = node.modifiers.length; i < n; i++) { - var modifier = node.modifiers[i]; + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { + var modifier = _a[_i]; switch (modifier.kind) { case 108: case 107: case 106: - var text; + var text = void 0; if (modifier.kind === 108) { text = "public"; } @@ -16594,14 +21318,13 @@ var ts; } } function checkGrammarTypeArguments(node, typeArguments) { - return checkGrammarForDisallowedTrailingComma(typeArguments) || - checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var i = 0, n = arguments.length; i < n; i++) { - var arg = arguments[i]; + for (var _i = 0; _i < arguments.length; _i++) { + var arg = arguments[_i]; if (arg.kind === 172) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } @@ -16609,8 +21332,7 @@ var ts; } } function checkGrammarArguments(node, arguments) { - return checkGrammarForDisallowedTrailingComma(arguments) || - checkGrammarForOmittedArgument(node, arguments); + return checkGrammarForDisallowedTrailingComma(arguments) || checkGrammarForOmittedArgument(node, arguments); } function checkGrammarHeritageClause(node) { var types = node.types; @@ -16627,9 +21349,8 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarModifiers(node) && node.heritageClauses) { - for (var i = 0, n = node.heritageClauses.length; i < n; i++) { - ts.Debug.assert(i <= 2); - var heritageClause = node.heritageClauses[i]; + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); @@ -16656,9 +21377,8 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var i = 0, n = node.heritageClauses.length; i < n; i++) { - ts.Debug.assert(i <= 1); - var heritageClause = node.heritageClauses[i]; + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); @@ -16703,19 +21423,18 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var i = 0, n = node.properties.length; i < n; i++) { - var prop = node.properties[i]; - var name = prop.name; - if (prop.kind === 172 || - name.kind === 126) { - checkGrammarComputedPropertyName(name); + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var prop = _a[_i]; + var _name = prop.name; + if (prop.kind === 172 || _name.kind === 126) { + checkGrammarComputedPropertyName(_name); continue; } - var currentKind; + var currentKind = void 0; if (prop.kind === 218 || prop.kind === 219) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name.kind === 7) { - checkGrammarNumbericLiteral(name); + if (_name.kind === 7) { + checkGrammarNumbericLiteral(_name); } currentKind = Property; } @@ -16731,26 +21450,26 @@ var ts; else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - if (!ts.hasProperty(seen, name.text)) { - seen[name.text] = currentKind; + if (!ts.hasProperty(seen, _name.text)) { + seen[_name.text] = currentKind; } else { - var existingKind = seen[name.text]; + var existingKind = seen[_name.text]; if (currentKind === Property && existingKind === Property) { if (inStrictMode) { - grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); + grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); } } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[name.text] = currentKind | existingKind; + seen[_name.text] = currentKind | existingKind; } else { - return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } @@ -16763,23 +21482,17 @@ var ts; var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 182 - ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement - : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 182 - ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer - : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; - return grammarErrorOnNode(firstDeclaration.name, diagnostic); + var _diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + return grammarErrorOnNode(firstDeclaration.name, _diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 182 - ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation - : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; - return grammarErrorOnNode(firstDeclaration, diagnostic); + var _diagnostic_1 = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + return grammarErrorOnNode(firstDeclaration, _diagnostic_1); } } } @@ -16832,9 +21545,7 @@ var ts; } } function checkGrammarMethod(node) { - if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || - checkGrammarFunctionLikeDeclaration(node) || - checkGrammarForGenerator(node)) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarForGenerator(node)) { return true; } if (node.parent.kind === 152) { @@ -16885,8 +21596,7 @@ var ts; switch (current.kind) { case 189: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 184 - && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 184 && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } @@ -16907,16 +21617,12 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 185 - ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement - : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + var message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 185 - ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement - : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; - return grammarErrorOnNode(node, message); + var _message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, _message); } } function checkGrammarBindingElement(node) { @@ -16952,8 +21658,7 @@ var ts; } } var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); - return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || - checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 64) { @@ -16963,8 +21668,9 @@ var ts; } else { var elements = name.elements; - for (var i = 0; i < elements.length; ++i) { - checkGrammarNameInLetOrConstDeclarations(elements[i].name); + for (var _i = 0; _i < elements.length; _i++) { + var element = elements[_i]; + checkGrammarNameInLetOrConstDeclarations(element.name); } } } @@ -17020,8 +21726,8 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var i = 0, n = enumDecl.members.length; i < n; i++) { - var node = enumDecl.members[i]; + for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { + var node = _a[_i]; if (node.name.kind === 126) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } @@ -17085,8 +21791,7 @@ var ts; } function checkGrammarProperty(node) { if (node.parent.kind === 196) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } @@ -17105,19 +21810,14 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 197 || - node.kind === 204 || - node.kind === 203 || - node.kind === 210 || - node.kind === 209 || - (node.flags & 2)) { + if (node.kind === 197 || node.kind === 204 || node.kind === 203 || node.kind === 210 || node.kind === 209 || (node.flags & 2)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var i = 0, n = file.statements.length; i < n; i++) { - var decl = file.statements[i]; + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + var decl = _a[_i]; if (ts.isDeclaration(decl) || decl.kind === 175) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; @@ -17138,9 +21838,9 @@ var ts; return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } if (node.parent.kind === 174 || node.parent.kind === 201 || node.parent.kind === 221) { - var links = getNodeLinks(node.parent); - if (!links.hasReportedStatementInAmbientContext) { - return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); + var _links = getNodeLinks(node.parent); + if (!_links.hasReportedStatementInAmbientContext) { + return _links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); } } else { @@ -17172,7 +21872,10 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var indentStrings = ["", " "]; + var indentStrings = [ + "", + " " + ]; function getIndentString(level) { if (indentStrings[level] === undefined) { indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; @@ -17247,21 +21950,34 @@ var ts; writeTextOfNode: writeTextOfNode, writeLiteral: writeLiteral, writeLine: writeLine, - increaseIndent: function () { return indent++; }, - decreaseIndent: function () { return indent--; }, - getIndent: function () { return indent; }, - getTextPos: function () { return output.length; }, - getLine: function () { return lineCount + 1; }, - getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, - getText: function () { return output; } + increaseIndent: function () { + return indent++; + }, + decreaseIndent: function () { + return indent--; + }, + getIndent: function () { + return indent; + }, + getTextPos: function () { + return output.length; + }, + getLine: function () { + return lineCount + 1; + }, + getColumn: function () { + return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; + }, + getText: function () { + return output; + } }; } function getLineOfLocalPosition(currentSourceFile, pos) { return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { - if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -17290,9 +22006,7 @@ var ts; var lineCount = ts.getLineStarts(currentSourceFile).length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = (currentLine + 1) === lineCount - ? currentSourceFile.text.length + 1 - : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); + var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { firstCommentLineIndent = calculateIndent(ts.getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); @@ -17370,8 +22084,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 134 || member.kind === 135) - && (member.flags & 128) === (accessor.flags & 128)) { + if ((member.kind === 134 || member.kind === 135) && (member.flags & 128) === (accessor.flags & 128)) { var memberName = ts.getPropertyNameForPropertyNameNode(member.name); var accessorName = ts.getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -17401,11 +22114,12 @@ var ts; } function getOwnEmitOutputFilePath(sourceFile, host, extension) { var compilerOptions = host.getCompilerOptions(); + var emitOutputFilePathWithoutExtension; if (compilerOptions.outDir) { - var emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); + emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); } else { - var emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName); + emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName); } return emitOutputFilePathWithoutExtension + extension; } @@ -17427,7 +22141,8 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { + } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var aliasDeclarationEmitInfo = []; var referencePathsOutput = ""; @@ -17436,9 +22151,7 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 2048) || - shouldEmitToOwnFile(referencedFile, compilerOptions) || - !addedGlobalFileReference)) { + if (referencedFile && ((referencedFile.flags & 2048) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { writeReferencePath(referencedFile); if (!isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -17455,8 +22168,7 @@ var ts; if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && - !ts.contains(emittedReferencedFiles, referencedFile))) { + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } @@ -17487,17 +22199,17 @@ var ts; } } function createAndSetNewTextWriterWithSymbolWriter() { - var writer = createTextWriter(newLine); - writer.trackSymbol = trackSymbol; - writer.writeKeyword = writer.write; - writer.writeOperator = writer.write; - writer.writePunctuation = writer.write; - writer.writeSpace = writer.write; - writer.writeStringLiteral = writer.writeLiteral; - writer.writeParameter = writer.write; - writer.writeSymbol = writer.write; - setWriter(writer); - return writer; + var _writer = createTextWriter(newLine); + _writer.trackSymbol = trackSymbol; + _writer.writeKeyword = _writer.write; + _writer.writeOperator = _writer.write; + _writer.writePunctuation = _writer.write; + _writer.writeSpace = _writer.write; + _writer.writeStringLiteral = _writer.writeLiteral; + _writer.writeParameter = _writer.write; + _writer.writeSymbol = _writer.write; + setWriter(_writer); + return _writer; } function setWriter(newWriter) { writer = newWriter; @@ -17510,7 +22222,9 @@ var ts; function writeAsychronousImportEqualsDeclarations(importEqualsDeclarations) { var oldWriter = writer; ts.forEach(importEqualsDeclarations, function (aliasToWrite) { - var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; }); + var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { + return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; + }); if (aliasEmitInfo) { createAndSetNewTextWriterWithSymbolWriter(); for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { @@ -17565,18 +22279,20 @@ var ts; } } function emitLines(nodes) { - for (var i = 0, n = nodes.length; i < n; i++) { - emit(nodes[i]); + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; + emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var i = 0, n = nodes.length; i < n; i++) { + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; if (currentWriterPos !== writer.getTextPos()) { write(separator); } currentWriterPos = writer.getTextPos(); - eachNodeEmitFn(nodes[i]); + eachNodeEmitFn(node); } } function emitCommaList(nodes, eachNodeEmitFn) { @@ -17835,15 +22551,8 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 140 || - node.parent.kind === 141 || - (node.parent.parent && node.parent.parent.kind === 143)) { - ts.Debug.assert(node.parent.kind === 132 || - node.parent.kind === 131 || - node.parent.kind === 140 || - node.parent.kind === 141 || - node.parent.kind === 136 || - node.parent.kind === 137); + if (node.parent.kind === 140 || node.parent.kind === 141 || (node.parent.parent && node.parent.parent.kind === 143)) { + ts.Debug.assert(node.parent.kind === 132 || node.parent.kind === 131 || node.parent.kind === 140 || node.parent.kind === 141 || node.parent.kind === 136 || node.parent.kind === 137); emitType(node.constraint); } else { @@ -17906,9 +22615,7 @@ var ts; function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.parent.parent.kind === 196) { - diagnosticMessage = isImplementsList ? - ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : - ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; @@ -17941,7 +22648,9 @@ var ts; emitTypeParameters(node.typeParameters); var baseTypeNode = ts.getClassBaseTypeNode(node); if (baseTypeNode) { - emitHeritageClause([baseTypeNode], false); + emitHeritageClause([ + baseTypeNode + ], false); } emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); write(" {"); @@ -18001,31 +22710,17 @@ var ts; function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.kind === 193) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } else if (node.kind === 130 || node.kind === 129) { if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } return diagnosticMessage !== undefined ? { @@ -18042,7 +22737,9 @@ var ts; } } function emitVariableStatement(node) { - var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); + var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { + return resolver.isDeclarationVisible(varDeclaration); + }); if (hasDeclarationWithEmit) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); @@ -18065,13 +22762,14 @@ var ts; return; } var accessors = getAllAccessorDeclarations(node.parent.members, node); + var accessorWithTypeAnnotation; if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(node); writeTextOfNode(currentSourceFile, node.name); if (!(node.flags & 32)) { - var accessorWithTypeAnnotation = node; + accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { var anotherAccessor = node.kind === 134 ? accessors.setAccessor : accessors.getAccessor; @@ -18087,25 +22785,17 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 134 - ? accessor.type - : accessor.parameters.length > 0 - ? accessor.parameters[0].type - : undefined; + return accessor.kind === 134 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; } } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (accessorWithTypeAnnotation.kind === 135) { if (accessorWithTypeAnnotation.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } return { diagnosticMessage: diagnosticMessage, @@ -18115,18 +22805,10 @@ var ts; } else { if (accessorWithTypeAnnotation.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; } return { diagnosticMessage: diagnosticMessage, @@ -18140,8 +22822,7 @@ var ts; if (ts.hasDynamicName(node)) { return; } - if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && - !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); if (node.kind === 195) { emitModuleElementDeclarationFlags(node); @@ -18208,48 +22889,28 @@ var ts; var diagnosticMessage; switch (node.kind) { case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 132: case 131: if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : - ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: ts.Debug.fail("This is unknown kind for signature: " + node.kind); @@ -18276,9 +22937,7 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 140 || - node.parent.kind === 141 || - node.parent.parent.kind === 143) { + if (node.parent.kind === 140 || node.parent.kind === 141 || node.parent.parent.kind === 143) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -18288,50 +22947,28 @@ var ts; var diagnosticMessage; switch (node.parent.kind) { case 133: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; break; case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 132: case 131: if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } else if (node.parent.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? - symbolAccesibilityResult.accessibility === 2 ? - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : - ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); @@ -18383,11 +23020,7 @@ var ts; } } function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 2048 - ? referencedFile.fileName - : shouldEmitToOwnFile(referencedFile, compilerOptions) - ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") - : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + var declFileName = referencedFile.flags & 2048 ? referencedFile.fileName : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencePathsOutput += "/// " + newLine; } @@ -18451,20 +23084,28 @@ var ts; var exportSpecifiers; var exportDefault; var writeEmittedFiles = writeJavaScriptFile; - var emitLeadingComments = compilerOptions.removeComments ? function (node) { } : emitLeadingDeclarationComments; - var emitTrailingComments = compilerOptions.removeComments ? function (node) { } : emitTrailingDeclarationComments; - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfLocalPosition; + var emitLeadingComments = compilerOptions.removeComments ? function (node) { + } : emitLeadingDeclarationComments; + var emitTrailingComments = compilerOptions.removeComments ? function (node) { + } : emitTrailingDeclarationComments; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { + } : emitLeadingCommentsOfLocalPosition; var detachedCommentsInfo; - var emitDetachedComments = compilerOptions.removeComments ? function (node) { } : emitDetachedCommentsAtPosition; + var emitDetachedComments = compilerOptions.removeComments ? function (node) { + } : emitDetachedCommentsAtPosition; var writeComment = writeCommentRange; var emitNodeWithoutSourceMap = compilerOptions.removeComments ? emitNodeWithoutSourceMapWithoutComments : emitNodeWithoutSourceMapWithComments; var emit = emitNodeWithoutSourceMap; var emitWithoutComments = emitNodeWithoutSourceMapWithoutComments; - var emitStart = function (node) { }; - var emitEnd = function (node) { }; + var emitStart = function (node) { + }; + var emitEnd = function (node) { + }; var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { }; - var scopeEmitEnd = function () { }; + var scopeEmitStart = function (scopeDeclaration, scopeName) { + }; + var scopeEmitEnd = function () { + }; var sourceMapData; if (compilerOptions.sourceMap) { initializeEmitterWithSourceMaps(); @@ -18490,7 +23131,10 @@ var ts; var names = currentScopeNames; currentScopeNames = undefined; if (names) { - lastFrame = { names: names, previous: lastFrame }; + lastFrame = { + names: names, + previous: lastFrame + }; return true; } return false; @@ -18505,14 +23149,16 @@ var ts; } } function generateUniqueNameForLocation(location, baseName) { - var name; + var _name; if (!isExistingName(location, baseName)) { - name = baseName; + _name = baseName; } else { - name = ts.generateUniqueName(baseName, function (n) { return isExistingName(location, n); }); + _name = ts.generateUniqueName(baseName, function (n) { + return isExistingName(location, n); + }); } - return recordNameInCurrentScope(name); + return recordNameInCurrentScope(_name); } function recordNameInCurrentScope(name) { if (!currentScopeNames) { @@ -18610,12 +23256,7 @@ var ts; sourceLinePos.character++; var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || - lastRecordedSourceMapSpan.emittedLine != emittedLine || - lastRecordedSourceMapSpan.emittedColumn != emittedColumn || - (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { encodeLastRecordedSourceMapSpan(); lastRecordedSourceMapSpan = { emittedLine: emittedLine, @@ -18660,8 +23301,8 @@ var ts; if (scopeName) { var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { - var name = node.name; - if (!name || name.kind !== 126) { + var _name = node.name; + if (!_name || _name.kind !== 126) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -18678,20 +23319,10 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 195 || - node.kind === 160 || - node.kind === 132 || - node.kind === 131 || - node.kind === 134 || - node.kind === 135 || - node.kind === 200 || - node.kind === 196 || - node.kind === 199) { + else if (node.kind === 195 || node.kind === 160 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135 || node.kind === 200 || node.kind === 196 || node.kind === 199) { if (node.name) { - var name = node.name; - scopeName = name.kind === 126 - ? ts.getTextOfNode(name) - : node.name.text; + var _name = node.name; + scopeName = _name.kind === 126 ? ts.getTextOfNode(_name) : node.name.text; } recordScopeNameStart(scopeName); } @@ -18806,17 +23437,17 @@ var ts; writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } function createTempVariable(location, forLoopVariable) { - var name = forLoopVariable ? "_i" : undefined; + var _name = forLoopVariable ? "_i" : undefined; while (true) { - if (name && !isExistingName(location, name)) { + if (_name && !isExistingName(location, _name)) { break; } - name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); + _name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); tempCount++; } - recordNameInCurrentScope(name); + recordNameInCurrentScope(_name); var result = ts.createSynthesizedNode(64); - result.text = name; + result.text = _name; return result; } function recordTempDeclaration(name) { @@ -19034,8 +23665,7 @@ var ts; if (node.template.kind === 169) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 167 - && templateSpan.expression.operatorToken.kind === 23; + var needsParens = templateSpan.expression.kind === 167 && templateSpan.expression.operatorToken.kind === 23; emitParenthesizedIf(templateSpan.expression, needsParens); }); } @@ -19046,8 +23676,7 @@ var ts; ts.forEachChild(node, emit); return; } - var emitOuterParens = ts.isExpression(node.parent) - && templateNeedsParens(node, node.parent); + var emitOuterParens = ts.isExpression(node.parent) && templateNeedsParens(node, node.parent); if (emitOuterParens) { write("("); } @@ -19056,10 +23685,9 @@ var ts; emitLiteral(node.head); headEmitted = true; } - for (var i = 0; i < node.templateSpans.length; i++) { + for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 159 - && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + var needsParens = templateSpan.expression.kind !== 159 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); } @@ -19133,8 +23761,8 @@ var ts; } } function isNotExpressionIdentifier(node) { - var parent = node.parent; - switch (parent.kind) { + var _parent = node.parent; + switch (_parent.kind) { case 128: case 193: case 150: @@ -19154,7 +23782,7 @@ var ts; case 199: case 200: case 203: - return parent.name === node; + return _parent.name === node; case 185: case 184: case 209: @@ -19261,8 +23889,8 @@ var ts; function emitListWithSpread(elements, multiLine, trailingComma) { var pos = 0; var group = 0; - var length = elements.length; - while (pos < length) { + var _length = elements.length; + while (pos < _length) { if (group === 1) { write(".concat("); } @@ -19277,14 +23905,14 @@ var ts; } else { var i = pos; - while (i < length && elements[i].kind !== 171) { + while (i < _length && elements[i].kind !== 171) { i++; } write("["); if (multiLine) { increaseIndent(); } - emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + emitList(elements, pos, i - pos, multiLine, trailingComma && i === _length); if (multiLine) { decreaseIndent(); } @@ -19360,8 +23988,8 @@ var ts; var propertyDescriptor = ts.createSynthesizedNode(152); var descriptorProperties = []; if (getAccessor) { - var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); - descriptorProperties.push(getProperty); + var _getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(_getProperty); } if (setAccessor) { var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); @@ -19474,7 +24102,6 @@ var ts; } } write("{"); - var properties = node.properties; if (properties.length) { emitLinePreservingList(node, properties, languageVersion >= 1, true); } @@ -19557,7 +24184,9 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 171; }); + return ts.forEach(elements, function (e) { + return e.kind === 171; + }); } function skipParentheses(node) { while (node.kind === 159 || node.kind === 158) { @@ -19670,14 +24299,7 @@ var ts; while (operand.kind == 158) { operand = operand.expression; } - if (operand.kind !== 165 && - operand.kind !== 164 && - operand.kind !== 163 && - operand.kind !== 162 && - operand.kind !== 166 && - operand.kind !== 156 && - !(operand.kind === 155 && node.parent.kind === 156) && - !(operand.kind === 160 && node.parent.kind === 155)) { + if (operand.kind !== 165 && operand.kind !== 164 && operand.kind !== 163 && operand.kind !== 162 && operand.kind !== 166 && operand.kind !== 156 && !(operand.kind === 155 && node.parent.kind === 156) && !(operand.kind === 160 && node.parent.kind === 155)) { emit(operand); return; } @@ -19720,8 +24342,7 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operatorToken.kind === 52 && - (node.left.kind === 152 || node.left.kind === 151)) { + if (languageVersion < 2 && node.operatorToken.kind === 52 && (node.left.kind === 152 || node.left.kind === 151)) { emitDestructuring(node, node.parent.kind === 177); } else { @@ -20028,16 +24649,13 @@ var ts; emitToken(15, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === - getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function nodeEndPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === - getLineOfLocalPosition(currentSourceFile, node2.end); + return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === - getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { if (node.kind === 214) { @@ -20135,7 +24753,7 @@ var ts; } function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; - var isDeclaration = (root.kind === 193 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 128; + var _isDeclaration = (root.kind === 193 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 128; if (root.kind === 167) { emitAssignmentExpression(root); } @@ -20160,7 +24778,7 @@ var ts; function ensureIdentifier(expr) { if (expr.kind !== 64) { var identifier = createTempVariable(lowestNonSynthesizedAncestor || root); - if (!isDeclaration) { + if (!_isDeclaration) { recordTempDeclaration(identifier); } emitAssignment(identifier, expr); @@ -20215,8 +24833,8 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var i = 0; i < properties.length; i++) { - var p = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); @@ -20261,18 +24879,18 @@ var ts; } function emitAssignmentExpression(root) { var target = root.left; - var value = root.right; + var _value = root.right; if (isAssignmentExpressionStatement) { - emitDestructuringAssignment(target, value); + emitDestructuringAssignment(target, _value); } else { if (root.parent.kind !== 159) { write("("); } - value = ensureIdentifier(value); - emitDestructuringAssignment(target, value); + _value = ensureIdentifier(_value); + emitDestructuringAssignment(target, _value); write(", "); - emit(value); + emit(_value); if (root.parent.kind !== 159) { write(")"); } @@ -20331,11 +24949,8 @@ var ts; emitModuleMemberName(node); var initializer = node.initializer; if (!initializer && languageVersion < 2) { - var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && - (getCombinedFlagsForIdentifier(node.name) & 4096); - if (isUninitializedLet && - node.parent.parent.kind !== 182 && - node.parent.parent.kind !== 183) { + var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); + if (isUninitializedLet && node.parent.parent.kind !== 182 && node.parent.parent.kind !== 183) { initializer = createVoidZero(); } } @@ -20343,12 +24958,12 @@ var ts; } } function emitExportVariableAssignments(node) { - var name = node.name; - if (name.kind === 64) { - emitExportMemberAssignments(name); + var _name = node.name; + if (_name.kind === 64) { + emitExportMemberAssignments(_name); } - else if (ts.isBindingPattern(name)) { - ts.forEach(name.elements, emitExportVariableAssignments); + else if (ts.isBindingPattern(_name)) { + ts.forEach(_name.elements, emitExportVariableAssignments); } } function getCombinedFlagsForIdentifier(node) { @@ -20358,10 +24973,7 @@ var ts; return ts.getCombinedNodeFlags(node.parent); } function renameNonTopLevelLetAndConst(node) { - if (languageVersion >= 2 || - ts.nodeIsSynthesized(node) || - node.kind !== 64 || - (node.parent.kind !== 193 && node.parent.kind !== 150)) { + if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 64 || (node.parent.kind !== 193 && node.parent.kind !== 150)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); @@ -20373,10 +24985,8 @@ var ts; return; } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 221 - ? blockScopeContainer - : blockScopeContainer.parent; - var generatedName = generateUniqueNameForLocation(parent, node.text); + var _parent = blockScopeContainer.kind === 221 ? blockScopeContainer : blockScopeContainer.parent; + var generatedName = generateUniqueNameForLocation(_parent, node.text); var variableId = resolver.getBlockScopedVariableId(node); if (!generatedBlockScopeNames) { generatedBlockScopeNames = []; @@ -20396,12 +25006,12 @@ var ts; function emitParameter(node) { if (languageVersion < 2) { if (ts.isBindingPattern(node.name)) { - var name = createTempVariable(node); + var _name = createTempVariable(node); if (!tempParameters) { tempParameters = []; } - tempParameters.push(name); - emit(name); + tempParameters.push(_name); + emit(_name); } else { emit(node.name); @@ -20647,9 +25257,10 @@ var ts; decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var i = 0, n = body.statements.length; i < n; i++) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; write(" "); - emit(body.statements[i]); + emit(statement); } emitTempDeclarations(false); write(" "); @@ -20887,11 +25498,12 @@ var ts; emitDetachedComments(ctor.body.statements); } emitCaptureThisForNodeIfNecessary(node); + var superCall; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); if (baseTypeNode) { - var superCall = findInitialSuperCall(ctor); + superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); emit(superCall); @@ -21136,8 +25748,7 @@ var ts; emitImportDeclaration(node); return; } - if (resolver.isReferencedAliasDeclaration(node) || - (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + if (resolver.isReferencedAliasDeclaration(node) || (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); if (!(node.flags & 1)) @@ -21239,8 +25850,8 @@ var ts; if (specifier.name.text === "default") { exportDefault = exportDefault || specifier; } - var name = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name] || (exportSpecifiers[name] = [])).push(specifier); + var _name = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[_name] || (exportSpecifiers[_name] = [])).push(specifier); }); } else if (node.kind === 209) { @@ -21263,8 +25874,8 @@ var ts; } function getExternalImportInfo(node) { if (externalImports) { - for (var i = 0; i < externalImports.length; i++) { - var info = externalImports[i]; + for (var _i = 0; _i < externalImports.length; _i++) { + var info = externalImports[_i]; if (info.rootNode === node) { return info; } @@ -21425,12 +26036,12 @@ var ts; if (node.flags & 2) { return emitPinnedOrTripleSlashComments(node); } - var emitComments = shouldEmitLeadingAndTrailingComments(node); - if (emitComments) { + var _emitComments = shouldEmitLeadingAndTrailingComments(node); + if (_emitComments) { emitLeadingComments(node); } emitJavaScriptWorker(node); - if (emitComments) { + if (_emitComments) { emitTrailingComments(node); } } @@ -21659,7 +26270,10 @@ var ts; else { leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); } - emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, { + pos: pos, + end: pos + }, leadingComments); emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitDetachedCommentsAtPosition(node) { @@ -21684,12 +26298,17 @@ var ts; if (nodeLine >= lastCommentLine + 2) { emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; + var currentDetachedCommentInfo = { + nodePos: node.pos, + detachedCommentEndPos: detachedComments[detachedComments.length - 1].end + }; if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); } else { - detachedCommentsInfo = [currentDetachedCommentInfo]; + detachedCommentsInfo = [ + currentDetachedCommentInfo + ]; } } } @@ -21701,10 +26320,7 @@ var ts; if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && - comment.pos + 2 < comment.end && - currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && - currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { return true; } } @@ -21750,16 +26366,15 @@ var ts; } var unsupportedFileEncodingErrorCode = -2147024809; function getSourceFile(fileName, languageVersion, onError) { + var text; try { var start = new Date().getTime(); - var text = ts.sys.readFile(fileName, options.charset); + text = ts.sys.readFile(fileName, options.charset); ts.ioReadTime += new Date().getTime() - start; } catch (e) { if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode - ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText - : e.message); + onError(e.number === unsupportedFileEncodingErrorCode ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText : e.message); } text = ""; } @@ -21795,12 +26410,20 @@ var ts; } return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + getDefaultLibFileName: function (options) { + return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); + }, writeFile: writeFile, - getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, - useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, + getCurrentDirectory: function () { + return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); + }, + useCaseSensitiveFileNames: function () { + return ts.sys.useCaseSensitiveFileNames; + }, getCanonicalFileName: getCanonicalFileName, - getNewLine: function () { return ts.sys.newLine; } + getNewLine: function () { + return ts.sys.newLine; + } }; } ts.createCompilerHost = createCompilerHost; @@ -21840,7 +26463,9 @@ var ts; var seenNoDefaultLib = options.noLib; var commonSourceDirectory; host = host || createCompilerHost(options); - ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + ts.forEach(rootNames, function (name) { + return processRootFile(name, false); + }); if (!seenNoDefaultLib) { processRootFile(host.getDefaultLibFileName(options), true); } @@ -21849,21 +26474,35 @@ var ts; var noDiagnosticsTypeChecker; program = { getSourceFile: getSourceFile, - getSourceFiles: function () { return files; }, - getCompilerOptions: function () { return options; }, + getSourceFiles: function () { + return files; + }, + getCompilerOptions: function () { + return options; + }, getSyntacticDiagnostics: getSyntacticDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, getDeclarationDiagnostics: getDeclarationDiagnostics, getTypeChecker: getTypeChecker, getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, - getCommonSourceDirectory: function () { return commonSourceDirectory; }, + getCommonSourceDirectory: function () { + return commonSourceDirectory; + }, emit: emit, getCurrentDirectory: host.getCurrentDirectory, - getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, - getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, - getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, - getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } + getNodeCount: function () { + return getDiagnosticsProducingTypeChecker().getNodeCount(); + }, + getIdentifierCount: function () { + return getDiagnosticsProducingTypeChecker().getIdentifierCount(); + }, + getSymbolCount: function () { + return getDiagnosticsProducingTypeChecker().getSymbolCount(); + }, + getTypeCount: function () { + return getDiagnosticsProducingTypeChecker().getTypeCount(); + } }; return program; function getEmitHost(writeFileCallback) { @@ -21890,7 +26529,11 @@ var ts; } function emit(sourceFile, writeFileCallback) { if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { - return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; + return { + diagnostics: [], + sourceMaps: undefined, + emitSkipped: true + }; } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); var start = new Date().getTime(); @@ -21943,9 +26586,11 @@ var ts; processSourceFile(ts.normalizePath(fileName), isDefaultLib); } function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { + var start; + var _length; if (refEnd !== undefined && refPos !== undefined) { - var start = refPos; - var length = refEnd - refPos; + start = refPos; + _length = refEnd - refPos; } var diagnostic; if (hasExtension(fileName)) { @@ -21970,7 +26615,7 @@ var ts; } if (diagnostic) { if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); + diagnostics.add(ts.createFileDiagnostic(refFile, start, _length, diagnostic, fileName)); } else { diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); @@ -22011,17 +26656,17 @@ var ts; files.push(file); } } + return file; } - return file; function getSourceFileFromCache(fileName, canonicalName, useAbsolutePath) { - var file = filesByName[canonicalName]; - if (file && host.useCaseSensitiveFileNames()) { - var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; + var _file = filesByName[canonicalName]; + if (_file && host.useCaseSensitiveFileNames()) { + var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(_file.fileName, host.getCurrentDirectory()) : _file.fileName; if (canonicalName !== sourceFileName) { diagnostics.add(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } } - return file; + return _file; } } function processReferencedFiles(file, basePath) { @@ -22054,15 +26699,14 @@ var ts; } else if (node.kind === 200 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && - ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { - var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); + var _searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); + var tsFile = findModuleSourceFile(_searchName + ".ts", nameLiteral); if (!tsFile) { - findModuleSourceFile(searchName + ".d.ts", nameLiteral); + findModuleSourceFile(_searchName + ".d.ts", nameLiteral); } } } @@ -22083,19 +26727,17 @@ var ts; } return; } - var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); + var firstExternalModuleSourceFile = ts.forEach(files, function (f) { + return ts.isExternalModule(f) ? f : undefined; + }); if (firstExternalModuleSourceFile && !options.module) { var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } - if (options.outDir || - options.sourceRoot || - (options.mapRoot && - (!options.out || firstExternalModuleSourceFile !== undefined))) { + if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModuleSourceFile !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { - if (!(sourceFile.flags & 2048) - && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { + if (!(sourceFile.flags & 2048) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); sourcePathComponents.pop(); if (commonPathComponents) { @@ -22282,7 +26924,11 @@ var ts; { name: "target", shortName: "t", - type: { "es3": 0, "es5": 1, "es6": 2 }, + type: { + "es3": 0, + "es5": 1, + "es6": 2 + }, description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, paramType: ts.Diagnostics.VERSION, error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6 @@ -22462,7 +27108,9 @@ var ts; var files = []; if (ts.hasProperty(json, "files")) { if (json["files"] instanceof Array) { - var files = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); + var files = ts.map(json["files"], function (s) { + return ts.combinePaths(basePath, s); + }); } } else { @@ -22489,8 +27137,7 @@ var ts; } var language = matchResult[1]; var territory = matchResult[3]; - if (!trySetLanguageAndTerritory(language, territory, errors) && - !trySetLanguageAndTerritory(language, undefined, errors)) { + if (!trySetLanguageAndTerritory(language, territory, errors) && !trySetLanguageAndTerritory(language, undefined, errors)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_locale_0, locale)); return false; } @@ -22692,7 +27339,9 @@ var ts; } var sourceFile = hostGetSourceFile(fileName, languageVersion, onError); if (sourceFile && compilerOptions.watch) { - sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.fileName, function () { return sourceFileChanged(sourceFile); }); + sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.fileName, function () { + return sourceFileChanged(sourceFile); + }); } return sourceFile; } @@ -22768,7 +27417,10 @@ var ts; reportTimeStatistic("Compile time", compileTime); reportTimeStatistic("Total time", end); } - return { program: program, exitStatus: exitStatus }; + return { + program: program, + exitStatus: exitStatus + }; function compileProgram() { var diagnostics = program.getSyntacticDiagnostics(); reportDiagnostics(diagnostics); @@ -22781,9 +27433,7 @@ var ts; } } if (compilerOptions.noEmit) { - return diagnostics.length - ? 1 - : 0; + return diagnostics.length ? 1 : 0; } var emitOutput = program.emit(); reportDiagnostics(emitOutput.diagnostics); @@ -22814,8 +27464,12 @@ var ts; output += padding + "tsc @args.txt" + ts.sys.newLine; output += ts.sys.newLine; output += getDiagnosticText(ts.Diagnostics.Options_Colon) + ts.sys.newLine; - var optsList = ts.filter(ts.optionDeclarations.slice(), function (v) { return !v.experimental; }); - optsList.sort(function (a, b) { return ts.compareValues(a.name.toLowerCase(), b.name.toLowerCase()); }); + var optsList = ts.filter(ts.optionDeclarations.slice(), function (v) { + return !v.experimental; + }); + optsList.sort(function (a, b) { + return ts.compareValues(a.name.toLowerCase(), b.name.toLowerCase()); + }); var marginLength = 0; var usageColumn = []; var descriptionColumn = []; diff --git a/bin/tsserver.js b/bin/tsserver.js index 65a06ca9928..fd087d9a138 100644 --- a/bin/tsserver.js +++ b/bin/tsserver.js @@ -44,8 +44,9 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + if (v === value) { return true; } } @@ -67,8 +68,9 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var i = 0, len = array.length; i < len; i++) { - if (predicate(array[i])) { + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + if (predicate(v)) { count++; } } @@ -77,12 +79,13 @@ var ts; } ts.countWhere = countWhere; function filter(array, f) { + var result; if (array) { - var result = []; - for (var i = 0, len = array.length; i < len; i++) { - var item = array[i]; - if (f(item)) { - result.push(item); + result = []; + for (var _i = 0; _i < array.length; _i++) { + var _item = array[_i]; + if (f(_item)) { + result.push(_item); } } } @@ -90,10 +93,12 @@ var ts; } ts.filter = filter; function map(array, f) { + var result; if (array) { - var result = []; - for (var i = 0, len = array.length; i < len; i++) { - result.push(f(array[i])); + result = []; + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + result.push(f(v)); } } return result; @@ -108,12 +113,14 @@ var ts; } ts.concatenate = concatenate; function deduplicate(array) { + var result; if (array) { - var result = []; - for (var i = 0, len = array.length; i < len; i++) { - var item = array[i]; - if (!contains(result, item)) - result.push(item); + result = []; + for (var _i = 0; _i < array.length; _i++) { + var _item = array[_i]; + if (!contains(result, _item)) { + result.push(_item); + } } } return result; @@ -121,15 +128,17 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var i = 0; i < array.length; i++) { - result += array[i][prop]; + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + result += v[prop]; } return result; } ts.sum = sum; function addRange(to, from) { - for (var i = 0, n = from.length; i < n; i++) { - to.push(from[i]); + for (var _i = 0; _i < from.length; _i++) { + var v = from[_i]; + to.push(v); } } ts.addRange = addRange; @@ -190,9 +199,9 @@ var ts; for (var id in first) { result[id] = first[id]; } - for (var id in second) { - if (!hasProperty(result, id)) { - result[id] = second[id]; + for (var _id in second) { + if (!hasProperty(result, _id)) { + result[_id] = second[_id]; } } return result; @@ -391,8 +400,8 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var i = 0; i < parts.length; i++) { - var part = parts[i]; + for (var _i = 0; _i < parts.length; _i++) { + var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { normalized.pop(); @@ -407,7 +416,7 @@ var ts; return normalized; } function normalizePath(path) { - var path = normalizeSlashes(path); + path = normalizeSlashes(path); var rootLength = getRootLength(path); var normalized = getNormalizedParts(path, rootLength); return path.substr(0, rootLength) + normalized.join(ts.directorySeparator); @@ -432,7 +441,7 @@ var ts; ].concat(normalizedParts); } function getNormalizedPathComponents(path, currentDirectory) { - var path = normalizeSlashes(path); + path = normalizeSlashes(path); var rootLength = getRootLength(path); if (rootLength == 0) { path = combinePaths(normalizeSlashes(currentDirectory), path); @@ -543,8 +552,8 @@ var ts; ".js" ]; function removeFileExtension(path) { - for (var i = 0; i < supportedExtensions.length; i++) { - var ext = supportedExtensions[i]; + for (var _i = 0; _i < supportedExtensions.length; _i++) { + var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -701,15 +710,16 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var i = 0; i < files.length; i++) { - var name = files[i]; - if (!extension || ts.fileExtensionIs(name, extension)) { - result.push(ts.combinePaths(path, name)); + for (var _i = 0; _i < files.length; _i++) { + var _name = files[_i]; + if (!extension || ts.fileExtensionIs(_name, extension)) { + result.push(ts.combinePaths(path, _name)); } } var subfolders = getNames(folder.subfolders); - for (var i = 0; i < subfolders.length; i++) { - visitDirectory(ts.combinePaths(path, subfolders[i])); + for (var _a = 0; _a < subfolders.length; _a++) { + var current = subfolders[_a]; + visitDirectory(ts.combinePaths(path, current)); } } } @@ -794,8 +804,9 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var i = 0; i < files.length; i++) { - var name = ts.combinePaths(path, files[i]); + for (var _i = 0; _i < files.length; _i++) { + var current = files[_i]; + var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); if (stat.isFile()) { if (!extension || ts.fileExtensionIs(name, extension)) { @@ -806,8 +817,9 @@ var ts; directories.push(name); } } - for (var i = 0; i < directories.length; i++) { - visitDirectory(directories[i]); + for (var _a = 0; _a < directories.length; _a++) { + var _current = directories[_a]; + visitDirectory(_current); } } } @@ -6256,9 +6268,9 @@ var ts; } function makeReverseMap(source) { var result = []; - for (var name in source) { - if (source.hasOwnProperty(name)) { - result[source[name]] = name; + for (var _name in source) { + if (source.hasOwnProperty(_name)) { + result[source[_name]] = _name; } } return result; @@ -6431,8 +6443,8 @@ var ts; else { ts.Debug.assert(ch === 61); while (pos < len) { - var ch = text.charCodeAt(pos); - if (ch === 62 && isConflictMarkerTrivia(text, pos)) { + var _ch = text.charCodeAt(pos); + if (_ch === 62 && isConflictMarkerTrivia(text, pos)) { break; } pos++; @@ -6826,8 +6838,8 @@ var ts; return result; } function getIdentifierToken() { - var len = tokenValue.length; - if (len >= 2 && len <= 11) { + var _len = tokenValue.length; + if (_len >= 2 && _len <= 11) { var ch = tokenValue.charCodeAt(0); if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { return token = textToToken[tokenValue]; @@ -6979,13 +6991,13 @@ var ts; pos += 2; var commentClosed = false; while (pos < len) { - var ch = text.charCodeAt(pos); - if (ch === 42 && text.charCodeAt(pos + 1) === 47) { + var _ch = text.charCodeAt(pos); + if (_ch === 42 && text.charCodeAt(pos + 1) === 47) { pos += 2; commentClosed = true; break; } - if (isLineBreak(ch)) { + if (isLineBreak(_ch)) { precedingLineBreak = true; } pos++; @@ -7018,22 +7030,22 @@ var ts; } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { pos += 2; - var value = scanBinaryOrOctalDigits(2); - if (value < 0) { + var _value = scanBinaryOrOctalDigits(2); + if (_value < 0) { error(ts.Diagnostics.Binary_digit_expected); - value = 0; + _value = 0; } - tokenValue = "" + value; + tokenValue = "" + _value; return token = 7; } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { pos += 2; - var value = scanBinaryOrOctalDigits(8); - if (value < 0) { + var _value_1 = scanBinaryOrOctalDigits(8); + if (_value_1 < 0) { error(ts.Diagnostics.Octal_digit_expected); - value = 0; + _value_1 = 0; } - tokenValue = "" + value; + tokenValue = "" + _value_1; return token = 7; } if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { @@ -7132,10 +7144,10 @@ var ts; case 126: return pos++, token = 47; case 92: - var ch = peekUnicodeEscape(); - if (ch >= 0 && isIdentifierStart(ch)) { + var cookedChar = peekUnicodeEscape(); + if (cookedChar >= 0 && isIdentifierStart(cookedChar)) { pos += 6; - tokenValue = String.fromCharCode(ch) + scanIdentifierParts(); + tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); return token = getIdentifierToken(); } error(ts.Diagnostics.Invalid_character); @@ -7671,8 +7683,8 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var declaration = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; } @@ -8156,8 +8168,8 @@ var ts; } case 7: case 8: - var parent = node.parent; - switch (parent.kind) { + var _parent = node.parent; + switch (_parent.kind) { case 193: case 128: case 130: @@ -8165,7 +8177,7 @@ var ts; case 220: case 218: case 150: - return parent.initializer === node; + return _parent.initializer === node; case 177: case 178: case 179: @@ -8176,22 +8188,22 @@ var ts; case 214: case 190: case 188: - return parent.expression === node; + return _parent.expression === node; case 181: - var forStatement = parent; + var forStatement = _parent; return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || forStatement.condition === node || forStatement.iterator === node; case 182: case 183: - var forInStatement = parent; + var forInStatement = _parent; return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || forInStatement.expression === node; case 158: - return node === parent.expression; + return node === _parent.expression; case 173: - return node === parent.expression; + return node === _parent.expression; case 126: - return node === parent.expression; + return node === _parent.expression; default: - if (isExpression(parent)) { + if (isExpression(_parent)) { return true; } } @@ -8349,14 +8361,14 @@ var ts; if (name.kind !== 64 && name.kind !== 8 && name.kind !== 7) { return false; } - var parent = name.parent; - if (parent.kind === 208 || parent.kind === 212) { - if (parent.propertyName) { + var _parent = name.parent; + if (_parent.kind === 208 || _parent.kind === 212) { + if (_parent.propertyName) { return true; } } - if (isDeclaration(parent)) { - return parent.name === name; + if (isDeclaration(_parent)) { + return _parent.name === name; } return false; } @@ -8378,9 +8390,10 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var i = 0, n = clauses.length; i < n; i++) { - if (clauses[i].token === kind) { - return clauses[i]; + for (var _i = 0; _i < clauses.length; _i++) { + var clause = clauses[_i]; + if (clause.token === kind) { + return clause; } } } @@ -8625,7 +8638,7 @@ var ts; ts.createSynthesizedNode = createSynthesizedNode; function generateUniqueName(baseName, isExistingName) { if (baseName.charCodeAt(0) !== 95) { - var baseName = "_" + baseName; + baseName = "_" + baseName; if (!isExistingName(baseName)) { return baseName; } @@ -8635,9 +8648,9 @@ var ts; } var i = 1; while (true) { - var name = baseName + i; - if (!isExistingName(name)) { - return name; + var _name = baseName + i; + if (!isExistingName(_name)) { + return _name; } i++; } @@ -8768,8 +8781,9 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var i = 0, len = nodes.length; i < len; i++) { - var result = cbNode(nodes[i]); + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; + var result = cbNode(node); if (result) { return result; } @@ -9021,16 +9035,16 @@ var ts; } ts.modifierToFlag = modifierToFlag; function fixupParentReferences(sourceFile) { - var parent = sourceFile; + var _parent = sourceFile; forEachChild(sourceFile, visitNode); return; function visitNode(n) { - if (n.parent !== parent) { - n.parent = parent; - var saveParent = parent; - parent = n; + if (n.parent !== _parent) { + n.parent = _parent; + var saveParent = _parent; + _parent = n; forEachChild(n, visitNode); - parent = saveParent; + _parent = saveParent; } } } @@ -9068,8 +9082,9 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var i = 0, n = array.length; i < n; i++) { - visitNode(array[i]); + for (var _i = 0; _i < array.length; _i++) { + var node = array[_i]; + visitNode(node); } } } @@ -9131,8 +9146,9 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var i = 0, n = array.length; i < n; i++) { - visitNode(array[i]); + for (var _i = 0; _i < array.length; _i++) { + var node = array[_i]; + visitNode(node); } return; } @@ -9424,8 +9440,8 @@ var ts; } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); - var length = scanner.getTextPos() - start; - parseErrorAtPosition(start, length, message, arg0); + var _length = scanner.getTextPos() - start; + parseErrorAtPosition(start, _length, message, arg0); } function parseErrorAtPosition(start, length, message, arg0) { var lastError = ts.lastOrUndefined(sourceFile.parseDiagnostics); @@ -10238,11 +10254,11 @@ var ts; } function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); - var name = parsePropertyName(); + var _name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (token === 16 || token === 24) { var method = createNode(131, fullStart); - method.name = name; + method.name = _name; method.questionToken = questionToken; fillSignature(51, false, false, method); parseTypeMemberSemicolon(); @@ -10250,7 +10266,7 @@ var ts; } else { var property = createNode(129, fullStart); - property.name = name; + property.name = _name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); parseTypeMemberSemicolon(); @@ -10569,6 +10585,10 @@ var ts; nextToken(); return !scanner.hasPrecedingLineBreak() && isIdentifier(); } + function nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() { + nextToken(); + return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 14 || token === 18); + } function parseYieldExpression() { var node = createNode(170); nextToken(); @@ -10900,10 +10920,10 @@ var ts; continue; } else if (token === 16) { - var callExpr = createNode(155, expression.pos); - callExpr.expression = expression; - callExpr.arguments = parseArgumentList(); - expression = finishNode(callExpr); + var _callExpr = createNode(155, expression.pos); + _callExpr.expression = expression; + _callExpr.arguments = parseArgumentList(); + expression = finishNode(_callExpr); continue; } return expression; @@ -11553,15 +11573,15 @@ var ts; } function parsePropertyOrMethodDeclaration(fullStart, modifiers) { var asteriskToken = parseOptionalToken(35); - var name = parsePropertyName(); + var _name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (asteriskToken || token === 16 || token === 24) { - return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); + return parseMethodDeclaration(fullStart, modifiers, asteriskToken, _name, questionToken, ts.Diagnostics.or_expected); } else { var property = createNode(130, fullStart); setModifiers(property, modifiers); - property.name = name; + property.name = _name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); property.initializer = allowInAnd(parseNonParameterInitializer); @@ -11899,7 +11919,7 @@ var ts; return finishNode(node); } function isLetDeclaration() { - return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOnSameLine); + return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine); } function isDeclarationStart() { switch (token) { @@ -12218,9 +12238,10 @@ var ts; } function declareSymbol(symbols, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); - var name = node.flags & 256 && parent ? "default" : getDeclarationName(node); - if (name !== undefined) { - var symbol = ts.hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); + var _name = node.flags & 256 && parent ? "default" : getDeclarationName(node); + var symbol; + if (_name !== undefined) { + symbol = ts.hasProperty(symbols, _name) ? symbols[_name] : (symbols[_name] = createSymbol(0, _name)); if (symbol.flags & excludes) { if (node.name) { node.name.parent = node; @@ -12230,7 +12251,7 @@ var ts; file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); - symbol = createSymbol(0, name); + symbol = createSymbol(0, _name); } } else { @@ -12582,6 +12603,8 @@ var ts; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0; var emitResolver = createResolver(); + var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); + var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); @@ -12630,8 +12653,6 @@ var ts; getEmitResolver: getEmitResolver, getExportsOfExternalModule: getExportsOfExternalModule }; - var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); - var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var unknownSymbol = createSymbol(4 | 67108864, "unknown"); var resolvingSymbol = createSymbol(67108864, "__resolving__"); var anyType = createIntrinsicType(1, "any"); @@ -13032,11 +13053,11 @@ var ts; function getExternalModuleMember(node, specifier) { var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); if (moduleSymbol) { - var name = specifier.propertyName || specifier.name; - if (name.text) { - var symbol = getSymbol(getExportsOfSymbol(moduleSymbol), name.text, 107455 | 793056 | 1536); + var _name = specifier.propertyName || specifier.name; + if (_name.text) { + var symbol = getSymbol(getExportsOfSymbol(moduleSymbol), _name.text, 107455 | 793056 | 1536); if (!symbol) { - error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name)); + error(_name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(_name)); return; } return symbol.flags & (107455 | 793056 | 1536) ? symbol : resolveAlias(symbol); @@ -13133,8 +13154,9 @@ var ts; if (ts.getFullWidth(name) === 0) { return undefined; } + var symbol; if (name.kind === 64) { - var symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); if (!symbol) { return undefined; } @@ -13145,7 +13167,7 @@ var ts; return undefined; } var right = name.right; - var symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); + symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { error(right, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); return undefined; @@ -13173,14 +13195,17 @@ var ts; return symbol; } } + var sourceFile; while (true) { var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - var sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); - if (sourceFile || isRelative) + sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + if (sourceFile || isRelative) { break; + } var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) + if (parentPath === searchPath) { break; + } searchPath = parentPath; } if (sourceFile) { @@ -13278,8 +13303,8 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var i = 0; i < members.length; i++) { - var member = members[i]; + for (var _i = 0; _i < members.length; _i++) { + var member = members[_i]; if (member.kind === 133 && ts.nodeIsPresent(member.body)) { return member; } @@ -13335,25 +13360,25 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var location = enclosingDeclaration; location; location = location.parent) { - if (location.locals && !isGlobalSourceFile(location)) { - if (result = callback(location.locals)) { + for (var _location = enclosingDeclaration; _location; _location = _location.parent) { + if (_location.locals && !isGlobalSourceFile(_location)) { + if (result = callback(_location.locals)) { return result; } } - switch (location.kind) { + switch (_location.kind) { case 221: - if (!ts.isExternalModule(location)) { + if (!ts.isExternalModule(_location)) { break; } case 200: - if (result = callback(getSymbolOfNode(location).exports)) { + if (result = callback(getSymbolOfNode(_location).exports)) { return result; } break; case 196: case 197: - if (result = callback(getSymbolOfNode(location).members)) { + if (result = callback(getSymbolOfNode(_location).members)) { return result; } break; @@ -13602,8 +13627,9 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var i = 0, n = accessibleSymbolChain.length; i < n; i++) { - appendParentTypeArgumentsAndSymbolName(accessibleSymbolChain[i]); + for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { + var accessibleSymbol = accessibleSymbolChain[_i]; + appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } } else { @@ -13782,15 +13808,17 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var i = 0; i < resolved.callSignatures.length; i++) { - buildSignatureDisplay(resolved.callSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { + var signature = _a[_i]; + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var i = 0; i < resolved.constructSignatures.length; i++) { + for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { + var _signature = _c[_b]; writeKeyword(writer, 87); writeSpace(writer); - buildSignatureDisplay(resolved.constructSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + buildSignatureDisplay(_signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } @@ -13820,17 +13848,18 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var i = 0; i < resolved.properties.length; i++) { - var p = resolved.properties[i]; + for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { + var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var j = 0; j < signatures.length; j++) { + for (var _f = 0; _f < signatures.length; _f++) { + var _signature_1 = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); } - buildSignatureDisplay(signatures[j], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + buildSignatureDisplay(_signature_1, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } @@ -13968,10 +13997,11 @@ var ts; } function isUsedInExportAssignment(node) { var externalModule = getContainingExternalModule(node); + var exportAssignmentSymbol; + var resolvedExportSymbol; if (externalModule) { var externalModuleSymbol = getSymbolOfNode(externalModule); - var exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); - var resolvedExportSymbol; + exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); var symbolOfNode = getSymbolOfNode(node); if (isSymbolUsedInExportAssignment(symbolOfNode)) { return true; @@ -14011,11 +14041,11 @@ var ts; case 195: case 199: case 203: - var parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 203 && parent.kind !== 221 && ts.isInAmbientContext(parent))) { - return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); + var _parent = getDeclarationContainer(node); + if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 203 && _parent.kind !== 221 && ts.isInAmbientContext(_parent))) { + return isGlobalSourceFile(_parent) || isUsedInExportAssignment(node); } - return isDeclarationVisible(parent); + return isDeclarationVisible(_parent); case 130: case 129: case 134: @@ -14087,11 +14117,12 @@ var ts; } return parentType; } + var type; if (pattern.kind === 148) { - var name = declaration.propertyName || declaration.name; - var type = getTypeOfPropertyOfType(parentType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); + var _name = declaration.propertyName || declaration.name; + type = getTypeOfPropertyOfType(parentType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); + error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(_name)); return unknownType; } } @@ -14102,7 +14133,7 @@ var ts; } if (!declaration.dotDotDotToken) { var propName = "" + ts.indexOf(pattern.elements, declaration); - var type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1); + type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1); if (!type) { if (isTupleType(parentType)) { error(declaration, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), parentType.elementTypes.length, pattern.elements.length); @@ -14114,7 +14145,7 @@ var ts; } } else { - var type = createArrayType(getIndexTypeOfType(parentType, 1)); + type = createArrayType(getIndexTypeOfType(parentType, 1)); } } return type; @@ -14166,8 +14197,8 @@ var ts; var members = {}; ts.forEach(pattern.elements, function (e) { var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); - var name = e.propertyName || e.name; - var symbol = createSymbol(flags, name.text); + var _name = e.propertyName || e.name; + var symbol = createSymbol(flags, _name.text); symbol.type = getTypeFromBindingElement(e); members[symbol.name] = symbol; }); @@ -14290,8 +14321,8 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 134); - error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + var _getter = ts.getDeclarationOfKind(symbol, 134); + error(_getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } } @@ -14470,8 +14501,8 @@ var ts; } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 198); - error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + var _declaration = ts.getDeclarationOfKind(symbol, 198); + error(_declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; } @@ -14527,23 +14558,23 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var i = 0; i < symbols.length; i++) { - var symbol = symbols[i]; + for (var _i = 0; _i < symbols.length; _i++) { + var symbol = symbols[_i]; result[symbol.name] = symbol; } return result; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var i = 0; i < symbols.length; i++) { - var symbol = symbols[i]; + for (var _i = 0; _i < symbols.length; _i++) { + var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var i = 0; i < baseSymbols.length; i++) { - var s = baseSymbols[i]; + for (var _i = 0; _i < baseSymbols.length; _i++) { + var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; } @@ -14551,8 +14582,9 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var i = 0; i < baseSignatures.length; i++) { - signatures.push(baseSignatures[i]); + for (var _i = 0; _i < baseSignatures.length; _i++) { + var signature = baseSignatures[_i]; + signatures.push(signature); } } } @@ -14652,13 +14684,14 @@ var ts; return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var i = 0; i < signatures.length; i++) { - if (signatures[i].typeParameters) { + for (var _i = 0; _i < signatures.length; _i++) { + var signature = signatures[_i]; + if (signature.typeParameters) { return emptyArray; } } - for (var i = 1; i < signatureLists.length; i++) { - if (!signatureListsIdentical(signatures, signatureLists[i])) { + for (var _i_1 = 1; _i_1 < signatureLists.length; _i_1++) { + if (!signatureListsIdentical(signatures, signatureLists[_i_1])) { return emptyArray; } } @@ -14674,8 +14707,9 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var i = 0; i < types.length; i++) { - var indexType = getIndexTypeOfType(types[i], kind); + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + var indexType = getIndexTypeOfType(type, kind); if (!indexType) { return undefined; } @@ -14692,17 +14726,22 @@ var ts; } function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; + var members; + var callSignatures; + var constructSignatures; + var stringIndexType; + var numberIndexType; if (symbol.flags & 2048) { - var members = symbol.members; - var callSignatures = getSignaturesOfSymbol(members["__call"]); - var constructSignatures = getSignaturesOfSymbol(members["__new"]); - var stringIndexType = getIndexTypeOfSymbol(symbol, 0); - var numberIndexType = getIndexTypeOfSymbol(symbol, 1); + members = symbol.members; + callSignatures = getSignaturesOfSymbol(members["__call"]); + constructSignatures = getSignaturesOfSymbol(members["__new"]); + stringIndexType = getIndexTypeOfSymbol(symbol, 0); + numberIndexType = getIndexTypeOfSymbol(symbol, 1); } else { - var members = emptySymbols; - var callSignatures = emptyArray; - var constructSignatures = emptyArray; + members = emptySymbols; + callSignatures = emptyArray; + constructSignatures = emptyArray; if (symbol.flags & 1952) { members = getExportsOfSymbol(symbol); } @@ -14720,8 +14759,8 @@ var ts; addInheritedMembers(members, getPropertiesOfObjectType(getTypeOfSymbol(classType.baseTypes[0].symbol))); } } - var stringIndexType = undefined; - var numberIndexType = (symbol.flags & 384) ? stringType : undefined; + stringIndexType = undefined; + numberIndexType = (symbol.flags & 384) ? stringType : undefined; } setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } @@ -14804,8 +14843,9 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var i = 0; i < types.length; i++) { - var type = getApparentType(types[i]); + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); if (!prop) { @@ -14823,12 +14863,12 @@ var ts; } var propTypes = []; var declarations = []; - for (var i = 0; i < props.length; i++) { - var prop = props[i]; - if (prop.declarations) { - declarations.push.apply(declarations, prop.declarations); + for (var _a = 0; _a < props.length; _a++) { + var _prop = props[_a]; + if (_prop.declarations) { + declarations.push.apply(declarations, _prop.declarations); } - propTypes.push(getTypeOfSymbol(prop)); + propTypes.push(getTypeOfSymbol(_prop)); } var result = createSymbol(4 | 67108864 | 268435456, name); result.unionType = unionType; @@ -14865,9 +14905,9 @@ var ts; } } if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) { - var symbol = getPropertyOfObjectType(globalFunctionType, name); - if (symbol) - return symbol; + var _symbol = getPropertyOfObjectType(globalFunctionType, name); + if (_symbol) + return _symbol; } return getPropertyOfObjectType(globalObjectType, name); } @@ -14904,11 +14944,11 @@ var ts; if (!node.moduleSpecifier) { return emptyArray; } - var module = resolveExternalModuleName(node, node.moduleSpecifier); - if (!module || !module.exports) { + var _module = resolveExternalModuleName(node, node.moduleSpecifier); + if (!_module || !_module.exports) { return emptyArray; } - return ts.mapToArray(getExportsOfModule(module)); + return ts.mapToArray(getExportsOfModule(_module)); } function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); @@ -14987,14 +15027,15 @@ var ts; function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { signature.resolvedReturnType = resolvingType; + var type; if (signature.target) { - var type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); + type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); } else if (signature.unionSignatures) { - var type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature)); + type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature)); } else { - var type = getReturnTypeFromBody(signature.declaration); + type = getReturnTypeFromBody(signature.declaration); } if (signature.resolvedReturnType === resolvingType) { signature.resolvedReturnType = type; @@ -15063,8 +15104,9 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var i = 0; i < len; i++) { - var node = indexSymbol.declarations[i]; + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var node = decl; if (node.parameters.length === 1) { var parameter = node.parameters[0]; if (parameter && parameter.type && parameter.type.kind === syntaxKind) { @@ -15100,8 +15142,9 @@ var ts; default: var result = ""; for (var i = 0; i < types.length; i++) { - if (i > 0) + if (i > 0) { result += ","; + } result += types[i].id; } return result; @@ -15109,8 +15152,9 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var i = 0; i < types.length; i++) { - result |= types[i].flags; + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + result |= type.flags; } return result & 786432; } @@ -15167,8 +15211,8 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { var symbol = resolveEntityName(node.typeName, 793056); + var type; if (symbol) { - var type; if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { type = unknownType; } @@ -15206,8 +15250,8 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var declaration = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; switch (declaration.kind) { case 196: case 197: @@ -15291,13 +15335,15 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var i = 0, len = types.length; i < len; i++) { - addTypeToSortedSet(sortedTypes, types[i]); + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -15313,8 +15359,9 @@ var ts; } } function containsAnyType(types) { - for (var i = 0; i < types.length; i++) { - if (types[i].flags & 1) { + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + if (type.flags & 1) { return true; } } @@ -15428,8 +15475,9 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var i = 0; i < items.length; i++) { - result.push(instantiator(items[i], mapper)); + for (var _i = 0; _i < items.length; _i++) { + var v = items[_i]; + result.push(instantiator(v, mapper)); } return result; } @@ -15454,8 +15502,9 @@ var ts; } return function (t) { for (var i = 0; i < sources.length; i++) { - if (t === sources[i]) + if (t === sources[i]) { return targets[i]; + } } return t; }; @@ -15478,9 +15527,11 @@ var ts; return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var i = 0; i < sources.length; i++) { - if (t === sources[i]) + for (var _i = 0; _i < sources.length; _i++) { + var source = sources[_i]; + if (t === source) { return anyType; + } } return t; }; @@ -15516,8 +15567,9 @@ var ts; return result; } function instantiateSignature(signature, mapper, eraseTypeParameters) { + var freshTypeParameters; if (signature.typeParameters && !eraseTypeParameters) { - var freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); + freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); } var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), signature.resolvedReturnType ? instantiateType(signature.resolvedReturnType, mapper) : undefined, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); @@ -15673,7 +15725,7 @@ var ts; } function isRelatedTo(source, target, reportErrors, headMessage, elaborateErrors) { if (elaborateErrors === void 0) { elaborateErrors = false; } - var result; + var _result; if (source === target) return -1; if (relation !== identityRelation) { @@ -15697,53 +15749,53 @@ var ts; if (source.flags & 16384 || target.flags & 16384) { if (relation === identityRelation) { if (source.flags & 16384 && target.flags & 16384) { - if (result = unionTypeRelatedToUnionType(source, target)) { - if (result &= unionTypeRelatedToUnionType(target, source)) { - return result; + if (_result = unionTypeRelatedToUnionType(source, target)) { + if (_result &= unionTypeRelatedToUnionType(target, source)) { + return _result; } } } else if (source.flags & 16384) { - if (result = unionTypeRelatedToType(source, target, reportErrors)) { - return result; + if (_result = unionTypeRelatedToType(source, target, reportErrors)) { + return _result; } } else { - if (result = unionTypeRelatedToType(target, source, reportErrors)) { - return result; + if (_result = unionTypeRelatedToType(target, source, reportErrors)) { + return _result; } } } else { if (source.flags & 16384) { - if (result = unionTypeRelatedToType(source, target, reportErrors)) { - return result; + if (_result = unionTypeRelatedToType(source, target, reportErrors)) { + return _result; } } else { - if (result = typeRelatedToUnionType(source, target, reportErrors)) { - return result; + if (_result = typeRelatedToUnionType(source, target, reportErrors)) { + return _result; } } } } else if (source.flags & 512 && target.flags & 512) { - if (result = typeParameterRelatedTo(source, target, reportErrors)) { - return result; + if (_result = typeParameterRelatedTo(source, target, reportErrors)) { + return _result; } } else { var saveErrorInfo = errorInfo; if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { - return result; + if (_result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return _result; } } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (_result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; - return result; + return _result; } } if (reportErrors) { @@ -15759,16 +15811,17 @@ var ts; return 0; } function unionTypeRelatedToUnionType(source, target) { - var result = -1; + var _result = -1; var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { - var related = typeRelatedToUnionType(sourceTypes[i], target, false); + for (var _i = 0; _i < sourceTypes.length; _i++) { + var sourceType = sourceTypes[_i]; + var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function typeRelatedToUnionType(source, target, reportErrors) { var targetTypes = target.types; @@ -15781,27 +15834,28 @@ var ts; return 0; } function unionTypeRelatedToType(source, target, reportErrors) { - var result = -1; + var _result = -1; var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { - var related = isRelatedTo(sourceTypes[i], target, reportErrors); + for (var _i = 0; _i < sourceTypes.length; _i++) { + var sourceType = sourceTypes[_i]; + var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function typesRelatedTo(sources, targets, reportErrors) { - var result = -1; + var _result = -1; for (var i = 0, len = sources.length; i < len; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function typeParameterRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { @@ -15867,19 +15921,20 @@ var ts; expandingFlags |= 1; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) expandingFlags |= 2; + var _result; if (expandingFlags === 3) { - var result = 1; + _result = 1; } else { - var result = propertiesRelatedTo(source, target, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 0, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 1, reportErrors); - if (result) { - result &= stringIndexTypesRelatedTo(source, target, reportErrors); - if (result) { - result &= numberIndexTypesRelatedTo(source, target, reportErrors); + _result = propertiesRelatedTo(source, target, reportErrors); + if (_result) { + _result &= signaturesRelatedTo(source, target, 0, reportErrors); + if (_result) { + _result &= signaturesRelatedTo(source, target, 1, reportErrors); + if (_result) { + _result &= stringIndexTypesRelatedTo(source, target, reportErrors); + if (_result) { + _result &= numberIndexTypesRelatedTo(source, target, reportErrors); } } } @@ -15887,23 +15942,23 @@ var ts; } expandingFlags = saveExpandingFlags; depth--; - if (result) { + if (_result) { var maybeCache = maybeStack[depth]; - var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; + var destinationCache = (_result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; ts.copyMap(maybeCache, destinationCache); } else { relation[id] = reportErrors ? 3 : 2; } - return result; + return _result; } function isDeeplyNestedGeneric(type, stack) { if (type.flags & 4096 && depth >= 10) { - var target = type.target; + var _target = type.target; var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & 4096 && t.target === target) { + if (t.flags & 4096 && t.target === _target) { count++; if (count >= 10) return true; @@ -15916,11 +15971,11 @@ var ts; if (relation === identityRelation) { return propertiesIdenticalTo(source, target); } - var result = -1; + var _result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var i = 0; i < properties.length; i++) { - var targetProp = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { @@ -15971,7 +16026,7 @@ var ts; } return 0; } - result &= related; + _result &= related; if (sourceProp.flags & 536870912 && !(targetProp.flags & 536870912)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); @@ -15981,7 +16036,7 @@ var ts; } } } - return result; + return _result; } function propertiesIdenticalTo(source, target) { var sourceProperties = getPropertiesOfObjectType(source); @@ -15989,9 +16044,9 @@ var ts; if (sourceProperties.length !== targetProperties.length) { return 0; } - var result = -1; - for (var i = 0, len = sourceProperties.length; i < len; ++i) { - var sourceProp = sourceProperties[i]; + var _result = -1; + for (var _i = 0; _i < sourceProperties.length; _i++) { + var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { return 0; @@ -16000,9 +16055,9 @@ var ts; if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function signaturesRelatedTo(source, target, kind, reportErrors) { if (relation === identityRelation) { @@ -16013,18 +16068,18 @@ var ts; } var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); - var result = -1; + var _result = -1; var saveErrorInfo = errorInfo; - outer: for (var i = 0; i < targetSignatures.length; i++) { - var t = targetSignatures[i]; + outer: for (var _i = 0; _i < targetSignatures.length; _i++) { + var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var j = 0; j < sourceSignatures.length; j++) { - var s = sourceSignatures[j]; + for (var _a = 0; _a < sourceSignatures.length; _a++) { + var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); if (related) { - result &= related; + _result &= related; errorInfo = saveErrorInfo; continue outer; } @@ -16034,7 +16089,7 @@ var ts; return 0; } } - return result; + return _result; } function signatureRelatedTo(source, target, reportErrors) { if (source === target) { @@ -16064,14 +16119,14 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); - var result = -1; + var _result = -1; for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + var _s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + var _t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); var saveErrorInfo = errorInfo; - var related = isRelatedTo(s, t, reportErrors); + var related = isRelatedTo(_s, _t, reportErrors); if (!related) { - related = isRelatedTo(t, s, false); + related = isRelatedTo(_t, _s, false); if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); @@ -16080,13 +16135,13 @@ var ts; } errorInfo = saveErrorInfo; } - result &= related; + _result &= related; } var t = getReturnTypeOfSignature(target); if (t === voidType) - return result; + return _result; var s = getReturnTypeOfSignature(source); - return result & isRelatedTo(s, t, reportErrors); + return _result & isRelatedTo(s, t, reportErrors); } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); @@ -16094,15 +16149,15 @@ var ts; if (sourceSignatures.length !== targetSignatures.length) { return 0; } - var result = -1; + var _result = -1; for (var i = 0, len = sourceSignatures.length; i < len; ++i) { var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function stringIndexTypesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { @@ -16142,11 +16197,12 @@ var ts; } return 0; } + var related; if (sourceStringType && sourceNumberType) { - var related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); + related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); } else { - var related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); + related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); } if (!related) { if (reportErrors) { @@ -16219,14 +16275,14 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); - for (var i = 0, len = source.parameters.length; i < len; i++) { - var s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); - var related = compareTypes(s, t); - if (!related) { + for (var _i = 0, _len = source.parameters.length; _i < _len; _i++) { + var s = source.hasRestParameter && _i === _len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[_i]); + var t = target.hasRestParameter && _i === _len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[_i]); + var _related = compareTypes(s, t); + if (!_related) { return 0; } - result &= related; + result &= _related; } if (compareReturnTypes) { result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); @@ -16234,8 +16290,9 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && !isTypeSubtypeOf(types[i], candidate)) + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; } return true; @@ -16340,29 +16397,30 @@ var ts; return reportWideningErrorsInType(type.typeArguments[0]); } if (type.flags & 131072) { - var errorReported = false; + var _errorReported = false; ts.forEach(getPropertiesOfObjectType(type), function (p) { var t = getTypeOfSymbol(p); if (t.flags & 262144) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); } - errorReported = true; + _errorReported = true; } }); - return errorReported; + return _errorReported; } return false; } function reportImplicitAnyError(declaration, type) { var typeAsString = typeToString(getWidenedType(type)); + var diagnostic; switch (declaration.kind) { case 130: case 129: - var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; + diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; case 128: - var diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; case 195: case 132: @@ -16375,10 +16433,10 @@ var ts; error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; } - var diagnostic = ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; + diagnostic = ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; default: - var diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type; + diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type; } error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } @@ -16417,7 +16475,8 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var i = 0; i < typeParameters.length; i++) { + for (var _i = 0; _i < typeParameters.length; _i++) { + var unused = typeParameters[_i]; inferences.push({ primary: undefined, secondary: undefined @@ -16439,19 +16498,21 @@ var ts; inferFromTypes(source, target); function isInProcess(source, target) { for (var i = 0; i < depth; i++) { - if (source === sourceStack[i] && target === targetStack[i]) + if (source === sourceStack[i] && target === targetStack[i]) { return true; + } } return false; } function isWithinDepthLimit(type, stack) { if (depth >= 5) { - var target = type.target; + var _target = type.target; var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & 4096 && t.target === target) + if (t.flags & 4096 && t.target === _target) { count++; + } } return count < 5; } @@ -16476,16 +16537,16 @@ var ts; else if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { var sourceTypes = source.typeArguments; var targetTypes = target.typeArguments; - for (var i = 0; i < sourceTypes.length; i++) { - inferFromTypes(sourceTypes[i], targetTypes[i]); + for (var _i = 0; _i < sourceTypes.length; _i++) { + inferFromTypes(sourceTypes[_i], targetTypes[_i]); } } else if (target.flags & 16384) { - var targetTypes = target.types; + var _targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var i = 0; i < targetTypes.length; i++) { - var t = targetTypes[i]; + for (var _a = 0; _a < _targetTypes.length; _a++) { + var t = _targetTypes[_a]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; @@ -16501,9 +16562,10 @@ var ts; } } else if (source.flags & 16384) { - var sourceTypes = source.types; - for (var i = 0; i < sourceTypes.length; i++) { - inferFromTypes(sourceTypes[i], target); + var _sourceTypes = source.types; + for (var _b = 0; _b < _sourceTypes.length; _b++) { + var sourceType = _sourceTypes[_b]; + inferFromTypes(sourceType, target); } } else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { @@ -16527,8 +16589,8 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var i = 0; i < properties.length; i++) { - var targetProp = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -16714,9 +16776,9 @@ var ts; } function resolveLocation(node) { var containerNodes = []; - for (var parent = node.parent; parent; parent = parent.parent) { - if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(parent)) { - containerNodes.unshift(parent); + for (var _parent = node.parent; _parent; _parent = _parent.parent) { + if ((ts.isExpression(_parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(_parent)) { + containerNodes.unshift(_parent); } } ts.forEach(containerNodes, function (node) { @@ -17004,11 +17066,12 @@ var ts; var container = ts.getSuperContainer(node, true); if (container) { var canUseSuperExpression = false; + var needToCaptureLexicalThis; if (isCallExpression) { canUseSuperExpression = container.kind === 133; } else { - var needToCaptureLexicalThis = false; + needToCaptureLexicalThis = false; while (container && container.kind === 161) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; @@ -17143,8 +17206,9 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var i = 0; i < types.length; i++) { - var t = mapper(types[i]); + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + var t = mapper(current); if (t) { if (!mappedType) { mappedType = t; @@ -17223,8 +17287,8 @@ var ts; if (node.contextualType) { return node.contextualType; } - var parent = node.parent; - switch (parent.kind) { + var _parent = node.parent; + switch (_parent.kind) { case 193: case 128: case 130: @@ -17236,22 +17300,22 @@ var ts; return getContextualTypeForReturnExpression(node); case 155: case 156: - return getContextualTypeForArgument(parent, node); + return getContextualTypeForArgument(_parent, node); case 158: - return getTypeFromTypeNode(parent.type); + return getTypeFromTypeNode(_parent.type); case 167: return getContextualTypeForBinaryOperand(node); case 218: - return getContextualTypeForObjectLiteralElement(parent); + return getContextualTypeForObjectLiteralElement(_parent); case 151: return getContextualTypeForElementExpression(node); case 168: return getContextualTypeForConditionalOperand(node); case 173: - ts.Debug.assert(parent.parent.kind === 169); - return getContextualTypeForSubstitutionExpression(parent.parent, node); + ts.Debug.assert(_parent.parent.kind === 169); + return getContextualTypeForSubstitutionExpression(_parent.parent, node); case 159: - return getContextualType(parent); + return getContextualType(_parent); } return undefined; } @@ -17281,11 +17345,12 @@ var ts; } var signatureList; var types = type.types; - for (var i = 0; i < types.length; i++) { - if (signatureList && getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; } - var signature = getNonGenericSignature(types[i]); + var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { signatureList = [ @@ -17312,15 +17377,15 @@ var ts; return mapper && mapper !== identityMapper; } function isAssignmentTarget(node) { - var parent = node.parent; - if (parent.kind === 167 && parent.operatorToken.kind === 52 && parent.left === node) { + var _parent = node.parent; + if (_parent.kind === 167 && _parent.operatorToken.kind === 52 && _parent.left === node) { return true; } - if (parent.kind === 218) { - return isAssignmentTarget(parent.parent); + if (_parent.kind === 218) { + return isAssignmentTarget(_parent.parent); } - if (parent.kind === 151) { - return isAssignmentTarget(parent); + if (_parent.kind === 151) { + return isAssignmentTarget(_parent); } return false; } @@ -17385,19 +17450,20 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var i = 0; i < node.properties.length; i++) { - var memberDecl = node.properties[i]; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var memberDecl = _a[_i]; var member = memberDecl.symbol; if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { + var type = void 0; if (memberDecl.kind === 218) { - var type = checkPropertyAssignment(memberDecl, contextualMapper); + type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 132) { - var type = checkObjectLiteralMethod(memberDecl, contextualMapper); + type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { ts.Debug.assert(memberDecl.kind === 219); - var type = memberDecl.name.kind === 126 ? unknownType : checkExpression(memberDecl.name, contextualMapper); + type = memberDecl.name.kind === 126 ? unknownType : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -17430,15 +17496,15 @@ var ts; for (var i = 0; i < propertiesArray.length; i++) { var propertyDecl = node.properties[i]; if (kind === 0 || isNumericName(propertyDecl.name)) { - var type = getTypeOfSymbol(propertiesArray[i]); - if (!ts.contains(propTypes, type)) { - propTypes.push(type); + var _type = getTypeOfSymbol(propertiesArray[i]); + if (!ts.contains(propTypes, _type)) { + propTypes.push(_type); } } } - var result = propTypes.length ? getUnionType(propTypes) : undefinedType; - typeFlags |= result.flags; - return result; + var _result = propTypes.length ? getUnionType(propTypes) : undefinedType; + typeFlags |= _result.flags; + return _result; } return undefined; } @@ -17539,9 +17605,9 @@ var ts; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); } else { - var start = node.end - "]".length; - var end = node.end; - grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected); + var _start = node.end - "]".length; + var _end = node.end; + grammarErrorAtPos(sourceFile, _start, _end - _start, ts.Diagnostics.Expression_expected); } } var objectType = getApparentType(checkExpression(node.expression)); @@ -17555,15 +17621,15 @@ var ts; return unknownType; } if (node.argumentExpression) { - var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); - if (name !== undefined) { - var prop = getPropertyOfType(objectType, name); + var _name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (_name !== undefined) { + var prop = getPropertyOfType(objectType, _name); if (prop) { getNodeLinks(node).resolvedSymbol = prop; return getTypeOfSymbol(prop); } else if (isConstEnum) { - error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name, symbolToString(objectType.symbol)); + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, _name, symbolToString(objectType.symbol)); return unknownType; } } @@ -17650,22 +17716,22 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var i = 0; i < signatures.length; i++) { - var signature = signatures[i]; + for (var _i = 0; _i < signatures.length; _i++) { + var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent = signature.declaration && signature.declaration.parent; + var _parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent === lastParent) { + if (lastParent && _parent === lastParent) { index++; } else { - lastParent = parent; + lastParent = _parent; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent; + lastParent = _parent; } lastSymbol = symbol; if (signature.hasStringLiterals) { @@ -17755,30 +17821,31 @@ var ts; var arg = args[i]; if (arg.kind !== 172) { var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); + var argType = void 0; if (i === 0 && args[i].parent.kind === 157) { - var argType = globalTemplateStringsArrayType; + argType = globalTemplateStringsArrayType; } else { var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; - var argType = checkExpressionWithContextualType(arg, paramType, mapper); + argType = checkExpressionWithContextualType(arg, paramType, mapper); } inferTypes(context, argType, paramType); } } if (excludeArgument) { - for (var i = 0; i < args.length; i++) { - if (excludeArgument[i] === false) { - var arg = args[i]; - var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + for (var _i = 0; _i < args.length; _i++) { + if (excludeArgument[_i] === false) { + var _arg = args[_i]; + var _paramType = getTypeAtPosition(signature, _arg.kind === 171 ? -1 : _i); + inferTypes(context, checkExpressionWithContextualType(_arg, _paramType, inferenceMapper), _paramType); } } } var inferredTypes = getInferredTypes(context); context.failedTypeParameterIndex = ts.indexOf(inferredTypes, inferenceFailureType); - for (var i = 0; i < inferredTypes.length; i++) { - if (inferredTypes[i] === inferenceFailureType) { - inferredTypes[i] = unknownType; + for (var _i_1 = 0; _i_1 < inferredTypes.length; _i_1++) { + if (inferredTypes[_i_1] === inferenceFailureType) { + inferredTypes[_i_1] = unknownType; } } return context; @@ -17900,50 +17967,53 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var i = 0, n = candidates.length; i < n; i++) { - if (hasCorrectArity(node, args, candidates[i])) { - return candidates[i]; + for (var _i = 0; _i < candidates.length; _i++) { + var candidate = candidates[_i]; + if (hasCorrectArity(node, args, candidate)) { + return candidate; } } } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var i = 0; i < candidates.length; i++) { - if (!hasCorrectArity(node, args, candidates[i])) { + for (var _a = 0; _a < candidates.length; _a++) { + var current = candidates[_a]; + if (!hasCorrectArity(node, args, current)) { continue; } - var originalCandidate = candidates[i]; - var inferenceResult; + var originalCandidate = current; + var inferenceResult = void 0; + var _candidate = void 0; + var typeArgumentsAreValid = void 0; while (true) { - var candidate = originalCandidate; - if (candidate.typeParameters) { - var typeArgumentTypes; - var typeArgumentsAreValid; + _candidate = originalCandidate; + if (_candidate.typeParameters) { + var typeArgumentTypes = void 0; if (typeArguments) { - typeArgumentTypes = new Array(candidate.typeParameters.length); - typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); + typeArgumentTypes = new Array(_candidate.typeParameters.length); + typeArgumentsAreValid = checkTypeArguments(_candidate, typeArguments, typeArgumentTypes, false); } else { - inferenceResult = inferTypeArguments(candidate, args, excludeArgument); + inferenceResult = inferTypeArguments(_candidate, args, excludeArgument); typeArgumentsAreValid = inferenceResult.failedTypeParameterIndex < 0; typeArgumentTypes = inferenceResult.inferredTypes; } if (!typeArgumentsAreValid) { break; } - candidate = getSignatureInstantiation(candidate, typeArgumentTypes); + _candidate = getSignatureInstantiation(_candidate, typeArgumentTypes); } - if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { + if (!checkApplicableSignature(node, args, _candidate, relation, excludeArgument, false)) { break; } var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; if (index < 0) { - return candidate; + return _candidate; } excludeArgument[index] = false; } if (originalCandidate.typeParameters) { - var instantiatedCandidate = candidate; + var instantiatedCandidate = _candidate; if (typeArgumentsAreValid) { candidateForArgumentError = instantiatedCandidate; } @@ -17955,7 +18025,7 @@ var ts; } } else { - ts.Debug.assert(originalCandidate === candidate); + ts.Debug.assert(originalCandidate === _candidate); candidateForArgumentError = originalCandidate; } } @@ -18107,9 +18177,9 @@ var ts; links.type = instantiateType(getTypeAtPosition(context, i), mapper); } if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { - var parameter = signature.parameters[signature.parameters.length - 1]; - var links = getSymbolLinks(parameter); - links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); + var _parameter = signature.parameters[signature.parameters.length - 1]; + var _links = getSymbolLinks(_parameter); + _links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); } } function getReturnTypeFromBody(func, contextualMapper) { @@ -18117,15 +18187,16 @@ var ts; if (!func.body) { return unknownType; } + var type; if (func.body.kind !== 174) { - var type = checkExpressionCached(func.body, contextualMapper); + type = checkExpressionCached(func.body, contextualMapper); } else { var types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper); if (types.length === 0) { return voidType; } - var type = contextualSignature ? getUnionType(types) : getCommonSupertype(types); + type = contextualSignature ? getUnionType(types) : getCommonSupertype(types); if (!type) { error(func, ts.Diagnostics.No_best_common_type_exists_among_return_expressions); return unknownType; @@ -18246,11 +18317,15 @@ var ts; function isReferenceOrErrorExpression(n) { switch (n.kind) { case 64: - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + { + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + } case 153: - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; + { + var _symbol = findSymbol(n); + return !_symbol || _symbol === unknownSymbol || (_symbol.flags & ~8) !== 0; + } case 154: return true; case 159: @@ -18263,17 +18338,21 @@ var ts; switch (n.kind) { case 64: case 153: - var symbol = findSymbol(n); - return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; + { + var symbol = findSymbol(n); + return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; + } case 154: - var index = n.argumentExpression; - var symbol = findSymbol(n.expression); - if (symbol && index && index.kind === 8) { - var name = index.text; - var prop = getPropertyOfType(getTypeOfSymbol(symbol), name); - return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; + { + var index = n.argumentExpression; + var _symbol = findSymbol(n.expression); + if (_symbol && index && index.kind === 8) { + var _name = index.text; + var prop = getPropertyOfType(getTypeOfSymbol(_symbol), _name); + return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; + } + return false; } - return false; case 159: return isConstVariableReference(n.expression); default: @@ -18345,8 +18424,9 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var i = 0; i < types.length; i++) { - if (types[i].flags & kind) { + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + if (current.flags & kind) { return true; } } @@ -18360,8 +18440,9 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var i = 0; i < types.length; i++) { - if (!(types[i].flags & kind)) { + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + if (!(current.flags & kind)) { return false; } } @@ -18395,16 +18476,16 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var i = 0; i < properties.length; i++) { - var p = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { - var name = p.name; - var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); + var _name = p.name; + var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { - checkDestructuringAssignment(p.initializer || name, type); + checkDestructuringAssignment(p.initializer || _name, type); } else { - error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name)); + error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(_name)); } } else { @@ -18835,8 +18916,9 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var i = 0, len = indexSymbol.declarations.length; i < len; ++i) { - var declaration = indexSymbol.declarations[i]; + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { case 120: @@ -19024,8 +19106,8 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var i = 0; i < signaturesToCheck.length; i++) { - var otherSignature = signaturesToCheck[i]; + for (var _i = 0; _i < signaturesToCheck.length; _i++) { + var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; } @@ -19105,16 +19187,16 @@ var ts; }); if (subsequentNode) { if (subsequentNode.kind === node.kind) { - var errorNode = subsequentNode.name || subsequentNode; + var _errorNode = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { ts.Debug.assert(node.kind === 132 || node.kind === 131); ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; - error(errorNode, diagnostic); + error(_errorNode, diagnostic); return; } else if (ts.nodeIsPresent(subsequentNode.body)) { - error(errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); + error(_errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); return; } } @@ -19130,8 +19212,9 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var i = 0; i < declarations.length; i++) { - var node = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var current = declarations[_i]; + var node = current; var inAmbientContext = ts.isInAmbientContext(node); var inAmbientContextOrInterface = node.parent.kind === 197 || node.parent.kind === 143 || inAmbientContext; if (inAmbientContextOrInterface) { @@ -19188,9 +19271,10 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var i = 0, len = signatures.length; i < len; ++i) { - if (!signatures[i].hasStringLiterals && !isSignatureAssignableTo(bodySignature, signatures[i])) { - error(signatures[i].declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + for (var _a = 0; _a < signatures.length; _a++) { + var signature = signatures[_a]; + if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { + error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; } } @@ -19202,7 +19286,6 @@ var ts; if (!produceDiagnostics) { return; } - var symbol; var symbol = node.localSymbol; if (!symbol) { symbol = getSymbolOfNode(node); @@ -19331,8 +19414,8 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4) { - var isDeclaration = node.kind !== 64; - if (isDeclaration) { + var _isDeclaration = node.kind !== 64; + if (_isDeclaration) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } else { @@ -19352,8 +19435,8 @@ var ts; return; } if (ts.getClassBaseTypeNode(enclosingClass)) { - var isDeclaration = node.kind !== 64; - if (isDeclaration) { + var _isDeclaration = node.kind !== 64; + if (_isDeclaration) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -19368,8 +19451,8 @@ var ts; if (node.kind === 200 && ts.getModuleInstanceState(node) !== 1) { return; } - var parent = getDeclarationContainer(node); - if (parent.kind === 221 && ts.isExternalModule(parent)) { + var _parent = getDeclarationContainer(node); + if (_parent.kind === 221 && ts.isExternalModule(_parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -19384,8 +19467,8 @@ var ts; var container = varDeclList.parent.kind === 175 && varDeclList.parent.parent; var namesShareScope = container && (container.kind === 174 && ts.isFunctionLike(container.parent) || (container.kind === 201 && container.kind === 200) || container.kind === 221); if (!namesShareScope) { - var name = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); + var _name = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, _name, _name); } } } @@ -19399,10 +19482,11 @@ var ts; return node.kind === 128; } function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind === 128) { - var func = ts.getContainingFunction(node); - visit(node.initializer); + if (getRootDeclaration(node).kind !== 128) { + return; } + var func = ts.getContainingFunction(node); + visit(node.initializer); function visit(n) { if (n.kind === 64) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; @@ -19831,8 +19915,8 @@ var ts; }); if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 196) { var classDeclaration = type.symbol.valueDeclaration; - for (var i = 0; i < classDeclaration.members.length; i++) { - var member = classDeclaration.members[i]; + for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { + var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0); @@ -19861,22 +19945,22 @@ var ts; if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { return; } - var errorNode; + var _errorNode; if (prop.valueDeclaration.name.kind === 126 || prop.parent === containingType.symbol) { - errorNode = prop.valueDeclaration; + _errorNode = prop.valueDeclaration; } else if (indexDeclaration) { - errorNode = indexDeclaration; + _errorNode = indexDeclaration; } else if (containingType.flags & 2048) { var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); - errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; + _errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } - if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { + if (_errorNode && !isTypeAssignableTo(propertyType, indexType)) { var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; - error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); + error(_errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); } } } @@ -19893,7 +19977,7 @@ var ts; } function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { - for (var i = 0; i < typeParameterDeclarations.length; i++) { + for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { var node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { @@ -19965,8 +20049,9 @@ var ts; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); - for (var i = 0, len = baseProperties.length; i < len; ++i) { - var base = getTargetSymbol(baseProperties[i]); + for (var _i = 0; _i < baseProperties.length; _i++) { + var baseProperty = baseProperties[_i]; + var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { continue; } @@ -19983,7 +20068,7 @@ var ts; if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) { continue; } - var errorMessage; + var errorMessage = void 0; if (base.flags & 8192) { if (derived.flags & 98304) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; @@ -20046,11 +20131,11 @@ var ts; }; }); var ok = true; - for (var i = 0, len = type.baseTypes.length; i < len; ++i) { - var base = type.baseTypes[i]; + for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { + var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var j = 0, proplen = properties.length; j < proplen; ++j) { - var prop = properties[j]; + for (var _b = 0; _b < properties.length; _b++) { + var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, @@ -20108,8 +20193,8 @@ var ts; checkSourceElement(node.type); } function computeEnumMemberValues(node) { - var nodeLinks = getNodeLinks(node); - if (!(nodeLinks.flags & 128)) { + var _nodeLinks = getNodeLinks(node); + if (!(_nodeLinks.flags & 128)) { var enumSymbol = getSymbolOfNode(node); var enumType = getDeclaredTypeOfSymbol(enumSymbol); var autoValue = 0; @@ -20146,7 +20231,7 @@ var ts; getNodeLinks(member).enumMemberValue = autoValue++; } }); - nodeLinks.flags |= 128; + _nodeLinks.flags |= 128; } function getConstantValueForEnumMemberInitializer(initializer, enumIsConst) { return evalConstant(initializer); @@ -20215,10 +20300,10 @@ var ts; } var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); - var enumType; + var _enumType; var propertyName; if (e.kind === 64) { - enumType = currentType; + _enumType = currentType; propertyName = e.text; } else { @@ -20226,21 +20311,21 @@ var ts; if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { return undefined; } - var enumType = getTypeOfNode(e.expression); + _enumType = getTypeOfNode(e.expression); propertyName = e.argumentExpression.text; } else { - var enumType = getTypeOfNode(e.expression); + _enumType = getTypeOfNode(e.expression); propertyName = e.name.text; } - if (enumType !== currentType) { + if (_enumType !== currentType) { return undefined; } } if (propertyName === undefined) { return undefined; } - var property = getPropertyOfObjectType(enumType, propertyName); + var property = getPropertyOfObjectType(_enumType, propertyName); if (!property || !(property.flags & 8)) { return undefined; } @@ -20300,8 +20385,8 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var declaration = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; if ((declaration.kind === 196 || (declaration.kind === 195 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -20468,18 +20553,19 @@ var ts; } function hasExportedMembers(moduleSymbol) { var declarations = moduleSymbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var statements = getModuleStatements(declarations[i]); - for (var j = 0; j < statements.length; j++) { - var node = statements[j]; + for (var _i = 0; _i < declarations.length; _i++) { + var current = declarations[_i]; + var statements = getModuleStatements(current); + for (var _a = 0; _a < statements.length; _a++) { + var node = statements[_a]; if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; } var specifiers = exportClause.elements; - for (var k = 0; k < specifiers.length; k++) { - var specifier = specifiers[k]; + for (var _b = 0; _b < specifiers.length; _b++) { + var specifier = specifiers[_b]; if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) { return true; } @@ -20842,21 +20928,21 @@ var ts; } case 125: ts.Debug.assert(node.kind === 64 || node.kind === 125, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); - var parent = node.parent; - if (parent.kind === 142) { + var _parent = node.parent; + if (_parent.kind === 142) { return false; } - if (139 <= parent.kind && parent.kind <= 147) { + if (139 <= _parent.kind && _parent.kind <= 147) { return true; } - switch (parent.kind) { + switch (_parent.kind) { case 127: - return node === parent.constraint; + return node === _parent.constraint; case 130: case 129: case 128: case 193: - return node === parent.type; + return node === _parent.type; case 195: case 160: case 161: @@ -20865,16 +20951,16 @@ var ts; case 131: case 134: case 135: - return node === parent.type; + return node === _parent.type; case 136: case 137: case 138: - return node === parent.type; + return node === _parent.type; case 158: - return node === parent.type; + return node === _parent.type; case 155: case 156: - return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + return _parent.typeArguments && ts.indexOf(_parent.typeArguments, node) >= 0; case 157: return false; } @@ -20930,17 +21016,17 @@ var ts; return getNodeLinks(entityName).resolvedSymbol; } else if (entityName.kind === 125) { - var symbol = getNodeLinks(entityName).resolvedSymbol; - if (!symbol) { + var _symbol = getNodeLinks(entityName).resolvedSymbol; + if (!_symbol) { checkQualifiedName(entityName); } return getNodeLinks(entityName).resolvedSymbol; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 139 ? 793056 : 1536; - meaning |= 8388608; - return resolveEntityName(entityName, meaning); + var _meaning = entityName.parent.kind === 139 ? 793056 : 1536; + _meaning |= 8388608; + return resolveEntityName(entityName, _meaning); } return undefined; } @@ -21009,21 +21095,21 @@ var ts; return getDeclaredTypeOfSymbol(symbol); } if (isTypeDeclarationName(node)) { - var symbol = getSymbolInfo(node); - return symbol && getDeclaredTypeOfSymbol(symbol); + var _symbol = getSymbolInfo(node); + return _symbol && getDeclaredTypeOfSymbol(_symbol); } if (ts.isDeclaration(node)) { - var symbol = getSymbolOfNode(node); - return getTypeOfSymbol(symbol); + var _symbol_1 = getSymbolOfNode(node); + return getTypeOfSymbol(_symbol_1); } if (ts.isDeclarationName(node)) { - var symbol = getSymbolInfo(node); - return symbol && getTypeOfSymbol(symbol); + var _symbol_2 = getSymbolInfo(node); + return _symbol_2 && getTypeOfSymbol(_symbol_2); } if (isInRightSideOfImportOrExportAssignment(node)) { - var symbol = getSymbolInfo(node); - var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); - return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); + var _symbol_3 = getSymbolInfo(node); + var declaredType = _symbol_3 && getDeclaredTypeOfSymbol(_symbol_3); + return declaredType !== unknownType ? declaredType : getTypeOfSymbol(_symbol_3); } return unknownType; } @@ -21034,7 +21120,7 @@ var ts; return checkExpression(expr); } function getAugmentedPropertiesOfType(type) { - var type = getApparentType(type); + type = getApparentType(type); var propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { @@ -21048,9 +21134,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456) { var symbols = []; - var name = symbol.name; + var _name = symbol.name; ts.forEach(getSymbolLinks(symbol).unionType.types, function (t) { - symbols.push(getPropertyOfType(t, name)); + symbols.push(getPropertyOfType(t, _name)); }); return symbols; } @@ -21127,8 +21213,8 @@ var ts; return ts.hasProperty(globals, name) || ts.hasProperty(sourceFile.identifiers, name) || ts.hasProperty(generatedNames, name); } function makeUniqueName(baseName) { - var name = ts.generateUniqueName(baseName, isExistingName); - return generatedNames[name] = name; + var _name = ts.generateUniqueName(baseName, isExistingName); + return generatedNames[_name] = _name; } function assignGeneratedName(node, name) { getNodeLinks(node).generatedName = ts.unescapeIdentifier(name); @@ -21140,8 +21226,8 @@ var ts; } function generateNameForModuleOrEnum(node) { if (node.name.kind === 64) { - var name = node.name.text; - assignGeneratedName(node, isUniqueLocalName(name, node) ? name : makeUniqueName(name)); + var _name = node.name.text; + assignGeneratedName(node, isUniqueLocalName(_name, node) ? _name : makeUniqueName(_name)); } } function generateNameForImportOrExportDeclaration(node) { @@ -21291,7 +21377,7 @@ var ts; return undefined; } var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || n.parent.kind === 150 ? getSymbolOfNode(n.parent) : undefined; - var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 2 | 8388608, undefined, undefined); + var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2) && symbol.valueDeclaration.parent.kind !== 217; if (isLetOrConst) { getSymbolLinks(symbol); @@ -21383,13 +21469,13 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var i = 0, n = node.modifiers.length; i < n; i++) { - var modifier = node.modifiers[i]; + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { + var modifier = _a[_i]; switch (modifier.kind) { case 108: case 107: case 106: - var text; + var text = void 0; if (modifier.kind === 108) { text = "public"; } @@ -21587,8 +21673,8 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var i = 0, n = arguments.length; i < n; i++) { - var arg = arguments[i]; + for (var _i = 0; _i < arguments.length; _i++) { + var arg = arguments[_i]; if (arg.kind === 172) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } @@ -21613,9 +21699,8 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarModifiers(node) && node.heritageClauses) { - for (var i = 0, n = node.heritageClauses.length; i < n; i++) { - ts.Debug.assert(i <= 2); - var heritageClause = node.heritageClauses[i]; + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); @@ -21642,9 +21727,8 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var i = 0, n = node.heritageClauses.length; i < n; i++) { - ts.Debug.assert(i <= 1); - var heritageClause = node.heritageClauses[i]; + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); @@ -21689,18 +21773,18 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var i = 0, n = node.properties.length; i < n; i++) { - var prop = node.properties[i]; - var name = prop.name; - if (prop.kind === 172 || name.kind === 126) { - checkGrammarComputedPropertyName(name); + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var prop = _a[_i]; + var _name = prop.name; + if (prop.kind === 172 || _name.kind === 126) { + checkGrammarComputedPropertyName(_name); continue; } - var currentKind; + var currentKind = void 0; if (prop.kind === 218 || prop.kind === 219) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name.kind === 7) { - checkGrammarNumbericLiteral(name); + if (_name.kind === 7) { + checkGrammarNumbericLiteral(_name); } currentKind = Property; } @@ -21716,26 +21800,26 @@ var ts; else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - if (!ts.hasProperty(seen, name.text)) { - seen[name.text] = currentKind; + if (!ts.hasProperty(seen, _name.text)) { + seen[_name.text] = currentKind; } else { - var existingKind = seen[name.text]; + var existingKind = seen[_name.text]; if (currentKind === Property && existingKind === Property) { if (inStrictMode) { - grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); + grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); } } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[name.text] = currentKind | existingKind; + seen[_name.text] = currentKind | existingKind; } else { - return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } @@ -21753,12 +21837,12 @@ var ts; } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; - return grammarErrorOnNode(firstDeclaration.name, diagnostic); + var _diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + return grammarErrorOnNode(firstDeclaration.name, _diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; - return grammarErrorOnNode(firstDeclaration, diagnostic); + var _diagnostic_1 = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + return grammarErrorOnNode(firstDeclaration, _diagnostic_1); } } } @@ -21887,8 +21971,8 @@ var ts; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; - return grammarErrorOnNode(node, message); + var _message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, _message); } } function checkGrammarBindingElement(node) { @@ -21934,8 +22018,9 @@ var ts; } else { var elements = name.elements; - for (var i = 0; i < elements.length; ++i) { - checkGrammarNameInLetOrConstDeclarations(elements[i].name); + for (var _i = 0; _i < elements.length; _i++) { + var element = elements[_i]; + checkGrammarNameInLetOrConstDeclarations(element.name); } } } @@ -21991,8 +22076,8 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var i = 0, n = enumDecl.members.length; i < n; i++) { - var node = enumDecl.members[i]; + for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { + var node = _a[_i]; if (node.name.kind === 126) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } @@ -22081,8 +22166,8 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var i = 0, n = file.statements.length; i < n; i++) { - var decl = file.statements[i]; + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + var decl = _a[_i]; if (ts.isDeclaration(decl) || decl.kind === 175) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; @@ -22103,9 +22188,9 @@ var ts; return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } if (node.parent.kind === 174 || node.parent.kind === 201 || node.parent.kind === 221) { - var links = getNodeLinks(node.parent); - if (!links.hasReportedStatementInAmbientContext) { - return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); + var _links = getNodeLinks(node.parent); + if (!_links.hasReportedStatementInAmbientContext) { + return _links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); } } else { @@ -22379,11 +22464,12 @@ var ts; } function getOwnEmitOutputFilePath(sourceFile, host, extension) { var compilerOptions = host.getCompilerOptions(); + var emitOutputFilePathWithoutExtension; if (compilerOptions.outDir) { - var emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); + emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); } else { - var emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName); + emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName); } return emitOutputFilePathWithoutExtension + extension; } @@ -22463,17 +22549,17 @@ var ts; } } function createAndSetNewTextWriterWithSymbolWriter() { - var writer = createTextWriter(newLine); - writer.trackSymbol = trackSymbol; - writer.writeKeyword = writer.write; - writer.writeOperator = writer.write; - writer.writePunctuation = writer.write; - writer.writeSpace = writer.write; - writer.writeStringLiteral = writer.writeLiteral; - writer.writeParameter = writer.write; - writer.writeSymbol = writer.write; - setWriter(writer); - return writer; + var _writer = createTextWriter(newLine); + _writer.trackSymbol = trackSymbol; + _writer.writeKeyword = _writer.write; + _writer.writeOperator = _writer.write; + _writer.writePunctuation = _writer.write; + _writer.writeSpace = _writer.write; + _writer.writeStringLiteral = _writer.writeLiteral; + _writer.writeParameter = _writer.write; + _writer.writeSymbol = _writer.write; + setWriter(_writer); + return _writer; } function setWriter(newWriter) { writer = newWriter; @@ -22543,18 +22629,20 @@ var ts; } } function emitLines(nodes) { - for (var i = 0, n = nodes.length; i < n; i++) { - emit(nodes[i]); + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; + emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var i = 0, n = nodes.length; i < n; i++) { + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; if (currentWriterPos !== writer.getTextPos()) { write(separator); } currentWriterPos = writer.getTextPos(); - eachNodeEmitFn(nodes[i]); + eachNodeEmitFn(node); } } function emitCommaList(nodes, eachNodeEmitFn) { @@ -23024,13 +23112,14 @@ var ts; return; } var accessors = getAllAccessorDeclarations(node.parent.members, node); + var accessorWithTypeAnnotation; if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(node); writeTextOfNode(currentSourceFile, node.name); if (!(node.flags & 32)) { - var accessorWithTypeAnnotation = node; + accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { var anotherAccessor = node.kind === 134 ? accessors.setAccessor : accessors.getAccessor; @@ -23410,16 +23499,16 @@ var ts; } } function generateUniqueNameForLocation(location, baseName) { - var name; + var _name; if (!isExistingName(location, baseName)) { - name = baseName; + _name = baseName; } else { - name = ts.generateUniqueName(baseName, function (n) { + _name = ts.generateUniqueName(baseName, function (n) { return isExistingName(location, n); }); } - return recordNameInCurrentScope(name); + return recordNameInCurrentScope(_name); } function recordNameInCurrentScope(name) { if (!currentScopeNames) { @@ -23562,8 +23651,8 @@ var ts; if (scopeName) { var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { - var name = node.name; - if (!name || name.kind !== 126) { + var _name = node.name; + if (!_name || _name.kind !== 126) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -23582,8 +23671,8 @@ var ts; } else if (node.kind === 195 || node.kind === 160 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135 || node.kind === 200 || node.kind === 196 || node.kind === 199) { if (node.name) { - var name = node.name; - scopeName = name.kind === 126 ? ts.getTextOfNode(name) : node.name.text; + var _name = node.name; + scopeName = _name.kind === 126 ? ts.getTextOfNode(_name) : node.name.text; } recordScopeNameStart(scopeName); } @@ -23698,17 +23787,17 @@ var ts; writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } function createTempVariable(location, forLoopVariable) { - var name = forLoopVariable ? "_i" : undefined; + var _name = forLoopVariable ? "_i" : undefined; while (true) { - if (name && !isExistingName(location, name)) { + if (_name && !isExistingName(location, _name)) { break; } - name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); + _name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); tempCount++; } - recordNameInCurrentScope(name); + recordNameInCurrentScope(_name); var result = ts.createSynthesizedNode(64); - result.text = name; + result.text = _name; return result; } function recordTempDeclaration(name) { @@ -23946,7 +24035,7 @@ var ts; emitLiteral(node.head); headEmitted = true; } - for (var i = 0; i < node.templateSpans.length; i++) { + for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; var needsParens = templateSpan.expression.kind !== 159 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { @@ -24022,8 +24111,8 @@ var ts; } } function isNotExpressionIdentifier(node) { - var parent = node.parent; - switch (parent.kind) { + var _parent = node.parent; + switch (_parent.kind) { case 128: case 193: case 150: @@ -24043,7 +24132,7 @@ var ts; case 199: case 200: case 203: - return parent.name === node; + return _parent.name === node; case 185: case 184: case 209: @@ -24150,8 +24239,8 @@ var ts; function emitListWithSpread(elements, multiLine, trailingComma) { var pos = 0; var group = 0; - var length = elements.length; - while (pos < length) { + var _length = elements.length; + while (pos < _length) { if (group === 1) { write(".concat("); } @@ -24166,14 +24255,14 @@ var ts; } else { var i = pos; - while (i < length && elements[i].kind !== 171) { + while (i < _length && elements[i].kind !== 171) { i++; } write("["); if (multiLine) { increaseIndent(); } - emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + emitList(elements, pos, i - pos, multiLine, trailingComma && i === _length); if (multiLine) { decreaseIndent(); } @@ -24249,8 +24338,8 @@ var ts; var propertyDescriptor = ts.createSynthesizedNode(152); var descriptorProperties = []; if (getAccessor) { - var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); - descriptorProperties.push(getProperty); + var _getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(_getProperty); } if (setAccessor) { var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); @@ -24363,7 +24452,6 @@ var ts; } } write("{"); - var properties = node.properties; if (properties.length) { emitLinePreservingList(node, properties, languageVersion >= 1, true); } @@ -25015,7 +25103,7 @@ var ts; } function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; - var isDeclaration = (root.kind === 193 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 128; + var _isDeclaration = (root.kind === 193 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 128; if (root.kind === 167) { emitAssignmentExpression(root); } @@ -25040,7 +25128,7 @@ var ts; function ensureIdentifier(expr) { if (expr.kind !== 64) { var identifier = createTempVariable(lowestNonSynthesizedAncestor || root); - if (!isDeclaration) { + if (!_isDeclaration) { recordTempDeclaration(identifier); } emitAssignment(identifier, expr); @@ -25095,8 +25183,8 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var i = 0; i < properties.length; i++) { - var p = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); @@ -25141,18 +25229,18 @@ var ts; } function emitAssignmentExpression(root) { var target = root.left; - var value = root.right; + var _value = root.right; if (isAssignmentExpressionStatement) { - emitDestructuringAssignment(target, value); + emitDestructuringAssignment(target, _value); } else { if (root.parent.kind !== 159) { write("("); } - value = ensureIdentifier(value); - emitDestructuringAssignment(target, value); + _value = ensureIdentifier(_value); + emitDestructuringAssignment(target, _value); write(", "); - emit(value); + emit(_value); if (root.parent.kind !== 159) { write(")"); } @@ -25220,12 +25308,12 @@ var ts; } } function emitExportVariableAssignments(node) { - var name = node.name; - if (name.kind === 64) { - emitExportMemberAssignments(name); + var _name = node.name; + if (_name.kind === 64) { + emitExportMemberAssignments(_name); } - else if (ts.isBindingPattern(name)) { - ts.forEach(name.elements, emitExportVariableAssignments); + else if (ts.isBindingPattern(_name)) { + ts.forEach(_name.elements, emitExportVariableAssignments); } } function getCombinedFlagsForIdentifier(node) { @@ -25247,8 +25335,8 @@ var ts; return; } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 221 ? blockScopeContainer : blockScopeContainer.parent; - var generatedName = generateUniqueNameForLocation(parent, node.text); + var _parent = blockScopeContainer.kind === 221 ? blockScopeContainer : blockScopeContainer.parent; + var generatedName = generateUniqueNameForLocation(_parent, node.text); var variableId = resolver.getBlockScopedVariableId(node); if (!generatedBlockScopeNames) { generatedBlockScopeNames = []; @@ -25268,12 +25356,12 @@ var ts; function emitParameter(node) { if (languageVersion < 2) { if (ts.isBindingPattern(node.name)) { - var name = createTempVariable(node); + var _name = createTempVariable(node); if (!tempParameters) { tempParameters = []; } - tempParameters.push(name); - emit(name); + tempParameters.push(_name); + emit(_name); } else { emit(node.name); @@ -25519,9 +25607,10 @@ var ts; decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var i = 0, n = body.statements.length; i < n; i++) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; write(" "); - emit(body.statements[i]); + emit(statement); } emitTempDeclarations(false); write(" "); @@ -25759,11 +25848,12 @@ var ts; emitDetachedComments(ctor.body.statements); } emitCaptureThisForNodeIfNecessary(node); + var superCall; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); if (baseTypeNode) { - var superCall = findInitialSuperCall(ctor); + superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); emit(superCall); @@ -26110,8 +26200,8 @@ var ts; if (specifier.name.text === "default") { exportDefault = exportDefault || specifier; } - var name = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name] || (exportSpecifiers[name] = [])).push(specifier); + var _name = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[_name] || (exportSpecifiers[_name] = [])).push(specifier); }); } else if (node.kind === 209) { @@ -26134,8 +26224,8 @@ var ts; } function getExternalImportInfo(node) { if (externalImports) { - for (var i = 0; i < externalImports.length; i++) { - var info = externalImports[i]; + for (var _i = 0; _i < externalImports.length; _i++) { + var info = externalImports[_i]; if (info.rootNode === node) { return info; } @@ -26296,12 +26386,12 @@ var ts; if (node.flags & 2) { return emitPinnedOrTripleSlashComments(node); } - var emitComments = shouldEmitLeadingAndTrailingComments(node); - if (emitComments) { + var _emitComments = shouldEmitLeadingAndTrailingComments(node); + if (_emitComments) { emitLeadingComments(node); } emitJavaScriptWorker(node); - if (emitComments) { + if (_emitComments) { emitTrailingComments(node); } } @@ -26626,9 +26716,10 @@ var ts; } var unsupportedFileEncodingErrorCode = -2147024809; function getSourceFile(fileName, languageVersion, onError) { + var text; try { var start = new Date().getTime(); - var text = ts.sys.readFile(fileName, options.charset); + text = ts.sys.readFile(fileName, options.charset); ts.ioReadTime += new Date().getTime() - start; } catch (e) { @@ -26845,9 +26936,11 @@ var ts; processSourceFile(ts.normalizePath(fileName), isDefaultLib); } function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { + var start; + var _length; if (refEnd !== undefined && refPos !== undefined) { - var start = refPos; - var length = refEnd - refPos; + start = refPos; + _length = refEnd - refPos; } var diagnostic; if (hasExtension(fileName)) { @@ -26872,7 +26965,7 @@ var ts; } if (diagnostic) { if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); + diagnostics.add(ts.createFileDiagnostic(refFile, start, _length, diagnostic, fileName)); } else { diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); @@ -26913,17 +27006,17 @@ var ts; files.push(file); } } + return file; } - return file; function getSourceFileFromCache(fileName, canonicalName, useAbsolutePath) { - var file = filesByName[canonicalName]; - if (file && host.useCaseSensitiveFileNames()) { - var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; + var _file = filesByName[canonicalName]; + if (_file && host.useCaseSensitiveFileNames()) { + var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(_file.fileName, host.getCurrentDirectory()) : _file.fileName; if (canonicalName !== sourceFileName) { diagnostics.add(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } } - return file; + return _file; } } function processReferencedFiles(file, basePath) { @@ -26960,10 +27053,10 @@ var ts; var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { - var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); + var _searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); + var tsFile = findModuleSourceFile(_searchName + ".ts", nameLiteral); if (!tsFile) { - findModuleSourceFile(searchName + ".d.ts", nameLiteral); + findModuleSourceFile(_searchName + ".d.ts", nameLiteral); } } } @@ -27418,17 +27511,17 @@ var ts; switch (n.kind) { case 174: if (!ts.isFunctionBlock(n)) { - var parent = n.parent; + var _parent = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent.kind === 179 || parent.kind === 182 || parent.kind === 183 || parent.kind === 181 || parent.kind === 178 || parent.kind === 180 || parent.kind === 187 || parent.kind === 217) { - addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); + if (_parent.kind === 179 || _parent.kind === 182 || _parent.kind === 183 || _parent.kind === 181 || _parent.kind === 178 || _parent.kind === 180 || _parent.kind === 187 || _parent.kind === 217) { + addOutliningSpan(_parent, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent.kind === 191) { - var tryStatement = parent; + if (_parent.kind === 191) { + var tryStatement = _parent; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(_parent, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -27449,19 +27542,23 @@ var ts; break; } case 201: - var openBrace = ts.findChildOfKind(n, 14, sourceFile); - var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); - break; + { + var _openBrace = ts.findChildOfKind(n, 14, sourceFile); + var _closeBrace = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n.parent, _openBrace, _closeBrace, autoCollapse(n)); + break; + } case 196: case 197: case 199: case 152: case 202: - var openBrace = ts.findChildOfKind(n, 14, sourceFile); - var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); - break; + { + var _openBrace_1 = ts.findChildOfKind(n, 14, sourceFile); + var _closeBrace_1 = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n, _openBrace_1, _closeBrace_1, autoCollapse(n)); + break; + } case 151: var openBracket = ts.findChildOfKind(n, 18, sourceFile); var closeBracket = ts.findChildOfKind(n, 19, sourceFile); @@ -27488,8 +27585,8 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - var declaration = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; var name = getDeclarationName(declaration); if (name !== undefined) { var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); @@ -27526,8 +27623,9 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var i = 0, n = matches.length; i < n; i++) { - if (!matches[i].isCaseSensitive) { + for (var _i = 0; _i < matches.length; _i++) { + var match = matches[_i]; + if (!match.isCaseSensitive) { return false; } } @@ -27603,14 +27701,15 @@ var ts; } function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); - var bestMatchKind = 3; - for (var i = 0, n = matches.length; i < n; i++) { - var kind = matches[i].kind; - if (kind < bestMatchKind) { - bestMatchKind = kind; + var _bestMatchKind = 3; + for (var _i = 0; _i < matches.length; _i++) { + var match = matches[_i]; + var kind = match.kind; + if (kind < _bestMatchKind) { + _bestMatchKind = kind; } } - return bestMatchKind; + return _bestMatchKind; } var baseSensitivity = { sensitivity: "base" @@ -27740,8 +27839,8 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var i = 0, n = nodes.length; i < n; i++) { - var node = nodes[i]; + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; switch (node.kind) { case 196: case 199: @@ -27781,19 +27880,19 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var i = 0, n = nodes.length; i < n; i++) { - var child = nodes[i]; - var item = createItem(child); - if (item !== undefined) { - if (item.text.length > 0) { - var key = item.text + "-" + item.kind + "-" + item.indent; + for (var _i = 0; _i < nodes.length; _i++) { + var child = nodes[_i]; + var _item = createItem(child); + if (_item !== undefined) { + if (_item.text.length > 0) { + var key = _item.text + "-" + _item.kind + "-" + _item.indent; var itemWithSameName = keyToItem[key]; if (itemWithSameName) { - merge(itemWithSameName, item); + merge(itemWithSameName, _item); } else { - keyToItem[key] = item; - items.push(item); + keyToItem[key] = _item; + items.push(_item); } } } @@ -27806,10 +27905,10 @@ var ts; if (!target.childItems) { target.childItems = []; } - outer: for (var i = 0, n = source.childItems.length; i < n; i++) { - var sourceChild = source.childItems[i]; - for (var j = 0, m = target.childItems.length; j < m; j++) { - var targetChild = target.childItems[j]; + outer: for (var _i = 0, _a = source.childItems; _i < _a.length; _i++) { + var sourceChild = _a[_i]; + for (var _b = 0, _c = target.childItems; _b < _c.length; _b++) { + var targetChild = _c[_b]; if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { merge(targetChild, sourceChild); continue outer; @@ -27852,9 +27951,9 @@ var ts; case 193: case 150: var variableDeclarationNode; - var name; + var _name; if (node.kind === 150) { - name = node.name; + _name = node.name; variableDeclarationNode = node; while (variableDeclarationNode && variableDeclarationNode.kind !== 193) { variableDeclarationNode = variableDeclarationNode.parent; @@ -27864,16 +27963,16 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name = node.name; + _name = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(_name), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(_name), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(_name), ts.ScriptElementKind.variableElement); } case 133: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); @@ -27981,7 +28080,7 @@ var ts; return !ts.isBindingPattern(p.name); })); } - var childItems = getItemsWorker(sortNodes(nodes), createChildItem); + childItems = getItemsWorker(sortNodes(nodes), createChildItem); } return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [ getNodeSpan(node) @@ -28109,8 +28208,8 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var i = 0, n = wordSpans.length; i < n; i++) { - var span = wordSpans[i]; + for (var _i = 0; _i < wordSpans.length; _i++) { + var span = wordSpans[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(2, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); } @@ -28164,8 +28263,8 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var i = 0, n = subWordTextChunks.length; i < n; i++) { - var subWordTextChunk = subWordTextChunks[i]; + for (var _i = 0; _i < subWordTextChunks.length; _i++) { + var subWordTextChunk = subWordTextChunks[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { return undefined; @@ -28191,10 +28290,10 @@ var ts; } } else { - for (var i = 0; i < patternPartLength; i++) { - var ch1 = pattern.charCodeAt(patternPartStart + i); - var ch2 = candidate.charCodeAt(candidateSpan.start + i); - if (ch1 !== ch2) { + for (var _i = 0; _i < patternPartLength; _i++) { + var _ch1 = pattern.charCodeAt(patternPartStart + _i); + var _ch2 = candidate.charCodeAt(candidateSpan.start + _i); + if (_ch1 !== _ch2) { return false; } } @@ -28510,15 +28609,15 @@ var ts; } var listItemInfo = ts.findListItemInfo(node); if (listItemInfo) { - var list = listItemInfo.list; - var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; - var argumentIndex = getArgumentIndex(list, node); - var argumentCount = getArgumentCount(list); + var _list = listItemInfo.list; + var _isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === _list.pos; + var argumentIndex = getArgumentIndex(_list, node); + var argumentCount = getArgumentCount(_list); ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); return { - kind: isTypeArgList ? 0 : 1, + kind: _isTypeArgList ? 0 : 1, invocation: callExpression, - argumentsSpan: getApplicableSpanForArguments(list), + argumentsSpan: getApplicableSpanForArguments(_list), argumentIndex: argumentIndex, argumentCount: argumentCount }; @@ -28533,28 +28632,28 @@ var ts; var templateExpression = node.parent; var tagExpression = templateExpression.parent; ts.Debug.assert(templateExpression.kind === 169); - var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; - return getArgumentListInfoForTemplate(tagExpression, argumentIndex); + var _argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; + return getArgumentListInfoForTemplate(tagExpression, _argumentIndex); } else if (node.parent.kind === 173 && node.parent.parent.parent.kind === 157) { var templateSpan = node.parent; - var templateExpression = templateSpan.parent; - var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 169); + var _templateExpression = templateSpan.parent; + var _tagExpression = _templateExpression.parent; + ts.Debug.assert(_templateExpression.kind === 169); if (node.kind === 13 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } - var spanIndex = templateExpression.templateSpans.indexOf(templateSpan); - var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node); - return getArgumentListInfoForTemplate(tagExpression, argumentIndex); + var spanIndex = _templateExpression.templateSpans.indexOf(templateSpan); + var _argumentIndex_1 = getArgumentIndexForTemplatePiece(spanIndex, node); + return getArgumentListInfoForTemplate(_tagExpression, _argumentIndex_1); } return undefined; } function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var i = 0, n = listChildren.length; i < n; i++) { - var child = listChildren[i]; + for (var _i = 0; _i < listChildren.length; _i++) { + var child = listChildren[_i]; if (child === node) { break; } @@ -28620,9 +28719,9 @@ var ts; if (n.pos < n.parent.pos || n.end > n.parent.end) { ts.Debug.fail("Node of kind " + n.kind + " is not a subspan of its parent of kind " + n.parent.kind); } - var argumentInfo = getImmediatelyContainingArgumentInfo(n); - if (argumentInfo) { - return argumentInfo; + var _argumentInfo = getImmediatelyContainingArgumentInfo(n); + if (_argumentInfo) { + return _argumentInfo; } } return undefined; @@ -28878,8 +28977,8 @@ var ts; return n; } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; ++i) { - var child = children[i]; + for (var _i = 0; _i < children.length; _i++) { + var child = children[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { return find(child); @@ -28904,7 +29003,7 @@ var ts; return n; } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; ++i) { + for (var i = 0, len = children.length; i < len; i++) { var child = children[i]; if (nodeHasTokens(child)) { if (position <= child.end) { @@ -28920,8 +29019,8 @@ var ts; } ts.Debug.assert(startNode !== undefined || n.kind === 221); if (children.length) { - var candidate = findRightmostChildNodeWithTokens(children, children.length); - return candidate && findRightmostToken(candidate); + var _candidate = findRightmostChildNodeWithTokens(children, children.length); + return _candidate && findRightmostToken(_candidate); } } function findRightmostChildNodeWithTokens(children, exclusiveStartPosition) { @@ -29229,21 +29328,21 @@ var ts; var t; var pos = scanner.getStartPos(); while (pos < endPos) { - var t = scanner.getToken(); - if (!ts.isTrivia(t)) { + var _t = scanner.getToken(); + if (!ts.isTrivia(_t)) { break; } scanner.scan(); - var item = { + var _item = { pos: pos, end: scanner.getStartPos(), - kind: t + kind: _t }; pos = scanner.getStartPos(); if (!leadingTrivia) { leadingTrivia = []; } - leadingTrivia.push(item); + leadingTrivia.push(_item); } savedPos = scanner.getStartPos(); } @@ -29340,8 +29439,8 @@ var ts; } function isOnToken() { var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); - var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); - return startPos < endPos && current !== 1 && !ts.isTrivia(current); + var _startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); + return _startPos < endPos && current !== 1 && !ts.isTrivia(current); } function fixTokenKind(tokenInfo, container) { if (ts.isToken(container) && tokenInfo.token.kind !== container.kind) { @@ -29527,8 +29626,9 @@ var ts; if (this.IsAny()) { return true; } - for (var i = 0, len = this.customContextChecks.length; i < len; i++) { - if (!this.customContextChecks[i](context)) { + for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) { + var check = _a[_i]; + if (!check(context)) { return false; } } @@ -29771,9 +29871,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name in o) { - if (o[name] === rule) { - return name; + for (var _name in o) { + if (o[_name] === rule) { + return _name; } } throw new Error("Unknown rule"); @@ -30014,10 +30114,11 @@ var ts; var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var i = 0, len = bucket.Rules().length; i < len; i++) { - var rule = bucket.Rules()[i]; - if (rule.Operation.Context.InContext(context)) + for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) { + var rule = _a[_i]; + if (rule.Operation.Context.InContext(context)) { return rule; + } } } return null; @@ -30385,13 +30486,13 @@ var ts; } formatting.formatSelection = formatSelection; function formatOutermostParent(position, expectedLastToken, sourceFile, options, rulesProvider, requestKind) { - var parent = findOutermostParent(position, expectedLastToken, sourceFile); - if (!parent) { + var _parent = findOutermostParent(position, expectedLastToken, sourceFile); + if (!_parent) { return []; } var span = { - pos: ts.getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), - end: parent.end + pos: ts.getLineStartPositionForPosition(_parent.getStart(sourceFile), sourceFile), + end: _parent.end }; return formatSpan(span, sourceFile, options, rulesProvider, requestKind); } @@ -30527,10 +30628,10 @@ var ts; } } else { - var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; + var _startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; var startLinePosition = ts.getLineStartPositionForPosition(startPos, sourceFile); var column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); - if (startLine !== parentStartLine || startPos === column) { + if (_startLine !== parentStartLine || startPos === column) { return column; } } @@ -30648,19 +30749,19 @@ var ts; return inheritedIndentation; } while (formattingScanner.isOnToken()) { - var tokenInfo = formattingScanner.readTokenInfo(node); - if (tokenInfo.token.end > childStartPos) { + var _tokenInfo = formattingScanner.readTokenInfo(node); + if (_tokenInfo.token.end > childStartPos) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(_tokenInfo, node, parentDynamicIndentation); } if (!formattingScanner.isOnToken()) { return inheritedIndentation; } if (ts.isToken(child)) { - var tokenInfo = formattingScanner.readTokenInfo(child); - ts.Debug.assert(tokenInfo.token.end === child.end); - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + var _tokenInfo_1 = formattingScanner.readTokenInfo(child); + ts.Debug.assert(_tokenInfo_1.token.end === child.end); + consumeTokenAndAdvanceScanner(_tokenInfo_1, node, parentDynamicIndentation); return inheritedIndentation; } var childIndentation = computeIndentation(child, childStart.line, childIndentationAmount, node, parentDynamicIndentation, parentStartLine); @@ -30672,33 +30773,34 @@ var ts; var listStartToken = getOpenTokenForList(parent, nodes); var listEndToken = getCloseTokenForOpenToken(listStartToken); var listDynamicIndentation = parentDynamicIndentation; - var startLine = parentStartLine; + var _startLine = parentStartLine; if (listStartToken !== 0) { while (formattingScanner.isOnToken()) { - var tokenInfo = formattingScanner.readTokenInfo(parent); - if (tokenInfo.token.end > nodes.pos) { + var _tokenInfo = formattingScanner.readTokenInfo(parent); + if (_tokenInfo.token.end > nodes.pos) { break; } - else if (tokenInfo.token.kind === listStartToken) { - startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; - var indentation = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, startLine); - listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation.indentation, indentation.delta); - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + else if (_tokenInfo.token.kind === listStartToken) { + _startLine = sourceFile.getLineAndCharacterOfPosition(_tokenInfo.token.pos).line; + var _indentation = computeIndentation(_tokenInfo.token, _startLine, -1, parent, parentDynamicIndentation, _startLine); + listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, _indentation.indentation, _indentation.delta); + consumeTokenAndAdvanceScanner(_tokenInfo, parent, listDynamicIndentation); } else { - consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(_tokenInfo, parent, parentDynamicIndentation); } } } var inheritedIndentation = -1; - for (var i = 0, len = nodes.length; i < len; ++i) { - inheritedIndentation = processChildNode(nodes[i], inheritedIndentation, node, listDynamicIndentation, startLine, true); + for (var _i = 0; _i < nodes.length; _i++) { + var child = nodes[_i]; + inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, _startLine, true); } if (listEndToken !== 0) { if (formattingScanner.isOnToken()) { - var tokenInfo = formattingScanner.readTokenInfo(parent); - if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + var _tokenInfo_1 = formattingScanner.readTokenInfo(parent); + if (_tokenInfo_1.token.kind === listEndToken && ts.rangeContainsRange(parent, _tokenInfo_1.token)) { + consumeTokenAndAdvanceScanner(_tokenInfo_1, parent, listDynamicIndentation); } } } @@ -30735,8 +30837,8 @@ var ts; if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var i = 0, len = currentTokenInfo.leadingTrivia.length; i < len; ++i) { - var triviaItem = currentTokenInfo.leadingTrivia[i]; + for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { + var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; } @@ -30749,8 +30851,8 @@ var ts; break; case 2: if (indentNextTokenOrTrivia) { - var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); - insertIndentation(triviaItem.pos, commentIndentation, false); + var _commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); + insertIndentation(triviaItem.pos, _commentIndentation, false); indentNextTokenOrTrivia = false; } break; @@ -30770,8 +30872,8 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var i = 0, len = trivia.length; i < len; ++i) { - var triviaItem = trivia[i]; + for (var _i = 0; _i < trivia.length; _i++) { + var triviaItem = trivia[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); @@ -30839,18 +30941,19 @@ var ts; } } function indentMultilineComment(commentRange, indentation, firstLineIsIndented) { - var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; + var _startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; - if (startLine === endLine) { + var parts; + if (_startLine === endLine) { if (!firstLineIsIndented) { insertIndentation(commentRange.pos, indentation, false); } return; } else { - var parts = []; + parts = []; var startPos = commentRange.pos; - for (var line = startLine; line < endLine; ++line) { + for (var line = _startLine; line < endLine; ++line) { var endOfLine = ts.getEndLinePosition(line, sourceFile); parts.push({ pos: startPos, @@ -30863,7 +30966,7 @@ var ts; end: commentRange.end }); } - var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); + var startLinePos = ts.getStartPositionOfLine(_startLine, sourceFile); var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options); if (indentation === nonWhitespaceColumnInFirstPart.column) { return; @@ -30871,19 +30974,19 @@ var ts; var startIndex = 0; if (firstLineIsIndented) { startIndex = 1; - startLine++; + _startLine++; } - var delta = indentation - nonWhitespaceColumnInFirstPart.column; - for (var i = startIndex, len = parts.length; i < len; ++i, ++startLine) { - var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); + var _delta = indentation - nonWhitespaceColumnInFirstPart.column; + for (var i = startIndex, len = parts.length; i < len; ++i, ++_startLine) { + var _startLinePos = ts.getStartPositionOfLine(_startLine, sourceFile); var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); - var newIndentation = nonWhitespaceCharacterAndColumn.column + delta; + var newIndentation = nonWhitespaceCharacterAndColumn.column + _delta; if (newIndentation > 0) { var indentationString = getIndentationString(newIndentation, options); - recordReplace(startLinePos, nonWhitespaceCharacterAndColumn.character, indentationString); + recordReplace(_startLinePos, nonWhitespaceCharacterAndColumn.character, indentationString); } else { - recordDelete(startLinePos, nonWhitespaceCharacterAndColumn.character); + recordDelete(_startLinePos, nonWhitespaceCharacterAndColumn.character); } } } @@ -31084,9 +31187,9 @@ var ts; } break; } - var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); - if (actualIndentation !== -1) { - return actualIndentation; + var _actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (_actualIndentation !== -1) { + return _actualIndentation; } previous = current; current = current.parent; @@ -31103,9 +31206,9 @@ var ts; } SmartIndenter.getIndentationForNode = getIndentationForNode; function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) { - var parent = current.parent; + var _parent = current.parent; var parentStart; - while (parent) { + while (_parent) { var useActualIndentation = true; if (ignoreActualIndentationRange) { var start = current.getStart(sourceFile); @@ -31117,20 +31220,20 @@ var ts; return actualIndentation + indentationDelta; } } - parentStart = getParentStart(parent, current, sourceFile); - var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); + parentStart = getParentStart(_parent, current, sourceFile); + var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(_parent, current, currentStart.line, sourceFile); if (useActualIndentation) { - var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); - if (actualIndentation !== -1) { - return actualIndentation + indentationDelta; + var _actualIndentation = getActualIndentationForNode(current, _parent, currentStart, parentAndChildShareLine, sourceFile, options); + if (_actualIndentation !== -1) { + return _actualIndentation + indentationDelta; } } - if (shouldIndentChildNode(parent.kind, current.kind) && !parentAndChildShareLine) { + if (shouldIndentChildNode(_parent.kind, current.kind) && !parentAndChildShareLine) { indentationDelta += options.IndentSize; } - current = parent; + current = _parent; currentStart = parentStart; - parent = current.parent; + _parent = current.parent; } return indentationDelta; } @@ -31206,24 +31309,28 @@ var ts; case 131: case 136: case 137: - var start = node.getStart(sourceFile); - if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { - return node.parent.typeParameters; + { + var start = node.getStart(sourceFile); + if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { + return node.parent.typeParameters; + } + if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { + return node.parent.parameters; + } + break; } - if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { - return node.parent.parameters; - } - break; case 156: case 155: - var start = node.getStart(sourceFile); - if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { - return node.parent.typeArguments; + { + var _start = node.getStart(sourceFile); + if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, _start, node.getEnd())) { + return node.parent.typeArguments; + } + if (node.parent.arguments && ts.rangeContainsStartEnd(node.parent.arguments, _start, node.getEnd())) { + return node.parent.arguments; + } + break; } - if (node.parent.arguments && ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { - return node.parent.arguments; - } - break; } } return undefined; @@ -31492,8 +31599,8 @@ var ts; var list = createNode(222, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; - for (var i = 0, len = nodes.length; i < len; i++) { - var node = nodes[i]; + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -31507,9 +31614,10 @@ var ts; }; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; + var children; if (this.kind >= 125) { scanner.setText((sourceFile || this.getSourceFile()).text); - var children = []; + children = []; var pos = this.pos; var processNode = function (node) { if (pos < node.pos) { @@ -31550,8 +31658,8 @@ var ts; }; NodeObject.prototype.getFirstToken = function (sourceFile) { var children = this.getChildren(); - for (var i = 0; i < children.length; i++) { - var child = children[i]; + for (var _i = 0; _i < children.length; _i++) { + var child = children[_i]; if (child.kind < 125) { return child; } @@ -31670,7 +31778,7 @@ var ts; } function getCleanedJsDocComment(pos, end, sourceFile) { var spacesToRemoveAfterAsterisk; - var docComments = []; + var _docComments = []; var blankLineCount = 0; var isInParamTag = false; while (pos < end) { @@ -31705,14 +31813,14 @@ var ts; } pos = consumeLineBreaks(pos, end, sourceFile); if (docCommentTextOfLine) { - pushDocCommentLineText(docComments, docCommentTextOfLine, blankLineCount); + pushDocCommentLineText(_docComments, docCommentTextOfLine, blankLineCount); blankLineCount = 0; } - else if (!isInParamTag && docComments.length) { + else if (!isInParamTag && _docComments.length) { blankLineCount++; } } - return docComments; + return _docComments; } function getCleanedParamJsDocComment(pos, end, sourceFile) { var paramHelpStringMargin; @@ -31813,8 +31921,8 @@ var ts; } var consumedSpaces = pos - startOfLinePos; if (consumedSpaces < paramHelpStringMargin) { - var ch = sourceFile.text.charCodeAt(pos); - if (ch === 42) { + var _ch = sourceFile.text.charCodeAt(pos); + if (_ch === 42) { pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, paramHelpStringMargin - consumedSpaces - 1); } } @@ -32126,8 +32234,8 @@ var ts; if (declaration.kind !== 193 && declaration.kind !== 195) { return false; } - for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { - if (parent.kind === 221 || parent.kind === 201) { + for (var _parent = declaration.parent; !ts.isFunctionBlock(_parent); _parent = _parent.parent) { + if (_parent.kind === 221 || _parent.kind === 201) { return false; } } @@ -32168,8 +32276,9 @@ var ts; this.host = host; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); - for (var i = 0, n = rootFileNames.length; i < n; i++) { - this.createEntry(rootFileNames[i]); + for (var _i = 0; _i < rootFileNames.length; _i++) { + var fileName = rootFileNames[_i]; + this.createEntry(fileName); } this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); } @@ -32228,17 +32337,17 @@ var ts; if (!scriptSnapshot) { throw new Error("Could not find file: '" + fileName + "'."); } - var version = this.host.getScriptVersion(fileName); + var _version = this.host.getScriptVersion(fileName); var sourceFile; if (this.currentFileName !== fileName) { - sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2, version, true); + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2, _version, true); } - else if (this.currentFileVersion !== version) { + else if (this.currentFileVersion !== _version) { var editRange = scriptSnapshot.getChangeRange(this.currentFileScriptSnapshot); - sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange); + sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, _version, editRange); } if (sourceFile) { - this.currentFileVersion = version; + this.currentFileVersion = _version; this.currentFileName = fileName; this.currentFileScriptSnapshot = scriptSnapshot; this.currentSourceFile = sourceFile; @@ -32746,8 +32855,9 @@ var ts; }); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var i = 0, n = oldSourceFiles.length; i < n; i++) { - var fileName = oldSourceFiles[i].fileName; + for (var _i = 0; _i < oldSourceFiles.length; _i++) { + var oldSourceFile = oldSourceFiles[_i]; + var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { documentRegistry.releaseDocument(fileName, oldSettings); } @@ -32762,8 +32872,8 @@ var ts; return undefined; } if (!changesInCompilationSettingsAffectSyntax) { - var oldSourceFile = program && program.getSourceFile(fileName); - if (oldSourceFile) { + var _oldSourceFile = program && program.getSourceFile(fileName); + if (_oldSourceFile) { return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); } } @@ -32780,8 +32890,9 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var i = 0, n = rootFileNames.length; i < n; i++) { - if (!sourceFileUpToDate(program.getSourceFile(rootFileNames[i]))) { + for (var _a = 0; _a < rootFileNames.length; _a++) { + var _fileName = rootFileNames[_a]; + if (!sourceFileUpToDate(program.getSourceFile(_fileName))) { return false; } } @@ -32833,8 +32944,8 @@ var ts; displayName = displayName.substring(1, displayName.length - 1); } var isValid = ts.isIdentifierStart(displayName.charCodeAt(0), target); - for (var i = 1, n = displayName.length; isValid && i < n; i++) { - isValid = ts.isIdentifierPart(displayName.charCodeAt(i), target); + for (var _i = 1, n = displayName.length; isValid && _i < n; _i++) { + isValid = ts.isIdentifierPart(displayName.charCodeAt(_i), target); } if (isValid) { return ts.unescapeIdentifier(displayName); @@ -32860,20 +32971,20 @@ var ts; var start = new Date().getTime(); var currentToken = ts.getTokenAtPosition(sourceFile, position); log("getCompletionsAtPosition: Get current token: " + (new Date().getTime() - start)); - var start = new Date().getTime(); + start = new Date().getTime(); var insideComment = isInsideComment(sourceFile, currentToken, position); log("getCompletionsAtPosition: Is inside comment: " + (new Date().getTime() - start)); if (insideComment) { log("Returning an empty list because completion was inside a comment."); return undefined; } - var start = new Date().getTime(); + start = new Date().getTime(); var previousToken = ts.findPrecedingToken(position, sourceFile); log("getCompletionsAtPosition: Get previous token 1: " + (new Date().getTime() - start)); if (previousToken && position <= previousToken.end && previousToken.kind === 64) { - var start = new Date().getTime(); + var _start = new Date().getTime(); previousToken = ts.findPrecedingToken(previousToken.pos, sourceFile); - log("getCompletionsAtPosition: Get previous token 2: " + (new Date().getTime() - start)); + log("getCompletionsAtPosition: Get previous token 2: " + (new Date().getTime() - _start)); } if (previousToken && isCompletionListBlocker(previousToken)) { log("Returning an empty list because completion was requested in an invalid position."); @@ -32901,12 +33012,14 @@ var ts; typeChecker: typeInfoResolver }; log("getCompletionsAtPosition: Syntactic work: " + (new Date().getTime() - syntacticStart)); - var location = ts.getTouchingPropertyName(sourceFile, position); + var _location = ts.getTouchingPropertyName(sourceFile, position); var semanticStart = new Date().getTime(); + var isMemberCompletion; + var isNewIdentifierLocation; if (isRightOfDot) { var symbols = []; - var isMemberCompletion = true; - var isNewIdentifierLocation = false; + isMemberCompletion = true; + isNewIdentifierLocation = false; if (node.kind === 64 || node.kind === 125 || node.kind === 153) { var symbol = typeInfoResolver.getSymbolAtLocation(node); if (symbol && symbol.flags & 8388608) { @@ -32951,8 +33064,8 @@ var ts; if (showCompletionsInImportsClause(previousToken)) { var importDeclaration = ts.getAncestor(previousToken, 204); ts.Debug.assert(importDeclaration !== undefined); - var exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); - var filteredExports = filterModuleExports(exports, importDeclaration); + var _exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration); + var filteredExports = filterModuleExports(_exports, importDeclaration); getCompletionEntriesFromSymbols(filteredExports, activeCompletionSession); } } @@ -32960,8 +33073,8 @@ var ts; isMemberCompletion = false; isNewIdentifierLocation = isNewIdentifierDefinitionLocation(previousToken); var symbolMeanings = 793056 | 107455 | 1536 | 8388608; - var symbols = typeInfoResolver.getSymbolsInScope(node, symbolMeanings); - getCompletionEntriesFromSymbols(symbols, activeCompletionSession); + var _symbols = typeInfoResolver.getSymbolsInScope(node, symbolMeanings); + getCompletionEntriesFromSymbols(_symbols, activeCompletionSession); } } if (!isMemberCompletion) { @@ -32975,9 +33088,9 @@ var ts; entries: activeCompletionSession.entries }; function getCompletionEntriesFromSymbols(symbols, session) { - var start = new Date().getTime(); + var _start_1 = new Date().getTime(); ts.forEach(symbols, function (symbol) { - var entry = createCompletionEntry(symbol, session.typeChecker, location); + var entry = createCompletionEntry(symbol, session.typeChecker, _location); if (entry) { var id = ts.escapeIdentifier(entry.name); if (!ts.lookUp(session.symbols, id)) { @@ -32986,12 +33099,12 @@ var ts; } } }); - log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - _start_1)); } function isCompletionListBlocker(previousToken) { - var start = new Date().getTime(); + var _start_1 = new Date().getTime(); var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); - log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); + log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - _start_1)); return result; } function showCompletionsInImportsClause(node) { @@ -33040,9 +33153,9 @@ var ts; } function isInStringOrRegularExpressionOrTemplateLiteral(previousToken) { if (previousToken.kind === 8 || previousToken.kind === 9 || ts.isTemplateLiteralKind(previousToken.kind)) { - var start = previousToken.getStart(); + var _start_1 = previousToken.getStart(); var end = previousToken.getEnd(); - if (start < position && position < end) { + if (_start_1 < position && position < end) { return true; } else if (position === end) { @@ -33053,12 +33166,12 @@ var ts; } function getContainingObjectLiteralApplicableForCompletion(previousToken) { if (previousToken) { - var parent = previousToken.parent; + var _parent = previousToken.parent; switch (previousToken.kind) { case 14: case 23: - if (parent && parent.kind === 152) { - return parent; + if (_parent && _parent.kind === 152) { + return _parent; } break; } @@ -33149,8 +33262,8 @@ var ts; } if (importDeclaration.importClause.namedBindings && importDeclaration.importClause.namedBindings.kind === 207) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { - var name = el.propertyName || el.name; - exisingImports[name.text] = true; + var _name = el.propertyName || el.name; + exisingImports[_name.text] = true; }); } if (ts.isEmpty(exisingImports)) { @@ -33174,13 +33287,13 @@ var ts; } existingMemberNames[m.name.text] = true; }); - var filteredMembers = []; + var _filteredMembers = []; ts.forEach(contextualMemberSymbols, function (s) { if (!existingMemberNames[s.name]) { - filteredMembers.push(s); + _filteredMembers.push(s); } }); - return filteredMembers; + return _filteredMembers; } } function getCompletionEntryDetails(fileName, position, entryName) { @@ -33191,10 +33304,10 @@ var ts; } var symbol = ts.lookUp(activeCompletionSession.symbols, ts.escapeIdentifier(entryName)); if (symbol) { - var location = ts.getTouchingPropertyName(sourceFile, position); - var completionEntry = createCompletionEntry(symbol, session.typeChecker, location); - ts.Debug.assert(session.typeChecker.getTypeOfSymbolAtLocation(symbol, location) !== undefined, "Could not find type for symbol"); - var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location, session.typeChecker, location, 7); + var _location = ts.getTouchingPropertyName(sourceFile, position); + var completionEntry = createCompletionEntry(symbol, session.typeChecker, _location); + ts.Debug.assert(session.typeChecker.getTypeOfSymbolAtLocation(symbol, _location) !== undefined, "Could not find type for symbol"); + var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), _location, session.typeChecker, _location, 7); return { name: entryName, kind: displayPartsDocumentationsAndSymbolKind.symbolKind, @@ -33317,11 +33430,13 @@ var ts; var symbolFlags = symbol.flags; var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, typeResolver, location); var hasAddedSymbolInfo; + var type; if (symbolKind !== ScriptElementKind.unknown || symbolFlags & 32 || symbolFlags & 8388608) { if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { symbolKind = ScriptElementKind.memberVariableElement; } - var type = typeResolver.getTypeOfSymbolAtLocation(symbol, location); + var signature; + type = typeResolver.getTypeOfSymbolAtLocation(symbol, location); if (type) { if (location.parent && location.parent.kind === 153) { var right = location.parent.name; @@ -33392,14 +33507,13 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || (location.kind === 113 && location.parent.kind === 133)) { - var signature; var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 133 ? type.getConstructSignatures() : type.getCallSignatures(); + var _allSignatures = functionDeclaration.kind === 133 ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeResolver.isImplementationOfOverload(functionDeclaration)) { signature = typeResolver.getSignatureFromDeclaration(functionDeclaration); } else { - signature = allSignatures[0]; + signature = _allSignatures[0]; } if (functionDeclaration.kind === 133) { symbolKind = ScriptElementKind.constructorImplementationElement; @@ -33408,7 +33522,7 @@ var ts; else { addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 136 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } - addSignatureDisplayParts(signature, allSignatures); + addSignatureDisplayParts(signature, _allSignatures); hasAddedSymbolInfo = true; } } @@ -33468,7 +33582,7 @@ var ts; } else { var signatureDeclaration = ts.getDeclarationOfKind(symbol, 127).parent; - var signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); + var _signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); if (signatureDeclaration.kind === 137) { displayParts.push(ts.keywordPart(87)); displayParts.push(ts.spacePart()); @@ -33476,7 +33590,7 @@ var ts; else if (signatureDeclaration.kind !== 136 && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } - displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeResolver, signature, sourceFile, 32)); + displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeResolver, _signature, sourceFile, 32)); } } if (symbolFlags & 8) { @@ -33540,8 +33654,8 @@ var ts; } } else if (symbolFlags & 16 || symbolFlags & 8192 || symbolFlags & 16384 || symbolFlags & 131072 || symbolFlags & 98304 || symbolKind === ScriptElementKind.memberFunctionElement) { - var allSignatures = type.getCallSignatures(); - addSignatureDisplayParts(allSignatures[0], allSignatures); + var _allSignatures_1 = type.getCallSignatures(); + addSignatureDisplayParts(_allSignatures_1[0], _allSignatures_1); } } } @@ -33590,10 +33704,10 @@ var ts; documentation = signature.getDocumentationComment(); } function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { - var typeParameterParts = ts.mapToDisplayParts(function (writer) { + var _typeParameterParts = ts.mapToDisplayParts(function (writer) { typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration); }); - displayParts.push.apply(displayParts, typeParameterParts); + displayParts.push.apply(displayParts, _typeParameterParts); } } function getQuickInfoAtPosition(fileName, position) { @@ -33710,11 +33824,11 @@ var ts; }; } function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { - var declarations = []; + var _declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { if ((selectConstructors && d.kind === 133) || (!selectConstructors && (d.kind === 195 || d.kind === 132 || d.kind === 131))) { - declarations.push(d); + _declarations.push(d); if (d.body) definition = d; } @@ -33723,8 +33837,8 @@ var ts; result.push(getDefinitionInfo(definition, symbolKind, symbolName, containerName)); return true; } - else if (declarations.length) { - result.push(getDefinitionInfo(declarations[declarations.length - 1], symbolKind, symbolName, containerName)); + else if (_declarations.length) { + result.push(getDefinitionInfo(_declarations[_declarations.length - 1], symbolKind, symbolName, containerName)); return true; } return false; @@ -33838,8 +33952,8 @@ var ts; while (ifStatement) { var children = ifStatement.getChildren(); pushKeywordIf(keywords, children[0], 83); - for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 75)) { + for (var _i = children.length - 1; _i >= 0; _i--) { + if (pushKeywordIf(keywords, children[_i], 75)) { break; } } @@ -33849,10 +33963,10 @@ var ts; ifStatement = ifStatement.elseStatement; } var result = []; - for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 75 && i < keywords.length - 1) { - var elseKeyword = keywords[i]; - var ifKeyword = keywords[i + 1]; + for (var _i_1 = 0; _i_1 < keywords.length; _i_1++) { + if (keywords[_i_1].kind === 75 && _i_1 < keywords.length - 1) { + var elseKeyword = keywords[_i_1]; + var ifKeyword = keywords[_i_1 + 1]; var shouldHighlightNextKeyword = true; for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { if (!ts.isWhiteSpace(sourceFile.text.charCodeAt(j))) { @@ -33866,11 +33980,11 @@ var ts; textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), isWriteAccess: false }); - i++; + _i_1++; continue; } } - result.push(getReferenceEntryFromNode(keywords[i])); + result.push(getReferenceEntryFromNode(keywords[_i_1])); } return result; } @@ -33933,17 +34047,17 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 221) { - return parent; + var _parent = child.parent; + if (ts.isFunctionBlock(_parent) || _parent.kind === 221) { + return _parent; } - if (parent.kind === 191) { - var tryStatement = parent; + if (_parent.kind === 191) { + var tryStatement = _parent; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent; + child = _parent; } return undefined; } @@ -33964,8 +34078,8 @@ var ts; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 81, 99, 74)) { if (loopNode.kind === 179) { var loopTokens = loopNode.getChildren(); - for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 99)) { + for (var _i = loopTokens.length - 1; _i >= 0; _i--) { + if (pushKeywordIf(keywords, loopTokens[_i], 99)) { break; } } @@ -34028,8 +34142,8 @@ var ts; return actualOwner && actualOwner === owner; } function getBreakOrContinueOwner(statement) { - for (var node = statement.parent; node; node = node.parent) { - switch (node.kind) { + for (var _node = statement.parent; _node; _node = _node.parent) { + switch (_node.kind) { case 188: if (statement.kind === 184) { continue; @@ -34039,12 +34153,12 @@ var ts; case 183: case 180: case 179: - if (!statement.label || isLabeledBy(node, statement.label.text)) { - return node; + if (!statement.label || isLabeledBy(_node, statement.label.text)) { + return _node; } break; default: - if (ts.isFunctionLike(node)) { + if (ts.isFunctionLike(_node)) { return undefined; } break; @@ -34252,14 +34366,15 @@ var ts; var functionExpression = ts.forEach(symbol.declarations, function (d) { return d.kind === 160 ? d : undefined; }); + var _name; if (functionExpression && functionExpression.name) { - var name = functionExpression.name.text; + _name = functionExpression.name.text; } if (isImportOrExportSpecifierName(location)) { return location.getText(); } - var name = typeInfoResolver.symbolToString(symbol); - return stripQuotes(name); + _name = typeInfoResolver.symbolToString(symbol); + return stripQuotes(_name); } function getInternedName(symbol, location, declarations) { if (isImportOrExportSpecifierName(location)) { @@ -34268,18 +34383,13 @@ var ts; var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 160 ? d : undefined; }); - if (functionExpression && functionExpression.name) { - var name = functionExpression.name.text; - } - else { - var name = symbol.name; - } - return stripQuotes(name); + var _name = functionExpression && functionExpression.name ? functionExpression.name.text : symbol.name; + return stripQuotes(_name); } function stripQuotes(name) { - var length = name.length; - if (length >= 2 && name.charCodeAt(0) === 34 && name.charCodeAt(length - 1) === 34) { - return name.substring(1, length - 1); + var _length = name.length; + if (_length >= 2 && name.charCodeAt(0) === 34 && name.charCodeAt(_length - 1) === 34) { + return name.substring(1, _length - 1); } ; return name; @@ -34299,24 +34409,25 @@ var ts; if (symbol.parent || (symbol.flags & 268435456)) { return undefined; } - var scope = undefined; - var declarations = symbol.getDeclarations(); - if (declarations) { - for (var i = 0, n = declarations.length; i < n; i++) { - var container = getContainerNode(declarations[i]); + var _scope = undefined; + var _declarations = symbol.getDeclarations(); + if (_declarations) { + for (var _i = 0; _i < _declarations.length; _i++) { + var declaration = _declarations[_i]; + var container = getContainerNode(declaration); if (!container) { return undefined; } - if (scope && scope !== container) { + if (_scope && _scope !== container) { return undefined; } if (container.kind === 221 && !ts.isExternalModule(container)) { return undefined; } - scope = container; + _scope = container; } } - return scope; + return _scope; } function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { var positions = []; @@ -34340,21 +34451,21 @@ var ts; return positions; } function getLabelReferencesInNode(container, targetLabel) { - var result = []; + var _result = []; var sourceFile = container.getSourceFile(); var labelName = targetLabel.text; var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.getWidth() !== labelName.length) { + var _node = ts.getTouchingWord(sourceFile, position); + if (!_node || _node.getWidth() !== labelName.length) { return; } - if (node === targetLabel || (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { - result.push(getReferenceEntryFromNode(node)); + if (_node === targetLabel || (isJumpStatementTarget(_node) && getTargetLabel(_node, labelName) === targetLabel)) { + _result.push(getReferenceEntryFromNode(_node)); } }); - return result; + return _result; } function isValidReferencePosition(node, searchSymbolName) { if (node) { @@ -34450,21 +34561,21 @@ var ts; default: return undefined; } - var result = []; + var _result = []; var sourceFile = searchSpaceNode.getSourceFile(); var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 90) { + var _node = ts.getTouchingWord(sourceFile, position); + if (!_node || _node.kind !== 90) { return; } - var container = ts.getSuperContainer(node, false); + var container = ts.getSuperContainer(_node, false); if (container && (128 & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { - result.push(getReferenceEntryFromNode(node)); + _result.push(getReferenceEntryFromNode(_node)); } }); - return result; + return _result; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); @@ -34493,48 +34604,49 @@ var ts; default: return undefined; } - var result = []; + var _result = []; + var possiblePositions; if (searchSpaceNode.kind === 221) { ts.forEach(sourceFiles, function (sourceFile) { - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); - getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, result); + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); + getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, _result); }); } else { var sourceFile = searchSpaceNode.getSourceFile(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); - getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result); + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, _result); } - return result; + return _result; function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 92) { + var _node = ts.getTouchingWord(sourceFile, position); + if (!_node || _node.kind !== 92) { return; } - var container = ts.getThisContainer(node, false); + var container = ts.getThisContainer(_node, false); switch (searchSpaceNode.kind) { case 160: case 195: if (searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); + result.push(getReferenceEntryFromNode(_node)); } break; case 132: case 131: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); + result.push(getReferenceEntryFromNode(_node)); } break; case 196: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { - result.push(getReferenceEntryFromNode(node)); + result.push(getReferenceEntryFromNode(_node)); } break; case 221: if (container.kind === 221 && !ts.isExternalModule(container)) { - result.push(getReferenceEntryFromNode(node)); + result.push(getReferenceEntryFromNode(_node)); } break; } @@ -34542,30 +34654,30 @@ var ts; } } function populateSearchSymbolSet(symbol, location) { - var result = [ + var _result = [ symbol ]; if (isImportOrExportSpecifierImportSymbol(symbol)) { - result.push(typeInfoResolver.getAliasedSymbol(symbol)); + _result.push(typeInfoResolver.getAliasedSymbol(symbol)); } if (isNameOfPropertyAssignment(location)) { ts.forEach(getPropertySymbolsFromContextualType(location), function (contextualSymbol) { - result.push.apply(result, typeInfoResolver.getRootSymbols(contextualSymbol)); + _result.push.apply(_result, typeInfoResolver.getRootSymbols(contextualSymbol)); }); var shorthandValueSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(location.parent); if (shorthandValueSymbol) { - result.push(shorthandValueSymbol); + _result.push(shorthandValueSymbol); } } ts.forEach(typeInfoResolver.getRootSymbols(symbol), function (rootSymbol) { if (rootSymbol !== symbol) { - result.push(rootSymbol); + _result.push(rootSymbol); } if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), _result); } }); - return result; + return _result; } function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 | 64)) { @@ -34612,9 +34724,9 @@ var ts; return true; } if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - var result = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); - return ts.forEach(result, function (s) { + var _result = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), _result); + return ts.forEach(_result, function (s) { return searchSymbols.indexOf(s) >= 0; }); } @@ -34625,31 +34737,31 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeInfoResolver.getContextualType(objectLiteral); - var name = node.text; + var _name = node.text; if (contextualType) { if (contextualType.flags & 16384) { - var unionProperty = contextualType.getProperty(name); + var unionProperty = contextualType.getProperty(_name); if (unionProperty) { return [ unionProperty ]; } else { - var result = []; + var _result = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name); - if (symbol) { - result.push(symbol); + var _symbol = t.getProperty(_name); + if (_symbol) { + _result.push(_symbol); } }); - return result; + return _result; } } else { - var symbol = contextualType.getProperty(name); - if (symbol) { + var _symbol = contextualType.getProperty(_name); + if (_symbol) { return [ - symbol + _symbol ]; } } @@ -34659,10 +34771,12 @@ var ts; } function getIntersectingMeaningFromDeclarations(meaning, declarations) { if (declarations) { + var lastIterationMeaning; do { - var lastIterationMeaning = meaning; - for (var i = 0, n = declarations.length; i < n; i++) { - var declarationMeaning = getMeaningFromDeclaration(declarations[i]); + lastIterationMeaning = meaning; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; + var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; } @@ -34689,13 +34803,13 @@ var ts; if (node.kind === 64 && ts.isDeclarationName(node)) { return true; } - var parent = node.parent; - if (parent) { - if (parent.kind === 166 || parent.kind === 165) { + var _parent = node.parent; + if (_parent) { + if (_parent.kind === 166 || _parent.kind === 165) { return true; } - else if (parent.kind === 167 && parent.left === node) { - var operator = parent.operatorToken.kind; + else if (_parent.kind === 167 && _parent.left === node) { + var operator = _parent.operatorToken.kind; return 52 <= operator && operator <= 63; } } @@ -35091,8 +35205,8 @@ var ts; function processElement(element) { if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var i = 0, n = children.length; i < n; i++) { - var child = children[i]; + for (var _i = 0; _i < children.length; _i++) { + var child = children[_i]; if (ts.isToken(child)) { classifyToken(child); } @@ -35116,8 +35230,8 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var i = 0, n = childNodes.length; i < n; i++) { - var current = childNodes[i]; + for (var _i = 0; _i < childNodes.length; _i++) { + var current = childNodes[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); var range2 = ts.createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); @@ -35159,7 +35273,7 @@ var ts; var start = new Date().getTime(); var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); log("getIndentationAtPosition: getCurrentSourceFile: " + (new Date().getTime() - start)); - var start = new Date().getTime(); + start = new Date().getTime(); var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, editorOptions); log("getIndentationAtPosition: computeIndentation : " + (new Date().getTime() - start)); return result; @@ -35205,9 +35319,9 @@ var ts; continue; } var descriptor = undefined; - for (var i = 0, n = descriptors.length; i < n; i++) { - if (matchArray[i + firstDescriptorCaptureIndex]) { - descriptor = descriptors[i]; + for (var _i = 0, n = descriptors.length; _i < n; _i++) { + if (matchArray[_i + firstDescriptorCaptureIndex]) { + descriptor = descriptors[_i]; } } ts.Debug.assert(descriptor !== undefined); @@ -35230,14 +35344,14 @@ var ts; var singleLineCommentStart = /(?:\/\/+\s*)/.source; var multiLineCommentStart = /(?:\/\*+\s*)/.source; var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; - var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + var _preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; var messageRemainder = /(?:.*?)/.source; var messagePortion = "(" + literals + messageRemainder + ")"; - var regExpString = preamble + messagePortion + endOfLineOrEndOfComment; + var regExpString = _preamble + messagePortion + endOfLineOrEndOfComment; return new RegExp(regExpString, "gim"); } function isLetterOrDigit(char) { @@ -35255,9 +35369,10 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var i = 0; i < declarations.length; i++) { - var sourceFile = declarations[i].getSourceFile(); - if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { + for (var _i = 0; _i < declarations.length; _i++) { + var current = declarations[_i]; + var _sourceFile = current.getSourceFile(); + if (_sourceFile && getCanonicalFileName(ts.normalizePath(_sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); } } @@ -35355,7 +35470,7 @@ var ts; return node && node.parent && node.parent.kind === 154 && node.parent.argumentExpression === node; } function createClassifier() { - var scanner = ts.createScanner(2, false); + var _scanner = ts.createScanner(2, false); var noRegexTable = []; noRegexTable[64] = true; noRegexTable[8] = true; @@ -35419,17 +35534,17 @@ var ts; templateStack.push(11); break; } - scanner.setText(text); + _scanner.setText(text); var result = { finalLexState: 0, entries: [] }; var angleBracketStack = 0; do { - token = scanner.scan(); + token = _scanner.scan(); if (!ts.isTrivia(token)) { if ((token === 36 || token === 56) && !noRegexTable[lastNonTriviaToken]) { - if (scanner.reScanSlashToken() === 9) { + if (_scanner.reScanSlashToken() === 9) { token = 9; } } @@ -35462,7 +35577,7 @@ var ts; if (templateStack.length > 0) { var lastTemplateStackToken = ts.lastOrUndefined(templateStack); if (lastTemplateStackToken === 11) { - token = scanner.reScanTemplateToken(); + token = _scanner.reScanTemplateToken(); if (token === 13) { templateStack.pop(); } @@ -35482,13 +35597,13 @@ var ts; } while (token !== 1); return result; function processToken() { - var start = scanner.getTokenPos(); - var end = scanner.getTextPos(); + var start = _scanner.getTokenPos(); + var end = _scanner.getTextPos(); addResult(end - start, classFromKind(token)); if (end >= text.length) { if (token === 8) { - var tokenText = scanner.getTokenText(); - if (scanner.isUnterminated()) { + var tokenText = _scanner.getTokenText(); + if (_scanner.isUnterminated()) { var lastCharIndex = tokenText.length - 1; var numBackslashes = 0; while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === 92) { @@ -35501,12 +35616,12 @@ var ts; } } else if (token === 3) { - if (scanner.isUnterminated()) { + if (_scanner.isUnterminated()) { result.finalLexState = 1; } } else if (ts.isTemplateLiteralKind(token)) { - if (scanner.isUnterminated()) { + if (_scanner.isUnterminated()) { if (token === 13) { result.finalLexState = 5; } diff --git a/bin/typescript.d.ts b/bin/typescript.d.ts index bf6b204d3bb..4319e2d1375 100644 --- a/bin/typescript.d.ts +++ b/bin/typescript.d.ts @@ -1443,7 +1443,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the TypeScript compiler release */ - var version: string; + let version: string; function createCompilerHost(options: CompilerOptions): CompilerHost; function getPreEmitDiagnostics(program: Program): Diagnostic[]; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; @@ -1451,7 +1451,7 @@ declare module "typescript" { } declare module "typescript" { /** The version of the language service API */ - var servicesVersion: string; + let servicesVersion: string; interface Node { getSourceFile(): SourceFile; getChildCount(sourceFile?: SourceFile): number; @@ -1938,7 +1938,7 @@ declare module "typescript" { throwIfCancellationRequested(): void; } function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; - var disableIncrementalParsing: boolean; + let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createDocumentRegistry(): DocumentRegistry; function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; diff --git a/bin/typescript.js b/bin/typescript.js index 0fb345eea1b..623e6341f90 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -625,8 +625,9 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + if (v === value) { return true; } } @@ -648,8 +649,9 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var i = 0, len = array.length; i < len; i++) { - if (predicate(array[i])) { + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + if (predicate(v)) { count++; } } @@ -658,12 +660,13 @@ var ts; } ts.countWhere = countWhere; function filter(array, f) { + var result; if (array) { - var result = []; - for (var i = 0, len = array.length; i < len; i++) { - var item = array[i]; - if (f(item)) { - result.push(item); + result = []; + for (var _i = 0; _i < array.length; _i++) { + var _item = array[_i]; + if (f(_item)) { + result.push(_item); } } } @@ -671,10 +674,12 @@ var ts; } ts.filter = filter; function map(array, f) { + var result; if (array) { - var result = []; - for (var i = 0, len = array.length; i < len; i++) { - result.push(f(array[i])); + result = []; + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + result.push(f(v)); } } return result; @@ -689,12 +694,14 @@ var ts; } ts.concatenate = concatenate; function deduplicate(array) { + var result; if (array) { - var result = []; - for (var i = 0, len = array.length; i < len; i++) { - var item = array[i]; - if (!contains(result, item)) - result.push(item); + result = []; + for (var _i = 0; _i < array.length; _i++) { + var _item = array[_i]; + if (!contains(result, _item)) { + result.push(_item); + } } } return result; @@ -702,15 +709,17 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var i = 0; i < array.length; i++) { - result += array[i][prop]; + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + result += v[prop]; } return result; } ts.sum = sum; function addRange(to, from) { - for (var i = 0, n = from.length; i < n; i++) { - to.push(from[i]); + for (var _i = 0; _i < from.length; _i++) { + var v = from[_i]; + to.push(v); } } ts.addRange = addRange; @@ -771,9 +780,9 @@ var ts; for (var id in first) { result[id] = first[id]; } - for (var id in second) { - if (!hasProperty(result, id)) { - result[id] = second[id]; + for (var _id in second) { + if (!hasProperty(result, _id)) { + result[_id] = second[_id]; } } return result; @@ -972,8 +981,8 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var i = 0; i < parts.length; i++) { - var part = parts[i]; + for (var _i = 0; _i < parts.length; _i++) { + var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { normalized.pop(); @@ -988,7 +997,7 @@ var ts; return normalized; } function normalizePath(path) { - var path = normalizeSlashes(path); + path = normalizeSlashes(path); var rootLength = getRootLength(path); var normalized = getNormalizedParts(path, rootLength); return path.substr(0, rootLength) + normalized.join(ts.directorySeparator); @@ -1013,7 +1022,7 @@ var ts; ].concat(normalizedParts); } function getNormalizedPathComponents(path, currentDirectory) { - var path = normalizeSlashes(path); + path = normalizeSlashes(path); var rootLength = getRootLength(path); if (rootLength == 0) { path = combinePaths(normalizeSlashes(currentDirectory), path); @@ -1124,8 +1133,8 @@ var ts; ".js" ]; function removeFileExtension(path) { - for (var i = 0; i < supportedExtensions.length; i++) { - var ext = supportedExtensions[i]; + for (var _i = 0; _i < supportedExtensions.length; _i++) { + var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -1289,15 +1298,16 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var i = 0; i < files.length; i++) { - var name = files[i]; - if (!extension || ts.fileExtensionIs(name, extension)) { - result.push(ts.combinePaths(path, name)); + for (var _i = 0; _i < files.length; _i++) { + var _name = files[_i]; + if (!extension || ts.fileExtensionIs(_name, extension)) { + result.push(ts.combinePaths(path, _name)); } } var subfolders = getNames(folder.subfolders); - for (var i = 0; i < subfolders.length; i++) { - visitDirectory(ts.combinePaths(path, subfolders[i])); + for (var _a = 0; _a < subfolders.length; _a++) { + var current = subfolders[_a]; + visitDirectory(ts.combinePaths(path, current)); } } } @@ -1382,8 +1392,9 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var i = 0; i < files.length; i++) { - var name = ts.combinePaths(path, files[i]); + for (var _i = 0; _i < files.length; _i++) { + var current = files[_i]; + var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); if (stat.isFile()) { if (!extension || ts.fileExtensionIs(name, extension)) { @@ -1394,8 +1405,9 @@ var ts; directories.push(name); } } - for (var i = 0; i < directories.length; i++) { - visitDirectory(directories[i]); + for (var _a = 0; _a < directories.length; _a++) { + var _current = directories[_a]; + visitDirectory(_current); } } } @@ -6844,9 +6856,9 @@ var ts; } function makeReverseMap(source) { var result = []; - for (var name in source) { - if (source.hasOwnProperty(name)) { - result[source[name]] = name; + for (var _name in source) { + if (source.hasOwnProperty(_name)) { + result[source[_name]] = _name; } } return result; @@ -7019,8 +7031,8 @@ var ts; else { ts.Debug.assert(ch === 61); while (pos < len) { - var ch = text.charCodeAt(pos); - if (ch === 62 && isConflictMarkerTrivia(text, pos)) { + var _ch = text.charCodeAt(pos); + if (_ch === 62 && isConflictMarkerTrivia(text, pos)) { break; } pos++; @@ -7414,8 +7426,8 @@ var ts; return result; } function getIdentifierToken() { - var len = tokenValue.length; - if (len >= 2 && len <= 11) { + var _len = tokenValue.length; + if (_len >= 2 && _len <= 11) { var ch = tokenValue.charCodeAt(0); if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { return token = textToToken[tokenValue]; @@ -7567,13 +7579,13 @@ var ts; pos += 2; var commentClosed = false; while (pos < len) { - var ch = text.charCodeAt(pos); - if (ch === 42 && text.charCodeAt(pos + 1) === 47) { + var _ch = text.charCodeAt(pos); + if (_ch === 42 && text.charCodeAt(pos + 1) === 47) { pos += 2; commentClosed = true; break; } - if (isLineBreak(ch)) { + if (isLineBreak(_ch)) { precedingLineBreak = true; } pos++; @@ -7606,22 +7618,22 @@ var ts; } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { pos += 2; - var value = scanBinaryOrOctalDigits(2); - if (value < 0) { + var _value = scanBinaryOrOctalDigits(2); + if (_value < 0) { error(ts.Diagnostics.Binary_digit_expected); - value = 0; + _value = 0; } - tokenValue = "" + value; + tokenValue = "" + _value; return token = 7; } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { pos += 2; - var value = scanBinaryOrOctalDigits(8); - if (value < 0) { + var _value_1 = scanBinaryOrOctalDigits(8); + if (_value_1 < 0) { error(ts.Diagnostics.Octal_digit_expected); - value = 0; + _value_1 = 0; } - tokenValue = "" + value; + tokenValue = "" + _value_1; return token = 7; } if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { @@ -7720,10 +7732,10 @@ var ts; case 126: return pos++, token = 47; case 92: - var ch = peekUnicodeEscape(); - if (ch >= 0 && isIdentifierStart(ch)) { + var cookedChar = peekUnicodeEscape(); + if (cookedChar >= 0 && isIdentifierStart(cookedChar)) { pos += 6; - tokenValue = String.fromCharCode(ch) + scanIdentifierParts(); + tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); return token = getIdentifierToken(); } error(ts.Diagnostics.Invalid_character); @@ -7909,8 +7921,8 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var declaration = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; } @@ -8394,8 +8406,8 @@ var ts; } case 7: case 8: - var parent = node.parent; - switch (parent.kind) { + var _parent = node.parent; + switch (_parent.kind) { case 193: case 128: case 130: @@ -8403,7 +8415,7 @@ var ts; case 220: case 218: case 150: - return parent.initializer === node; + return _parent.initializer === node; case 177: case 178: case 179: @@ -8414,22 +8426,22 @@ var ts; case 214: case 190: case 188: - return parent.expression === node; + return _parent.expression === node; case 181: - var forStatement = parent; + var forStatement = _parent; return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || forStatement.condition === node || forStatement.iterator === node; case 182: case 183: - var forInStatement = parent; + var forInStatement = _parent; return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || forInStatement.expression === node; case 158: - return node === parent.expression; + return node === _parent.expression; case 173: - return node === parent.expression; + return node === _parent.expression; case 126: - return node === parent.expression; + return node === _parent.expression; default: - if (isExpression(parent)) { + if (isExpression(_parent)) { return true; } } @@ -8587,14 +8599,14 @@ var ts; if (name.kind !== 64 && name.kind !== 8 && name.kind !== 7) { return false; } - var parent = name.parent; - if (parent.kind === 208 || parent.kind === 212) { - if (parent.propertyName) { + var _parent = name.parent; + if (_parent.kind === 208 || _parent.kind === 212) { + if (_parent.propertyName) { return true; } } - if (isDeclaration(parent)) { - return parent.name === name; + if (isDeclaration(_parent)) { + return _parent.name === name; } return false; } @@ -8616,9 +8628,10 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var i = 0, n = clauses.length; i < n; i++) { - if (clauses[i].token === kind) { - return clauses[i]; + for (var _i = 0; _i < clauses.length; _i++) { + var clause = clauses[_i]; + if (clause.token === kind) { + return clause; } } } @@ -8863,7 +8876,7 @@ var ts; ts.createSynthesizedNode = createSynthesizedNode; function generateUniqueName(baseName, isExistingName) { if (baseName.charCodeAt(0) !== 95) { - var baseName = "_" + baseName; + baseName = "_" + baseName; if (!isExistingName(baseName)) { return baseName; } @@ -8873,9 +8886,9 @@ var ts; } var i = 1; while (true) { - var name = baseName + i; - if (!isExistingName(name)) { - return name; + var _name = baseName + i; + if (!isExistingName(_name)) { + return _name; } i++; } @@ -9006,8 +9019,9 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var i = 0, len = nodes.length; i < len; i++) { - var result = cbNode(nodes[i]); + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; + var result = cbNode(node); if (result) { return result; } @@ -9290,16 +9304,16 @@ var ts; } ts.modifierToFlag = modifierToFlag; function fixupParentReferences(sourceFile) { - var parent = sourceFile; + var _parent = sourceFile; forEachChild(sourceFile, visitNode); return; function visitNode(n) { - if (n.parent !== parent) { - n.parent = parent; - var saveParent = parent; - parent = n; + if (n.parent !== _parent) { + n.parent = _parent; + var saveParent = _parent; + _parent = n; forEachChild(n, visitNode); - parent = saveParent; + _parent = saveParent; } } } @@ -9337,8 +9351,9 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var i = 0, n = array.length; i < n; i++) { - visitNode(array[i]); + for (var _i = 0; _i < array.length; _i++) { + var node = array[_i]; + visitNode(node); } } } @@ -9400,8 +9415,9 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var i = 0, n = array.length; i < n; i++) { - visitNode(array[i]); + for (var _i = 0; _i < array.length; _i++) { + var node = array[_i]; + visitNode(node); } return; } @@ -9697,8 +9713,8 @@ var ts; } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); - var length = scanner.getTextPos() - start; - parseErrorAtPosition(start, length, message, arg0); + var _length = scanner.getTextPos() - start; + parseErrorAtPosition(start, _length, message, arg0); } function parseErrorAtPosition(start, length, message, arg0) { var lastError = ts.lastOrUndefined(sourceFile.parseDiagnostics); @@ -10511,11 +10527,11 @@ var ts; } function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); - var name = parsePropertyName(); + var _name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (token === 16 || token === 24) { var method = createNode(131, fullStart); - method.name = name; + method.name = _name; method.questionToken = questionToken; fillSignature(51, false, false, method); parseTypeMemberSemicolon(); @@ -10523,7 +10539,7 @@ var ts; } else { var property = createNode(129, fullStart); - property.name = name; + property.name = _name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); parseTypeMemberSemicolon(); @@ -10842,6 +10858,10 @@ var ts; nextToken(); return !scanner.hasPrecedingLineBreak() && isIdentifier(); } + function nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() { + nextToken(); + return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 14 || token === 18); + } function parseYieldExpression() { var node = createNode(170); nextToken(); @@ -11173,10 +11193,10 @@ var ts; continue; } else if (token === 16) { - var callExpr = createNode(155, expression.pos); - callExpr.expression = expression; - callExpr.arguments = parseArgumentList(); - expression = finishNode(callExpr); + var _callExpr = createNode(155, expression.pos); + _callExpr.expression = expression; + _callExpr.arguments = parseArgumentList(); + expression = finishNode(_callExpr); continue; } return expression; @@ -11826,15 +11846,15 @@ var ts; } function parsePropertyOrMethodDeclaration(fullStart, modifiers) { var asteriskToken = parseOptionalToken(35); - var name = parsePropertyName(); + var _name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (asteriskToken || token === 16 || token === 24) { - return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); + return parseMethodDeclaration(fullStart, modifiers, asteriskToken, _name, questionToken, ts.Diagnostics.or_expected); } else { var property = createNode(130, fullStart); setModifiers(property, modifiers); - property.name = name; + property.name = _name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); property.initializer = allowInAnd(parseNonParameterInitializer); @@ -12172,7 +12192,7 @@ var ts; return finishNode(node); } function isLetDeclaration() { - return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOnSameLine); + return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine); } function isDeclarationStart() { switch (token) { @@ -12497,9 +12517,10 @@ var ts; } function declareSymbol(symbols, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); - var name = node.flags & 256 && parent ? "default" : getDeclarationName(node); - if (name !== undefined) { - var symbol = ts.hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); + var _name = node.flags & 256 && parent ? "default" : getDeclarationName(node); + var symbol; + if (_name !== undefined) { + symbol = ts.hasProperty(symbols, _name) ? symbols[_name] : (symbols[_name] = createSymbol(0, _name)); if (symbol.flags & excludes) { if (node.name) { node.name.parent = node; @@ -12509,7 +12530,7 @@ var ts; file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); - symbol = createSymbol(0, name); + symbol = createSymbol(0, _name); } } else { @@ -12861,6 +12882,8 @@ var ts; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0; var emitResolver = createResolver(); + var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); + var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); @@ -12909,8 +12932,6 @@ var ts; getEmitResolver: getEmitResolver, getExportsOfExternalModule: getExportsOfExternalModule }; - var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); - var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var unknownSymbol = createSymbol(4 | 67108864, "unknown"); var resolvingSymbol = createSymbol(67108864, "__resolving__"); var anyType = createIntrinsicType(1, "any"); @@ -13311,11 +13332,11 @@ var ts; function getExternalModuleMember(node, specifier) { var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); if (moduleSymbol) { - var name = specifier.propertyName || specifier.name; - if (name.text) { - var symbol = getSymbol(getExportsOfSymbol(moduleSymbol), name.text, 107455 | 793056 | 1536); + var _name = specifier.propertyName || specifier.name; + if (_name.text) { + var symbol = getSymbol(getExportsOfSymbol(moduleSymbol), _name.text, 107455 | 793056 | 1536); if (!symbol) { - error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name)); + error(_name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(_name)); return; } return symbol.flags & (107455 | 793056 | 1536) ? symbol : resolveAlias(symbol); @@ -13412,8 +13433,9 @@ var ts; if (ts.getFullWidth(name) === 0) { return undefined; } + var symbol; if (name.kind === 64) { - var symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); if (!symbol) { return undefined; } @@ -13424,7 +13446,7 @@ var ts; return undefined; } var right = name.right; - var symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); + symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { error(right, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); return undefined; @@ -13452,14 +13474,17 @@ var ts; return symbol; } } + var sourceFile; while (true) { var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - var sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); - if (sourceFile || isRelative) + sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + if (sourceFile || isRelative) { break; + } var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) + if (parentPath === searchPath) { break; + } searchPath = parentPath; } if (sourceFile) { @@ -13557,8 +13582,8 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var i = 0; i < members.length; i++) { - var member = members[i]; + for (var _i = 0; _i < members.length; _i++) { + var member = members[_i]; if (member.kind === 133 && ts.nodeIsPresent(member.body)) { return member; } @@ -13614,25 +13639,25 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var location = enclosingDeclaration; location; location = location.parent) { - if (location.locals && !isGlobalSourceFile(location)) { - if (result = callback(location.locals)) { + for (var _location = enclosingDeclaration; _location; _location = _location.parent) { + if (_location.locals && !isGlobalSourceFile(_location)) { + if (result = callback(_location.locals)) { return result; } } - switch (location.kind) { + switch (_location.kind) { case 221: - if (!ts.isExternalModule(location)) { + if (!ts.isExternalModule(_location)) { break; } case 200: - if (result = callback(getSymbolOfNode(location).exports)) { + if (result = callback(getSymbolOfNode(_location).exports)) { return result; } break; case 196: case 197: - if (result = callback(getSymbolOfNode(location).members)) { + if (result = callback(getSymbolOfNode(_location).members)) { return result; } break; @@ -13881,8 +13906,9 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var i = 0, n = accessibleSymbolChain.length; i < n; i++) { - appendParentTypeArgumentsAndSymbolName(accessibleSymbolChain[i]); + for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { + var accessibleSymbol = accessibleSymbolChain[_i]; + appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } } else { @@ -14061,15 +14087,17 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var i = 0; i < resolved.callSignatures.length; i++) { - buildSignatureDisplay(resolved.callSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { + var signature = _a[_i]; + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var i = 0; i < resolved.constructSignatures.length; i++) { + for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { + var _signature = _c[_b]; writeKeyword(writer, 87); writeSpace(writer); - buildSignatureDisplay(resolved.constructSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + buildSignatureDisplay(_signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } @@ -14099,17 +14127,18 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var i = 0; i < resolved.properties.length; i++) { - var p = resolved.properties[i]; + for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { + var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var j = 0; j < signatures.length; j++) { + for (var _f = 0; _f < signatures.length; _f++) { + var _signature_1 = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); } - buildSignatureDisplay(signatures[j], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + buildSignatureDisplay(_signature_1, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } @@ -14247,10 +14276,11 @@ var ts; } function isUsedInExportAssignment(node) { var externalModule = getContainingExternalModule(node); + var exportAssignmentSymbol; + var resolvedExportSymbol; if (externalModule) { var externalModuleSymbol = getSymbolOfNode(externalModule); - var exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); - var resolvedExportSymbol; + exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); var symbolOfNode = getSymbolOfNode(node); if (isSymbolUsedInExportAssignment(symbolOfNode)) { return true; @@ -14290,11 +14320,11 @@ var ts; case 195: case 199: case 203: - var parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 203 && parent.kind !== 221 && ts.isInAmbientContext(parent))) { - return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); + var _parent = getDeclarationContainer(node); + if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 203 && _parent.kind !== 221 && ts.isInAmbientContext(_parent))) { + return isGlobalSourceFile(_parent) || isUsedInExportAssignment(node); } - return isDeclarationVisible(parent); + return isDeclarationVisible(_parent); case 130: case 129: case 134: @@ -14366,11 +14396,12 @@ var ts; } return parentType; } + var type; if (pattern.kind === 148) { - var name = declaration.propertyName || declaration.name; - var type = getTypeOfPropertyOfType(parentType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); + var _name = declaration.propertyName || declaration.name; + type = getTypeOfPropertyOfType(parentType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); + error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(_name)); return unknownType; } } @@ -14381,7 +14412,7 @@ var ts; } if (!declaration.dotDotDotToken) { var propName = "" + ts.indexOf(pattern.elements, declaration); - var type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1); + type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1); if (!type) { if (isTupleType(parentType)) { error(declaration, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), parentType.elementTypes.length, pattern.elements.length); @@ -14393,7 +14424,7 @@ var ts; } } else { - var type = createArrayType(getIndexTypeOfType(parentType, 1)); + type = createArrayType(getIndexTypeOfType(parentType, 1)); } } return type; @@ -14445,8 +14476,8 @@ var ts; var members = {}; ts.forEach(pattern.elements, function (e) { var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); - var name = e.propertyName || e.name; - var symbol = createSymbol(flags, name.text); + var _name = e.propertyName || e.name; + var symbol = createSymbol(flags, _name.text); symbol.type = getTypeFromBindingElement(e); members[symbol.name] = symbol; }); @@ -14569,8 +14600,8 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 134); - error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + var _getter = ts.getDeclarationOfKind(symbol, 134); + error(_getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } } @@ -14749,8 +14780,8 @@ var ts; } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 198); - error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + var _declaration = ts.getDeclarationOfKind(symbol, 198); + error(_declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; } @@ -14806,23 +14837,23 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var i = 0; i < symbols.length; i++) { - var symbol = symbols[i]; + for (var _i = 0; _i < symbols.length; _i++) { + var symbol = symbols[_i]; result[symbol.name] = symbol; } return result; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var i = 0; i < symbols.length; i++) { - var symbol = symbols[i]; + for (var _i = 0; _i < symbols.length; _i++) { + var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var i = 0; i < baseSymbols.length; i++) { - var s = baseSymbols[i]; + for (var _i = 0; _i < baseSymbols.length; _i++) { + var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; } @@ -14830,8 +14861,9 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var i = 0; i < baseSignatures.length; i++) { - signatures.push(baseSignatures[i]); + for (var _i = 0; _i < baseSignatures.length; _i++) { + var signature = baseSignatures[_i]; + signatures.push(signature); } } } @@ -14931,13 +14963,14 @@ var ts; return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var i = 0; i < signatures.length; i++) { - if (signatures[i].typeParameters) { + for (var _i = 0; _i < signatures.length; _i++) { + var signature = signatures[_i]; + if (signature.typeParameters) { return emptyArray; } } - for (var i = 1; i < signatureLists.length; i++) { - if (!signatureListsIdentical(signatures, signatureLists[i])) { + for (var _i_1 = 1; _i_1 < signatureLists.length; _i_1++) { + if (!signatureListsIdentical(signatures, signatureLists[_i_1])) { return emptyArray; } } @@ -14953,8 +14986,9 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var i = 0; i < types.length; i++) { - var indexType = getIndexTypeOfType(types[i], kind); + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + var indexType = getIndexTypeOfType(type, kind); if (!indexType) { return undefined; } @@ -14971,17 +15005,22 @@ var ts; } function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; + var members; + var callSignatures; + var constructSignatures; + var stringIndexType; + var numberIndexType; if (symbol.flags & 2048) { - var members = symbol.members; - var callSignatures = getSignaturesOfSymbol(members["__call"]); - var constructSignatures = getSignaturesOfSymbol(members["__new"]); - var stringIndexType = getIndexTypeOfSymbol(symbol, 0); - var numberIndexType = getIndexTypeOfSymbol(symbol, 1); + members = symbol.members; + callSignatures = getSignaturesOfSymbol(members["__call"]); + constructSignatures = getSignaturesOfSymbol(members["__new"]); + stringIndexType = getIndexTypeOfSymbol(symbol, 0); + numberIndexType = getIndexTypeOfSymbol(symbol, 1); } else { - var members = emptySymbols; - var callSignatures = emptyArray; - var constructSignatures = emptyArray; + members = emptySymbols; + callSignatures = emptyArray; + constructSignatures = emptyArray; if (symbol.flags & 1952) { members = getExportsOfSymbol(symbol); } @@ -14999,8 +15038,8 @@ var ts; addInheritedMembers(members, getPropertiesOfObjectType(getTypeOfSymbol(classType.baseTypes[0].symbol))); } } - var stringIndexType = undefined; - var numberIndexType = (symbol.flags & 384) ? stringType : undefined; + stringIndexType = undefined; + numberIndexType = (symbol.flags & 384) ? stringType : undefined; } setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } @@ -15083,8 +15122,9 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var i = 0; i < types.length; i++) { - var type = getApparentType(types[i]); + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); if (!prop) { @@ -15102,12 +15142,12 @@ var ts; } var propTypes = []; var declarations = []; - for (var i = 0; i < props.length; i++) { - var prop = props[i]; - if (prop.declarations) { - declarations.push.apply(declarations, prop.declarations); + for (var _a = 0; _a < props.length; _a++) { + var _prop = props[_a]; + if (_prop.declarations) { + declarations.push.apply(declarations, _prop.declarations); } - propTypes.push(getTypeOfSymbol(prop)); + propTypes.push(getTypeOfSymbol(_prop)); } var result = createSymbol(4 | 67108864 | 268435456, name); result.unionType = unionType; @@ -15144,9 +15184,9 @@ var ts; } } if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) { - var symbol = getPropertyOfObjectType(globalFunctionType, name); - if (symbol) - return symbol; + var _symbol = getPropertyOfObjectType(globalFunctionType, name); + if (_symbol) + return _symbol; } return getPropertyOfObjectType(globalObjectType, name); } @@ -15266,14 +15306,15 @@ var ts; function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { signature.resolvedReturnType = resolvingType; + var type; if (signature.target) { - var type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); + type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); } else if (signature.unionSignatures) { - var type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature)); + type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature)); } else { - var type = getReturnTypeFromBody(signature.declaration); + type = getReturnTypeFromBody(signature.declaration); } if (signature.resolvedReturnType === resolvingType) { signature.resolvedReturnType = type; @@ -15342,8 +15383,9 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var i = 0; i < len; i++) { - var node = indexSymbol.declarations[i]; + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var node = decl; if (node.parameters.length === 1) { var parameter = node.parameters[0]; if (parameter && parameter.type && parameter.type.kind === syntaxKind) { @@ -15379,8 +15421,9 @@ var ts; default: var result = ""; for (var i = 0; i < types.length; i++) { - if (i > 0) + if (i > 0) { result += ","; + } result += types[i].id; } return result; @@ -15388,8 +15431,9 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var i = 0; i < types.length; i++) { - result |= types[i].flags; + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + result |= type.flags; } return result & 786432; } @@ -15446,8 +15490,8 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { var symbol = resolveEntityName(node.typeName, 793056); + var type; if (symbol) { - var type; if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { type = unknownType; } @@ -15485,8 +15529,8 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var declaration = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; switch (declaration.kind) { case 196: case 197: @@ -15570,13 +15614,15 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var i = 0, len = types.length; i < len; i++) { - addTypeToSortedSet(sortedTypes, types[i]); + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -15592,8 +15638,9 @@ var ts; } } function containsAnyType(types) { - for (var i = 0; i < types.length; i++) { - if (types[i].flags & 1) { + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + if (type.flags & 1) { return true; } } @@ -15707,8 +15754,9 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var i = 0; i < items.length; i++) { - result.push(instantiator(items[i], mapper)); + for (var _i = 0; _i < items.length; _i++) { + var v = items[_i]; + result.push(instantiator(v, mapper)); } return result; } @@ -15733,8 +15781,9 @@ var ts; } return function (t) { for (var i = 0; i < sources.length; i++) { - if (t === sources[i]) + if (t === sources[i]) { return targets[i]; + } } return t; }; @@ -15757,9 +15806,11 @@ var ts; return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var i = 0; i < sources.length; i++) { - if (t === sources[i]) + for (var _i = 0; _i < sources.length; _i++) { + var source = sources[_i]; + if (t === source) { return anyType; + } } return t; }; @@ -15795,8 +15846,9 @@ var ts; return result; } function instantiateSignature(signature, mapper, eraseTypeParameters) { + var freshTypeParameters; if (signature.typeParameters && !eraseTypeParameters) { - var freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); + freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); } var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), signature.resolvedReturnType ? instantiateType(signature.resolvedReturnType, mapper) : undefined, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); @@ -15952,7 +16004,7 @@ var ts; } function isRelatedTo(source, target, reportErrors, headMessage, elaborateErrors) { if (elaborateErrors === void 0) { elaborateErrors = false; } - var result; + var _result; if (source === target) return -1; if (relation !== identityRelation) { @@ -15976,53 +16028,53 @@ var ts; if (source.flags & 16384 || target.flags & 16384) { if (relation === identityRelation) { if (source.flags & 16384 && target.flags & 16384) { - if (result = unionTypeRelatedToUnionType(source, target)) { - if (result &= unionTypeRelatedToUnionType(target, source)) { - return result; + if (_result = unionTypeRelatedToUnionType(source, target)) { + if (_result &= unionTypeRelatedToUnionType(target, source)) { + return _result; } } } else if (source.flags & 16384) { - if (result = unionTypeRelatedToType(source, target, reportErrors)) { - return result; + if (_result = unionTypeRelatedToType(source, target, reportErrors)) { + return _result; } } else { - if (result = unionTypeRelatedToType(target, source, reportErrors)) { - return result; + if (_result = unionTypeRelatedToType(target, source, reportErrors)) { + return _result; } } } else { if (source.flags & 16384) { - if (result = unionTypeRelatedToType(source, target, reportErrors)) { - return result; + if (_result = unionTypeRelatedToType(source, target, reportErrors)) { + return _result; } } else { - if (result = typeRelatedToUnionType(source, target, reportErrors)) { - return result; + if (_result = typeRelatedToUnionType(source, target, reportErrors)) { + return _result; } } } } else if (source.flags & 512 && target.flags & 512) { - if (result = typeParameterRelatedTo(source, target, reportErrors)) { - return result; + if (_result = typeParameterRelatedTo(source, target, reportErrors)) { + return _result; } } else { var saveErrorInfo = errorInfo; if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { - return result; + if (_result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return _result; } } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (_result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; - return result; + return _result; } } if (reportErrors) { @@ -16038,16 +16090,17 @@ var ts; return 0; } function unionTypeRelatedToUnionType(source, target) { - var result = -1; + var _result = -1; var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { - var related = typeRelatedToUnionType(sourceTypes[i], target, false); + for (var _i = 0; _i < sourceTypes.length; _i++) { + var sourceType = sourceTypes[_i]; + var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function typeRelatedToUnionType(source, target, reportErrors) { var targetTypes = target.types; @@ -16060,27 +16113,28 @@ var ts; return 0; } function unionTypeRelatedToType(source, target, reportErrors) { - var result = -1; + var _result = -1; var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { - var related = isRelatedTo(sourceTypes[i], target, reportErrors); + for (var _i = 0; _i < sourceTypes.length; _i++) { + var sourceType = sourceTypes[_i]; + var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function typesRelatedTo(sources, targets, reportErrors) { - var result = -1; + var _result = -1; for (var i = 0, len = sources.length; i < len; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function typeParameterRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { @@ -16146,19 +16200,20 @@ var ts; expandingFlags |= 1; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) expandingFlags |= 2; + var _result; if (expandingFlags === 3) { - var result = 1; + _result = 1; } else { - var result = propertiesRelatedTo(source, target, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 0, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 1, reportErrors); - if (result) { - result &= stringIndexTypesRelatedTo(source, target, reportErrors); - if (result) { - result &= numberIndexTypesRelatedTo(source, target, reportErrors); + _result = propertiesRelatedTo(source, target, reportErrors); + if (_result) { + _result &= signaturesRelatedTo(source, target, 0, reportErrors); + if (_result) { + _result &= signaturesRelatedTo(source, target, 1, reportErrors); + if (_result) { + _result &= stringIndexTypesRelatedTo(source, target, reportErrors); + if (_result) { + _result &= numberIndexTypesRelatedTo(source, target, reportErrors); } } } @@ -16166,23 +16221,23 @@ var ts; } expandingFlags = saveExpandingFlags; depth--; - if (result) { + if (_result) { var maybeCache = maybeStack[depth]; - var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; + var destinationCache = (_result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; ts.copyMap(maybeCache, destinationCache); } else { relation[id] = reportErrors ? 3 : 2; } - return result; + return _result; } function isDeeplyNestedGeneric(type, stack) { if (type.flags & 4096 && depth >= 10) { - var target = type.target; + var _target = type.target; var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & 4096 && t.target === target) { + if (t.flags & 4096 && t.target === _target) { count++; if (count >= 10) return true; @@ -16195,11 +16250,11 @@ var ts; if (relation === identityRelation) { return propertiesIdenticalTo(source, target); } - var result = -1; + var _result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var i = 0; i < properties.length; i++) { - var targetProp = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { @@ -16250,7 +16305,7 @@ var ts; } return 0; } - result &= related; + _result &= related; if (sourceProp.flags & 536870912 && !(targetProp.flags & 536870912)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); @@ -16260,7 +16315,7 @@ var ts; } } } - return result; + return _result; } function propertiesIdenticalTo(source, target) { var sourceProperties = getPropertiesOfObjectType(source); @@ -16268,9 +16323,9 @@ var ts; if (sourceProperties.length !== targetProperties.length) { return 0; } - var result = -1; - for (var i = 0, len = sourceProperties.length; i < len; ++i) { - var sourceProp = sourceProperties[i]; + var _result = -1; + for (var _i = 0; _i < sourceProperties.length; _i++) { + var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { return 0; @@ -16279,9 +16334,9 @@ var ts; if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function signaturesRelatedTo(source, target, kind, reportErrors) { if (relation === identityRelation) { @@ -16292,18 +16347,18 @@ var ts; } var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); - var result = -1; + var _result = -1; var saveErrorInfo = errorInfo; - outer: for (var i = 0; i < targetSignatures.length; i++) { - var t = targetSignatures[i]; + outer: for (var _i = 0; _i < targetSignatures.length; _i++) { + var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var j = 0; j < sourceSignatures.length; j++) { - var s = sourceSignatures[j]; + for (var _a = 0; _a < sourceSignatures.length; _a++) { + var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); if (related) { - result &= related; + _result &= related; errorInfo = saveErrorInfo; continue outer; } @@ -16313,7 +16368,7 @@ var ts; return 0; } } - return result; + return _result; } function signatureRelatedTo(source, target, reportErrors) { if (source === target) { @@ -16343,14 +16398,14 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); - var result = -1; + var _result = -1; for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + var _s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + var _t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); var saveErrorInfo = errorInfo; - var related = isRelatedTo(s, t, reportErrors); + var related = isRelatedTo(_s, _t, reportErrors); if (!related) { - related = isRelatedTo(t, s, false); + related = isRelatedTo(_t, _s, false); if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); @@ -16359,13 +16414,13 @@ var ts; } errorInfo = saveErrorInfo; } - result &= related; + _result &= related; } var t = getReturnTypeOfSignature(target); if (t === voidType) - return result; + return _result; var s = getReturnTypeOfSignature(source); - return result & isRelatedTo(s, t, reportErrors); + return _result & isRelatedTo(s, t, reportErrors); } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); @@ -16373,15 +16428,15 @@ var ts; if (sourceSignatures.length !== targetSignatures.length) { return 0; } - var result = -1; + var _result = -1; for (var i = 0, len = sourceSignatures.length; i < len; ++i) { var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function stringIndexTypesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { @@ -16421,11 +16476,12 @@ var ts; } return 0; } + var related; if (sourceStringType && sourceNumberType) { - var related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); + related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); } else { - var related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); + related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); } if (!related) { if (reportErrors) { @@ -16498,14 +16554,14 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); - for (var i = 0, len = source.parameters.length; i < len; i++) { - var s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); - var related = compareTypes(s, t); - if (!related) { + for (var _i = 0, _len = source.parameters.length; _i < _len; _i++) { + var s = source.hasRestParameter && _i === _len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[_i]); + var t = target.hasRestParameter && _i === _len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[_i]); + var _related = compareTypes(s, t); + if (!_related) { return 0; } - result &= related; + result &= _related; } if (compareReturnTypes) { result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); @@ -16513,8 +16569,9 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && !isTypeSubtypeOf(types[i], candidate)) + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; } return true; @@ -16619,29 +16676,30 @@ var ts; return reportWideningErrorsInType(type.typeArguments[0]); } if (type.flags & 131072) { - var errorReported = false; + var _errorReported = false; ts.forEach(getPropertiesOfObjectType(type), function (p) { var t = getTypeOfSymbol(p); if (t.flags & 262144) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); } - errorReported = true; + _errorReported = true; } }); - return errorReported; + return _errorReported; } return false; } function reportImplicitAnyError(declaration, type) { var typeAsString = typeToString(getWidenedType(type)); + var diagnostic; switch (declaration.kind) { case 130: case 129: - var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; + diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; case 128: - var diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; case 195: case 132: @@ -16654,10 +16712,10 @@ var ts; error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; } - var diagnostic = ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; + diagnostic = ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; default: - var diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type; + diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type; } error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } @@ -16696,7 +16754,8 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var i = 0; i < typeParameters.length; i++) { + for (var _i = 0; _i < typeParameters.length; _i++) { + var unused = typeParameters[_i]; inferences.push({ primary: undefined, secondary: undefined @@ -16718,19 +16777,21 @@ var ts; inferFromTypes(source, target); function isInProcess(source, target) { for (var i = 0; i < depth; i++) { - if (source === sourceStack[i] && target === targetStack[i]) + if (source === sourceStack[i] && target === targetStack[i]) { return true; + } } return false; } function isWithinDepthLimit(type, stack) { if (depth >= 5) { - var target = type.target; + var _target = type.target; var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & 4096 && t.target === target) + if (t.flags & 4096 && t.target === _target) { count++; + } } return count < 5; } @@ -16755,16 +16816,16 @@ var ts; else if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { var sourceTypes = source.typeArguments; var targetTypes = target.typeArguments; - for (var i = 0; i < sourceTypes.length; i++) { - inferFromTypes(sourceTypes[i], targetTypes[i]); + for (var _i = 0; _i < sourceTypes.length; _i++) { + inferFromTypes(sourceTypes[_i], targetTypes[_i]); } } else if (target.flags & 16384) { - var targetTypes = target.types; + var _targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var i = 0; i < targetTypes.length; i++) { - var t = targetTypes[i]; + for (var _a = 0; _a < _targetTypes.length; _a++) { + var t = _targetTypes[_a]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; @@ -16780,9 +16841,10 @@ var ts; } } else if (source.flags & 16384) { - var sourceTypes = source.types; - for (var i = 0; i < sourceTypes.length; i++) { - inferFromTypes(sourceTypes[i], target); + var _sourceTypes = source.types; + for (var _b = 0; _b < _sourceTypes.length; _b++) { + var sourceType = _sourceTypes[_b]; + inferFromTypes(sourceType, target); } } else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { @@ -16806,8 +16868,8 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var i = 0; i < properties.length; i++) { - var targetProp = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -16993,9 +17055,9 @@ var ts; } function resolveLocation(node) { var containerNodes = []; - for (var parent = node.parent; parent; parent = parent.parent) { - if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(parent)) { - containerNodes.unshift(parent); + for (var _parent = node.parent; _parent; _parent = _parent.parent) { + if ((ts.isExpression(_parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(_parent)) { + containerNodes.unshift(_parent); } } ts.forEach(containerNodes, function (node) { @@ -17283,11 +17345,12 @@ var ts; var container = ts.getSuperContainer(node, true); if (container) { var canUseSuperExpression = false; + var needToCaptureLexicalThis; if (isCallExpression) { canUseSuperExpression = container.kind === 133; } else { - var needToCaptureLexicalThis = false; + needToCaptureLexicalThis = false; while (container && container.kind === 161) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; @@ -17422,8 +17485,9 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var i = 0; i < types.length; i++) { - var t = mapper(types[i]); + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + var t = mapper(current); if (t) { if (!mappedType) { mappedType = t; @@ -17502,8 +17566,8 @@ var ts; if (node.contextualType) { return node.contextualType; } - var parent = node.parent; - switch (parent.kind) { + var _parent = node.parent; + switch (_parent.kind) { case 193: case 128: case 130: @@ -17515,22 +17579,22 @@ var ts; return getContextualTypeForReturnExpression(node); case 155: case 156: - return getContextualTypeForArgument(parent, node); + return getContextualTypeForArgument(_parent, node); case 158: - return getTypeFromTypeNode(parent.type); + return getTypeFromTypeNode(_parent.type); case 167: return getContextualTypeForBinaryOperand(node); case 218: - return getContextualTypeForObjectLiteralElement(parent); + return getContextualTypeForObjectLiteralElement(_parent); case 151: return getContextualTypeForElementExpression(node); case 168: return getContextualTypeForConditionalOperand(node); case 173: - ts.Debug.assert(parent.parent.kind === 169); - return getContextualTypeForSubstitutionExpression(parent.parent, node); + ts.Debug.assert(_parent.parent.kind === 169); + return getContextualTypeForSubstitutionExpression(_parent.parent, node); case 159: - return getContextualType(parent); + return getContextualType(_parent); } return undefined; } @@ -17560,11 +17624,12 @@ var ts; } var signatureList; var types = type.types; - for (var i = 0; i < types.length; i++) { - if (signatureList && getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; } - var signature = getNonGenericSignature(types[i]); + var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { signatureList = [ @@ -17591,15 +17656,15 @@ var ts; return mapper && mapper !== identityMapper; } function isAssignmentTarget(node) { - var parent = node.parent; - if (parent.kind === 167 && parent.operatorToken.kind === 52 && parent.left === node) { + var _parent = node.parent; + if (_parent.kind === 167 && _parent.operatorToken.kind === 52 && _parent.left === node) { return true; } - if (parent.kind === 218) { - return isAssignmentTarget(parent.parent); + if (_parent.kind === 218) { + return isAssignmentTarget(_parent.parent); } - if (parent.kind === 151) { - return isAssignmentTarget(parent); + if (_parent.kind === 151) { + return isAssignmentTarget(_parent); } return false; } @@ -17664,19 +17729,20 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var i = 0; i < node.properties.length; i++) { - var memberDecl = node.properties[i]; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var memberDecl = _a[_i]; var member = memberDecl.symbol; if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { + var type = void 0; if (memberDecl.kind === 218) { - var type = checkPropertyAssignment(memberDecl, contextualMapper); + type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 132) { - var type = checkObjectLiteralMethod(memberDecl, contextualMapper); + type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { ts.Debug.assert(memberDecl.kind === 219); - var type = memberDecl.name.kind === 126 ? unknownType : checkExpression(memberDecl.name, contextualMapper); + type = memberDecl.name.kind === 126 ? unknownType : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -17709,15 +17775,15 @@ var ts; for (var i = 0; i < propertiesArray.length; i++) { var propertyDecl = node.properties[i]; if (kind === 0 || isNumericName(propertyDecl.name)) { - var type = getTypeOfSymbol(propertiesArray[i]); - if (!ts.contains(propTypes, type)) { - propTypes.push(type); + var _type = getTypeOfSymbol(propertiesArray[i]); + if (!ts.contains(propTypes, _type)) { + propTypes.push(_type); } } } - var result = propTypes.length ? getUnionType(propTypes) : undefinedType; - typeFlags |= result.flags; - return result; + var _result = propTypes.length ? getUnionType(propTypes) : undefinedType; + typeFlags |= _result.flags; + return _result; } return undefined; } @@ -17818,9 +17884,9 @@ var ts; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); } else { - var start = node.end - "]".length; - var end = node.end; - grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected); + var _start = node.end - "]".length; + var _end = node.end; + grammarErrorAtPos(sourceFile, _start, _end - _start, ts.Diagnostics.Expression_expected); } } var objectType = getApparentType(checkExpression(node.expression)); @@ -17834,15 +17900,15 @@ var ts; return unknownType; } if (node.argumentExpression) { - var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); - if (name !== undefined) { - var prop = getPropertyOfType(objectType, name); + var _name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (_name !== undefined) { + var prop = getPropertyOfType(objectType, _name); if (prop) { getNodeLinks(node).resolvedSymbol = prop; return getTypeOfSymbol(prop); } else if (isConstEnum) { - error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name, symbolToString(objectType.symbol)); + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, _name, symbolToString(objectType.symbol)); return unknownType; } } @@ -17929,22 +17995,22 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var i = 0; i < signatures.length; i++) { - var signature = signatures[i]; + for (var _i = 0; _i < signatures.length; _i++) { + var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent = signature.declaration && signature.declaration.parent; + var _parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent === lastParent) { + if (lastParent && _parent === lastParent) { index++; } else { - lastParent = parent; + lastParent = _parent; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent; + lastParent = _parent; } lastSymbol = symbol; if (signature.hasStringLiterals) { @@ -18034,30 +18100,31 @@ var ts; var arg = args[i]; if (arg.kind !== 172) { var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); + var argType = void 0; if (i === 0 && args[i].parent.kind === 157) { - var argType = globalTemplateStringsArrayType; + argType = globalTemplateStringsArrayType; } else { var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; - var argType = checkExpressionWithContextualType(arg, paramType, mapper); + argType = checkExpressionWithContextualType(arg, paramType, mapper); } inferTypes(context, argType, paramType); } } if (excludeArgument) { - for (var i = 0; i < args.length; i++) { - if (excludeArgument[i] === false) { - var arg = args[i]; - var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + for (var _i = 0; _i < args.length; _i++) { + if (excludeArgument[_i] === false) { + var _arg = args[_i]; + var _paramType = getTypeAtPosition(signature, _arg.kind === 171 ? -1 : _i); + inferTypes(context, checkExpressionWithContextualType(_arg, _paramType, inferenceMapper), _paramType); } } } var inferredTypes = getInferredTypes(context); context.failedTypeParameterIndex = ts.indexOf(inferredTypes, inferenceFailureType); - for (var i = 0; i < inferredTypes.length; i++) { - if (inferredTypes[i] === inferenceFailureType) { - inferredTypes[i] = unknownType; + for (var _i_1 = 0; _i_1 < inferredTypes.length; _i_1++) { + if (inferredTypes[_i_1] === inferenceFailureType) { + inferredTypes[_i_1] = unknownType; } } return context; @@ -18179,50 +18246,53 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var i = 0, n = candidates.length; i < n; i++) { - if (hasCorrectArity(node, args, candidates[i])) { - return candidates[i]; + for (var _i = 0; _i < candidates.length; _i++) { + var candidate = candidates[_i]; + if (hasCorrectArity(node, args, candidate)) { + return candidate; } } } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var i = 0; i < candidates.length; i++) { - if (!hasCorrectArity(node, args, candidates[i])) { + for (var _a = 0; _a < candidates.length; _a++) { + var current = candidates[_a]; + if (!hasCorrectArity(node, args, current)) { continue; } - var originalCandidate = candidates[i]; - var inferenceResult; + var originalCandidate = current; + var inferenceResult = void 0; + var _candidate = void 0; + var typeArgumentsAreValid = void 0; while (true) { - var candidate = originalCandidate; - if (candidate.typeParameters) { - var typeArgumentTypes; - var typeArgumentsAreValid; + _candidate = originalCandidate; + if (_candidate.typeParameters) { + var typeArgumentTypes = void 0; if (typeArguments) { - typeArgumentTypes = new Array(candidate.typeParameters.length); - typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); + typeArgumentTypes = new Array(_candidate.typeParameters.length); + typeArgumentsAreValid = checkTypeArguments(_candidate, typeArguments, typeArgumentTypes, false); } else { - inferenceResult = inferTypeArguments(candidate, args, excludeArgument); + inferenceResult = inferTypeArguments(_candidate, args, excludeArgument); typeArgumentsAreValid = inferenceResult.failedTypeParameterIndex < 0; typeArgumentTypes = inferenceResult.inferredTypes; } if (!typeArgumentsAreValid) { break; } - candidate = getSignatureInstantiation(candidate, typeArgumentTypes); + _candidate = getSignatureInstantiation(_candidate, typeArgumentTypes); } - if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { + if (!checkApplicableSignature(node, args, _candidate, relation, excludeArgument, false)) { break; } var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; if (index < 0) { - return candidate; + return _candidate; } excludeArgument[index] = false; } if (originalCandidate.typeParameters) { - var instantiatedCandidate = candidate; + var instantiatedCandidate = _candidate; if (typeArgumentsAreValid) { candidateForArgumentError = instantiatedCandidate; } @@ -18234,7 +18304,7 @@ var ts; } } else { - ts.Debug.assert(originalCandidate === candidate); + ts.Debug.assert(originalCandidate === _candidate); candidateForArgumentError = originalCandidate; } } @@ -18386,9 +18456,9 @@ var ts; links.type = instantiateType(getTypeAtPosition(context, i), mapper); } if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { - var parameter = signature.parameters[signature.parameters.length - 1]; - var links = getSymbolLinks(parameter); - links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); + var _parameter = signature.parameters[signature.parameters.length - 1]; + var _links = getSymbolLinks(_parameter); + _links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); } } function getReturnTypeFromBody(func, contextualMapper) { @@ -18396,15 +18466,16 @@ var ts; if (!func.body) { return unknownType; } + var type; if (func.body.kind !== 174) { - var type = checkExpressionCached(func.body, contextualMapper); + type = checkExpressionCached(func.body, contextualMapper); } else { var types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper); if (types.length === 0) { return voidType; } - var type = contextualSignature ? getUnionType(types) : getCommonSupertype(types); + type = contextualSignature ? getUnionType(types) : getCommonSupertype(types); if (!type) { error(func, ts.Diagnostics.No_best_common_type_exists_among_return_expressions); return unknownType; @@ -18525,11 +18596,15 @@ var ts; function isReferenceOrErrorExpression(n) { switch (n.kind) { case 64: - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + { + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + } case 153: - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; + { + var _symbol = findSymbol(n); + return !_symbol || _symbol === unknownSymbol || (_symbol.flags & ~8) !== 0; + } case 154: return true; case 159: @@ -18542,17 +18617,21 @@ var ts; switch (n.kind) { case 64: case 153: - var symbol = findSymbol(n); - return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; + { + var symbol = findSymbol(n); + return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; + } case 154: - var index = n.argumentExpression; - var symbol = findSymbol(n.expression); - if (symbol && index && index.kind === 8) { - var name = index.text; - var prop = getPropertyOfType(getTypeOfSymbol(symbol), name); - return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; + { + var index = n.argumentExpression; + var _symbol = findSymbol(n.expression); + if (_symbol && index && index.kind === 8) { + var _name = index.text; + var prop = getPropertyOfType(getTypeOfSymbol(_symbol), _name); + return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; + } + return false; } - return false; case 159: return isConstVariableReference(n.expression); default: @@ -18624,8 +18703,9 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var i = 0; i < types.length; i++) { - if (types[i].flags & kind) { + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + if (current.flags & kind) { return true; } } @@ -18639,8 +18719,9 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var i = 0; i < types.length; i++) { - if (!(types[i].flags & kind)) { + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + if (!(current.flags & kind)) { return false; } } @@ -18674,16 +18755,16 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var i = 0; i < properties.length; i++) { - var p = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { - var name = p.name; - var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); + var _name = p.name; + var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { - checkDestructuringAssignment(p.initializer || name, type); + checkDestructuringAssignment(p.initializer || _name, type); } else { - error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name)); + error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(_name)); } } else { @@ -19114,8 +19195,9 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var i = 0, len = indexSymbol.declarations.length; i < len; ++i) { - var declaration = indexSymbol.declarations[i]; + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { case 120: @@ -19303,8 +19385,8 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var i = 0; i < signaturesToCheck.length; i++) { - var otherSignature = signaturesToCheck[i]; + for (var _i = 0; _i < signaturesToCheck.length; _i++) { + var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; } @@ -19384,16 +19466,16 @@ var ts; }); if (subsequentNode) { if (subsequentNode.kind === node.kind) { - var errorNode = subsequentNode.name || subsequentNode; + var _errorNode = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { ts.Debug.assert(node.kind === 132 || node.kind === 131); ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; - error(errorNode, diagnostic); + error(_errorNode, diagnostic); return; } else if (ts.nodeIsPresent(subsequentNode.body)) { - error(errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); + error(_errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); return; } } @@ -19409,8 +19491,9 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var i = 0; i < declarations.length; i++) { - var node = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var current = declarations[_i]; + var node = current; var inAmbientContext = ts.isInAmbientContext(node); var inAmbientContextOrInterface = node.parent.kind === 197 || node.parent.kind === 143 || inAmbientContext; if (inAmbientContextOrInterface) { @@ -19467,9 +19550,10 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var i = 0, len = signatures.length; i < len; ++i) { - if (!signatures[i].hasStringLiterals && !isSignatureAssignableTo(bodySignature, signatures[i])) { - error(signatures[i].declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + for (var _a = 0; _a < signatures.length; _a++) { + var signature = signatures[_a]; + if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { + error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; } } @@ -19481,7 +19565,6 @@ var ts; if (!produceDiagnostics) { return; } - var symbol; var symbol = node.localSymbol; if (!symbol) { symbol = getSymbolOfNode(node); @@ -19610,8 +19693,8 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4) { - var isDeclaration = node.kind !== 64; - if (isDeclaration) { + var _isDeclaration = node.kind !== 64; + if (_isDeclaration) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } else { @@ -19631,8 +19714,8 @@ var ts; return; } if (ts.getClassBaseTypeNode(enclosingClass)) { - var isDeclaration = node.kind !== 64; - if (isDeclaration) { + var _isDeclaration = node.kind !== 64; + if (_isDeclaration) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -19647,8 +19730,8 @@ var ts; if (node.kind === 200 && ts.getModuleInstanceState(node) !== 1) { return; } - var parent = getDeclarationContainer(node); - if (parent.kind === 221 && ts.isExternalModule(parent)) { + var _parent = getDeclarationContainer(node); + if (_parent.kind === 221 && ts.isExternalModule(_parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -19663,8 +19746,8 @@ var ts; var container = varDeclList.parent.kind === 175 && varDeclList.parent.parent; var namesShareScope = container && (container.kind === 174 && ts.isFunctionLike(container.parent) || (container.kind === 201 && container.kind === 200) || container.kind === 221); if (!namesShareScope) { - var name = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); + var _name = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, _name, _name); } } } @@ -19678,10 +19761,11 @@ var ts; return node.kind === 128; } function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind === 128) { - var func = ts.getContainingFunction(node); - visit(node.initializer); + if (getRootDeclaration(node).kind !== 128) { + return; } + var func = ts.getContainingFunction(node); + visit(node.initializer); function visit(n) { if (n.kind === 64) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; @@ -20110,8 +20194,8 @@ var ts; }); if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 196) { var classDeclaration = type.symbol.valueDeclaration; - for (var i = 0; i < classDeclaration.members.length; i++) { - var member = classDeclaration.members[i]; + for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { + var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0); @@ -20140,22 +20224,22 @@ var ts; if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { return; } - var errorNode; + var _errorNode; if (prop.valueDeclaration.name.kind === 126 || prop.parent === containingType.symbol) { - errorNode = prop.valueDeclaration; + _errorNode = prop.valueDeclaration; } else if (indexDeclaration) { - errorNode = indexDeclaration; + _errorNode = indexDeclaration; } else if (containingType.flags & 2048) { var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); - errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; + _errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } - if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { + if (_errorNode && !isTypeAssignableTo(propertyType, indexType)) { var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; - error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); + error(_errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); } } } @@ -20172,7 +20256,7 @@ var ts; } function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { - for (var i = 0; i < typeParameterDeclarations.length; i++) { + for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { var node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { @@ -20244,8 +20328,9 @@ var ts; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); - for (var i = 0, len = baseProperties.length; i < len; ++i) { - var base = getTargetSymbol(baseProperties[i]); + for (var _i = 0; _i < baseProperties.length; _i++) { + var baseProperty = baseProperties[_i]; + var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { continue; } @@ -20262,7 +20347,7 @@ var ts; if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) { continue; } - var errorMessage; + var errorMessage = void 0; if (base.flags & 8192) { if (derived.flags & 98304) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; @@ -20325,11 +20410,11 @@ var ts; }; }); var ok = true; - for (var i = 0, len = type.baseTypes.length; i < len; ++i) { - var base = type.baseTypes[i]; + for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { + var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var j = 0, proplen = properties.length; j < proplen; ++j) { - var prop = properties[j]; + for (var _b = 0; _b < properties.length; _b++) { + var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, @@ -20387,8 +20472,8 @@ var ts; checkSourceElement(node.type); } function computeEnumMemberValues(node) { - var nodeLinks = getNodeLinks(node); - if (!(nodeLinks.flags & 128)) { + var _nodeLinks = getNodeLinks(node); + if (!(_nodeLinks.flags & 128)) { var enumSymbol = getSymbolOfNode(node); var enumType = getDeclaredTypeOfSymbol(enumSymbol); var autoValue = 0; @@ -20425,7 +20510,7 @@ var ts; getNodeLinks(member).enumMemberValue = autoValue++; } }); - nodeLinks.flags |= 128; + _nodeLinks.flags |= 128; } function getConstantValueForEnumMemberInitializer(initializer, enumIsConst) { return evalConstant(initializer); @@ -20494,10 +20579,10 @@ var ts; } var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); - var enumType; + var _enumType; var propertyName; if (e.kind === 64) { - enumType = currentType; + _enumType = currentType; propertyName = e.text; } else { @@ -20505,21 +20590,21 @@ var ts; if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { return undefined; } - var enumType = getTypeOfNode(e.expression); + _enumType = getTypeOfNode(e.expression); propertyName = e.argumentExpression.text; } else { - var enumType = getTypeOfNode(e.expression); + _enumType = getTypeOfNode(e.expression); propertyName = e.name.text; } - if (enumType !== currentType) { + if (_enumType !== currentType) { return undefined; } } if (propertyName === undefined) { return undefined; } - var property = getPropertyOfObjectType(enumType, propertyName); + var property = getPropertyOfObjectType(_enumType, propertyName); if (!property || !(property.flags & 8)) { return undefined; } @@ -20579,8 +20664,8 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var declaration = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; if ((declaration.kind === 196 || (declaration.kind === 195 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -20747,18 +20832,19 @@ var ts; } function hasExportedMembers(moduleSymbol) { var declarations = moduleSymbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var statements = getModuleStatements(declarations[i]); - for (var j = 0; j < statements.length; j++) { - var node = statements[j]; + for (var _i = 0; _i < declarations.length; _i++) { + var current = declarations[_i]; + var statements = getModuleStatements(current); + for (var _a = 0; _a < statements.length; _a++) { + var node = statements[_a]; if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; } var specifiers = exportClause.elements; - for (var k = 0; k < specifiers.length; k++) { - var specifier = specifiers[k]; + for (var _b = 0; _b < specifiers.length; _b++) { + var specifier = specifiers[_b]; if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) { return true; } @@ -21121,21 +21207,21 @@ var ts; } case 125: ts.Debug.assert(node.kind === 64 || node.kind === 125, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); - var parent = node.parent; - if (parent.kind === 142) { + var _parent = node.parent; + if (_parent.kind === 142) { return false; } - if (139 <= parent.kind && parent.kind <= 147) { + if (139 <= _parent.kind && _parent.kind <= 147) { return true; } - switch (parent.kind) { + switch (_parent.kind) { case 127: - return node === parent.constraint; + return node === _parent.constraint; case 130: case 129: case 128: case 193: - return node === parent.type; + return node === _parent.type; case 195: case 160: case 161: @@ -21144,16 +21230,16 @@ var ts; case 131: case 134: case 135: - return node === parent.type; + return node === _parent.type; case 136: case 137: case 138: - return node === parent.type; + return node === _parent.type; case 158: - return node === parent.type; + return node === _parent.type; case 155: case 156: - return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + return _parent.typeArguments && ts.indexOf(_parent.typeArguments, node) >= 0; case 157: return false; } @@ -21209,17 +21295,17 @@ var ts; return getNodeLinks(entityName).resolvedSymbol; } else if (entityName.kind === 125) { - var symbol = getNodeLinks(entityName).resolvedSymbol; - if (!symbol) { + var _symbol = getNodeLinks(entityName).resolvedSymbol; + if (!_symbol) { checkQualifiedName(entityName); } return getNodeLinks(entityName).resolvedSymbol; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 139 ? 793056 : 1536; - meaning |= 8388608; - return resolveEntityName(entityName, meaning); + var _meaning = entityName.parent.kind === 139 ? 793056 : 1536; + _meaning |= 8388608; + return resolveEntityName(entityName, _meaning); } return undefined; } @@ -21288,21 +21374,21 @@ var ts; return getDeclaredTypeOfSymbol(symbol); } if (isTypeDeclarationName(node)) { - var symbol = getSymbolInfo(node); - return symbol && getDeclaredTypeOfSymbol(symbol); + var _symbol = getSymbolInfo(node); + return _symbol && getDeclaredTypeOfSymbol(_symbol); } if (ts.isDeclaration(node)) { - var symbol = getSymbolOfNode(node); - return getTypeOfSymbol(symbol); + var _symbol_1 = getSymbolOfNode(node); + return getTypeOfSymbol(_symbol_1); } if (ts.isDeclarationName(node)) { - var symbol = getSymbolInfo(node); - return symbol && getTypeOfSymbol(symbol); + var _symbol_2 = getSymbolInfo(node); + return _symbol_2 && getTypeOfSymbol(_symbol_2); } if (isInRightSideOfImportOrExportAssignment(node)) { - var symbol = getSymbolInfo(node); - var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); - return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); + var _symbol_3 = getSymbolInfo(node); + var declaredType = _symbol_3 && getDeclaredTypeOfSymbol(_symbol_3); + return declaredType !== unknownType ? declaredType : getTypeOfSymbol(_symbol_3); } return unknownType; } @@ -21313,7 +21399,7 @@ var ts; return checkExpression(expr); } function getAugmentedPropertiesOfType(type) { - var type = getApparentType(type); + type = getApparentType(type); var propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { @@ -21327,9 +21413,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456) { var symbols = []; - var name = symbol.name; + var _name = symbol.name; ts.forEach(getSymbolLinks(symbol).unionType.types, function (t) { - symbols.push(getPropertyOfType(t, name)); + symbols.push(getPropertyOfType(t, _name)); }); return symbols; } @@ -21406,8 +21492,8 @@ var ts; return ts.hasProperty(globals, name) || ts.hasProperty(sourceFile.identifiers, name) || ts.hasProperty(generatedNames, name); } function makeUniqueName(baseName) { - var name = ts.generateUniqueName(baseName, isExistingName); - return generatedNames[name] = name; + var _name = ts.generateUniqueName(baseName, isExistingName); + return generatedNames[_name] = _name; } function assignGeneratedName(node, name) { getNodeLinks(node).generatedName = ts.unescapeIdentifier(name); @@ -21419,8 +21505,8 @@ var ts; } function generateNameForModuleOrEnum(node) { if (node.name.kind === 64) { - var name = node.name.text; - assignGeneratedName(node, isUniqueLocalName(name, node) ? name : makeUniqueName(name)); + var _name = node.name.text; + assignGeneratedName(node, isUniqueLocalName(_name, node) ? _name : makeUniqueName(_name)); } } function generateNameForImportOrExportDeclaration(node) { @@ -21570,7 +21656,7 @@ var ts; return undefined; } var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || n.parent.kind === 150 ? getSymbolOfNode(n.parent) : undefined; - var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 2 | 8388608, undefined, undefined); + var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2) && symbol.valueDeclaration.parent.kind !== 217; if (isLetOrConst) { getSymbolLinks(symbol); @@ -21662,13 +21748,13 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var i = 0, n = node.modifiers.length; i < n; i++) { - var modifier = node.modifiers[i]; + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { + var modifier = _a[_i]; switch (modifier.kind) { case 108: case 107: case 106: - var text; + var text = void 0; if (modifier.kind === 108) { text = "public"; } @@ -21866,8 +21952,8 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var i = 0, n = arguments.length; i < n; i++) { - var arg = arguments[i]; + for (var _i = 0; _i < arguments.length; _i++) { + var arg = arguments[_i]; if (arg.kind === 172) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } @@ -21892,9 +21978,8 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarModifiers(node) && node.heritageClauses) { - for (var i = 0, n = node.heritageClauses.length; i < n; i++) { - ts.Debug.assert(i <= 2); - var heritageClause = node.heritageClauses[i]; + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); @@ -21921,9 +22006,8 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var i = 0, n = node.heritageClauses.length; i < n; i++) { - ts.Debug.assert(i <= 1); - var heritageClause = node.heritageClauses[i]; + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); @@ -21968,18 +22052,18 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var i = 0, n = node.properties.length; i < n; i++) { - var prop = node.properties[i]; - var name = prop.name; - if (prop.kind === 172 || name.kind === 126) { - checkGrammarComputedPropertyName(name); + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var prop = _a[_i]; + var _name = prop.name; + if (prop.kind === 172 || _name.kind === 126) { + checkGrammarComputedPropertyName(_name); continue; } - var currentKind; + var currentKind = void 0; if (prop.kind === 218 || prop.kind === 219) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name.kind === 7) { - checkGrammarNumbericLiteral(name); + if (_name.kind === 7) { + checkGrammarNumbericLiteral(_name); } currentKind = Property; } @@ -21995,26 +22079,26 @@ var ts; else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - if (!ts.hasProperty(seen, name.text)) { - seen[name.text] = currentKind; + if (!ts.hasProperty(seen, _name.text)) { + seen[_name.text] = currentKind; } else { - var existingKind = seen[name.text]; + var existingKind = seen[_name.text]; if (currentKind === Property && existingKind === Property) { if (inStrictMode) { - grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); + grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); } } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[name.text] = currentKind | existingKind; + seen[_name.text] = currentKind | existingKind; } else { - return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } @@ -22032,12 +22116,12 @@ var ts; } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; - return grammarErrorOnNode(firstDeclaration.name, diagnostic); + var _diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + return grammarErrorOnNode(firstDeclaration.name, _diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; - return grammarErrorOnNode(firstDeclaration, diagnostic); + var _diagnostic_1 = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + return grammarErrorOnNode(firstDeclaration, _diagnostic_1); } } } @@ -22166,8 +22250,8 @@ var ts; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; - return grammarErrorOnNode(node, message); + var _message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, _message); } } function checkGrammarBindingElement(node) { @@ -22213,8 +22297,9 @@ var ts; } else { var elements = name.elements; - for (var i = 0; i < elements.length; ++i) { - checkGrammarNameInLetOrConstDeclarations(elements[i].name); + for (var _i = 0; _i < elements.length; _i++) { + var element = elements[_i]; + checkGrammarNameInLetOrConstDeclarations(element.name); } } } @@ -22270,8 +22355,8 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var i = 0, n = enumDecl.members.length; i < n; i++) { - var node = enumDecl.members[i]; + for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { + var node = _a[_i]; if (node.name.kind === 126) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } @@ -22360,8 +22445,8 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var i = 0, n = file.statements.length; i < n; i++) { - var decl = file.statements[i]; + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + var decl = _a[_i]; if (ts.isDeclaration(decl) || decl.kind === 175) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; @@ -22382,9 +22467,9 @@ var ts; return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } if (node.parent.kind === 174 || node.parent.kind === 201 || node.parent.kind === 221) { - var links = getNodeLinks(node.parent); - if (!links.hasReportedStatementInAmbientContext) { - return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); + var _links = getNodeLinks(node.parent); + if (!_links.hasReportedStatementInAmbientContext) { + return _links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); } } else { @@ -22658,11 +22743,12 @@ var ts; } function getOwnEmitOutputFilePath(sourceFile, host, extension) { var compilerOptions = host.getCompilerOptions(); + var emitOutputFilePathWithoutExtension; if (compilerOptions.outDir) { - var emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); + emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); } else { - var emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName); + emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName); } return emitOutputFilePathWithoutExtension + extension; } @@ -22742,17 +22828,17 @@ var ts; } } function createAndSetNewTextWriterWithSymbolWriter() { - var writer = createTextWriter(newLine); - writer.trackSymbol = trackSymbol; - writer.writeKeyword = writer.write; - writer.writeOperator = writer.write; - writer.writePunctuation = writer.write; - writer.writeSpace = writer.write; - writer.writeStringLiteral = writer.writeLiteral; - writer.writeParameter = writer.write; - writer.writeSymbol = writer.write; - setWriter(writer); - return writer; + var _writer = createTextWriter(newLine); + _writer.trackSymbol = trackSymbol; + _writer.writeKeyword = _writer.write; + _writer.writeOperator = _writer.write; + _writer.writePunctuation = _writer.write; + _writer.writeSpace = _writer.write; + _writer.writeStringLiteral = _writer.writeLiteral; + _writer.writeParameter = _writer.write; + _writer.writeSymbol = _writer.write; + setWriter(_writer); + return _writer; } function setWriter(newWriter) { writer = newWriter; @@ -22822,18 +22908,20 @@ var ts; } } function emitLines(nodes) { - for (var i = 0, n = nodes.length; i < n; i++) { - emit(nodes[i]); + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; + emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var i = 0, n = nodes.length; i < n; i++) { + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; if (currentWriterPos !== writer.getTextPos()) { write(separator); } currentWriterPos = writer.getTextPos(); - eachNodeEmitFn(nodes[i]); + eachNodeEmitFn(node); } } function emitCommaList(nodes, eachNodeEmitFn) { @@ -23303,13 +23391,14 @@ var ts; return; } var accessors = getAllAccessorDeclarations(node.parent.members, node); + var accessorWithTypeAnnotation; if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(node); writeTextOfNode(currentSourceFile, node.name); if (!(node.flags & 32)) { - var accessorWithTypeAnnotation = node; + accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { var anotherAccessor = node.kind === 134 ? accessors.setAccessor : accessors.getAccessor; @@ -23689,16 +23778,16 @@ var ts; } } function generateUniqueNameForLocation(location, baseName) { - var name; + var _name; if (!isExistingName(location, baseName)) { - name = baseName; + _name = baseName; } else { - name = ts.generateUniqueName(baseName, function (n) { + _name = ts.generateUniqueName(baseName, function (n) { return isExistingName(location, n); }); } - return recordNameInCurrentScope(name); + return recordNameInCurrentScope(_name); } function recordNameInCurrentScope(name) { if (!currentScopeNames) { @@ -23841,8 +23930,8 @@ var ts; if (scopeName) { var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { - var name = node.name; - if (!name || name.kind !== 126) { + var _name = node.name; + if (!_name || _name.kind !== 126) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -23861,8 +23950,8 @@ var ts; } else if (node.kind === 195 || node.kind === 160 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135 || node.kind === 200 || node.kind === 196 || node.kind === 199) { if (node.name) { - var name = node.name; - scopeName = name.kind === 126 ? ts.getTextOfNode(name) : node.name.text; + var _name = node.name; + scopeName = _name.kind === 126 ? ts.getTextOfNode(_name) : node.name.text; } recordScopeNameStart(scopeName); } @@ -23977,17 +24066,17 @@ var ts; writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } function createTempVariable(location, forLoopVariable) { - var name = forLoopVariable ? "_i" : undefined; + var _name = forLoopVariable ? "_i" : undefined; while (true) { - if (name && !isExistingName(location, name)) { + if (_name && !isExistingName(location, _name)) { break; } - name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); + _name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); tempCount++; } - recordNameInCurrentScope(name); + recordNameInCurrentScope(_name); var result = ts.createSynthesizedNode(64); - result.text = name; + result.text = _name; return result; } function recordTempDeclaration(name) { @@ -24225,7 +24314,7 @@ var ts; emitLiteral(node.head); headEmitted = true; } - for (var i = 0; i < node.templateSpans.length; i++) { + for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; var needsParens = templateSpan.expression.kind !== 159 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { @@ -24301,8 +24390,8 @@ var ts; } } function isNotExpressionIdentifier(node) { - var parent = node.parent; - switch (parent.kind) { + var _parent = node.parent; + switch (_parent.kind) { case 128: case 193: case 150: @@ -24322,7 +24411,7 @@ var ts; case 199: case 200: case 203: - return parent.name === node; + return _parent.name === node; case 185: case 184: case 209: @@ -24429,8 +24518,8 @@ var ts; function emitListWithSpread(elements, multiLine, trailingComma) { var pos = 0; var group = 0; - var length = elements.length; - while (pos < length) { + var _length = elements.length; + while (pos < _length) { if (group === 1) { write(".concat("); } @@ -24445,14 +24534,14 @@ var ts; } else { var i = pos; - while (i < length && elements[i].kind !== 171) { + while (i < _length && elements[i].kind !== 171) { i++; } write("["); if (multiLine) { increaseIndent(); } - emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + emitList(elements, pos, i - pos, multiLine, trailingComma && i === _length); if (multiLine) { decreaseIndent(); } @@ -24528,8 +24617,8 @@ var ts; var propertyDescriptor = ts.createSynthesizedNode(152); var descriptorProperties = []; if (getAccessor) { - var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); - descriptorProperties.push(getProperty); + var _getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(_getProperty); } if (setAccessor) { var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); @@ -24642,7 +24731,6 @@ var ts; } } write("{"); - var properties = node.properties; if (properties.length) { emitLinePreservingList(node, properties, languageVersion >= 1, true); } @@ -25294,7 +25382,7 @@ var ts; } function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; - var isDeclaration = (root.kind === 193 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 128; + var _isDeclaration = (root.kind === 193 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 128; if (root.kind === 167) { emitAssignmentExpression(root); } @@ -25319,7 +25407,7 @@ var ts; function ensureIdentifier(expr) { if (expr.kind !== 64) { var identifier = createTempVariable(lowestNonSynthesizedAncestor || root); - if (!isDeclaration) { + if (!_isDeclaration) { recordTempDeclaration(identifier); } emitAssignment(identifier, expr); @@ -25374,8 +25462,8 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var i = 0; i < properties.length; i++) { - var p = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); @@ -25420,18 +25508,18 @@ var ts; } function emitAssignmentExpression(root) { var target = root.left; - var value = root.right; + var _value = root.right; if (isAssignmentExpressionStatement) { - emitDestructuringAssignment(target, value); + emitDestructuringAssignment(target, _value); } else { if (root.parent.kind !== 159) { write("("); } - value = ensureIdentifier(value); - emitDestructuringAssignment(target, value); + _value = ensureIdentifier(_value); + emitDestructuringAssignment(target, _value); write(", "); - emit(value); + emit(_value); if (root.parent.kind !== 159) { write(")"); } @@ -25499,12 +25587,12 @@ var ts; } } function emitExportVariableAssignments(node) { - var name = node.name; - if (name.kind === 64) { - emitExportMemberAssignments(name); + var _name = node.name; + if (_name.kind === 64) { + emitExportMemberAssignments(_name); } - else if (ts.isBindingPattern(name)) { - ts.forEach(name.elements, emitExportVariableAssignments); + else if (ts.isBindingPattern(_name)) { + ts.forEach(_name.elements, emitExportVariableAssignments); } } function getCombinedFlagsForIdentifier(node) { @@ -25526,8 +25614,8 @@ var ts; return; } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 221 ? blockScopeContainer : blockScopeContainer.parent; - var generatedName = generateUniqueNameForLocation(parent, node.text); + var _parent = blockScopeContainer.kind === 221 ? blockScopeContainer : blockScopeContainer.parent; + var generatedName = generateUniqueNameForLocation(_parent, node.text); var variableId = resolver.getBlockScopedVariableId(node); if (!generatedBlockScopeNames) { generatedBlockScopeNames = []; @@ -25547,12 +25635,12 @@ var ts; function emitParameter(node) { if (languageVersion < 2) { if (ts.isBindingPattern(node.name)) { - var name = createTempVariable(node); + var _name = createTempVariable(node); if (!tempParameters) { tempParameters = []; } - tempParameters.push(name); - emit(name); + tempParameters.push(_name); + emit(_name); } else { emit(node.name); @@ -25798,9 +25886,10 @@ var ts; decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var i = 0, n = body.statements.length; i < n; i++) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; write(" "); - emit(body.statements[i]); + emit(statement); } emitTempDeclarations(false); write(" "); @@ -26038,11 +26127,12 @@ var ts; emitDetachedComments(ctor.body.statements); } emitCaptureThisForNodeIfNecessary(node); + var superCall; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); if (baseTypeNode) { - var superCall = findInitialSuperCall(ctor); + superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); emit(superCall); @@ -26389,8 +26479,8 @@ var ts; if (specifier.name.text === "default") { exportDefault = exportDefault || specifier; } - var name = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name] || (exportSpecifiers[name] = [])).push(specifier); + var _name = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[_name] || (exportSpecifiers[_name] = [])).push(specifier); }); } else if (node.kind === 209) { @@ -26413,8 +26503,8 @@ var ts; } function getExternalImportInfo(node) { if (externalImports) { - for (var i = 0; i < externalImports.length; i++) { - var info = externalImports[i]; + for (var _i = 0; _i < externalImports.length; _i++) { + var info = externalImports[_i]; if (info.rootNode === node) { return info; } @@ -26575,12 +26665,12 @@ var ts; if (node.flags & 2) { return emitPinnedOrTripleSlashComments(node); } - var emitComments = shouldEmitLeadingAndTrailingComments(node); - if (emitComments) { + var _emitComments = shouldEmitLeadingAndTrailingComments(node); + if (_emitComments) { emitLeadingComments(node); } emitJavaScriptWorker(node); - if (emitComments) { + if (_emitComments) { emitTrailingComments(node); } } @@ -26905,9 +26995,10 @@ var ts; } var unsupportedFileEncodingErrorCode = -2147024809; function getSourceFile(fileName, languageVersion, onError) { + var text; try { var start = new Date().getTime(); - var text = ts.sys.readFile(fileName, options.charset); + text = ts.sys.readFile(fileName, options.charset); ts.ioReadTime += new Date().getTime() - start; } catch (e) { @@ -27124,9 +27215,11 @@ var ts; processSourceFile(ts.normalizePath(fileName), isDefaultLib); } function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { + var start; + var _length; if (refEnd !== undefined && refPos !== undefined) { - var start = refPos; - var length = refEnd - refPos; + start = refPos; + _length = refEnd - refPos; } var diagnostic; if (hasExtension(fileName)) { @@ -27151,7 +27244,7 @@ var ts; } if (diagnostic) { if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); + diagnostics.add(ts.createFileDiagnostic(refFile, start, _length, diagnostic, fileName)); } else { diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); @@ -27192,17 +27285,17 @@ var ts; files.push(file); } } + return file; } - return file; function getSourceFileFromCache(fileName, canonicalName, useAbsolutePath) { - var file = filesByName[canonicalName]; - if (file && host.useCaseSensitiveFileNames()) { - var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; + var _file = filesByName[canonicalName]; + if (_file && host.useCaseSensitiveFileNames()) { + var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(_file.fileName, host.getCurrentDirectory()) : _file.fileName; if (canonicalName !== sourceFileName) { diagnostics.add(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } } - return file; + return _file; } } function processReferencedFiles(file, basePath) { @@ -27239,10 +27332,10 @@ var ts; var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { - var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); + var _searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); + var tsFile = findModuleSourceFile(_searchName + ".ts", nameLiteral); if (!tsFile) { - findModuleSourceFile(searchName + ".d.ts", nameLiteral); + findModuleSourceFile(_searchName + ".d.ts", nameLiteral); } } } @@ -27693,17 +27786,17 @@ var ts; switch (n.kind) { case 174: if (!ts.isFunctionBlock(n)) { - var parent = n.parent; + var _parent = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent.kind === 179 || parent.kind === 182 || parent.kind === 183 || parent.kind === 181 || parent.kind === 178 || parent.kind === 180 || parent.kind === 187 || parent.kind === 217) { - addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); + if (_parent.kind === 179 || _parent.kind === 182 || _parent.kind === 183 || _parent.kind === 181 || _parent.kind === 178 || _parent.kind === 180 || _parent.kind === 187 || _parent.kind === 217) { + addOutliningSpan(_parent, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent.kind === 191) { - var tryStatement = parent; + if (_parent.kind === 191) { + var tryStatement = _parent; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(_parent, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -27724,19 +27817,23 @@ var ts; break; } case 201: - var openBrace = ts.findChildOfKind(n, 14, sourceFile); - var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); - break; + { + var _openBrace = ts.findChildOfKind(n, 14, sourceFile); + var _closeBrace = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n.parent, _openBrace, _closeBrace, autoCollapse(n)); + break; + } case 196: case 197: case 199: case 152: case 202: - var openBrace = ts.findChildOfKind(n, 14, sourceFile); - var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); - break; + { + var _openBrace_1 = ts.findChildOfKind(n, 14, sourceFile); + var _closeBrace_1 = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n, _openBrace_1, _closeBrace_1, autoCollapse(n)); + break; + } case 151: var openBracket = ts.findChildOfKind(n, 18, sourceFile); var closeBracket = ts.findChildOfKind(n, 19, sourceFile); @@ -27763,8 +27860,8 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - var declaration = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; var name = getDeclarationName(declaration); if (name !== undefined) { var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); @@ -27801,8 +27898,9 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var i = 0, n = matches.length; i < n; i++) { - if (!matches[i].isCaseSensitive) { + for (var _i = 0; _i < matches.length; _i++) { + var match = matches[_i]; + if (!match.isCaseSensitive) { return false; } } @@ -27878,14 +27976,15 @@ var ts; } function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); - var bestMatchKind = 3; - for (var i = 0, n = matches.length; i < n; i++) { - var kind = matches[i].kind; - if (kind < bestMatchKind) { - bestMatchKind = kind; + var _bestMatchKind = 3; + for (var _i = 0; _i < matches.length; _i++) { + var match = matches[_i]; + var kind = match.kind; + if (kind < _bestMatchKind) { + _bestMatchKind = kind; } } - return bestMatchKind; + return _bestMatchKind; } var baseSensitivity = { sensitivity: "base" @@ -28015,8 +28114,8 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var i = 0, n = nodes.length; i < n; i++) { - var node = nodes[i]; + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; switch (node.kind) { case 196: case 199: @@ -28056,19 +28155,19 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var i = 0, n = nodes.length; i < n; i++) { - var child = nodes[i]; - var item = createItem(child); - if (item !== undefined) { - if (item.text.length > 0) { - var key = item.text + "-" + item.kind + "-" + item.indent; + for (var _i = 0; _i < nodes.length; _i++) { + var child = nodes[_i]; + var _item = createItem(child); + if (_item !== undefined) { + if (_item.text.length > 0) { + var key = _item.text + "-" + _item.kind + "-" + _item.indent; var itemWithSameName = keyToItem[key]; if (itemWithSameName) { - merge(itemWithSameName, item); + merge(itemWithSameName, _item); } else { - keyToItem[key] = item; - items.push(item); + keyToItem[key] = _item; + items.push(_item); } } } @@ -28081,10 +28180,10 @@ var ts; if (!target.childItems) { target.childItems = []; } - outer: for (var i = 0, n = source.childItems.length; i < n; i++) { - var sourceChild = source.childItems[i]; - for (var j = 0, m = target.childItems.length; j < m; j++) { - var targetChild = target.childItems[j]; + outer: for (var _i = 0, _a = source.childItems; _i < _a.length; _i++) { + var sourceChild = _a[_i]; + for (var _b = 0, _c = target.childItems; _b < _c.length; _b++) { + var targetChild = _c[_b]; if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { merge(targetChild, sourceChild); continue outer; @@ -28127,9 +28226,9 @@ var ts; case 193: case 150: var variableDeclarationNode; - var name; + var _name; if (node.kind === 150) { - name = node.name; + _name = node.name; variableDeclarationNode = node; while (variableDeclarationNode && variableDeclarationNode.kind !== 193) { variableDeclarationNode = variableDeclarationNode.parent; @@ -28139,16 +28238,16 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name = node.name; + _name = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(_name), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(_name), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(_name), ts.ScriptElementKind.variableElement); } case 133: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); @@ -28256,7 +28355,7 @@ var ts; return !ts.isBindingPattern(p.name); })); } - var childItems = getItemsWorker(sortNodes(nodes), createChildItem); + childItems = getItemsWorker(sortNodes(nodes), createChildItem); } return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [ getNodeSpan(node) @@ -28384,8 +28483,8 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var i = 0, n = wordSpans.length; i < n; i++) { - var span = wordSpans[i]; + for (var _i = 0; _i < wordSpans.length; _i++) { + var span = wordSpans[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(2, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); } @@ -28439,8 +28538,8 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var i = 0, n = subWordTextChunks.length; i < n; i++) { - var subWordTextChunk = subWordTextChunks[i]; + for (var _i = 0; _i < subWordTextChunks.length; _i++) { + var subWordTextChunk = subWordTextChunks[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { return undefined; @@ -28466,10 +28565,10 @@ var ts; } } else { - for (var i = 0; i < patternPartLength; i++) { - var ch1 = pattern.charCodeAt(patternPartStart + i); - var ch2 = candidate.charCodeAt(candidateSpan.start + i); - if (ch1 !== ch2) { + for (var _i = 0; _i < patternPartLength; _i++) { + var _ch1 = pattern.charCodeAt(patternPartStart + _i); + var _ch2 = candidate.charCodeAt(candidateSpan.start + _i); + if (_ch1 !== _ch2) { return false; } } @@ -28791,15 +28890,15 @@ var ts; } var listItemInfo = ts.findListItemInfo(node); if (listItemInfo) { - var list = listItemInfo.list; - var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; - var argumentIndex = getArgumentIndex(list, node); - var argumentCount = getArgumentCount(list); + var _list = listItemInfo.list; + var _isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === _list.pos; + var argumentIndex = getArgumentIndex(_list, node); + var argumentCount = getArgumentCount(_list); ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); return { - kind: isTypeArgList ? 0 : 1, + kind: _isTypeArgList ? 0 : 1, invocation: callExpression, - argumentsSpan: getApplicableSpanForArguments(list), + argumentsSpan: getApplicableSpanForArguments(_list), argumentIndex: argumentIndex, argumentCount: argumentCount }; @@ -28814,28 +28913,28 @@ var ts; var templateExpression = node.parent; var tagExpression = templateExpression.parent; ts.Debug.assert(templateExpression.kind === 169); - var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; - return getArgumentListInfoForTemplate(tagExpression, argumentIndex); + var _argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; + return getArgumentListInfoForTemplate(tagExpression, _argumentIndex); } else if (node.parent.kind === 173 && node.parent.parent.parent.kind === 157) { var templateSpan = node.parent; - var templateExpression = templateSpan.parent; - var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 169); + var _templateExpression = templateSpan.parent; + var _tagExpression = _templateExpression.parent; + ts.Debug.assert(_templateExpression.kind === 169); if (node.kind === 13 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } - var spanIndex = templateExpression.templateSpans.indexOf(templateSpan); - var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node); - return getArgumentListInfoForTemplate(tagExpression, argumentIndex); + var spanIndex = _templateExpression.templateSpans.indexOf(templateSpan); + var _argumentIndex_1 = getArgumentIndexForTemplatePiece(spanIndex, node); + return getArgumentListInfoForTemplate(_tagExpression, _argumentIndex_1); } return undefined; } function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var i = 0, n = listChildren.length; i < n; i++) { - var child = listChildren[i]; + for (var _i = 0; _i < listChildren.length; _i++) { + var child = listChildren[_i]; if (child === node) { break; } @@ -28901,9 +29000,9 @@ var ts; if (n.pos < n.parent.pos || n.end > n.parent.end) { ts.Debug.fail("Node of kind " + n.kind + " is not a subspan of its parent of kind " + n.parent.kind); } - var argumentInfo = getImmediatelyContainingArgumentInfo(n); - if (argumentInfo) { - return argumentInfo; + var _argumentInfo = getImmediatelyContainingArgumentInfo(n); + if (_argumentInfo) { + return _argumentInfo; } } return undefined; @@ -29159,8 +29258,8 @@ var ts; return n; } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; ++i) { - var child = children[i]; + for (var _i = 0; _i < children.length; _i++) { + var child = children[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { return find(child); @@ -29185,7 +29284,7 @@ var ts; return n; } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; ++i) { + for (var i = 0, len = children.length; i < len; i++) { var child = children[i]; if (nodeHasTokens(child)) { if (position <= child.end) { @@ -29201,8 +29300,8 @@ var ts; } ts.Debug.assert(startNode !== undefined || n.kind === 221); if (children.length) { - var candidate = findRightmostChildNodeWithTokens(children, children.length); - return candidate && findRightmostToken(candidate); + var _candidate = findRightmostChildNodeWithTokens(children, children.length); + return _candidate && findRightmostToken(_candidate); } } function findRightmostChildNodeWithTokens(children, exclusiveStartPosition) { @@ -29517,21 +29616,21 @@ var ts; var t; var pos = scanner.getStartPos(); while (pos < endPos) { - var t = scanner.getToken(); - if (!ts.isTrivia(t)) { + var _t = scanner.getToken(); + if (!ts.isTrivia(_t)) { break; } scanner.scan(); - var item = { + var _item = { pos: pos, end: scanner.getStartPos(), - kind: t + kind: _t }; pos = scanner.getStartPos(); if (!leadingTrivia) { leadingTrivia = []; } - leadingTrivia.push(item); + leadingTrivia.push(_item); } savedPos = scanner.getStartPos(); } @@ -29628,8 +29727,8 @@ var ts; } function isOnToken() { var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); - var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); - return startPos < endPos && current !== 1 && !ts.isTrivia(current); + var _startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); + return _startPos < endPos && current !== 1 && !ts.isTrivia(current); } function fixTokenKind(tokenInfo, container) { if (ts.isToken(container) && tokenInfo.token.kind !== container.kind) { @@ -29850,8 +29949,9 @@ var ts; if (this.IsAny()) { return true; } - for (var i = 0, len = this.customContextChecks.length; i < len; i++) { - if (!this.customContextChecks[i](context)) { + for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) { + var check = _a[_i]; + if (!check(context)) { return false; } } @@ -30094,9 +30194,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name in o) { - if (o[name] === rule) { - return name; + for (var _name in o) { + if (o[_name] === rule) { + return _name; } } throw new Error("Unknown rule"); @@ -30337,10 +30437,11 @@ var ts; var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var i = 0, len = bucket.Rules().length; i < len; i++) { - var rule = bucket.Rules()[i]; - if (rule.Operation.Context.InContext(context)) + for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) { + var rule = _a[_i]; + if (rule.Operation.Context.InContext(context)) { return rule; + } } } return null; @@ -30712,13 +30813,13 @@ var ts; } formatting.formatSelection = formatSelection; function formatOutermostParent(position, expectedLastToken, sourceFile, options, rulesProvider, requestKind) { - var parent = findOutermostParent(position, expectedLastToken, sourceFile); - if (!parent) { + var _parent = findOutermostParent(position, expectedLastToken, sourceFile); + if (!_parent) { return []; } var span = { - pos: ts.getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), - end: parent.end + pos: ts.getLineStartPositionForPosition(_parent.getStart(sourceFile), sourceFile), + end: _parent.end }; return formatSpan(span, sourceFile, options, rulesProvider, requestKind); } @@ -30854,10 +30955,10 @@ var ts; } } else { - var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; + var _startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; var startLinePosition = ts.getLineStartPositionForPosition(startPos, sourceFile); var column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); - if (startLine !== parentStartLine || startPos === column) { + if (_startLine !== parentStartLine || startPos === column) { return column; } } @@ -30975,19 +31076,19 @@ var ts; return inheritedIndentation; } while (formattingScanner.isOnToken()) { - var tokenInfo = formattingScanner.readTokenInfo(node); - if (tokenInfo.token.end > childStartPos) { + var _tokenInfo = formattingScanner.readTokenInfo(node); + if (_tokenInfo.token.end > childStartPos) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(_tokenInfo, node, parentDynamicIndentation); } if (!formattingScanner.isOnToken()) { return inheritedIndentation; } if (ts.isToken(child)) { - var tokenInfo = formattingScanner.readTokenInfo(child); - ts.Debug.assert(tokenInfo.token.end === child.end); - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + var _tokenInfo_1 = formattingScanner.readTokenInfo(child); + ts.Debug.assert(_tokenInfo_1.token.end === child.end); + consumeTokenAndAdvanceScanner(_tokenInfo_1, node, parentDynamicIndentation); return inheritedIndentation; } var childIndentation = computeIndentation(child, childStart.line, childIndentationAmount, node, parentDynamicIndentation, parentStartLine); @@ -30999,33 +31100,34 @@ var ts; var listStartToken = getOpenTokenForList(parent, nodes); var listEndToken = getCloseTokenForOpenToken(listStartToken); var listDynamicIndentation = parentDynamicIndentation; - var startLine = parentStartLine; + var _startLine = parentStartLine; if (listStartToken !== 0) { while (formattingScanner.isOnToken()) { - var tokenInfo = formattingScanner.readTokenInfo(parent); - if (tokenInfo.token.end > nodes.pos) { + var _tokenInfo = formattingScanner.readTokenInfo(parent); + if (_tokenInfo.token.end > nodes.pos) { break; } - else if (tokenInfo.token.kind === listStartToken) { - startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; - var indentation = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, startLine); - listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation.indentation, indentation.delta); - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + else if (_tokenInfo.token.kind === listStartToken) { + _startLine = sourceFile.getLineAndCharacterOfPosition(_tokenInfo.token.pos).line; + var _indentation = computeIndentation(_tokenInfo.token, _startLine, -1, parent, parentDynamicIndentation, _startLine); + listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, _indentation.indentation, _indentation.delta); + consumeTokenAndAdvanceScanner(_tokenInfo, parent, listDynamicIndentation); } else { - consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(_tokenInfo, parent, parentDynamicIndentation); } } } var inheritedIndentation = -1; - for (var i = 0, len = nodes.length; i < len; ++i) { - inheritedIndentation = processChildNode(nodes[i], inheritedIndentation, node, listDynamicIndentation, startLine, true); + for (var _i = 0; _i < nodes.length; _i++) { + var child = nodes[_i]; + inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, _startLine, true); } if (listEndToken !== 0) { if (formattingScanner.isOnToken()) { - var tokenInfo = formattingScanner.readTokenInfo(parent); - if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + var _tokenInfo_1 = formattingScanner.readTokenInfo(parent); + if (_tokenInfo_1.token.kind === listEndToken && ts.rangeContainsRange(parent, _tokenInfo_1.token)) { + consumeTokenAndAdvanceScanner(_tokenInfo_1, parent, listDynamicIndentation); } } } @@ -31062,8 +31164,8 @@ var ts; if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var i = 0, len = currentTokenInfo.leadingTrivia.length; i < len; ++i) { - var triviaItem = currentTokenInfo.leadingTrivia[i]; + for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { + var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; } @@ -31076,8 +31178,8 @@ var ts; break; case 2: if (indentNextTokenOrTrivia) { - var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); - insertIndentation(triviaItem.pos, commentIndentation, false); + var _commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); + insertIndentation(triviaItem.pos, _commentIndentation, false); indentNextTokenOrTrivia = false; } break; @@ -31097,8 +31199,8 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var i = 0, len = trivia.length; i < len; ++i) { - var triviaItem = trivia[i]; + for (var _i = 0; _i < trivia.length; _i++) { + var triviaItem = trivia[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); @@ -31166,18 +31268,19 @@ var ts; } } function indentMultilineComment(commentRange, indentation, firstLineIsIndented) { - var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; + var _startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; - if (startLine === endLine) { + var parts; + if (_startLine === endLine) { if (!firstLineIsIndented) { insertIndentation(commentRange.pos, indentation, false); } return; } else { - var parts = []; + parts = []; var startPos = commentRange.pos; - for (var line = startLine; line < endLine; ++line) { + for (var line = _startLine; line < endLine; ++line) { var endOfLine = ts.getEndLinePosition(line, sourceFile); parts.push({ pos: startPos, @@ -31190,7 +31293,7 @@ var ts; end: commentRange.end }); } - var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); + var startLinePos = ts.getStartPositionOfLine(_startLine, sourceFile); var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options); if (indentation === nonWhitespaceColumnInFirstPart.column) { return; @@ -31198,19 +31301,19 @@ var ts; var startIndex = 0; if (firstLineIsIndented) { startIndex = 1; - startLine++; + _startLine++; } - var delta = indentation - nonWhitespaceColumnInFirstPart.column; - for (var i = startIndex, len = parts.length; i < len; ++i, ++startLine) { - var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); + var _delta = indentation - nonWhitespaceColumnInFirstPart.column; + for (var i = startIndex, len = parts.length; i < len; ++i, ++_startLine) { + var _startLinePos = ts.getStartPositionOfLine(_startLine, sourceFile); var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); - var newIndentation = nonWhitespaceCharacterAndColumn.column + delta; + var newIndentation = nonWhitespaceCharacterAndColumn.column + _delta; if (newIndentation > 0) { var indentationString = getIndentationString(newIndentation, options); - recordReplace(startLinePos, nonWhitespaceCharacterAndColumn.character, indentationString); + recordReplace(_startLinePos, nonWhitespaceCharacterAndColumn.character, indentationString); } else { - recordDelete(startLinePos, nonWhitespaceCharacterAndColumn.character); + recordDelete(_startLinePos, nonWhitespaceCharacterAndColumn.character); } } } @@ -31415,9 +31518,9 @@ var ts; } break; } - var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); - if (actualIndentation !== -1) { - return actualIndentation; + var _actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (_actualIndentation !== -1) { + return _actualIndentation; } previous = current; current = current.parent; @@ -31434,9 +31537,9 @@ var ts; } SmartIndenter.getIndentationForNode = getIndentationForNode; function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) { - var parent = current.parent; + var _parent = current.parent; var parentStart; - while (parent) { + while (_parent) { var useActualIndentation = true; if (ignoreActualIndentationRange) { var start = current.getStart(sourceFile); @@ -31448,20 +31551,20 @@ var ts; return actualIndentation + indentationDelta; } } - parentStart = getParentStart(parent, current, sourceFile); - var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); + parentStart = getParentStart(_parent, current, sourceFile); + var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(_parent, current, currentStart.line, sourceFile); if (useActualIndentation) { - var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); - if (actualIndentation !== -1) { - return actualIndentation + indentationDelta; + var _actualIndentation = getActualIndentationForNode(current, _parent, currentStart, parentAndChildShareLine, sourceFile, options); + if (_actualIndentation !== -1) { + return _actualIndentation + indentationDelta; } } - if (shouldIndentChildNode(parent.kind, current.kind) && !parentAndChildShareLine) { + if (shouldIndentChildNode(_parent.kind, current.kind) && !parentAndChildShareLine) { indentationDelta += options.IndentSize; } - current = parent; + current = _parent; currentStart = parentStart; - parent = current.parent; + _parent = current.parent; } return indentationDelta; } @@ -31537,24 +31640,28 @@ var ts; case 131: case 136: case 137: - var start = node.getStart(sourceFile); - if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { - return node.parent.typeParameters; + { + var start = node.getStart(sourceFile); + if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { + return node.parent.typeParameters; + } + if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { + return node.parent.parameters; + } + break; } - if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { - return node.parent.parameters; - } - break; case 156: case 155: - var start = node.getStart(sourceFile); - if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { - return node.parent.typeArguments; + { + var _start = node.getStart(sourceFile); + if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, _start, node.getEnd())) { + return node.parent.typeArguments; + } + if (node.parent.arguments && ts.rangeContainsStartEnd(node.parent.arguments, _start, node.getEnd())) { + return node.parent.arguments; + } + break; } - if (node.parent.arguments && ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { - return node.parent.arguments; - } - break; } } return undefined; @@ -31823,8 +31930,8 @@ var ts; var list = createNode(222, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; - for (var i = 0, len = nodes.length; i < len; i++) { - var node = nodes[i]; + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -31838,9 +31945,10 @@ var ts; }; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; + var children; if (this.kind >= 125) { scanner.setText((sourceFile || this.getSourceFile()).text); - var children = []; + children = []; var pos = this.pos; var processNode = function (node) { if (pos < node.pos) { @@ -31881,8 +31989,8 @@ var ts; }; NodeObject.prototype.getFirstToken = function (sourceFile) { var children = this.getChildren(); - for (var i = 0; i < children.length; i++) { - var child = children[i]; + for (var _i = 0; _i < children.length; _i++) { + var child = children[_i]; if (child.kind < 125) { return child; } @@ -32001,7 +32109,7 @@ var ts; } function getCleanedJsDocComment(pos, end, sourceFile) { var spacesToRemoveAfterAsterisk; - var docComments = []; + var _docComments = []; var blankLineCount = 0; var isInParamTag = false; while (pos < end) { @@ -32036,14 +32144,14 @@ var ts; } pos = consumeLineBreaks(pos, end, sourceFile); if (docCommentTextOfLine) { - pushDocCommentLineText(docComments, docCommentTextOfLine, blankLineCount); + pushDocCommentLineText(_docComments, docCommentTextOfLine, blankLineCount); blankLineCount = 0; } - else if (!isInParamTag && docComments.length) { + else if (!isInParamTag && _docComments.length) { blankLineCount++; } } - return docComments; + return _docComments; } function getCleanedParamJsDocComment(pos, end, sourceFile) { var paramHelpStringMargin; @@ -32144,8 +32252,8 @@ var ts; } var consumedSpaces = pos - startOfLinePos; if (consumedSpaces < paramHelpStringMargin) { - var ch = sourceFile.text.charCodeAt(pos); - if (ch === 42) { + var _ch = sourceFile.text.charCodeAt(pos); + if (_ch === 42) { pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, paramHelpStringMargin - consumedSpaces - 1); } } @@ -32473,8 +32581,8 @@ var ts; if (declaration.kind !== 193 && declaration.kind !== 195) { return false; } - for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { - if (parent.kind === 221 || parent.kind === 201) { + for (var _parent = declaration.parent; !ts.isFunctionBlock(_parent); _parent = _parent.parent) { + if (_parent.kind === 221 || _parent.kind === 201) { return false; } } @@ -32515,8 +32623,9 @@ var ts; this.host = host; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); - for (var i = 0, n = rootFileNames.length; i < n; i++) { - this.createEntry(rootFileNames[i]); + for (var _i = 0; _i < rootFileNames.length; _i++) { + var fileName = rootFileNames[_i]; + this.createEntry(fileName); } this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); } @@ -32575,17 +32684,17 @@ var ts; if (!scriptSnapshot) { throw new Error("Could not find file: '" + fileName + "'."); } - var version = this.host.getScriptVersion(fileName); + var _version = this.host.getScriptVersion(fileName); var sourceFile; if (this.currentFileName !== fileName) { - sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2, version, true); + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2, _version, true); } - else if (this.currentFileVersion !== version) { + else if (this.currentFileVersion !== _version) { var editRange = scriptSnapshot.getChangeRange(this.currentFileScriptSnapshot); - sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange); + sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, _version, editRange); } if (sourceFile) { - this.currentFileVersion = version; + this.currentFileVersion = _version; this.currentFileName = fileName; this.currentFileScriptSnapshot = scriptSnapshot; this.currentSourceFile = sourceFile; @@ -33108,8 +33217,9 @@ var ts; }); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var i = 0, n = oldSourceFiles.length; i < n; i++) { - var fileName = oldSourceFiles[i].fileName; + for (var _i = 0; _i < oldSourceFiles.length; _i++) { + var oldSourceFile = oldSourceFiles[_i]; + var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { documentRegistry.releaseDocument(fileName, oldSettings); } @@ -33124,8 +33234,8 @@ var ts; return undefined; } if (!changesInCompilationSettingsAffectSyntax) { - var oldSourceFile = program && program.getSourceFile(fileName); - if (oldSourceFile) { + var _oldSourceFile = program && program.getSourceFile(fileName); + if (_oldSourceFile) { return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); } } @@ -33142,8 +33252,9 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var i = 0, n = rootFileNames.length; i < n; i++) { - if (!sourceFileUpToDate(program.getSourceFile(rootFileNames[i]))) { + for (var _a = 0; _a < rootFileNames.length; _a++) { + var _fileName = rootFileNames[_a]; + if (!sourceFileUpToDate(program.getSourceFile(_fileName))) { return false; } } @@ -33195,8 +33306,8 @@ var ts; displayName = displayName.substring(1, displayName.length - 1); } var isValid = ts.isIdentifierStart(displayName.charCodeAt(0), target); - for (var i = 1, n = displayName.length; isValid && i < n; i++) { - isValid = ts.isIdentifierPart(displayName.charCodeAt(i), target); + for (var _i = 1, n = displayName.length; isValid && _i < n; _i++) { + isValid = ts.isIdentifierPart(displayName.charCodeAt(_i), target); } if (isValid) { return ts.unescapeIdentifier(displayName); @@ -33222,20 +33333,20 @@ var ts; var start = new Date().getTime(); var currentToken = ts.getTokenAtPosition(sourceFile, position); log("getCompletionsAtPosition: Get current token: " + (new Date().getTime() - start)); - var start = new Date().getTime(); + start = new Date().getTime(); var insideComment = isInsideComment(sourceFile, currentToken, position); log("getCompletionsAtPosition: Is inside comment: " + (new Date().getTime() - start)); if (insideComment) { log("Returning an empty list because completion was inside a comment."); return undefined; } - var start = new Date().getTime(); + start = new Date().getTime(); var previousToken = ts.findPrecedingToken(position, sourceFile); log("getCompletionsAtPosition: Get previous token 1: " + (new Date().getTime() - start)); if (previousToken && position <= previousToken.end && previousToken.kind === 64) { - var start = new Date().getTime(); + var _start = new Date().getTime(); previousToken = ts.findPrecedingToken(previousToken.pos, sourceFile); - log("getCompletionsAtPosition: Get previous token 2: " + (new Date().getTime() - start)); + log("getCompletionsAtPosition: Get previous token 2: " + (new Date().getTime() - _start)); } if (previousToken && isCompletionListBlocker(previousToken)) { log("Returning an empty list because completion was requested in an invalid position."); @@ -33263,12 +33374,14 @@ var ts; typeChecker: typeInfoResolver }; log("getCompletionsAtPosition: Syntactic work: " + (new Date().getTime() - syntacticStart)); - var location = ts.getTouchingPropertyName(sourceFile, position); + var _location = ts.getTouchingPropertyName(sourceFile, position); var semanticStart = new Date().getTime(); + var isMemberCompletion; + var isNewIdentifierLocation; if (isRightOfDot) { var symbols = []; - var isMemberCompletion = true; - var isNewIdentifierLocation = false; + isMemberCompletion = true; + isNewIdentifierLocation = false; if (node.kind === 64 || node.kind === 125 || node.kind === 153) { var symbol = typeInfoResolver.getSymbolAtLocation(node); if (symbol && symbol.flags & 8388608) { @@ -33322,8 +33435,8 @@ var ts; isMemberCompletion = false; isNewIdentifierLocation = isNewIdentifierDefinitionLocation(previousToken); var symbolMeanings = 793056 | 107455 | 1536 | 8388608; - var symbols = typeInfoResolver.getSymbolsInScope(node, symbolMeanings); - getCompletionEntriesFromSymbols(symbols, activeCompletionSession); + var _symbols = typeInfoResolver.getSymbolsInScope(node, symbolMeanings); + getCompletionEntriesFromSymbols(_symbols, activeCompletionSession); } } if (!isMemberCompletion) { @@ -33337,9 +33450,9 @@ var ts; entries: activeCompletionSession.entries }; function getCompletionEntriesFromSymbols(symbols, session) { - var start = new Date().getTime(); + var _start_1 = new Date().getTime(); ts.forEach(symbols, function (symbol) { - var entry = createCompletionEntry(symbol, session.typeChecker, location); + var entry = createCompletionEntry(symbol, session.typeChecker, _location); if (entry) { var id = ts.escapeIdentifier(entry.name); if (!ts.lookUp(session.symbols, id)) { @@ -33348,12 +33461,12 @@ var ts; } } }); - log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - _start_1)); } function isCompletionListBlocker(previousToken) { - var start = new Date().getTime(); + var _start_1 = new Date().getTime(); var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); - log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); + log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - _start_1)); return result; } function showCompletionsInImportsClause(node) { @@ -33402,9 +33515,9 @@ var ts; } function isInStringOrRegularExpressionOrTemplateLiteral(previousToken) { if (previousToken.kind === 8 || previousToken.kind === 9 || ts.isTemplateLiteralKind(previousToken.kind)) { - var start = previousToken.getStart(); + var _start_1 = previousToken.getStart(); var end = previousToken.getEnd(); - if (start < position && position < end) { + if (_start_1 < position && position < end) { return true; } else if (position === end) { @@ -33415,12 +33528,12 @@ var ts; } function getContainingObjectLiteralApplicableForCompletion(previousToken) { if (previousToken) { - var parent = previousToken.parent; + var _parent = previousToken.parent; switch (previousToken.kind) { case 14: case 23: - if (parent && parent.kind === 152) { - return parent; + if (_parent && _parent.kind === 152) { + return _parent; } break; } @@ -33511,8 +33624,8 @@ var ts; } if (importDeclaration.importClause.namedBindings && importDeclaration.importClause.namedBindings.kind === 207) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { - var name = el.propertyName || el.name; - exisingImports[name.text] = true; + var _name = el.propertyName || el.name; + exisingImports[_name.text] = true; }); } if (ts.isEmpty(exisingImports)) { @@ -33536,13 +33649,13 @@ var ts; } existingMemberNames[m.name.text] = true; }); - var filteredMembers = []; + var _filteredMembers = []; ts.forEach(contextualMemberSymbols, function (s) { if (!existingMemberNames[s.name]) { - filteredMembers.push(s); + _filteredMembers.push(s); } }); - return filteredMembers; + return _filteredMembers; } } function getCompletionEntryDetails(fileName, position, entryName) { @@ -33553,10 +33666,10 @@ var ts; } var symbol = ts.lookUp(activeCompletionSession.symbols, ts.escapeIdentifier(entryName)); if (symbol) { - var location = ts.getTouchingPropertyName(sourceFile, position); - var completionEntry = createCompletionEntry(symbol, session.typeChecker, location); - ts.Debug.assert(session.typeChecker.getTypeOfSymbolAtLocation(symbol, location) !== undefined, "Could not find type for symbol"); - var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location, session.typeChecker, location, 7); + var _location = ts.getTouchingPropertyName(sourceFile, position); + var completionEntry = createCompletionEntry(symbol, session.typeChecker, _location); + ts.Debug.assert(session.typeChecker.getTypeOfSymbolAtLocation(symbol, _location) !== undefined, "Could not find type for symbol"); + var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), _location, session.typeChecker, _location, 7); return { name: entryName, kind: displayPartsDocumentationsAndSymbolKind.symbolKind, @@ -33679,11 +33792,13 @@ var ts; var symbolFlags = symbol.flags; var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, typeResolver, location); var hasAddedSymbolInfo; + var type; if (symbolKind !== ScriptElementKind.unknown || symbolFlags & 32 || symbolFlags & 8388608) { if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { symbolKind = ScriptElementKind.memberVariableElement; } - var type = typeResolver.getTypeOfSymbolAtLocation(symbol, location); + var signature; + type = typeResolver.getTypeOfSymbolAtLocation(symbol, location); if (type) { if (location.parent && location.parent.kind === 153) { var right = location.parent.name; @@ -33754,14 +33869,13 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || (location.kind === 113 && location.parent.kind === 133)) { - var signature; var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 133 ? type.getConstructSignatures() : type.getCallSignatures(); + var _allSignatures = functionDeclaration.kind === 133 ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeResolver.isImplementationOfOverload(functionDeclaration)) { signature = typeResolver.getSignatureFromDeclaration(functionDeclaration); } else { - signature = allSignatures[0]; + signature = _allSignatures[0]; } if (functionDeclaration.kind === 133) { symbolKind = ScriptElementKind.constructorImplementationElement; @@ -33770,7 +33884,7 @@ var ts; else { addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 136 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } - addSignatureDisplayParts(signature, allSignatures); + addSignatureDisplayParts(signature, _allSignatures); hasAddedSymbolInfo = true; } } @@ -33830,7 +33944,7 @@ var ts; } else { var signatureDeclaration = ts.getDeclarationOfKind(symbol, 127).parent; - var signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); + var _signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); if (signatureDeclaration.kind === 137) { displayParts.push(ts.keywordPart(87)); displayParts.push(ts.spacePart()); @@ -33838,7 +33952,7 @@ var ts; else if (signatureDeclaration.kind !== 136 && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } - displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeResolver, signature, sourceFile, 32)); + displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeResolver, _signature, sourceFile, 32)); } } if (symbolFlags & 8) { @@ -33902,8 +34016,8 @@ var ts; } } else if (symbolFlags & 16 || symbolFlags & 8192 || symbolFlags & 16384 || symbolFlags & 131072 || symbolFlags & 98304 || symbolKind === ScriptElementKind.memberFunctionElement) { - var allSignatures = type.getCallSignatures(); - addSignatureDisplayParts(allSignatures[0], allSignatures); + var _allSignatures_1 = type.getCallSignatures(); + addSignatureDisplayParts(_allSignatures_1[0], _allSignatures_1); } } } @@ -33952,10 +34066,10 @@ var ts; documentation = signature.getDocumentationComment(); } function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { - var typeParameterParts = ts.mapToDisplayParts(function (writer) { + var _typeParameterParts = ts.mapToDisplayParts(function (writer) { typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration); }); - displayParts.push.apply(displayParts, typeParameterParts); + displayParts.push.apply(displayParts, _typeParameterParts); } } function getQuickInfoAtPosition(fileName, position) { @@ -34072,11 +34186,11 @@ var ts; }; } function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { - var declarations = []; + var _declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { if ((selectConstructors && d.kind === 133) || (!selectConstructors && (d.kind === 195 || d.kind === 132 || d.kind === 131))) { - declarations.push(d); + _declarations.push(d); if (d.body) definition = d; } @@ -34085,8 +34199,8 @@ var ts; result.push(getDefinitionInfo(definition, symbolKind, symbolName, containerName)); return true; } - else if (declarations.length) { - result.push(getDefinitionInfo(declarations[declarations.length - 1], symbolKind, symbolName, containerName)); + else if (_declarations.length) { + result.push(getDefinitionInfo(_declarations[_declarations.length - 1], symbolKind, symbolName, containerName)); return true; } return false; @@ -34200,8 +34314,8 @@ var ts; while (ifStatement) { var children = ifStatement.getChildren(); pushKeywordIf(keywords, children[0], 83); - for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 75)) { + for (var _i = children.length - 1; _i >= 0; _i--) { + if (pushKeywordIf(keywords, children[_i], 75)) { break; } } @@ -34211,10 +34325,10 @@ var ts; ifStatement = ifStatement.elseStatement; } var result = []; - for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 75 && i < keywords.length - 1) { - var elseKeyword = keywords[i]; - var ifKeyword = keywords[i + 1]; + for (var _i_1 = 0; _i_1 < keywords.length; _i_1++) { + if (keywords[_i_1].kind === 75 && _i_1 < keywords.length - 1) { + var elseKeyword = keywords[_i_1]; + var ifKeyword = keywords[_i_1 + 1]; var shouldHighlightNextKeyword = true; for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { if (!ts.isWhiteSpace(sourceFile.text.charCodeAt(j))) { @@ -34228,11 +34342,11 @@ var ts; textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), isWriteAccess: false }); - i++; + _i_1++; continue; } } - result.push(getReferenceEntryFromNode(keywords[i])); + result.push(getReferenceEntryFromNode(keywords[_i_1])); } return result; } @@ -34295,17 +34409,17 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 221) { - return parent; + var _parent = child.parent; + if (ts.isFunctionBlock(_parent) || _parent.kind === 221) { + return _parent; } - if (parent.kind === 191) { - var tryStatement = parent; + if (_parent.kind === 191) { + var tryStatement = _parent; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent; + child = _parent; } return undefined; } @@ -34326,8 +34440,8 @@ var ts; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 81, 99, 74)) { if (loopNode.kind === 179) { var loopTokens = loopNode.getChildren(); - for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 99)) { + for (var _i = loopTokens.length - 1; _i >= 0; _i--) { + if (pushKeywordIf(keywords, loopTokens[_i], 99)) { break; } } @@ -34390,8 +34504,8 @@ var ts; return actualOwner && actualOwner === owner; } function getBreakOrContinueOwner(statement) { - for (var node = statement.parent; node; node = node.parent) { - switch (node.kind) { + for (var _node = statement.parent; _node; _node = _node.parent) { + switch (_node.kind) { case 188: if (statement.kind === 184) { continue; @@ -34401,12 +34515,12 @@ var ts; case 183: case 180: case 179: - if (!statement.label || isLabeledBy(node, statement.label.text)) { - return node; + if (!statement.label || isLabeledBy(_node, statement.label.text)) { + return _node; } break; default: - if (ts.isFunctionLike(node)) { + if (ts.isFunctionLike(_node)) { return undefined; } break; @@ -34614,14 +34728,15 @@ var ts; var functionExpression = ts.forEach(symbol.declarations, function (d) { return d.kind === 160 ? d : undefined; }); + var _name; if (functionExpression && functionExpression.name) { - var name = functionExpression.name.text; + _name = functionExpression.name.text; } if (isImportOrExportSpecifierName(location)) { return location.getText(); } - var name = typeInfoResolver.symbolToString(symbol); - return stripQuotes(name); + _name = typeInfoResolver.symbolToString(symbol); + return stripQuotes(_name); } function getInternedName(symbol, location, declarations) { if (isImportOrExportSpecifierName(location)) { @@ -34630,18 +34745,13 @@ var ts; var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 160 ? d : undefined; }); - if (functionExpression && functionExpression.name) { - var name = functionExpression.name.text; - } - else { - var name = symbol.name; - } - return stripQuotes(name); + var _name = functionExpression && functionExpression.name ? functionExpression.name.text : symbol.name; + return stripQuotes(_name); } function stripQuotes(name) { - var length = name.length; - if (length >= 2 && name.charCodeAt(0) === 34 && name.charCodeAt(length - 1) === 34) { - return name.substring(1, length - 1); + var _length = name.length; + if (_length >= 2 && name.charCodeAt(0) === 34 && name.charCodeAt(_length - 1) === 34) { + return name.substring(1, _length - 1); } ; return name; @@ -34661,24 +34771,25 @@ var ts; if (symbol.parent || (symbol.flags & 268435456)) { return undefined; } - var scope = undefined; - var declarations = symbol.getDeclarations(); - if (declarations) { - for (var i = 0, n = declarations.length; i < n; i++) { - var container = getContainerNode(declarations[i]); + var _scope = undefined; + var _declarations = symbol.getDeclarations(); + if (_declarations) { + for (var _i = 0; _i < _declarations.length; _i++) { + var declaration = _declarations[_i]; + var container = getContainerNode(declaration); if (!container) { return undefined; } - if (scope && scope !== container) { + if (_scope && _scope !== container) { return undefined; } if (container.kind === 221 && !ts.isExternalModule(container)) { return undefined; } - scope = container; + _scope = container; } } - return scope; + return _scope; } function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { var positions = []; @@ -34702,21 +34813,21 @@ var ts; return positions; } function getLabelReferencesInNode(container, targetLabel) { - var result = []; + var _result = []; var sourceFile = container.getSourceFile(); var labelName = targetLabel.text; var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.getWidth() !== labelName.length) { + var _node = ts.getTouchingWord(sourceFile, position); + if (!_node || _node.getWidth() !== labelName.length) { return; } - if (node === targetLabel || (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { - result.push(getReferenceEntryFromNode(node)); + if (_node === targetLabel || (isJumpStatementTarget(_node) && getTargetLabel(_node, labelName) === targetLabel)) { + _result.push(getReferenceEntryFromNode(_node)); } }); - return result; + return _result; } function isValidReferencePosition(node, searchSymbolName) { if (node) { @@ -34812,21 +34923,21 @@ var ts; default: return undefined; } - var result = []; + var _result = []; var sourceFile = searchSpaceNode.getSourceFile(); var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 90) { + var _node = ts.getTouchingWord(sourceFile, position); + if (!_node || _node.kind !== 90) { return; } - var container = ts.getSuperContainer(node, false); + var container = ts.getSuperContainer(_node, false); if (container && (128 & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { - result.push(getReferenceEntryFromNode(node)); + _result.push(getReferenceEntryFromNode(_node)); } }); - return result; + return _result; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); @@ -34855,48 +34966,49 @@ var ts; default: return undefined; } - var result = []; + var _result = []; + var possiblePositions; if (searchSpaceNode.kind === 221) { ts.forEach(sourceFiles, function (sourceFile) { - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); - getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, result); + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); + getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, _result); }); } else { var sourceFile = searchSpaceNode.getSourceFile(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); - getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result); + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, _result); } - return result; + return _result; function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 92) { + var _node = ts.getTouchingWord(sourceFile, position); + if (!_node || _node.kind !== 92) { return; } - var container = ts.getThisContainer(node, false); + var container = ts.getThisContainer(_node, false); switch (searchSpaceNode.kind) { case 160: case 195: if (searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); + result.push(getReferenceEntryFromNode(_node)); } break; case 132: case 131: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); + result.push(getReferenceEntryFromNode(_node)); } break; case 196: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { - result.push(getReferenceEntryFromNode(node)); + result.push(getReferenceEntryFromNode(_node)); } break; case 221: if (container.kind === 221 && !ts.isExternalModule(container)) { - result.push(getReferenceEntryFromNode(node)); + result.push(getReferenceEntryFromNode(_node)); } break; } @@ -34904,30 +35016,30 @@ var ts; } } function populateSearchSymbolSet(symbol, location) { - var result = [ + var _result = [ symbol ]; if (isImportOrExportSpecifierImportSymbol(symbol)) { - result.push(typeInfoResolver.getAliasedSymbol(symbol)); + _result.push(typeInfoResolver.getAliasedSymbol(symbol)); } if (isNameOfPropertyAssignment(location)) { ts.forEach(getPropertySymbolsFromContextualType(location), function (contextualSymbol) { - result.push.apply(result, typeInfoResolver.getRootSymbols(contextualSymbol)); + _result.push.apply(_result, typeInfoResolver.getRootSymbols(contextualSymbol)); }); var shorthandValueSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(location.parent); if (shorthandValueSymbol) { - result.push(shorthandValueSymbol); + _result.push(shorthandValueSymbol); } } ts.forEach(typeInfoResolver.getRootSymbols(symbol), function (rootSymbol) { if (rootSymbol !== symbol) { - result.push(rootSymbol); + _result.push(rootSymbol); } if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), _result); } }); - return result; + return _result; } function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 | 64)) { @@ -34974,9 +35086,9 @@ var ts; return true; } if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - var result = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); - return ts.forEach(result, function (s) { + var _result = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), _result); + return ts.forEach(_result, function (s) { return searchSymbols.indexOf(s) >= 0; }); } @@ -34987,31 +35099,31 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeInfoResolver.getContextualType(objectLiteral); - var name = node.text; + var _name = node.text; if (contextualType) { if (contextualType.flags & 16384) { - var unionProperty = contextualType.getProperty(name); + var unionProperty = contextualType.getProperty(_name); if (unionProperty) { return [ unionProperty ]; } else { - var result = []; + var _result = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name); - if (symbol) { - result.push(symbol); + var _symbol = t.getProperty(_name); + if (_symbol) { + _result.push(_symbol); } }); - return result; + return _result; } } else { - var symbol = contextualType.getProperty(name); - if (symbol) { + var _symbol = contextualType.getProperty(_name); + if (_symbol) { return [ - symbol + _symbol ]; } } @@ -35021,10 +35133,12 @@ var ts; } function getIntersectingMeaningFromDeclarations(meaning, declarations) { if (declarations) { + var lastIterationMeaning; do { - var lastIterationMeaning = meaning; - for (var i = 0, n = declarations.length; i < n; i++) { - var declarationMeaning = getMeaningFromDeclaration(declarations[i]); + lastIterationMeaning = meaning; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; + var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; } @@ -35051,13 +35165,13 @@ var ts; if (node.kind === 64 && ts.isDeclarationName(node)) { return true; } - var parent = node.parent; - if (parent) { - if (parent.kind === 166 || parent.kind === 165) { + var _parent = node.parent; + if (_parent) { + if (_parent.kind === 166 || _parent.kind === 165) { return true; } - else if (parent.kind === 167 && parent.left === node) { - var operator = parent.operatorToken.kind; + else if (_parent.kind === 167 && _parent.left === node) { + var operator = _parent.operatorToken.kind; return 52 <= operator && operator <= 63; } } @@ -35453,8 +35567,8 @@ var ts; function processElement(element) { if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var i = 0, n = children.length; i < n; i++) { - var child = children[i]; + for (var _i = 0; _i < children.length; _i++) { + var child = children[_i]; if (ts.isToken(child)) { classifyToken(child); } @@ -35478,8 +35592,8 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var i = 0, n = childNodes.length; i < n; i++) { - var current = childNodes[i]; + for (var _i = 0; _i < childNodes.length; _i++) { + var current = childNodes[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); var range2 = ts.createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); @@ -35521,7 +35635,7 @@ var ts; var start = new Date().getTime(); var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); log("getIndentationAtPosition: getCurrentSourceFile: " + (new Date().getTime() - start)); - var start = new Date().getTime(); + start = new Date().getTime(); var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, editorOptions); log("getIndentationAtPosition: computeIndentation : " + (new Date().getTime() - start)); return result; @@ -35567,9 +35681,9 @@ var ts; continue; } var descriptor = undefined; - for (var i = 0, n = descriptors.length; i < n; i++) { - if (matchArray[i + firstDescriptorCaptureIndex]) { - descriptor = descriptors[i]; + for (var _i = 0, n = descriptors.length; _i < n; _i++) { + if (matchArray[_i + firstDescriptorCaptureIndex]) { + descriptor = descriptors[_i]; } } ts.Debug.assert(descriptor !== undefined); @@ -35592,14 +35706,14 @@ var ts; var singleLineCommentStart = /(?:\/\/+\s*)/.source; var multiLineCommentStart = /(?:\/\*+\s*)/.source; var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; - var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + var _preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; var messageRemainder = /(?:.*?)/.source; var messagePortion = "(" + literals + messageRemainder + ")"; - var regExpString = preamble + messagePortion + endOfLineOrEndOfComment; + var regExpString = _preamble + messagePortion + endOfLineOrEndOfComment; return new RegExp(regExpString, "gim"); } function isLetterOrDigit(char) { @@ -35617,9 +35731,10 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var i = 0; i < declarations.length; i++) { - var sourceFile = declarations[i].getSourceFile(); - if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { + for (var _i = 0; _i < declarations.length; _i++) { + var current = declarations[_i]; + var _sourceFile = current.getSourceFile(); + if (_sourceFile && getCanonicalFileName(ts.normalizePath(_sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); } } @@ -35717,7 +35832,7 @@ var ts; return node && node.parent && node.parent.kind === 154 && node.parent.argumentExpression === node; } function createClassifier() { - var scanner = ts.createScanner(2, false); + var _scanner = ts.createScanner(2, false); var noRegexTable = []; noRegexTable[64] = true; noRegexTable[8] = true; @@ -35781,17 +35896,17 @@ var ts; templateStack.push(11); break; } - scanner.setText(text); + _scanner.setText(text); var result = { finalLexState: 0, entries: [] }; var angleBracketStack = 0; do { - token = scanner.scan(); + token = _scanner.scan(); if (!ts.isTrivia(token)) { if ((token === 36 || token === 56) && !noRegexTable[lastNonTriviaToken]) { - if (scanner.reScanSlashToken() === 9) { + if (_scanner.reScanSlashToken() === 9) { token = 9; } } @@ -35824,7 +35939,7 @@ var ts; if (templateStack.length > 0) { var lastTemplateStackToken = ts.lastOrUndefined(templateStack); if (lastTemplateStackToken === 11) { - token = scanner.reScanTemplateToken(); + token = _scanner.reScanTemplateToken(); if (token === 13) { templateStack.pop(); } @@ -35844,13 +35959,13 @@ var ts; } while (token !== 1); return result; function processToken() { - var start = scanner.getTokenPos(); - var end = scanner.getTextPos(); + var start = _scanner.getTokenPos(); + var end = _scanner.getTextPos(); addResult(end - start, classFromKind(token)); if (end >= text.length) { if (token === 8) { - var tokenText = scanner.getTokenText(); - if (scanner.isUnterminated()) { + var tokenText = _scanner.getTokenText(); + if (_scanner.isUnterminated()) { var lastCharIndex = tokenText.length - 1; var numBackslashes = 0; while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === 92) { @@ -35863,12 +35978,12 @@ var ts; } } else if (token === 3) { - if (scanner.isUnterminated()) { + if (_scanner.isUnterminated()) { result.finalLexState = 1; } } else if (ts.isTemplateLiteralKind(token)) { - if (scanner.isUnterminated()) { + if (_scanner.isUnterminated()) { if (token === 13) { result.finalLexState = 5; } diff --git a/bin/typescriptServices.d.ts b/bin/typescriptServices.d.ts index c0800ecbd77..d5293c99b3b 100644 --- a/bin/typescriptServices.d.ts +++ b/bin/typescriptServices.d.ts @@ -1443,7 +1443,7 @@ declare module ts { } declare module ts { /** The version of the TypeScript compiler release */ - var version: string; + let version: string; function createCompilerHost(options: CompilerOptions): CompilerHost; function getPreEmitDiagnostics(program: Program): Diagnostic[]; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; @@ -1451,7 +1451,7 @@ declare module ts { } declare module ts { /** The version of the language service API */ - var servicesVersion: string; + let servicesVersion: string; interface Node { getSourceFile(): SourceFile; getChildCount(sourceFile?: SourceFile): number; @@ -1938,7 +1938,7 @@ declare module ts { throwIfCancellationRequested(): void; } function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; - var disableIncrementalParsing: boolean; + let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createDocumentRegistry(): DocumentRegistry; function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index 0fb345eea1b..623e6341f90 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -625,8 +625,9 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + if (v === value) { return true; } } @@ -648,8 +649,9 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var i = 0, len = array.length; i < len; i++) { - if (predicate(array[i])) { + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + if (predicate(v)) { count++; } } @@ -658,12 +660,13 @@ var ts; } ts.countWhere = countWhere; function filter(array, f) { + var result; if (array) { - var result = []; - for (var i = 0, len = array.length; i < len; i++) { - var item = array[i]; - if (f(item)) { - result.push(item); + result = []; + for (var _i = 0; _i < array.length; _i++) { + var _item = array[_i]; + if (f(_item)) { + result.push(_item); } } } @@ -671,10 +674,12 @@ var ts; } ts.filter = filter; function map(array, f) { + var result; if (array) { - var result = []; - for (var i = 0, len = array.length; i < len; i++) { - result.push(f(array[i])); + result = []; + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + result.push(f(v)); } } return result; @@ -689,12 +694,14 @@ var ts; } ts.concatenate = concatenate; function deduplicate(array) { + var result; if (array) { - var result = []; - for (var i = 0, len = array.length; i < len; i++) { - var item = array[i]; - if (!contains(result, item)) - result.push(item); + result = []; + for (var _i = 0; _i < array.length; _i++) { + var _item = array[_i]; + if (!contains(result, _item)) { + result.push(_item); + } } } return result; @@ -702,15 +709,17 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var i = 0; i < array.length; i++) { - result += array[i][prop]; + for (var _i = 0; _i < array.length; _i++) { + var v = array[_i]; + result += v[prop]; } return result; } ts.sum = sum; function addRange(to, from) { - for (var i = 0, n = from.length; i < n; i++) { - to.push(from[i]); + for (var _i = 0; _i < from.length; _i++) { + var v = from[_i]; + to.push(v); } } ts.addRange = addRange; @@ -771,9 +780,9 @@ var ts; for (var id in first) { result[id] = first[id]; } - for (var id in second) { - if (!hasProperty(result, id)) { - result[id] = second[id]; + for (var _id in second) { + if (!hasProperty(result, _id)) { + result[_id] = second[_id]; } } return result; @@ -972,8 +981,8 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var i = 0; i < parts.length; i++) { - var part = parts[i]; + for (var _i = 0; _i < parts.length; _i++) { + var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { normalized.pop(); @@ -988,7 +997,7 @@ var ts; return normalized; } function normalizePath(path) { - var path = normalizeSlashes(path); + path = normalizeSlashes(path); var rootLength = getRootLength(path); var normalized = getNormalizedParts(path, rootLength); return path.substr(0, rootLength) + normalized.join(ts.directorySeparator); @@ -1013,7 +1022,7 @@ var ts; ].concat(normalizedParts); } function getNormalizedPathComponents(path, currentDirectory) { - var path = normalizeSlashes(path); + path = normalizeSlashes(path); var rootLength = getRootLength(path); if (rootLength == 0) { path = combinePaths(normalizeSlashes(currentDirectory), path); @@ -1124,8 +1133,8 @@ var ts; ".js" ]; function removeFileExtension(path) { - for (var i = 0; i < supportedExtensions.length; i++) { - var ext = supportedExtensions[i]; + for (var _i = 0; _i < supportedExtensions.length; _i++) { + var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); } @@ -1289,15 +1298,16 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var i = 0; i < files.length; i++) { - var name = files[i]; - if (!extension || ts.fileExtensionIs(name, extension)) { - result.push(ts.combinePaths(path, name)); + for (var _i = 0; _i < files.length; _i++) { + var _name = files[_i]; + if (!extension || ts.fileExtensionIs(_name, extension)) { + result.push(ts.combinePaths(path, _name)); } } var subfolders = getNames(folder.subfolders); - for (var i = 0; i < subfolders.length; i++) { - visitDirectory(ts.combinePaths(path, subfolders[i])); + for (var _a = 0; _a < subfolders.length; _a++) { + var current = subfolders[_a]; + visitDirectory(ts.combinePaths(path, current)); } } } @@ -1382,8 +1392,9 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var i = 0; i < files.length; i++) { - var name = ts.combinePaths(path, files[i]); + for (var _i = 0; _i < files.length; _i++) { + var current = files[_i]; + var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); if (stat.isFile()) { if (!extension || ts.fileExtensionIs(name, extension)) { @@ -1394,8 +1405,9 @@ var ts; directories.push(name); } } - for (var i = 0; i < directories.length; i++) { - visitDirectory(directories[i]); + for (var _a = 0; _a < directories.length; _a++) { + var _current = directories[_a]; + visitDirectory(_current); } } } @@ -6844,9 +6856,9 @@ var ts; } function makeReverseMap(source) { var result = []; - for (var name in source) { - if (source.hasOwnProperty(name)) { - result[source[name]] = name; + for (var _name in source) { + if (source.hasOwnProperty(_name)) { + result[source[_name]] = _name; } } return result; @@ -7019,8 +7031,8 @@ var ts; else { ts.Debug.assert(ch === 61); while (pos < len) { - var ch = text.charCodeAt(pos); - if (ch === 62 && isConflictMarkerTrivia(text, pos)) { + var _ch = text.charCodeAt(pos); + if (_ch === 62 && isConflictMarkerTrivia(text, pos)) { break; } pos++; @@ -7414,8 +7426,8 @@ var ts; return result; } function getIdentifierToken() { - var len = tokenValue.length; - if (len >= 2 && len <= 11) { + var _len = tokenValue.length; + if (_len >= 2 && _len <= 11) { var ch = tokenValue.charCodeAt(0); if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { return token = textToToken[tokenValue]; @@ -7567,13 +7579,13 @@ var ts; pos += 2; var commentClosed = false; while (pos < len) { - var ch = text.charCodeAt(pos); - if (ch === 42 && text.charCodeAt(pos + 1) === 47) { + var _ch = text.charCodeAt(pos); + if (_ch === 42 && text.charCodeAt(pos + 1) === 47) { pos += 2; commentClosed = true; break; } - if (isLineBreak(ch)) { + if (isLineBreak(_ch)) { precedingLineBreak = true; } pos++; @@ -7606,22 +7618,22 @@ var ts; } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { pos += 2; - var value = scanBinaryOrOctalDigits(2); - if (value < 0) { + var _value = scanBinaryOrOctalDigits(2); + if (_value < 0) { error(ts.Diagnostics.Binary_digit_expected); - value = 0; + _value = 0; } - tokenValue = "" + value; + tokenValue = "" + _value; return token = 7; } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { pos += 2; - var value = scanBinaryOrOctalDigits(8); - if (value < 0) { + var _value_1 = scanBinaryOrOctalDigits(8); + if (_value_1 < 0) { error(ts.Diagnostics.Octal_digit_expected); - value = 0; + _value_1 = 0; } - tokenValue = "" + value; + tokenValue = "" + _value_1; return token = 7; } if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { @@ -7720,10 +7732,10 @@ var ts; case 126: return pos++, token = 47; case 92: - var ch = peekUnicodeEscape(); - if (ch >= 0 && isIdentifierStart(ch)) { + var cookedChar = peekUnicodeEscape(); + if (cookedChar >= 0 && isIdentifierStart(cookedChar)) { pos += 6; - tokenValue = String.fromCharCode(ch) + scanIdentifierParts(); + tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); return token = getIdentifierToken(); } error(ts.Diagnostics.Invalid_character); @@ -7909,8 +7921,8 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var declaration = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; } @@ -8394,8 +8406,8 @@ var ts; } case 7: case 8: - var parent = node.parent; - switch (parent.kind) { + var _parent = node.parent; + switch (_parent.kind) { case 193: case 128: case 130: @@ -8403,7 +8415,7 @@ var ts; case 220: case 218: case 150: - return parent.initializer === node; + return _parent.initializer === node; case 177: case 178: case 179: @@ -8414,22 +8426,22 @@ var ts; case 214: case 190: case 188: - return parent.expression === node; + return _parent.expression === node; case 181: - var forStatement = parent; + var forStatement = _parent; return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || forStatement.condition === node || forStatement.iterator === node; case 182: case 183: - var forInStatement = parent; + var forInStatement = _parent; return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || forInStatement.expression === node; case 158: - return node === parent.expression; + return node === _parent.expression; case 173: - return node === parent.expression; + return node === _parent.expression; case 126: - return node === parent.expression; + return node === _parent.expression; default: - if (isExpression(parent)) { + if (isExpression(_parent)) { return true; } } @@ -8587,14 +8599,14 @@ var ts; if (name.kind !== 64 && name.kind !== 8 && name.kind !== 7) { return false; } - var parent = name.parent; - if (parent.kind === 208 || parent.kind === 212) { - if (parent.propertyName) { + var _parent = name.parent; + if (_parent.kind === 208 || _parent.kind === 212) { + if (_parent.propertyName) { return true; } } - if (isDeclaration(parent)) { - return parent.name === name; + if (isDeclaration(_parent)) { + return _parent.name === name; } return false; } @@ -8616,9 +8628,10 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var i = 0, n = clauses.length; i < n; i++) { - if (clauses[i].token === kind) { - return clauses[i]; + for (var _i = 0; _i < clauses.length; _i++) { + var clause = clauses[_i]; + if (clause.token === kind) { + return clause; } } } @@ -8863,7 +8876,7 @@ var ts; ts.createSynthesizedNode = createSynthesizedNode; function generateUniqueName(baseName, isExistingName) { if (baseName.charCodeAt(0) !== 95) { - var baseName = "_" + baseName; + baseName = "_" + baseName; if (!isExistingName(baseName)) { return baseName; } @@ -8873,9 +8886,9 @@ var ts; } var i = 1; while (true) { - var name = baseName + i; - if (!isExistingName(name)) { - return name; + var _name = baseName + i; + if (!isExistingName(_name)) { + return _name; } i++; } @@ -9006,8 +9019,9 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var i = 0, len = nodes.length; i < len; i++) { - var result = cbNode(nodes[i]); + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; + var result = cbNode(node); if (result) { return result; } @@ -9290,16 +9304,16 @@ var ts; } ts.modifierToFlag = modifierToFlag; function fixupParentReferences(sourceFile) { - var parent = sourceFile; + var _parent = sourceFile; forEachChild(sourceFile, visitNode); return; function visitNode(n) { - if (n.parent !== parent) { - n.parent = parent; - var saveParent = parent; - parent = n; + if (n.parent !== _parent) { + n.parent = _parent; + var saveParent = _parent; + _parent = n; forEachChild(n, visitNode); - parent = saveParent; + _parent = saveParent; } } } @@ -9337,8 +9351,9 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var i = 0, n = array.length; i < n; i++) { - visitNode(array[i]); + for (var _i = 0; _i < array.length; _i++) { + var node = array[_i]; + visitNode(node); } } } @@ -9400,8 +9415,9 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var i = 0, n = array.length; i < n; i++) { - visitNode(array[i]); + for (var _i = 0; _i < array.length; _i++) { + var node = array[_i]; + visitNode(node); } return; } @@ -9697,8 +9713,8 @@ var ts; } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); - var length = scanner.getTextPos() - start; - parseErrorAtPosition(start, length, message, arg0); + var _length = scanner.getTextPos() - start; + parseErrorAtPosition(start, _length, message, arg0); } function parseErrorAtPosition(start, length, message, arg0) { var lastError = ts.lastOrUndefined(sourceFile.parseDiagnostics); @@ -10511,11 +10527,11 @@ var ts; } function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); - var name = parsePropertyName(); + var _name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (token === 16 || token === 24) { var method = createNode(131, fullStart); - method.name = name; + method.name = _name; method.questionToken = questionToken; fillSignature(51, false, false, method); parseTypeMemberSemicolon(); @@ -10523,7 +10539,7 @@ var ts; } else { var property = createNode(129, fullStart); - property.name = name; + property.name = _name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); parseTypeMemberSemicolon(); @@ -10842,6 +10858,10 @@ var ts; nextToken(); return !scanner.hasPrecedingLineBreak() && isIdentifier(); } + function nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() { + nextToken(); + return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 14 || token === 18); + } function parseYieldExpression() { var node = createNode(170); nextToken(); @@ -11173,10 +11193,10 @@ var ts; continue; } else if (token === 16) { - var callExpr = createNode(155, expression.pos); - callExpr.expression = expression; - callExpr.arguments = parseArgumentList(); - expression = finishNode(callExpr); + var _callExpr = createNode(155, expression.pos); + _callExpr.expression = expression; + _callExpr.arguments = parseArgumentList(); + expression = finishNode(_callExpr); continue; } return expression; @@ -11826,15 +11846,15 @@ var ts; } function parsePropertyOrMethodDeclaration(fullStart, modifiers) { var asteriskToken = parseOptionalToken(35); - var name = parsePropertyName(); + var _name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (asteriskToken || token === 16 || token === 24) { - return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); + return parseMethodDeclaration(fullStart, modifiers, asteriskToken, _name, questionToken, ts.Diagnostics.or_expected); } else { var property = createNode(130, fullStart); setModifiers(property, modifiers); - property.name = name; + property.name = _name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); property.initializer = allowInAnd(parseNonParameterInitializer); @@ -12172,7 +12192,7 @@ var ts; return finishNode(node); } function isLetDeclaration() { - return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOnSameLine); + return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine); } function isDeclarationStart() { switch (token) { @@ -12497,9 +12517,10 @@ var ts; } function declareSymbol(symbols, parent, node, includes, excludes) { ts.Debug.assert(!ts.hasDynamicName(node)); - var name = node.flags & 256 && parent ? "default" : getDeclarationName(node); - if (name !== undefined) { - var symbol = ts.hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); + var _name = node.flags & 256 && parent ? "default" : getDeclarationName(node); + var symbol; + if (_name !== undefined) { + symbol = ts.hasProperty(symbols, _name) ? symbols[_name] : (symbols[_name] = createSymbol(0, _name)); if (symbol.flags & excludes) { if (node.name) { node.name.parent = node; @@ -12509,7 +12530,7 @@ var ts; file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); - symbol = createSymbol(0, name); + symbol = createSymbol(0, _name); } } else { @@ -12861,6 +12882,8 @@ var ts; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0; var emitResolver = createResolver(); + var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); + var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); @@ -12909,8 +12932,6 @@ var ts; getEmitResolver: getEmitResolver, getExportsOfExternalModule: getExportsOfExternalModule }; - var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); - var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var unknownSymbol = createSymbol(4 | 67108864, "unknown"); var resolvingSymbol = createSymbol(67108864, "__resolving__"); var anyType = createIntrinsicType(1, "any"); @@ -13311,11 +13332,11 @@ var ts; function getExternalModuleMember(node, specifier) { var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); if (moduleSymbol) { - var name = specifier.propertyName || specifier.name; - if (name.text) { - var symbol = getSymbol(getExportsOfSymbol(moduleSymbol), name.text, 107455 | 793056 | 1536); + var _name = specifier.propertyName || specifier.name; + if (_name.text) { + var symbol = getSymbol(getExportsOfSymbol(moduleSymbol), _name.text, 107455 | 793056 | 1536); if (!symbol) { - error(name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(name)); + error(_name, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), ts.declarationNameToString(_name)); return; } return symbol.flags & (107455 | 793056 | 1536) ? symbol : resolveAlias(symbol); @@ -13412,8 +13433,9 @@ var ts; if (ts.getFullWidth(name) === 0) { return undefined; } + var symbol; if (name.kind === 64) { - var symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + symbol = resolveName(name, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); if (!symbol) { return undefined; } @@ -13424,7 +13446,7 @@ var ts; return undefined; } var right = name.right; - var symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); + symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); if (!symbol) { error(right, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); return undefined; @@ -13452,14 +13474,17 @@ var ts; return symbol; } } + var sourceFile; while (true) { var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - var sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); - if (sourceFile || isRelative) + sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + if (sourceFile || isRelative) { break; + } var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) + if (parentPath === searchPath) { break; + } searchPath = parentPath; } if (sourceFile) { @@ -13557,8 +13582,8 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var i = 0; i < members.length; i++) { - var member = members[i]; + for (var _i = 0; _i < members.length; _i++) { + var member = members[_i]; if (member.kind === 133 && ts.nodeIsPresent(member.body)) { return member; } @@ -13614,25 +13639,25 @@ var ts; } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; - for (var location = enclosingDeclaration; location; location = location.parent) { - if (location.locals && !isGlobalSourceFile(location)) { - if (result = callback(location.locals)) { + for (var _location = enclosingDeclaration; _location; _location = _location.parent) { + if (_location.locals && !isGlobalSourceFile(_location)) { + if (result = callback(_location.locals)) { return result; } } - switch (location.kind) { + switch (_location.kind) { case 221: - if (!ts.isExternalModule(location)) { + if (!ts.isExternalModule(_location)) { break; } case 200: - if (result = callback(getSymbolOfNode(location).exports)) { + if (result = callback(getSymbolOfNode(_location).exports)) { return result; } break; case 196: case 197: - if (result = callback(getSymbolOfNode(location).members)) { + if (result = callback(getSymbolOfNode(_location).members)) { return result; } break; @@ -13881,8 +13906,9 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var i = 0, n = accessibleSymbolChain.length; i < n; i++) { - appendParentTypeArgumentsAndSymbolName(accessibleSymbolChain[i]); + for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { + var accessibleSymbol = accessibleSymbolChain[_i]; + appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } } else { @@ -14061,15 +14087,17 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var i = 0; i < resolved.callSignatures.length; i++) { - buildSignatureDisplay(resolved.callSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { + var signature = _a[_i]; + buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var i = 0; i < resolved.constructSignatures.length; i++) { + for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { + var _signature = _c[_b]; writeKeyword(writer, 87); writeSpace(writer); - buildSignatureDisplay(resolved.constructSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + buildSignatureDisplay(_signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } @@ -14099,17 +14127,18 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var i = 0; i < resolved.properties.length; i++) { - var p = resolved.properties[i]; + for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { + var p = _e[_d]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var j = 0; j < signatures.length; j++) { + for (var _f = 0; _f < signatures.length; _f++) { + var _signature_1 = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); } - buildSignatureDisplay(signatures[j], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + buildSignatureDisplay(_signature_1, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } @@ -14247,10 +14276,11 @@ var ts; } function isUsedInExportAssignment(node) { var externalModule = getContainingExternalModule(node); + var exportAssignmentSymbol; + var resolvedExportSymbol; if (externalModule) { var externalModuleSymbol = getSymbolOfNode(externalModule); - var exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); - var resolvedExportSymbol; + exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); var symbolOfNode = getSymbolOfNode(node); if (isSymbolUsedInExportAssignment(symbolOfNode)) { return true; @@ -14290,11 +14320,11 @@ var ts; case 195: case 199: case 203: - var parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 203 && parent.kind !== 221 && ts.isInAmbientContext(parent))) { - return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); + var _parent = getDeclarationContainer(node); + if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 203 && _parent.kind !== 221 && ts.isInAmbientContext(_parent))) { + return isGlobalSourceFile(_parent) || isUsedInExportAssignment(node); } - return isDeclarationVisible(parent); + return isDeclarationVisible(_parent); case 130: case 129: case 134: @@ -14366,11 +14396,12 @@ var ts; } return parentType; } + var type; if (pattern.kind === 148) { - var name = declaration.propertyName || declaration.name; - var type = getTypeOfPropertyOfType(parentType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); + var _name = declaration.propertyName || declaration.name; + type = getTypeOfPropertyOfType(parentType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { - error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); + error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(_name)); return unknownType; } } @@ -14381,7 +14412,7 @@ var ts; } if (!declaration.dotDotDotToken) { var propName = "" + ts.indexOf(pattern.elements, declaration); - var type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1); + type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1); if (!type) { if (isTupleType(parentType)) { error(declaration, ts.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(parentType), parentType.elementTypes.length, pattern.elements.length); @@ -14393,7 +14424,7 @@ var ts; } } else { - var type = createArrayType(getIndexTypeOfType(parentType, 1)); + type = createArrayType(getIndexTypeOfType(parentType, 1)); } } return type; @@ -14445,8 +14476,8 @@ var ts; var members = {}; ts.forEach(pattern.elements, function (e) { var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); - var name = e.propertyName || e.name; - var symbol = createSymbol(flags, name.text); + var _name = e.propertyName || e.name; + var symbol = createSymbol(flags, _name.text); symbol.type = getTypeFromBindingElement(e); members[symbol.name] = symbol; }); @@ -14569,8 +14600,8 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 134); - error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + var _getter = ts.getDeclarationOfKind(symbol, 134); + error(_getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } } @@ -14749,8 +14780,8 @@ var ts; } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 198); - error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + var _declaration = ts.getDeclarationOfKind(symbol, 198); + error(_declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; } @@ -14806,23 +14837,23 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var i = 0; i < symbols.length; i++) { - var symbol = symbols[i]; + for (var _i = 0; _i < symbols.length; _i++) { + var symbol = symbols[_i]; result[symbol.name] = symbol; } return result; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var i = 0; i < symbols.length; i++) { - var symbol = symbols[i]; + for (var _i = 0; _i < symbols.length; _i++) { + var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var i = 0; i < baseSymbols.length; i++) { - var s = baseSymbols[i]; + for (var _i = 0; _i < baseSymbols.length; _i++) { + var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; } @@ -14830,8 +14861,9 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var i = 0; i < baseSignatures.length; i++) { - signatures.push(baseSignatures[i]); + for (var _i = 0; _i < baseSignatures.length; _i++) { + var signature = baseSignatures[_i]; + signatures.push(signature); } } } @@ -14931,13 +14963,14 @@ var ts; return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var i = 0; i < signatures.length; i++) { - if (signatures[i].typeParameters) { + for (var _i = 0; _i < signatures.length; _i++) { + var signature = signatures[_i]; + if (signature.typeParameters) { return emptyArray; } } - for (var i = 1; i < signatureLists.length; i++) { - if (!signatureListsIdentical(signatures, signatureLists[i])) { + for (var _i_1 = 1; _i_1 < signatureLists.length; _i_1++) { + if (!signatureListsIdentical(signatures, signatureLists[_i_1])) { return emptyArray; } } @@ -14953,8 +14986,9 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var i = 0; i < types.length; i++) { - var indexType = getIndexTypeOfType(types[i], kind); + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + var indexType = getIndexTypeOfType(type, kind); if (!indexType) { return undefined; } @@ -14971,17 +15005,22 @@ var ts; } function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; + var members; + var callSignatures; + var constructSignatures; + var stringIndexType; + var numberIndexType; if (symbol.flags & 2048) { - var members = symbol.members; - var callSignatures = getSignaturesOfSymbol(members["__call"]); - var constructSignatures = getSignaturesOfSymbol(members["__new"]); - var stringIndexType = getIndexTypeOfSymbol(symbol, 0); - var numberIndexType = getIndexTypeOfSymbol(symbol, 1); + members = symbol.members; + callSignatures = getSignaturesOfSymbol(members["__call"]); + constructSignatures = getSignaturesOfSymbol(members["__new"]); + stringIndexType = getIndexTypeOfSymbol(symbol, 0); + numberIndexType = getIndexTypeOfSymbol(symbol, 1); } else { - var members = emptySymbols; - var callSignatures = emptyArray; - var constructSignatures = emptyArray; + members = emptySymbols; + callSignatures = emptyArray; + constructSignatures = emptyArray; if (symbol.flags & 1952) { members = getExportsOfSymbol(symbol); } @@ -14999,8 +15038,8 @@ var ts; addInheritedMembers(members, getPropertiesOfObjectType(getTypeOfSymbol(classType.baseTypes[0].symbol))); } } - var stringIndexType = undefined; - var numberIndexType = (symbol.flags & 384) ? stringType : undefined; + stringIndexType = undefined; + numberIndexType = (symbol.flags & 384) ? stringType : undefined; } setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } @@ -15083,8 +15122,9 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var i = 0; i < types.length; i++) { - var type = getApparentType(types[i]); + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + var type = getApparentType(current); if (type !== unknownType) { var prop = getPropertyOfType(type, name); if (!prop) { @@ -15102,12 +15142,12 @@ var ts; } var propTypes = []; var declarations = []; - for (var i = 0; i < props.length; i++) { - var prop = props[i]; - if (prop.declarations) { - declarations.push.apply(declarations, prop.declarations); + for (var _a = 0; _a < props.length; _a++) { + var _prop = props[_a]; + if (_prop.declarations) { + declarations.push.apply(declarations, _prop.declarations); } - propTypes.push(getTypeOfSymbol(prop)); + propTypes.push(getTypeOfSymbol(_prop)); } var result = createSymbol(4 | 67108864 | 268435456, name); result.unionType = unionType; @@ -15144,9 +15184,9 @@ var ts; } } if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) { - var symbol = getPropertyOfObjectType(globalFunctionType, name); - if (symbol) - return symbol; + var _symbol = getPropertyOfObjectType(globalFunctionType, name); + if (_symbol) + return _symbol; } return getPropertyOfObjectType(globalObjectType, name); } @@ -15266,14 +15306,15 @@ var ts; function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { signature.resolvedReturnType = resolvingType; + var type; if (signature.target) { - var type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); + type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); } else if (signature.unionSignatures) { - var type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature)); + type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature)); } else { - var type = getReturnTypeFromBody(signature.declaration); + type = getReturnTypeFromBody(signature.declaration); } if (signature.resolvedReturnType === resolvingType) { signature.resolvedReturnType = type; @@ -15342,8 +15383,9 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var i = 0; i < len; i++) { - var node = indexSymbol.declarations[i]; + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var node = decl; if (node.parameters.length === 1) { var parameter = node.parameters[0]; if (parameter && parameter.type && parameter.type.kind === syntaxKind) { @@ -15379,8 +15421,9 @@ var ts; default: var result = ""; for (var i = 0; i < types.length; i++) { - if (i > 0) + if (i > 0) { result += ","; + } result += types[i].id; } return result; @@ -15388,8 +15431,9 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var i = 0; i < types.length; i++) { - result |= types[i].flags; + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + result |= type.flags; } return result & 786432; } @@ -15446,8 +15490,8 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { var symbol = resolveEntityName(node.typeName, 793056); + var type; if (symbol) { - var type; if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { type = unknownType; } @@ -15485,8 +15529,8 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var declaration = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; switch (declaration.kind) { case 196: case 197: @@ -15570,13 +15614,15 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var i = 0, len = types.length; i < len; i++) { - addTypeToSortedSet(sortedTypes, types[i]); + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; } } @@ -15592,8 +15638,9 @@ var ts; } } function containsAnyType(types) { - for (var i = 0; i < types.length; i++) { - if (types[i].flags & 1) { + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + if (type.flags & 1) { return true; } } @@ -15707,8 +15754,9 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var i = 0; i < items.length; i++) { - result.push(instantiator(items[i], mapper)); + for (var _i = 0; _i < items.length; _i++) { + var v = items[_i]; + result.push(instantiator(v, mapper)); } return result; } @@ -15733,8 +15781,9 @@ var ts; } return function (t) { for (var i = 0; i < sources.length; i++) { - if (t === sources[i]) + if (t === sources[i]) { return targets[i]; + } } return t; }; @@ -15757,9 +15806,11 @@ var ts; return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var i = 0; i < sources.length; i++) { - if (t === sources[i]) + for (var _i = 0; _i < sources.length; _i++) { + var source = sources[_i]; + if (t === source) { return anyType; + } } return t; }; @@ -15795,8 +15846,9 @@ var ts; return result; } function instantiateSignature(signature, mapper, eraseTypeParameters) { + var freshTypeParameters; if (signature.typeParameters && !eraseTypeParameters) { - var freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); + freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); } var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), signature.resolvedReturnType ? instantiateType(signature.resolvedReturnType, mapper) : undefined, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); @@ -15952,7 +16004,7 @@ var ts; } function isRelatedTo(source, target, reportErrors, headMessage, elaborateErrors) { if (elaborateErrors === void 0) { elaborateErrors = false; } - var result; + var _result; if (source === target) return -1; if (relation !== identityRelation) { @@ -15976,53 +16028,53 @@ var ts; if (source.flags & 16384 || target.flags & 16384) { if (relation === identityRelation) { if (source.flags & 16384 && target.flags & 16384) { - if (result = unionTypeRelatedToUnionType(source, target)) { - if (result &= unionTypeRelatedToUnionType(target, source)) { - return result; + if (_result = unionTypeRelatedToUnionType(source, target)) { + if (_result &= unionTypeRelatedToUnionType(target, source)) { + return _result; } } } else if (source.flags & 16384) { - if (result = unionTypeRelatedToType(source, target, reportErrors)) { - return result; + if (_result = unionTypeRelatedToType(source, target, reportErrors)) { + return _result; } } else { - if (result = unionTypeRelatedToType(target, source, reportErrors)) { - return result; + if (_result = unionTypeRelatedToType(target, source, reportErrors)) { + return _result; } } } else { if (source.flags & 16384) { - if (result = unionTypeRelatedToType(source, target, reportErrors)) { - return result; + if (_result = unionTypeRelatedToType(source, target, reportErrors)) { + return _result; } } else { - if (result = typeRelatedToUnionType(source, target, reportErrors)) { - return result; + if (_result = typeRelatedToUnionType(source, target, reportErrors)) { + return _result; } } } } else if (source.flags & 512 && target.flags & 512) { - if (result = typeParameterRelatedTo(source, target, reportErrors)) { - return result; + if (_result = typeParameterRelatedTo(source, target, reportErrors)) { + return _result; } } else { var saveErrorInfo = errorInfo; if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { - return result; + if (_result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return _result; } } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (_result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; - return result; + return _result; } } if (reportErrors) { @@ -16038,16 +16090,17 @@ var ts; return 0; } function unionTypeRelatedToUnionType(source, target) { - var result = -1; + var _result = -1; var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { - var related = typeRelatedToUnionType(sourceTypes[i], target, false); + for (var _i = 0; _i < sourceTypes.length; _i++) { + var sourceType = sourceTypes[_i]; + var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function typeRelatedToUnionType(source, target, reportErrors) { var targetTypes = target.types; @@ -16060,27 +16113,28 @@ var ts; return 0; } function unionTypeRelatedToType(source, target, reportErrors) { - var result = -1; + var _result = -1; var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { - var related = isRelatedTo(sourceTypes[i], target, reportErrors); + for (var _i = 0; _i < sourceTypes.length; _i++) { + var sourceType = sourceTypes[_i]; + var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function typesRelatedTo(sources, targets, reportErrors) { - var result = -1; + var _result = -1; for (var i = 0, len = sources.length; i < len; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function typeParameterRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { @@ -16146,19 +16200,20 @@ var ts; expandingFlags |= 1; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) expandingFlags |= 2; + var _result; if (expandingFlags === 3) { - var result = 1; + _result = 1; } else { - var result = propertiesRelatedTo(source, target, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 0, reportErrors); - if (result) { - result &= signaturesRelatedTo(source, target, 1, reportErrors); - if (result) { - result &= stringIndexTypesRelatedTo(source, target, reportErrors); - if (result) { - result &= numberIndexTypesRelatedTo(source, target, reportErrors); + _result = propertiesRelatedTo(source, target, reportErrors); + if (_result) { + _result &= signaturesRelatedTo(source, target, 0, reportErrors); + if (_result) { + _result &= signaturesRelatedTo(source, target, 1, reportErrors); + if (_result) { + _result &= stringIndexTypesRelatedTo(source, target, reportErrors); + if (_result) { + _result &= numberIndexTypesRelatedTo(source, target, reportErrors); } } } @@ -16166,23 +16221,23 @@ var ts; } expandingFlags = saveExpandingFlags; depth--; - if (result) { + if (_result) { var maybeCache = maybeStack[depth]; - var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; + var destinationCache = (_result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; ts.copyMap(maybeCache, destinationCache); } else { relation[id] = reportErrors ? 3 : 2; } - return result; + return _result; } function isDeeplyNestedGeneric(type, stack) { if (type.flags & 4096 && depth >= 10) { - var target = type.target; + var _target = type.target; var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & 4096 && t.target === target) { + if (t.flags & 4096 && t.target === _target) { count++; if (count >= 10) return true; @@ -16195,11 +16250,11 @@ var ts; if (relation === identityRelation) { return propertiesIdenticalTo(source, target); } - var result = -1; + var _result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var i = 0; i < properties.length; i++) { - var targetProp = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { @@ -16250,7 +16305,7 @@ var ts; } return 0; } - result &= related; + _result &= related; if (sourceProp.flags & 536870912 && !(targetProp.flags & 536870912)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); @@ -16260,7 +16315,7 @@ var ts; } } } - return result; + return _result; } function propertiesIdenticalTo(source, target) { var sourceProperties = getPropertiesOfObjectType(source); @@ -16268,9 +16323,9 @@ var ts; if (sourceProperties.length !== targetProperties.length) { return 0; } - var result = -1; - for (var i = 0, len = sourceProperties.length; i < len; ++i) { - var sourceProp = sourceProperties[i]; + var _result = -1; + for (var _i = 0; _i < sourceProperties.length; _i++) { + var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { return 0; @@ -16279,9 +16334,9 @@ var ts; if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function signaturesRelatedTo(source, target, kind, reportErrors) { if (relation === identityRelation) { @@ -16292,18 +16347,18 @@ var ts; } var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); - var result = -1; + var _result = -1; var saveErrorInfo = errorInfo; - outer: for (var i = 0; i < targetSignatures.length; i++) { - var t = targetSignatures[i]; + outer: for (var _i = 0; _i < targetSignatures.length; _i++) { + var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var j = 0; j < sourceSignatures.length; j++) { - var s = sourceSignatures[j]; + for (var _a = 0; _a < sourceSignatures.length; _a++) { + var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); if (related) { - result &= related; + _result &= related; errorInfo = saveErrorInfo; continue outer; } @@ -16313,7 +16368,7 @@ var ts; return 0; } } - return result; + return _result; } function signatureRelatedTo(source, target, reportErrors) { if (source === target) { @@ -16343,14 +16398,14 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); - var result = -1; + var _result = -1; for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + var _s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + var _t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); var saveErrorInfo = errorInfo; - var related = isRelatedTo(s, t, reportErrors); + var related = isRelatedTo(_s, _t, reportErrors); if (!related) { - related = isRelatedTo(t, s, false); + related = isRelatedTo(_t, _s, false); if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); @@ -16359,13 +16414,13 @@ var ts; } errorInfo = saveErrorInfo; } - result &= related; + _result &= related; } var t = getReturnTypeOfSignature(target); if (t === voidType) - return result; + return _result; var s = getReturnTypeOfSignature(source); - return result & isRelatedTo(s, t, reportErrors); + return _result & isRelatedTo(s, t, reportErrors); } function signaturesIdenticalTo(source, target, kind) { var sourceSignatures = getSignaturesOfType(source, kind); @@ -16373,15 +16428,15 @@ var ts; if (sourceSignatures.length !== targetSignatures.length) { return 0; } - var result = -1; + var _result = -1; for (var i = 0, len = sourceSignatures.length; i < len; ++i) { var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); if (!related) { return 0; } - result &= related; + _result &= related; } - return result; + return _result; } function stringIndexTypesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { @@ -16421,11 +16476,12 @@ var ts; } return 0; } + var related; if (sourceStringType && sourceNumberType) { - var related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); + related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); } else { - var related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); + related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); } if (!related) { if (reportErrors) { @@ -16498,14 +16554,14 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); - for (var i = 0, len = source.parameters.length; i < len; i++) { - var s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); - var related = compareTypes(s, t); - if (!related) { + for (var _i = 0, _len = source.parameters.length; _i < _len; _i++) { + var s = source.hasRestParameter && _i === _len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[_i]); + var t = target.hasRestParameter && _i === _len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[_i]); + var _related = compareTypes(s, t); + if (!_related) { return 0; } - result &= related; + result &= _related; } if (compareReturnTypes) { result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); @@ -16513,8 +16569,9 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var i = 0, len = types.length; i < len; i++) { - if (candidate !== types[i] && !isTypeSubtypeOf(types[i], candidate)) + for (var _i = 0; _i < types.length; _i++) { + var type = types[_i]; + if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; } return true; @@ -16619,29 +16676,30 @@ var ts; return reportWideningErrorsInType(type.typeArguments[0]); } if (type.flags & 131072) { - var errorReported = false; + var _errorReported = false; ts.forEach(getPropertiesOfObjectType(type), function (p) { var t = getTypeOfSymbol(p); if (t.flags & 262144) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); } - errorReported = true; + _errorReported = true; } }); - return errorReported; + return _errorReported; } return false; } function reportImplicitAnyError(declaration, type) { var typeAsString = typeToString(getWidenedType(type)); + var diagnostic; switch (declaration.kind) { case 130: case 129: - var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; + diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; case 128: - var diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; case 195: case 132: @@ -16654,10 +16712,10 @@ var ts; error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; } - var diagnostic = ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; + diagnostic = ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; default: - var diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type; + diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type; } error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } @@ -16696,7 +16754,8 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var i = 0; i < typeParameters.length; i++) { + for (var _i = 0; _i < typeParameters.length; _i++) { + var unused = typeParameters[_i]; inferences.push({ primary: undefined, secondary: undefined @@ -16718,19 +16777,21 @@ var ts; inferFromTypes(source, target); function isInProcess(source, target) { for (var i = 0; i < depth; i++) { - if (source === sourceStack[i] && target === targetStack[i]) + if (source === sourceStack[i] && target === targetStack[i]) { return true; + } } return false; } function isWithinDepthLimit(type, stack) { if (depth >= 5) { - var target = type.target; + var _target = type.target; var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & 4096 && t.target === target) + if (t.flags & 4096 && t.target === _target) { count++; + } } return count < 5; } @@ -16755,16 +16816,16 @@ var ts; else if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { var sourceTypes = source.typeArguments; var targetTypes = target.typeArguments; - for (var i = 0; i < sourceTypes.length; i++) { - inferFromTypes(sourceTypes[i], targetTypes[i]); + for (var _i = 0; _i < sourceTypes.length; _i++) { + inferFromTypes(sourceTypes[_i], targetTypes[_i]); } } else if (target.flags & 16384) { - var targetTypes = target.types; + var _targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var i = 0; i < targetTypes.length; i++) { - var t = targetTypes[i]; + for (var _a = 0; _a < _targetTypes.length; _a++) { + var t = _targetTypes[_a]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; @@ -16780,9 +16841,10 @@ var ts; } } else if (source.flags & 16384) { - var sourceTypes = source.types; - for (var i = 0; i < sourceTypes.length; i++) { - inferFromTypes(sourceTypes[i], target); + var _sourceTypes = source.types; + for (var _b = 0; _b < _sourceTypes.length; _b++) { + var sourceType = _sourceTypes[_b]; + inferFromTypes(sourceType, target); } } else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { @@ -16806,8 +16868,8 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var i = 0; i < properties.length; i++) { - var targetProp = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); @@ -16993,9 +17055,9 @@ var ts; } function resolveLocation(node) { var containerNodes = []; - for (var parent = node.parent; parent; parent = parent.parent) { - if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(parent)) { - containerNodes.unshift(parent); + for (var _parent = node.parent; _parent; _parent = _parent.parent) { + if ((ts.isExpression(_parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(_parent)) { + containerNodes.unshift(_parent); } } ts.forEach(containerNodes, function (node) { @@ -17283,11 +17345,12 @@ var ts; var container = ts.getSuperContainer(node, true); if (container) { var canUseSuperExpression = false; + var needToCaptureLexicalThis; if (isCallExpression) { canUseSuperExpression = container.kind === 133; } else { - var needToCaptureLexicalThis = false; + needToCaptureLexicalThis = false; while (container && container.kind === 161) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; @@ -17422,8 +17485,9 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var i = 0; i < types.length; i++) { - var t = mapper(types[i]); + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + var t = mapper(current); if (t) { if (!mappedType) { mappedType = t; @@ -17502,8 +17566,8 @@ var ts; if (node.contextualType) { return node.contextualType; } - var parent = node.parent; - switch (parent.kind) { + var _parent = node.parent; + switch (_parent.kind) { case 193: case 128: case 130: @@ -17515,22 +17579,22 @@ var ts; return getContextualTypeForReturnExpression(node); case 155: case 156: - return getContextualTypeForArgument(parent, node); + return getContextualTypeForArgument(_parent, node); case 158: - return getTypeFromTypeNode(parent.type); + return getTypeFromTypeNode(_parent.type); case 167: return getContextualTypeForBinaryOperand(node); case 218: - return getContextualTypeForObjectLiteralElement(parent); + return getContextualTypeForObjectLiteralElement(_parent); case 151: return getContextualTypeForElementExpression(node); case 168: return getContextualTypeForConditionalOperand(node); case 173: - ts.Debug.assert(parent.parent.kind === 169); - return getContextualTypeForSubstitutionExpression(parent.parent, node); + ts.Debug.assert(_parent.parent.kind === 169); + return getContextualTypeForSubstitutionExpression(_parent.parent, node); case 159: - return getContextualType(parent); + return getContextualType(_parent); } return undefined; } @@ -17560,11 +17624,12 @@ var ts; } var signatureList; var types = type.types; - for (var i = 0; i < types.length; i++) { - if (signatureList && getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; } - var signature = getNonGenericSignature(types[i]); + var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { signatureList = [ @@ -17591,15 +17656,15 @@ var ts; return mapper && mapper !== identityMapper; } function isAssignmentTarget(node) { - var parent = node.parent; - if (parent.kind === 167 && parent.operatorToken.kind === 52 && parent.left === node) { + var _parent = node.parent; + if (_parent.kind === 167 && _parent.operatorToken.kind === 52 && _parent.left === node) { return true; } - if (parent.kind === 218) { - return isAssignmentTarget(parent.parent); + if (_parent.kind === 218) { + return isAssignmentTarget(_parent.parent); } - if (parent.kind === 151) { - return isAssignmentTarget(parent); + if (_parent.kind === 151) { + return isAssignmentTarget(_parent); } return false; } @@ -17664,19 +17729,20 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var i = 0; i < node.properties.length; i++) { - var memberDecl = node.properties[i]; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var memberDecl = _a[_i]; var member = memberDecl.symbol; if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { + var type = void 0; if (memberDecl.kind === 218) { - var type = checkPropertyAssignment(memberDecl, contextualMapper); + type = checkPropertyAssignment(memberDecl, contextualMapper); } else if (memberDecl.kind === 132) { - var type = checkObjectLiteralMethod(memberDecl, contextualMapper); + type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { ts.Debug.assert(memberDecl.kind === 219); - var type = memberDecl.name.kind === 126 ? unknownType : checkExpression(memberDecl.name, contextualMapper); + type = memberDecl.name.kind === 126 ? unknownType : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -17709,15 +17775,15 @@ var ts; for (var i = 0; i < propertiesArray.length; i++) { var propertyDecl = node.properties[i]; if (kind === 0 || isNumericName(propertyDecl.name)) { - var type = getTypeOfSymbol(propertiesArray[i]); - if (!ts.contains(propTypes, type)) { - propTypes.push(type); + var _type = getTypeOfSymbol(propertiesArray[i]); + if (!ts.contains(propTypes, _type)) { + propTypes.push(_type); } } } - var result = propTypes.length ? getUnionType(propTypes) : undefinedType; - typeFlags |= result.flags; - return result; + var _result = propTypes.length ? getUnionType(propTypes) : undefinedType; + typeFlags |= _result.flags; + return _result; } return undefined; } @@ -17818,9 +17884,9 @@ var ts; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); } else { - var start = node.end - "]".length; - var end = node.end; - grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected); + var _start = node.end - "]".length; + var _end = node.end; + grammarErrorAtPos(sourceFile, _start, _end - _start, ts.Diagnostics.Expression_expected); } } var objectType = getApparentType(checkExpression(node.expression)); @@ -17834,15 +17900,15 @@ var ts; return unknownType; } if (node.argumentExpression) { - var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); - if (name !== undefined) { - var prop = getPropertyOfType(objectType, name); + var _name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (_name !== undefined) { + var prop = getPropertyOfType(objectType, _name); if (prop) { getNodeLinks(node).resolvedSymbol = prop; return getTypeOfSymbol(prop); } else if (isConstEnum) { - error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name, symbolToString(objectType.symbol)); + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, _name, symbolToString(objectType.symbol)); return unknownType; } } @@ -17929,22 +17995,22 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var i = 0; i < signatures.length; i++) { - var signature = signatures[i]; + for (var _i = 0; _i < signatures.length; _i++) { + var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent = signature.declaration && signature.declaration.parent; + var _parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent === lastParent) { + if (lastParent && _parent === lastParent) { index++; } else { - lastParent = parent; + lastParent = _parent; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent; + lastParent = _parent; } lastSymbol = symbol; if (signature.hasStringLiterals) { @@ -18034,30 +18100,31 @@ var ts; var arg = args[i]; if (arg.kind !== 172) { var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); + var argType = void 0; if (i === 0 && args[i].parent.kind === 157) { - var argType = globalTemplateStringsArrayType; + argType = globalTemplateStringsArrayType; } else { var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; - var argType = checkExpressionWithContextualType(arg, paramType, mapper); + argType = checkExpressionWithContextualType(arg, paramType, mapper); } inferTypes(context, argType, paramType); } } if (excludeArgument) { - for (var i = 0; i < args.length; i++) { - if (excludeArgument[i] === false) { - var arg = args[i]; - var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); - inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + for (var _i = 0; _i < args.length; _i++) { + if (excludeArgument[_i] === false) { + var _arg = args[_i]; + var _paramType = getTypeAtPosition(signature, _arg.kind === 171 ? -1 : _i); + inferTypes(context, checkExpressionWithContextualType(_arg, _paramType, inferenceMapper), _paramType); } } } var inferredTypes = getInferredTypes(context); context.failedTypeParameterIndex = ts.indexOf(inferredTypes, inferenceFailureType); - for (var i = 0; i < inferredTypes.length; i++) { - if (inferredTypes[i] === inferenceFailureType) { - inferredTypes[i] = unknownType; + for (var _i_1 = 0; _i_1 < inferredTypes.length; _i_1++) { + if (inferredTypes[_i_1] === inferenceFailureType) { + inferredTypes[_i_1] = unknownType; } } return context; @@ -18179,50 +18246,53 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var i = 0, n = candidates.length; i < n; i++) { - if (hasCorrectArity(node, args, candidates[i])) { - return candidates[i]; + for (var _i = 0; _i < candidates.length; _i++) { + var candidate = candidates[_i]; + if (hasCorrectArity(node, args, candidate)) { + return candidate; } } } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var i = 0; i < candidates.length; i++) { - if (!hasCorrectArity(node, args, candidates[i])) { + for (var _a = 0; _a < candidates.length; _a++) { + var current = candidates[_a]; + if (!hasCorrectArity(node, args, current)) { continue; } - var originalCandidate = candidates[i]; - var inferenceResult; + var originalCandidate = current; + var inferenceResult = void 0; + var _candidate = void 0; + var typeArgumentsAreValid = void 0; while (true) { - var candidate = originalCandidate; - if (candidate.typeParameters) { - var typeArgumentTypes; - var typeArgumentsAreValid; + _candidate = originalCandidate; + if (_candidate.typeParameters) { + var typeArgumentTypes = void 0; if (typeArguments) { - typeArgumentTypes = new Array(candidate.typeParameters.length); - typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); + typeArgumentTypes = new Array(_candidate.typeParameters.length); + typeArgumentsAreValid = checkTypeArguments(_candidate, typeArguments, typeArgumentTypes, false); } else { - inferenceResult = inferTypeArguments(candidate, args, excludeArgument); + inferenceResult = inferTypeArguments(_candidate, args, excludeArgument); typeArgumentsAreValid = inferenceResult.failedTypeParameterIndex < 0; typeArgumentTypes = inferenceResult.inferredTypes; } if (!typeArgumentsAreValid) { break; } - candidate = getSignatureInstantiation(candidate, typeArgumentTypes); + _candidate = getSignatureInstantiation(_candidate, typeArgumentTypes); } - if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { + if (!checkApplicableSignature(node, args, _candidate, relation, excludeArgument, false)) { break; } var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; if (index < 0) { - return candidate; + return _candidate; } excludeArgument[index] = false; } if (originalCandidate.typeParameters) { - var instantiatedCandidate = candidate; + var instantiatedCandidate = _candidate; if (typeArgumentsAreValid) { candidateForArgumentError = instantiatedCandidate; } @@ -18234,7 +18304,7 @@ var ts; } } else { - ts.Debug.assert(originalCandidate === candidate); + ts.Debug.assert(originalCandidate === _candidate); candidateForArgumentError = originalCandidate; } } @@ -18386,9 +18456,9 @@ var ts; links.type = instantiateType(getTypeAtPosition(context, i), mapper); } if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { - var parameter = signature.parameters[signature.parameters.length - 1]; - var links = getSymbolLinks(parameter); - links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); + var _parameter = signature.parameters[signature.parameters.length - 1]; + var _links = getSymbolLinks(_parameter); + _links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); } } function getReturnTypeFromBody(func, contextualMapper) { @@ -18396,15 +18466,16 @@ var ts; if (!func.body) { return unknownType; } + var type; if (func.body.kind !== 174) { - var type = checkExpressionCached(func.body, contextualMapper); + type = checkExpressionCached(func.body, contextualMapper); } else { var types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper); if (types.length === 0) { return voidType; } - var type = contextualSignature ? getUnionType(types) : getCommonSupertype(types); + type = contextualSignature ? getUnionType(types) : getCommonSupertype(types); if (!type) { error(func, ts.Diagnostics.No_best_common_type_exists_among_return_expressions); return unknownType; @@ -18525,11 +18596,15 @@ var ts; function isReferenceOrErrorExpression(n) { switch (n.kind) { case 64: - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + { + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + } case 153: - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; + { + var _symbol = findSymbol(n); + return !_symbol || _symbol === unknownSymbol || (_symbol.flags & ~8) !== 0; + } case 154: return true; case 159: @@ -18542,17 +18617,21 @@ var ts; switch (n.kind) { case 64: case 153: - var symbol = findSymbol(n); - return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; + { + var symbol = findSymbol(n); + return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; + } case 154: - var index = n.argumentExpression; - var symbol = findSymbol(n.expression); - if (symbol && index && index.kind === 8) { - var name = index.text; - var prop = getPropertyOfType(getTypeOfSymbol(symbol), name); - return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; + { + var index = n.argumentExpression; + var _symbol = findSymbol(n.expression); + if (_symbol && index && index.kind === 8) { + var _name = index.text; + var prop = getPropertyOfType(getTypeOfSymbol(_symbol), _name); + return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; + } + return false; } - return false; case 159: return isConstVariableReference(n.expression); default: @@ -18624,8 +18703,9 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var i = 0; i < types.length; i++) { - if (types[i].flags & kind) { + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + if (current.flags & kind) { return true; } } @@ -18639,8 +18719,9 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var i = 0; i < types.length; i++) { - if (!(types[i].flags & kind)) { + for (var _i = 0; _i < types.length; _i++) { + var current = types[_i]; + if (!(current.flags & kind)) { return false; } } @@ -18674,16 +18755,16 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var i = 0; i < properties.length; i++) { - var p = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { - var name = p.name; - var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); + var _name = p.name; + var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { - checkDestructuringAssignment(p.initializer || name, type); + checkDestructuringAssignment(p.initializer || _name, type); } else { - error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name)); + error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(_name)); } } else { @@ -19114,8 +19195,9 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var i = 0, len = indexSymbol.declarations.length; i < len; ++i) { - var declaration = indexSymbol.declarations[i]; + for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; + var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { case 120: @@ -19303,8 +19385,8 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var i = 0; i < signaturesToCheck.length; i++) { - var otherSignature = signaturesToCheck[i]; + for (var _i = 0; _i < signaturesToCheck.length; _i++) { + var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; } @@ -19384,16 +19466,16 @@ var ts; }); if (subsequentNode) { if (subsequentNode.kind === node.kind) { - var errorNode = subsequentNode.name || subsequentNode; + var _errorNode = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { ts.Debug.assert(node.kind === 132 || node.kind === 131); ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; - error(errorNode, diagnostic); + error(_errorNode, diagnostic); return; } else if (ts.nodeIsPresent(subsequentNode.body)) { - error(errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); + error(_errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); return; } } @@ -19409,8 +19491,9 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var i = 0; i < declarations.length; i++) { - var node = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var current = declarations[_i]; + var node = current; var inAmbientContext = ts.isInAmbientContext(node); var inAmbientContextOrInterface = node.parent.kind === 197 || node.parent.kind === 143 || inAmbientContext; if (inAmbientContextOrInterface) { @@ -19467,9 +19550,10 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var i = 0, len = signatures.length; i < len; ++i) { - if (!signatures[i].hasStringLiterals && !isSignatureAssignableTo(bodySignature, signatures[i])) { - error(signatures[i].declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + for (var _a = 0; _a < signatures.length; _a++) { + var signature = signatures[_a]; + if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { + error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; } } @@ -19481,7 +19565,6 @@ var ts; if (!produceDiagnostics) { return; } - var symbol; var symbol = node.localSymbol; if (!symbol) { symbol = getSymbolOfNode(node); @@ -19610,8 +19693,8 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4) { - var isDeclaration = node.kind !== 64; - if (isDeclaration) { + var _isDeclaration = node.kind !== 64; + if (_isDeclaration) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } else { @@ -19631,8 +19714,8 @@ var ts; return; } if (ts.getClassBaseTypeNode(enclosingClass)) { - var isDeclaration = node.kind !== 64; - if (isDeclaration) { + var _isDeclaration = node.kind !== 64; + if (_isDeclaration) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } else { @@ -19647,8 +19730,8 @@ var ts; if (node.kind === 200 && ts.getModuleInstanceState(node) !== 1) { return; } - var parent = getDeclarationContainer(node); - if (parent.kind === 221 && ts.isExternalModule(parent)) { + var _parent = getDeclarationContainer(node); + if (_parent.kind === 221 && ts.isExternalModule(_parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -19663,8 +19746,8 @@ var ts; var container = varDeclList.parent.kind === 175 && varDeclList.parent.parent; var namesShareScope = container && (container.kind === 174 && ts.isFunctionLike(container.parent) || (container.kind === 201 && container.kind === 200) || container.kind === 221); if (!namesShareScope) { - var name = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); + var _name = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, _name, _name); } } } @@ -19678,10 +19761,11 @@ var ts; return node.kind === 128; } function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind === 128) { - var func = ts.getContainingFunction(node); - visit(node.initializer); + if (getRootDeclaration(node).kind !== 128) { + return; } + var func = ts.getContainingFunction(node); + visit(node.initializer); function visit(n) { if (n.kind === 64) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; @@ -20110,8 +20194,8 @@ var ts; }); if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 196) { var classDeclaration = type.symbol.valueDeclaration; - for (var i = 0; i < classDeclaration.members.length; i++) { - var member = classDeclaration.members[i]; + for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { + var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0); @@ -20140,22 +20224,22 @@ var ts; if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { return; } - var errorNode; + var _errorNode; if (prop.valueDeclaration.name.kind === 126 || prop.parent === containingType.symbol) { - errorNode = prop.valueDeclaration; + _errorNode = prop.valueDeclaration; } else if (indexDeclaration) { - errorNode = indexDeclaration; + _errorNode = indexDeclaration; } else if (containingType.flags & 2048) { var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); - errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; + _errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } - if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { + if (_errorNode && !isTypeAssignableTo(propertyType, indexType)) { var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; - error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); + error(_errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); } } } @@ -20172,7 +20256,7 @@ var ts; } function checkTypeParameters(typeParameterDeclarations) { if (typeParameterDeclarations) { - for (var i = 0; i < typeParameterDeclarations.length; i++) { + for (var i = 0, n = typeParameterDeclarations.length; i < n; i++) { var node = typeParameterDeclarations[i]; checkTypeParameter(node); if (produceDiagnostics) { @@ -20244,8 +20328,9 @@ var ts; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); - for (var i = 0, len = baseProperties.length; i < len; ++i) { - var base = getTargetSymbol(baseProperties[i]); + for (var _i = 0; _i < baseProperties.length; _i++) { + var baseProperty = baseProperties[_i]; + var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { continue; } @@ -20262,7 +20347,7 @@ var ts; if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) { continue; } - var errorMessage; + var errorMessage = void 0; if (base.flags & 8192) { if (derived.flags & 98304) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; @@ -20325,11 +20410,11 @@ var ts; }; }); var ok = true; - for (var i = 0, len = type.baseTypes.length; i < len; ++i) { - var base = type.baseTypes[i]; + for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { + var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var j = 0, proplen = properties.length; j < proplen; ++j) { - var prop = properties[j]; + for (var _b = 0; _b < properties.length; _b++) { + var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, @@ -20387,8 +20472,8 @@ var ts; checkSourceElement(node.type); } function computeEnumMemberValues(node) { - var nodeLinks = getNodeLinks(node); - if (!(nodeLinks.flags & 128)) { + var _nodeLinks = getNodeLinks(node); + if (!(_nodeLinks.flags & 128)) { var enumSymbol = getSymbolOfNode(node); var enumType = getDeclaredTypeOfSymbol(enumSymbol); var autoValue = 0; @@ -20425,7 +20510,7 @@ var ts; getNodeLinks(member).enumMemberValue = autoValue++; } }); - nodeLinks.flags |= 128; + _nodeLinks.flags |= 128; } function getConstantValueForEnumMemberInitializer(initializer, enumIsConst) { return evalConstant(initializer); @@ -20494,10 +20579,10 @@ var ts; } var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); - var enumType; + var _enumType; var propertyName; if (e.kind === 64) { - enumType = currentType; + _enumType = currentType; propertyName = e.text; } else { @@ -20505,21 +20590,21 @@ var ts; if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { return undefined; } - var enumType = getTypeOfNode(e.expression); + _enumType = getTypeOfNode(e.expression); propertyName = e.argumentExpression.text; } else { - var enumType = getTypeOfNode(e.expression); + _enumType = getTypeOfNode(e.expression); propertyName = e.name.text; } - if (enumType !== currentType) { + if (_enumType !== currentType) { return undefined; } } if (propertyName === undefined) { return undefined; } - var property = getPropertyOfObjectType(enumType, propertyName); + var property = getPropertyOfObjectType(_enumType, propertyName); if (!property || !(property.flags & 8)) { return undefined; } @@ -20579,8 +20664,8 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var declaration = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; if ((declaration.kind === 196 || (declaration.kind === 195 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -20747,18 +20832,19 @@ var ts; } function hasExportedMembers(moduleSymbol) { var declarations = moduleSymbol.declarations; - for (var i = 0; i < declarations.length; i++) { - var statements = getModuleStatements(declarations[i]); - for (var j = 0; j < statements.length; j++) { - var node = statements[j]; + for (var _i = 0; _i < declarations.length; _i++) { + var current = declarations[_i]; + var statements = getModuleStatements(current); + for (var _a = 0; _a < statements.length; _a++) { + var node = statements[_a]; if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; } var specifiers = exportClause.elements; - for (var k = 0; k < specifiers.length; k++) { - var specifier = specifiers[k]; + for (var _b = 0; _b < specifiers.length; _b++) { + var specifier = specifiers[_b]; if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) { return true; } @@ -21121,21 +21207,21 @@ var ts; } case 125: ts.Debug.assert(node.kind === 64 || node.kind === 125, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); - var parent = node.parent; - if (parent.kind === 142) { + var _parent = node.parent; + if (_parent.kind === 142) { return false; } - if (139 <= parent.kind && parent.kind <= 147) { + if (139 <= _parent.kind && _parent.kind <= 147) { return true; } - switch (parent.kind) { + switch (_parent.kind) { case 127: - return node === parent.constraint; + return node === _parent.constraint; case 130: case 129: case 128: case 193: - return node === parent.type; + return node === _parent.type; case 195: case 160: case 161: @@ -21144,16 +21230,16 @@ var ts; case 131: case 134: case 135: - return node === parent.type; + return node === _parent.type; case 136: case 137: case 138: - return node === parent.type; + return node === _parent.type; case 158: - return node === parent.type; + return node === _parent.type; case 155: case 156: - return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + return _parent.typeArguments && ts.indexOf(_parent.typeArguments, node) >= 0; case 157: return false; } @@ -21209,17 +21295,17 @@ var ts; return getNodeLinks(entityName).resolvedSymbol; } else if (entityName.kind === 125) { - var symbol = getNodeLinks(entityName).resolvedSymbol; - if (!symbol) { + var _symbol = getNodeLinks(entityName).resolvedSymbol; + if (!_symbol) { checkQualifiedName(entityName); } return getNodeLinks(entityName).resolvedSymbol; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 139 ? 793056 : 1536; - meaning |= 8388608; - return resolveEntityName(entityName, meaning); + var _meaning = entityName.parent.kind === 139 ? 793056 : 1536; + _meaning |= 8388608; + return resolveEntityName(entityName, _meaning); } return undefined; } @@ -21288,21 +21374,21 @@ var ts; return getDeclaredTypeOfSymbol(symbol); } if (isTypeDeclarationName(node)) { - var symbol = getSymbolInfo(node); - return symbol && getDeclaredTypeOfSymbol(symbol); + var _symbol = getSymbolInfo(node); + return _symbol && getDeclaredTypeOfSymbol(_symbol); } if (ts.isDeclaration(node)) { - var symbol = getSymbolOfNode(node); - return getTypeOfSymbol(symbol); + var _symbol_1 = getSymbolOfNode(node); + return getTypeOfSymbol(_symbol_1); } if (ts.isDeclarationName(node)) { - var symbol = getSymbolInfo(node); - return symbol && getTypeOfSymbol(symbol); + var _symbol_2 = getSymbolInfo(node); + return _symbol_2 && getTypeOfSymbol(_symbol_2); } if (isInRightSideOfImportOrExportAssignment(node)) { - var symbol = getSymbolInfo(node); - var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); - return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); + var _symbol_3 = getSymbolInfo(node); + var declaredType = _symbol_3 && getDeclaredTypeOfSymbol(_symbol_3); + return declaredType !== unknownType ? declaredType : getTypeOfSymbol(_symbol_3); } return unknownType; } @@ -21313,7 +21399,7 @@ var ts; return checkExpression(expr); } function getAugmentedPropertiesOfType(type) { - var type = getApparentType(type); + type = getApparentType(type); var propsByName = createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { @@ -21327,9 +21413,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456) { var symbols = []; - var name = symbol.name; + var _name = symbol.name; ts.forEach(getSymbolLinks(symbol).unionType.types, function (t) { - symbols.push(getPropertyOfType(t, name)); + symbols.push(getPropertyOfType(t, _name)); }); return symbols; } @@ -21406,8 +21492,8 @@ var ts; return ts.hasProperty(globals, name) || ts.hasProperty(sourceFile.identifiers, name) || ts.hasProperty(generatedNames, name); } function makeUniqueName(baseName) { - var name = ts.generateUniqueName(baseName, isExistingName); - return generatedNames[name] = name; + var _name = ts.generateUniqueName(baseName, isExistingName); + return generatedNames[_name] = _name; } function assignGeneratedName(node, name) { getNodeLinks(node).generatedName = ts.unescapeIdentifier(name); @@ -21419,8 +21505,8 @@ var ts; } function generateNameForModuleOrEnum(node) { if (node.name.kind === 64) { - var name = node.name.text; - assignGeneratedName(node, isUniqueLocalName(name, node) ? name : makeUniqueName(name)); + var _name = node.name.text; + assignGeneratedName(node, isUniqueLocalName(_name, node) ? _name : makeUniqueName(_name)); } } function generateNameForImportOrExportDeclaration(node) { @@ -21570,7 +21656,7 @@ var ts; return undefined; } var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || n.parent.kind === 150 ? getSymbolOfNode(n.parent) : undefined; - var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 2 | 8388608, undefined, undefined); + var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2) && symbol.valueDeclaration.parent.kind !== 217; if (isLetOrConst) { getSymbolLinks(symbol); @@ -21662,13 +21748,13 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var i = 0, n = node.modifiers.length; i < n; i++) { - var modifier = node.modifiers[i]; + for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { + var modifier = _a[_i]; switch (modifier.kind) { case 108: case 107: case 106: - var text; + var text = void 0; if (modifier.kind === 108) { text = "public"; } @@ -21866,8 +21952,8 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var i = 0, n = arguments.length; i < n; i++) { - var arg = arguments[i]; + for (var _i = 0; _i < arguments.length; _i++) { + var arg = arguments[_i]; if (arg.kind === 172) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } @@ -21892,9 +21978,8 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarModifiers(node) && node.heritageClauses) { - for (var i = 0, n = node.heritageClauses.length; i < n; i++) { - ts.Debug.assert(i <= 2); - var heritageClause = node.heritageClauses[i]; + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); @@ -21921,9 +22006,8 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var i = 0, n = node.heritageClauses.length; i < n; i++) { - ts.Debug.assert(i <= 1); - var heritageClause = node.heritageClauses[i]; + for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); @@ -21968,18 +22052,18 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var i = 0, n = node.properties.length; i < n; i++) { - var prop = node.properties[i]; - var name = prop.name; - if (prop.kind === 172 || name.kind === 126) { - checkGrammarComputedPropertyName(name); + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var prop = _a[_i]; + var _name = prop.name; + if (prop.kind === 172 || _name.kind === 126) { + checkGrammarComputedPropertyName(_name); continue; } - var currentKind; + var currentKind = void 0; if (prop.kind === 218 || prop.kind === 219) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name.kind === 7) { - checkGrammarNumbericLiteral(name); + if (_name.kind === 7) { + checkGrammarNumbericLiteral(_name); } currentKind = Property; } @@ -21995,26 +22079,26 @@ var ts; else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - if (!ts.hasProperty(seen, name.text)) { - seen[name.text] = currentKind; + if (!ts.hasProperty(seen, _name.text)) { + seen[_name.text] = currentKind; } else { - var existingKind = seen[name.text]; + var existingKind = seen[_name.text]; if (currentKind === Property && existingKind === Property) { if (inStrictMode) { - grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); + grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); } } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[name.text] = currentKind | existingKind; + seen[_name.text] = currentKind | existingKind; } else { - return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + return grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); } } else { - return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + return grammarErrorOnNode(_name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); } } } @@ -22032,12 +22116,12 @@ var ts; } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; - return grammarErrorOnNode(firstDeclaration.name, diagnostic); + var _diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + return grammarErrorOnNode(firstDeclaration.name, _diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; - return grammarErrorOnNode(firstDeclaration, diagnostic); + var _diagnostic_1 = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + return grammarErrorOnNode(firstDeclaration, _diagnostic_1); } } } @@ -22166,8 +22250,8 @@ var ts; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; - return grammarErrorOnNode(node, message); + var _message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, _message); } } function checkGrammarBindingElement(node) { @@ -22213,8 +22297,9 @@ var ts; } else { var elements = name.elements; - for (var i = 0; i < elements.length; ++i) { - checkGrammarNameInLetOrConstDeclarations(elements[i].name); + for (var _i = 0; _i < elements.length; _i++) { + var element = elements[_i]; + checkGrammarNameInLetOrConstDeclarations(element.name); } } } @@ -22270,8 +22355,8 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var i = 0, n = enumDecl.members.length; i < n; i++) { - var node = enumDecl.members[i]; + for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { + var node = _a[_i]; if (node.name.kind === 126) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } @@ -22360,8 +22445,8 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var i = 0, n = file.statements.length; i < n; i++) { - var decl = file.statements[i]; + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + var decl = _a[_i]; if (ts.isDeclaration(decl) || decl.kind === 175) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; @@ -22382,9 +22467,9 @@ var ts; return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } if (node.parent.kind === 174 || node.parent.kind === 201 || node.parent.kind === 221) { - var links = getNodeLinks(node.parent); - if (!links.hasReportedStatementInAmbientContext) { - return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); + var _links = getNodeLinks(node.parent); + if (!_links.hasReportedStatementInAmbientContext) { + return _links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); } } else { @@ -22658,11 +22743,12 @@ var ts; } function getOwnEmitOutputFilePath(sourceFile, host, extension) { var compilerOptions = host.getCompilerOptions(); + var emitOutputFilePathWithoutExtension; if (compilerOptions.outDir) { - var emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); + emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); } else { - var emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName); + emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName); } return emitOutputFilePathWithoutExtension + extension; } @@ -22742,17 +22828,17 @@ var ts; } } function createAndSetNewTextWriterWithSymbolWriter() { - var writer = createTextWriter(newLine); - writer.trackSymbol = trackSymbol; - writer.writeKeyword = writer.write; - writer.writeOperator = writer.write; - writer.writePunctuation = writer.write; - writer.writeSpace = writer.write; - writer.writeStringLiteral = writer.writeLiteral; - writer.writeParameter = writer.write; - writer.writeSymbol = writer.write; - setWriter(writer); - return writer; + var _writer = createTextWriter(newLine); + _writer.trackSymbol = trackSymbol; + _writer.writeKeyword = _writer.write; + _writer.writeOperator = _writer.write; + _writer.writePunctuation = _writer.write; + _writer.writeSpace = _writer.write; + _writer.writeStringLiteral = _writer.writeLiteral; + _writer.writeParameter = _writer.write; + _writer.writeSymbol = _writer.write; + setWriter(_writer); + return _writer; } function setWriter(newWriter) { writer = newWriter; @@ -22822,18 +22908,20 @@ var ts; } } function emitLines(nodes) { - for (var i = 0, n = nodes.length; i < n; i++) { - emit(nodes[i]); + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; + emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var i = 0, n = nodes.length; i < n; i++) { + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; if (currentWriterPos !== writer.getTextPos()) { write(separator); } currentWriterPos = writer.getTextPos(); - eachNodeEmitFn(nodes[i]); + eachNodeEmitFn(node); } } function emitCommaList(nodes, eachNodeEmitFn) { @@ -23303,13 +23391,14 @@ var ts; return; } var accessors = getAllAccessorDeclarations(node.parent.members, node); + var accessorWithTypeAnnotation; if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(node); writeTextOfNode(currentSourceFile, node.name); if (!(node.flags & 32)) { - var accessorWithTypeAnnotation = node; + accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { var anotherAccessor = node.kind === 134 ? accessors.setAccessor : accessors.getAccessor; @@ -23689,16 +23778,16 @@ var ts; } } function generateUniqueNameForLocation(location, baseName) { - var name; + var _name; if (!isExistingName(location, baseName)) { - name = baseName; + _name = baseName; } else { - name = ts.generateUniqueName(baseName, function (n) { + _name = ts.generateUniqueName(baseName, function (n) { return isExistingName(location, n); }); } - return recordNameInCurrentScope(name); + return recordNameInCurrentScope(_name); } function recordNameInCurrentScope(name) { if (!currentScopeNames) { @@ -23841,8 +23930,8 @@ var ts; if (scopeName) { var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { - var name = node.name; - if (!name || name.kind !== 126) { + var _name = node.name; + if (!_name || _name.kind !== 126) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -23861,8 +23950,8 @@ var ts; } else if (node.kind === 195 || node.kind === 160 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135 || node.kind === 200 || node.kind === 196 || node.kind === 199) { if (node.name) { - var name = node.name; - scopeName = name.kind === 126 ? ts.getTextOfNode(name) : node.name.text; + var _name = node.name; + scopeName = _name.kind === 126 ? ts.getTextOfNode(_name) : node.name.text; } recordScopeNameStart(scopeName); } @@ -23977,17 +24066,17 @@ var ts; writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } function createTempVariable(location, forLoopVariable) { - var name = forLoopVariable ? "_i" : undefined; + var _name = forLoopVariable ? "_i" : undefined; while (true) { - if (name && !isExistingName(location, name)) { + if (_name && !isExistingName(location, _name)) { break; } - name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); + _name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); tempCount++; } - recordNameInCurrentScope(name); + recordNameInCurrentScope(_name); var result = ts.createSynthesizedNode(64); - result.text = name; + result.text = _name; return result; } function recordTempDeclaration(name) { @@ -24225,7 +24314,7 @@ var ts; emitLiteral(node.head); headEmitted = true; } - for (var i = 0; i < node.templateSpans.length; i++) { + for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; var needsParens = templateSpan.expression.kind !== 159 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { @@ -24301,8 +24390,8 @@ var ts; } } function isNotExpressionIdentifier(node) { - var parent = node.parent; - switch (parent.kind) { + var _parent = node.parent; + switch (_parent.kind) { case 128: case 193: case 150: @@ -24322,7 +24411,7 @@ var ts; case 199: case 200: case 203: - return parent.name === node; + return _parent.name === node; case 185: case 184: case 209: @@ -24429,8 +24518,8 @@ var ts; function emitListWithSpread(elements, multiLine, trailingComma) { var pos = 0; var group = 0; - var length = elements.length; - while (pos < length) { + var _length = elements.length; + while (pos < _length) { if (group === 1) { write(".concat("); } @@ -24445,14 +24534,14 @@ var ts; } else { var i = pos; - while (i < length && elements[i].kind !== 171) { + while (i < _length && elements[i].kind !== 171) { i++; } write("["); if (multiLine) { increaseIndent(); } - emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + emitList(elements, pos, i - pos, multiLine, trailingComma && i === _length); if (multiLine) { decreaseIndent(); } @@ -24528,8 +24617,8 @@ var ts; var propertyDescriptor = ts.createSynthesizedNode(152); var descriptorProperties = []; if (getAccessor) { - var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); - descriptorProperties.push(getProperty); + var _getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(_getProperty); } if (setAccessor) { var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); @@ -24642,7 +24731,6 @@ var ts; } } write("{"); - var properties = node.properties; if (properties.length) { emitLinePreservingList(node, properties, languageVersion >= 1, true); } @@ -25294,7 +25382,7 @@ var ts; } function emitDestructuring(root, isAssignmentExpressionStatement, value, lowestNonSynthesizedAncestor) { var emitCount = 0; - var isDeclaration = (root.kind === 193 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 128; + var _isDeclaration = (root.kind === 193 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 128; if (root.kind === 167) { emitAssignmentExpression(root); } @@ -25319,7 +25407,7 @@ var ts; function ensureIdentifier(expr) { if (expr.kind !== 64) { var identifier = createTempVariable(lowestNonSynthesizedAncestor || root); - if (!isDeclaration) { + if (!_isDeclaration) { recordTempDeclaration(identifier); } emitAssignment(identifier, expr); @@ -25374,8 +25462,8 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var i = 0; i < properties.length; i++) { - var p = properties[i]; + for (var _i = 0; _i < properties.length; _i++) { + var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); @@ -25420,18 +25508,18 @@ var ts; } function emitAssignmentExpression(root) { var target = root.left; - var value = root.right; + var _value = root.right; if (isAssignmentExpressionStatement) { - emitDestructuringAssignment(target, value); + emitDestructuringAssignment(target, _value); } else { if (root.parent.kind !== 159) { write("("); } - value = ensureIdentifier(value); - emitDestructuringAssignment(target, value); + _value = ensureIdentifier(_value); + emitDestructuringAssignment(target, _value); write(", "); - emit(value); + emit(_value); if (root.parent.kind !== 159) { write(")"); } @@ -25499,12 +25587,12 @@ var ts; } } function emitExportVariableAssignments(node) { - var name = node.name; - if (name.kind === 64) { - emitExportMemberAssignments(name); + var _name = node.name; + if (_name.kind === 64) { + emitExportMemberAssignments(_name); } - else if (ts.isBindingPattern(name)) { - ts.forEach(name.elements, emitExportVariableAssignments); + else if (ts.isBindingPattern(_name)) { + ts.forEach(_name.elements, emitExportVariableAssignments); } } function getCombinedFlagsForIdentifier(node) { @@ -25526,8 +25614,8 @@ var ts; return; } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 221 ? blockScopeContainer : blockScopeContainer.parent; - var generatedName = generateUniqueNameForLocation(parent, node.text); + var _parent = blockScopeContainer.kind === 221 ? blockScopeContainer : blockScopeContainer.parent; + var generatedName = generateUniqueNameForLocation(_parent, node.text); var variableId = resolver.getBlockScopedVariableId(node); if (!generatedBlockScopeNames) { generatedBlockScopeNames = []; @@ -25547,12 +25635,12 @@ var ts; function emitParameter(node) { if (languageVersion < 2) { if (ts.isBindingPattern(node.name)) { - var name = createTempVariable(node); + var _name = createTempVariable(node); if (!tempParameters) { tempParameters = []; } - tempParameters.push(name); - emit(name); + tempParameters.push(_name); + emit(_name); } else { emit(node.name); @@ -25798,9 +25886,10 @@ var ts; decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var i = 0, n = body.statements.length; i < n; i++) { + for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { + var statement = _a[_i]; write(" "); - emit(body.statements[i]); + emit(statement); } emitTempDeclarations(false); write(" "); @@ -26038,11 +26127,12 @@ var ts; emitDetachedComments(ctor.body.statements); } emitCaptureThisForNodeIfNecessary(node); + var superCall; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); if (baseTypeNode) { - var superCall = findInitialSuperCall(ctor); + superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); emit(superCall); @@ -26389,8 +26479,8 @@ var ts; if (specifier.name.text === "default") { exportDefault = exportDefault || specifier; } - var name = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name] || (exportSpecifiers[name] = [])).push(specifier); + var _name = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[_name] || (exportSpecifiers[_name] = [])).push(specifier); }); } else if (node.kind === 209) { @@ -26413,8 +26503,8 @@ var ts; } function getExternalImportInfo(node) { if (externalImports) { - for (var i = 0; i < externalImports.length; i++) { - var info = externalImports[i]; + for (var _i = 0; _i < externalImports.length; _i++) { + var info = externalImports[_i]; if (info.rootNode === node) { return info; } @@ -26575,12 +26665,12 @@ var ts; if (node.flags & 2) { return emitPinnedOrTripleSlashComments(node); } - var emitComments = shouldEmitLeadingAndTrailingComments(node); - if (emitComments) { + var _emitComments = shouldEmitLeadingAndTrailingComments(node); + if (_emitComments) { emitLeadingComments(node); } emitJavaScriptWorker(node); - if (emitComments) { + if (_emitComments) { emitTrailingComments(node); } } @@ -26905,9 +26995,10 @@ var ts; } var unsupportedFileEncodingErrorCode = -2147024809; function getSourceFile(fileName, languageVersion, onError) { + var text; try { var start = new Date().getTime(); - var text = ts.sys.readFile(fileName, options.charset); + text = ts.sys.readFile(fileName, options.charset); ts.ioReadTime += new Date().getTime() - start; } catch (e) { @@ -27124,9 +27215,11 @@ var ts; processSourceFile(ts.normalizePath(fileName), isDefaultLib); } function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { + var start; + var _length; if (refEnd !== undefined && refPos !== undefined) { - var start = refPos; - var length = refEnd - refPos; + start = refPos; + _length = refEnd - refPos; } var diagnostic; if (hasExtension(fileName)) { @@ -27151,7 +27244,7 @@ var ts; } if (diagnostic) { if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); + diagnostics.add(ts.createFileDiagnostic(refFile, start, _length, diagnostic, fileName)); } else { diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); @@ -27192,17 +27285,17 @@ var ts; files.push(file); } } + return file; } - return file; function getSourceFileFromCache(fileName, canonicalName, useAbsolutePath) { - var file = filesByName[canonicalName]; - if (file && host.useCaseSensitiveFileNames()) { - var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; + var _file = filesByName[canonicalName]; + if (_file && host.useCaseSensitiveFileNames()) { + var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(_file.fileName, host.getCurrentDirectory()) : _file.fileName; if (canonicalName !== sourceFileName) { diagnostics.add(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } } - return file; + return _file; } } function processReferencedFiles(file, basePath) { @@ -27239,10 +27332,10 @@ var ts; var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { - var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); + var _searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); + var tsFile = findModuleSourceFile(_searchName + ".ts", nameLiteral); if (!tsFile) { - findModuleSourceFile(searchName + ".d.ts", nameLiteral); + findModuleSourceFile(_searchName + ".d.ts", nameLiteral); } } } @@ -27693,17 +27786,17 @@ var ts; switch (n.kind) { case 174: if (!ts.isFunctionBlock(n)) { - var parent = n.parent; + var _parent = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent.kind === 179 || parent.kind === 182 || parent.kind === 183 || parent.kind === 181 || parent.kind === 178 || parent.kind === 180 || parent.kind === 187 || parent.kind === 217) { - addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); + if (_parent.kind === 179 || _parent.kind === 182 || _parent.kind === 183 || _parent.kind === 181 || _parent.kind === 178 || _parent.kind === 180 || _parent.kind === 187 || _parent.kind === 217) { + addOutliningSpan(_parent, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent.kind === 191) { - var tryStatement = parent; + if (_parent.kind === 191) { + var tryStatement = _parent; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(_parent, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -27724,19 +27817,23 @@ var ts; break; } case 201: - var openBrace = ts.findChildOfKind(n, 14, sourceFile); - var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); - break; + { + var _openBrace = ts.findChildOfKind(n, 14, sourceFile); + var _closeBrace = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n.parent, _openBrace, _closeBrace, autoCollapse(n)); + break; + } case 196: case 197: case 199: case 152: case 202: - var openBrace = ts.findChildOfKind(n, 14, sourceFile); - var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); - break; + { + var _openBrace_1 = ts.findChildOfKind(n, 14, sourceFile); + var _closeBrace_1 = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n, _openBrace_1, _closeBrace_1, autoCollapse(n)); + break; + } case 151: var openBracket = ts.findChildOfKind(n, 18, sourceFile); var closeBracket = ts.findChildOfKind(n, 19, sourceFile); @@ -27763,8 +27860,8 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - var declaration = declarations[i]; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; var name = getDeclarationName(declaration); if (name !== undefined) { var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name); @@ -27801,8 +27898,9 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var i = 0, n = matches.length; i < n; i++) { - if (!matches[i].isCaseSensitive) { + for (var _i = 0; _i < matches.length; _i++) { + var match = matches[_i]; + if (!match.isCaseSensitive) { return false; } } @@ -27878,14 +27976,15 @@ var ts; } function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); - var bestMatchKind = 3; - for (var i = 0, n = matches.length; i < n; i++) { - var kind = matches[i].kind; - if (kind < bestMatchKind) { - bestMatchKind = kind; + var _bestMatchKind = 3; + for (var _i = 0; _i < matches.length; _i++) { + var match = matches[_i]; + var kind = match.kind; + if (kind < _bestMatchKind) { + _bestMatchKind = kind; } } - return bestMatchKind; + return _bestMatchKind; } var baseSensitivity = { sensitivity: "base" @@ -28015,8 +28114,8 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var i = 0, n = nodes.length; i < n; i++) { - var node = nodes[i]; + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; switch (node.kind) { case 196: case 199: @@ -28056,19 +28155,19 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var i = 0, n = nodes.length; i < n; i++) { - var child = nodes[i]; - var item = createItem(child); - if (item !== undefined) { - if (item.text.length > 0) { - var key = item.text + "-" + item.kind + "-" + item.indent; + for (var _i = 0; _i < nodes.length; _i++) { + var child = nodes[_i]; + var _item = createItem(child); + if (_item !== undefined) { + if (_item.text.length > 0) { + var key = _item.text + "-" + _item.kind + "-" + _item.indent; var itemWithSameName = keyToItem[key]; if (itemWithSameName) { - merge(itemWithSameName, item); + merge(itemWithSameName, _item); } else { - keyToItem[key] = item; - items.push(item); + keyToItem[key] = _item; + items.push(_item); } } } @@ -28081,10 +28180,10 @@ var ts; if (!target.childItems) { target.childItems = []; } - outer: for (var i = 0, n = source.childItems.length; i < n; i++) { - var sourceChild = source.childItems[i]; - for (var j = 0, m = target.childItems.length; j < m; j++) { - var targetChild = target.childItems[j]; + outer: for (var _i = 0, _a = source.childItems; _i < _a.length; _i++) { + var sourceChild = _a[_i]; + for (var _b = 0, _c = target.childItems; _b < _c.length; _b++) { + var targetChild = _c[_b]; if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { merge(targetChild, sourceChild); continue outer; @@ -28127,9 +28226,9 @@ var ts; case 193: case 150: var variableDeclarationNode; - var name; + var _name; if (node.kind === 150) { - name = node.name; + _name = node.name; variableDeclarationNode = node; while (variableDeclarationNode && variableDeclarationNode.kind !== 193) { variableDeclarationNode = variableDeclarationNode.parent; @@ -28139,16 +28238,16 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name = node.name; + _name = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(_name), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(_name), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(_name), ts.ScriptElementKind.variableElement); } case 133: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); @@ -28256,7 +28355,7 @@ var ts; return !ts.isBindingPattern(p.name); })); } - var childItems = getItemsWorker(sortNodes(nodes), createChildItem); + childItems = getItemsWorker(sortNodes(nodes), createChildItem); } return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [ getNodeSpan(node) @@ -28384,8 +28483,8 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var i = 0, n = wordSpans.length; i < n; i++) { - var span = wordSpans[i]; + for (var _i = 0; _i < wordSpans.length; _i++) { + var span = wordSpans[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(2, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); } @@ -28439,8 +28538,8 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var i = 0, n = subWordTextChunks.length; i < n; i++) { - var subWordTextChunk = subWordTextChunks[i]; + for (var _i = 0; _i < subWordTextChunks.length; _i++) { + var subWordTextChunk = subWordTextChunks[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { return undefined; @@ -28466,10 +28565,10 @@ var ts; } } else { - for (var i = 0; i < patternPartLength; i++) { - var ch1 = pattern.charCodeAt(patternPartStart + i); - var ch2 = candidate.charCodeAt(candidateSpan.start + i); - if (ch1 !== ch2) { + for (var _i = 0; _i < patternPartLength; _i++) { + var _ch1 = pattern.charCodeAt(patternPartStart + _i); + var _ch2 = candidate.charCodeAt(candidateSpan.start + _i); + if (_ch1 !== _ch2) { return false; } } @@ -28791,15 +28890,15 @@ var ts; } var listItemInfo = ts.findListItemInfo(node); if (listItemInfo) { - var list = listItemInfo.list; - var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; - var argumentIndex = getArgumentIndex(list, node); - var argumentCount = getArgumentCount(list); + var _list = listItemInfo.list; + var _isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === _list.pos; + var argumentIndex = getArgumentIndex(_list, node); + var argumentCount = getArgumentCount(_list); ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); return { - kind: isTypeArgList ? 0 : 1, + kind: _isTypeArgList ? 0 : 1, invocation: callExpression, - argumentsSpan: getApplicableSpanForArguments(list), + argumentsSpan: getApplicableSpanForArguments(_list), argumentIndex: argumentIndex, argumentCount: argumentCount }; @@ -28814,28 +28913,28 @@ var ts; var templateExpression = node.parent; var tagExpression = templateExpression.parent; ts.Debug.assert(templateExpression.kind === 169); - var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; - return getArgumentListInfoForTemplate(tagExpression, argumentIndex); + var _argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; + return getArgumentListInfoForTemplate(tagExpression, _argumentIndex); } else if (node.parent.kind === 173 && node.parent.parent.parent.kind === 157) { var templateSpan = node.parent; - var templateExpression = templateSpan.parent; - var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 169); + var _templateExpression = templateSpan.parent; + var _tagExpression = _templateExpression.parent; + ts.Debug.assert(_templateExpression.kind === 169); if (node.kind === 13 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } - var spanIndex = templateExpression.templateSpans.indexOf(templateSpan); - var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node); - return getArgumentListInfoForTemplate(tagExpression, argumentIndex); + var spanIndex = _templateExpression.templateSpans.indexOf(templateSpan); + var _argumentIndex_1 = getArgumentIndexForTemplatePiece(spanIndex, node); + return getArgumentListInfoForTemplate(_tagExpression, _argumentIndex_1); } return undefined; } function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var i = 0, n = listChildren.length; i < n; i++) { - var child = listChildren[i]; + for (var _i = 0; _i < listChildren.length; _i++) { + var child = listChildren[_i]; if (child === node) { break; } @@ -28901,9 +29000,9 @@ var ts; if (n.pos < n.parent.pos || n.end > n.parent.end) { ts.Debug.fail("Node of kind " + n.kind + " is not a subspan of its parent of kind " + n.parent.kind); } - var argumentInfo = getImmediatelyContainingArgumentInfo(n); - if (argumentInfo) { - return argumentInfo; + var _argumentInfo = getImmediatelyContainingArgumentInfo(n); + if (_argumentInfo) { + return _argumentInfo; } } return undefined; @@ -29159,8 +29258,8 @@ var ts; return n; } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; ++i) { - var child = children[i]; + for (var _i = 0; _i < children.length; _i++) { + var child = children[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { return find(child); @@ -29185,7 +29284,7 @@ var ts; return n; } var children = n.getChildren(); - for (var i = 0, len = children.length; i < len; ++i) { + for (var i = 0, len = children.length; i < len; i++) { var child = children[i]; if (nodeHasTokens(child)) { if (position <= child.end) { @@ -29201,8 +29300,8 @@ var ts; } ts.Debug.assert(startNode !== undefined || n.kind === 221); if (children.length) { - var candidate = findRightmostChildNodeWithTokens(children, children.length); - return candidate && findRightmostToken(candidate); + var _candidate = findRightmostChildNodeWithTokens(children, children.length); + return _candidate && findRightmostToken(_candidate); } } function findRightmostChildNodeWithTokens(children, exclusiveStartPosition) { @@ -29517,21 +29616,21 @@ var ts; var t; var pos = scanner.getStartPos(); while (pos < endPos) { - var t = scanner.getToken(); - if (!ts.isTrivia(t)) { + var _t = scanner.getToken(); + if (!ts.isTrivia(_t)) { break; } scanner.scan(); - var item = { + var _item = { pos: pos, end: scanner.getStartPos(), - kind: t + kind: _t }; pos = scanner.getStartPos(); if (!leadingTrivia) { leadingTrivia = []; } - leadingTrivia.push(item); + leadingTrivia.push(_item); } savedPos = scanner.getStartPos(); } @@ -29628,8 +29727,8 @@ var ts; } function isOnToken() { var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); - var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); - return startPos < endPos && current !== 1 && !ts.isTrivia(current); + var _startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); + return _startPos < endPos && current !== 1 && !ts.isTrivia(current); } function fixTokenKind(tokenInfo, container) { if (ts.isToken(container) && tokenInfo.token.kind !== container.kind) { @@ -29850,8 +29949,9 @@ var ts; if (this.IsAny()) { return true; } - for (var i = 0, len = this.customContextChecks.length; i < len; i++) { - if (!this.customContextChecks[i](context)) { + for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) { + var check = _a[_i]; + if (!check(context)) { return false; } } @@ -30094,9 +30194,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name in o) { - if (o[name] === rule) { - return name; + for (var _name in o) { + if (o[_name] === rule) { + return _name; } } throw new Error("Unknown rule"); @@ -30337,10 +30437,11 @@ var ts; var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var i = 0, len = bucket.Rules().length; i < len; i++) { - var rule = bucket.Rules()[i]; - if (rule.Operation.Context.InContext(context)) + for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) { + var rule = _a[_i]; + if (rule.Operation.Context.InContext(context)) { return rule; + } } } return null; @@ -30712,13 +30813,13 @@ var ts; } formatting.formatSelection = formatSelection; function formatOutermostParent(position, expectedLastToken, sourceFile, options, rulesProvider, requestKind) { - var parent = findOutermostParent(position, expectedLastToken, sourceFile); - if (!parent) { + var _parent = findOutermostParent(position, expectedLastToken, sourceFile); + if (!_parent) { return []; } var span = { - pos: ts.getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), - end: parent.end + pos: ts.getLineStartPositionForPosition(_parent.getStart(sourceFile), sourceFile), + end: _parent.end }; return formatSpan(span, sourceFile, options, rulesProvider, requestKind); } @@ -30854,10 +30955,10 @@ var ts; } } else { - var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; + var _startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; var startLinePosition = ts.getLineStartPositionForPosition(startPos, sourceFile); var column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); - if (startLine !== parentStartLine || startPos === column) { + if (_startLine !== parentStartLine || startPos === column) { return column; } } @@ -30975,19 +31076,19 @@ var ts; return inheritedIndentation; } while (formattingScanner.isOnToken()) { - var tokenInfo = formattingScanner.readTokenInfo(node); - if (tokenInfo.token.end > childStartPos) { + var _tokenInfo = formattingScanner.readTokenInfo(node); + if (_tokenInfo.token.end > childStartPos) { break; } - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(_tokenInfo, node, parentDynamicIndentation); } if (!formattingScanner.isOnToken()) { return inheritedIndentation; } if (ts.isToken(child)) { - var tokenInfo = formattingScanner.readTokenInfo(child); - ts.Debug.assert(tokenInfo.token.end === child.end); - consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + var _tokenInfo_1 = formattingScanner.readTokenInfo(child); + ts.Debug.assert(_tokenInfo_1.token.end === child.end); + consumeTokenAndAdvanceScanner(_tokenInfo_1, node, parentDynamicIndentation); return inheritedIndentation; } var childIndentation = computeIndentation(child, childStart.line, childIndentationAmount, node, parentDynamicIndentation, parentStartLine); @@ -30999,33 +31100,34 @@ var ts; var listStartToken = getOpenTokenForList(parent, nodes); var listEndToken = getCloseTokenForOpenToken(listStartToken); var listDynamicIndentation = parentDynamicIndentation; - var startLine = parentStartLine; + var _startLine = parentStartLine; if (listStartToken !== 0) { while (formattingScanner.isOnToken()) { - var tokenInfo = formattingScanner.readTokenInfo(parent); - if (tokenInfo.token.end > nodes.pos) { + var _tokenInfo = formattingScanner.readTokenInfo(parent); + if (_tokenInfo.token.end > nodes.pos) { break; } - else if (tokenInfo.token.kind === listStartToken) { - startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; - var indentation = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, startLine); - listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation.indentation, indentation.delta); - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + else if (_tokenInfo.token.kind === listStartToken) { + _startLine = sourceFile.getLineAndCharacterOfPosition(_tokenInfo.token.pos).line; + var _indentation = computeIndentation(_tokenInfo.token, _startLine, -1, parent, parentDynamicIndentation, _startLine); + listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, _indentation.indentation, _indentation.delta); + consumeTokenAndAdvanceScanner(_tokenInfo, parent, listDynamicIndentation); } else { - consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + consumeTokenAndAdvanceScanner(_tokenInfo, parent, parentDynamicIndentation); } } } var inheritedIndentation = -1; - for (var i = 0, len = nodes.length; i < len; ++i) { - inheritedIndentation = processChildNode(nodes[i], inheritedIndentation, node, listDynamicIndentation, startLine, true); + for (var _i = 0; _i < nodes.length; _i++) { + var child = nodes[_i]; + inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, _startLine, true); } if (listEndToken !== 0) { if (formattingScanner.isOnToken()) { - var tokenInfo = formattingScanner.readTokenInfo(parent); - if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { - consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + var _tokenInfo_1 = formattingScanner.readTokenInfo(parent); + if (_tokenInfo_1.token.kind === listEndToken && ts.rangeContainsRange(parent, _tokenInfo_1.token)) { + consumeTokenAndAdvanceScanner(_tokenInfo_1, parent, listDynamicIndentation); } } } @@ -31062,8 +31164,8 @@ var ts; if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var i = 0, len = currentTokenInfo.leadingTrivia.length; i < len; ++i) { - var triviaItem = currentTokenInfo.leadingTrivia[i]; + for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { + var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; } @@ -31076,8 +31178,8 @@ var ts; break; case 2: if (indentNextTokenOrTrivia) { - var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); - insertIndentation(triviaItem.pos, commentIndentation, false); + var _commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); + insertIndentation(triviaItem.pos, _commentIndentation, false); indentNextTokenOrTrivia = false; } break; @@ -31097,8 +31199,8 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var i = 0, len = trivia.length; i < len; ++i) { - var triviaItem = trivia[i]; + for (var _i = 0; _i < trivia.length; _i++) { + var triviaItem = trivia[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); @@ -31166,18 +31268,19 @@ var ts; } } function indentMultilineComment(commentRange, indentation, firstLineIsIndented) { - var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; + var _startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; - if (startLine === endLine) { + var parts; + if (_startLine === endLine) { if (!firstLineIsIndented) { insertIndentation(commentRange.pos, indentation, false); } return; } else { - var parts = []; + parts = []; var startPos = commentRange.pos; - for (var line = startLine; line < endLine; ++line) { + for (var line = _startLine; line < endLine; ++line) { var endOfLine = ts.getEndLinePosition(line, sourceFile); parts.push({ pos: startPos, @@ -31190,7 +31293,7 @@ var ts; end: commentRange.end }); } - var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); + var startLinePos = ts.getStartPositionOfLine(_startLine, sourceFile); var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options); if (indentation === nonWhitespaceColumnInFirstPart.column) { return; @@ -31198,19 +31301,19 @@ var ts; var startIndex = 0; if (firstLineIsIndented) { startIndex = 1; - startLine++; + _startLine++; } - var delta = indentation - nonWhitespaceColumnInFirstPart.column; - for (var i = startIndex, len = parts.length; i < len; ++i, ++startLine) { - var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); + var _delta = indentation - nonWhitespaceColumnInFirstPart.column; + for (var i = startIndex, len = parts.length; i < len; ++i, ++_startLine) { + var _startLinePos = ts.getStartPositionOfLine(_startLine, sourceFile); var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); - var newIndentation = nonWhitespaceCharacterAndColumn.column + delta; + var newIndentation = nonWhitespaceCharacterAndColumn.column + _delta; if (newIndentation > 0) { var indentationString = getIndentationString(newIndentation, options); - recordReplace(startLinePos, nonWhitespaceCharacterAndColumn.character, indentationString); + recordReplace(_startLinePos, nonWhitespaceCharacterAndColumn.character, indentationString); } else { - recordDelete(startLinePos, nonWhitespaceCharacterAndColumn.character); + recordDelete(_startLinePos, nonWhitespaceCharacterAndColumn.character); } } } @@ -31415,9 +31518,9 @@ var ts; } break; } - var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); - if (actualIndentation !== -1) { - return actualIndentation; + var _actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (_actualIndentation !== -1) { + return _actualIndentation; } previous = current; current = current.parent; @@ -31434,9 +31537,9 @@ var ts; } SmartIndenter.getIndentationForNode = getIndentationForNode; function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) { - var parent = current.parent; + var _parent = current.parent; var parentStart; - while (parent) { + while (_parent) { var useActualIndentation = true; if (ignoreActualIndentationRange) { var start = current.getStart(sourceFile); @@ -31448,20 +31551,20 @@ var ts; return actualIndentation + indentationDelta; } } - parentStart = getParentStart(parent, current, sourceFile); - var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); + parentStart = getParentStart(_parent, current, sourceFile); + var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(_parent, current, currentStart.line, sourceFile); if (useActualIndentation) { - var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); - if (actualIndentation !== -1) { - return actualIndentation + indentationDelta; + var _actualIndentation = getActualIndentationForNode(current, _parent, currentStart, parentAndChildShareLine, sourceFile, options); + if (_actualIndentation !== -1) { + return _actualIndentation + indentationDelta; } } - if (shouldIndentChildNode(parent.kind, current.kind) && !parentAndChildShareLine) { + if (shouldIndentChildNode(_parent.kind, current.kind) && !parentAndChildShareLine) { indentationDelta += options.IndentSize; } - current = parent; + current = _parent; currentStart = parentStart; - parent = current.parent; + _parent = current.parent; } return indentationDelta; } @@ -31537,24 +31640,28 @@ var ts; case 131: case 136: case 137: - var start = node.getStart(sourceFile); - if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { - return node.parent.typeParameters; + { + var start = node.getStart(sourceFile); + if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { + return node.parent.typeParameters; + } + if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { + return node.parent.parameters; + } + break; } - if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { - return node.parent.parameters; - } - break; case 156: case 155: - var start = node.getStart(sourceFile); - if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { - return node.parent.typeArguments; + { + var _start = node.getStart(sourceFile); + if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, _start, node.getEnd())) { + return node.parent.typeArguments; + } + if (node.parent.arguments && ts.rangeContainsStartEnd(node.parent.arguments, _start, node.getEnd())) { + return node.parent.arguments; + } + break; } - if (node.parent.arguments && ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { - return node.parent.arguments; - } - break; } } return undefined; @@ -31823,8 +31930,8 @@ var ts; var list = createNode(222, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; - for (var i = 0, len = nodes.length; i < len; i++) { - var node = nodes[i]; + for (var _i = 0; _i < nodes.length; _i++) { + var node = nodes[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -31838,9 +31945,10 @@ var ts; }; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; + var children; if (this.kind >= 125) { scanner.setText((sourceFile || this.getSourceFile()).text); - var children = []; + children = []; var pos = this.pos; var processNode = function (node) { if (pos < node.pos) { @@ -31881,8 +31989,8 @@ var ts; }; NodeObject.prototype.getFirstToken = function (sourceFile) { var children = this.getChildren(); - for (var i = 0; i < children.length; i++) { - var child = children[i]; + for (var _i = 0; _i < children.length; _i++) { + var child = children[_i]; if (child.kind < 125) { return child; } @@ -32001,7 +32109,7 @@ var ts; } function getCleanedJsDocComment(pos, end, sourceFile) { var spacesToRemoveAfterAsterisk; - var docComments = []; + var _docComments = []; var blankLineCount = 0; var isInParamTag = false; while (pos < end) { @@ -32036,14 +32144,14 @@ var ts; } pos = consumeLineBreaks(pos, end, sourceFile); if (docCommentTextOfLine) { - pushDocCommentLineText(docComments, docCommentTextOfLine, blankLineCount); + pushDocCommentLineText(_docComments, docCommentTextOfLine, blankLineCount); blankLineCount = 0; } - else if (!isInParamTag && docComments.length) { + else if (!isInParamTag && _docComments.length) { blankLineCount++; } } - return docComments; + return _docComments; } function getCleanedParamJsDocComment(pos, end, sourceFile) { var paramHelpStringMargin; @@ -32144,8 +32252,8 @@ var ts; } var consumedSpaces = pos - startOfLinePos; if (consumedSpaces < paramHelpStringMargin) { - var ch = sourceFile.text.charCodeAt(pos); - if (ch === 42) { + var _ch = sourceFile.text.charCodeAt(pos); + if (_ch === 42) { pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, paramHelpStringMargin - consumedSpaces - 1); } } @@ -32473,8 +32581,8 @@ var ts; if (declaration.kind !== 193 && declaration.kind !== 195) { return false; } - for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { - if (parent.kind === 221 || parent.kind === 201) { + for (var _parent = declaration.parent; !ts.isFunctionBlock(_parent); _parent = _parent.parent) { + if (_parent.kind === 221 || _parent.kind === 201) { return false; } } @@ -32515,8 +32623,9 @@ var ts; this.host = host; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); - for (var i = 0, n = rootFileNames.length; i < n; i++) { - this.createEntry(rootFileNames[i]); + for (var _i = 0; _i < rootFileNames.length; _i++) { + var fileName = rootFileNames[_i]; + this.createEntry(fileName); } this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); } @@ -32575,17 +32684,17 @@ var ts; if (!scriptSnapshot) { throw new Error("Could not find file: '" + fileName + "'."); } - var version = this.host.getScriptVersion(fileName); + var _version = this.host.getScriptVersion(fileName); var sourceFile; if (this.currentFileName !== fileName) { - sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2, version, true); + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2, _version, true); } - else if (this.currentFileVersion !== version) { + else if (this.currentFileVersion !== _version) { var editRange = scriptSnapshot.getChangeRange(this.currentFileScriptSnapshot); - sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange); + sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, _version, editRange); } if (sourceFile) { - this.currentFileVersion = version; + this.currentFileVersion = _version; this.currentFileName = fileName; this.currentFileScriptSnapshot = scriptSnapshot; this.currentSourceFile = sourceFile; @@ -33108,8 +33217,9 @@ var ts; }); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var i = 0, n = oldSourceFiles.length; i < n; i++) { - var fileName = oldSourceFiles[i].fileName; + for (var _i = 0; _i < oldSourceFiles.length; _i++) { + var oldSourceFile = oldSourceFiles[_i]; + var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { documentRegistry.releaseDocument(fileName, oldSettings); } @@ -33124,8 +33234,8 @@ var ts; return undefined; } if (!changesInCompilationSettingsAffectSyntax) { - var oldSourceFile = program && program.getSourceFile(fileName); - if (oldSourceFile) { + var _oldSourceFile = program && program.getSourceFile(fileName); + if (_oldSourceFile) { return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); } } @@ -33142,8 +33252,9 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var i = 0, n = rootFileNames.length; i < n; i++) { - if (!sourceFileUpToDate(program.getSourceFile(rootFileNames[i]))) { + for (var _a = 0; _a < rootFileNames.length; _a++) { + var _fileName = rootFileNames[_a]; + if (!sourceFileUpToDate(program.getSourceFile(_fileName))) { return false; } } @@ -33195,8 +33306,8 @@ var ts; displayName = displayName.substring(1, displayName.length - 1); } var isValid = ts.isIdentifierStart(displayName.charCodeAt(0), target); - for (var i = 1, n = displayName.length; isValid && i < n; i++) { - isValid = ts.isIdentifierPart(displayName.charCodeAt(i), target); + for (var _i = 1, n = displayName.length; isValid && _i < n; _i++) { + isValid = ts.isIdentifierPart(displayName.charCodeAt(_i), target); } if (isValid) { return ts.unescapeIdentifier(displayName); @@ -33222,20 +33333,20 @@ var ts; var start = new Date().getTime(); var currentToken = ts.getTokenAtPosition(sourceFile, position); log("getCompletionsAtPosition: Get current token: " + (new Date().getTime() - start)); - var start = new Date().getTime(); + start = new Date().getTime(); var insideComment = isInsideComment(sourceFile, currentToken, position); log("getCompletionsAtPosition: Is inside comment: " + (new Date().getTime() - start)); if (insideComment) { log("Returning an empty list because completion was inside a comment."); return undefined; } - var start = new Date().getTime(); + start = new Date().getTime(); var previousToken = ts.findPrecedingToken(position, sourceFile); log("getCompletionsAtPosition: Get previous token 1: " + (new Date().getTime() - start)); if (previousToken && position <= previousToken.end && previousToken.kind === 64) { - var start = new Date().getTime(); + var _start = new Date().getTime(); previousToken = ts.findPrecedingToken(previousToken.pos, sourceFile); - log("getCompletionsAtPosition: Get previous token 2: " + (new Date().getTime() - start)); + log("getCompletionsAtPosition: Get previous token 2: " + (new Date().getTime() - _start)); } if (previousToken && isCompletionListBlocker(previousToken)) { log("Returning an empty list because completion was requested in an invalid position."); @@ -33263,12 +33374,14 @@ var ts; typeChecker: typeInfoResolver }; log("getCompletionsAtPosition: Syntactic work: " + (new Date().getTime() - syntacticStart)); - var location = ts.getTouchingPropertyName(sourceFile, position); + var _location = ts.getTouchingPropertyName(sourceFile, position); var semanticStart = new Date().getTime(); + var isMemberCompletion; + var isNewIdentifierLocation; if (isRightOfDot) { var symbols = []; - var isMemberCompletion = true; - var isNewIdentifierLocation = false; + isMemberCompletion = true; + isNewIdentifierLocation = false; if (node.kind === 64 || node.kind === 125 || node.kind === 153) { var symbol = typeInfoResolver.getSymbolAtLocation(node); if (symbol && symbol.flags & 8388608) { @@ -33322,8 +33435,8 @@ var ts; isMemberCompletion = false; isNewIdentifierLocation = isNewIdentifierDefinitionLocation(previousToken); var symbolMeanings = 793056 | 107455 | 1536 | 8388608; - var symbols = typeInfoResolver.getSymbolsInScope(node, symbolMeanings); - getCompletionEntriesFromSymbols(symbols, activeCompletionSession); + var _symbols = typeInfoResolver.getSymbolsInScope(node, symbolMeanings); + getCompletionEntriesFromSymbols(_symbols, activeCompletionSession); } } if (!isMemberCompletion) { @@ -33337,9 +33450,9 @@ var ts; entries: activeCompletionSession.entries }; function getCompletionEntriesFromSymbols(symbols, session) { - var start = new Date().getTime(); + var _start_1 = new Date().getTime(); ts.forEach(symbols, function (symbol) { - var entry = createCompletionEntry(symbol, session.typeChecker, location); + var entry = createCompletionEntry(symbol, session.typeChecker, _location); if (entry) { var id = ts.escapeIdentifier(entry.name); if (!ts.lookUp(session.symbols, id)) { @@ -33348,12 +33461,12 @@ var ts; } } }); - log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - _start_1)); } function isCompletionListBlocker(previousToken) { - var start = new Date().getTime(); + var _start_1 = new Date().getTime(); var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); - log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); + log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - _start_1)); return result; } function showCompletionsInImportsClause(node) { @@ -33402,9 +33515,9 @@ var ts; } function isInStringOrRegularExpressionOrTemplateLiteral(previousToken) { if (previousToken.kind === 8 || previousToken.kind === 9 || ts.isTemplateLiteralKind(previousToken.kind)) { - var start = previousToken.getStart(); + var _start_1 = previousToken.getStart(); var end = previousToken.getEnd(); - if (start < position && position < end) { + if (_start_1 < position && position < end) { return true; } else if (position === end) { @@ -33415,12 +33528,12 @@ var ts; } function getContainingObjectLiteralApplicableForCompletion(previousToken) { if (previousToken) { - var parent = previousToken.parent; + var _parent = previousToken.parent; switch (previousToken.kind) { case 14: case 23: - if (parent && parent.kind === 152) { - return parent; + if (_parent && _parent.kind === 152) { + return _parent; } break; } @@ -33511,8 +33624,8 @@ var ts; } if (importDeclaration.importClause.namedBindings && importDeclaration.importClause.namedBindings.kind === 207) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { - var name = el.propertyName || el.name; - exisingImports[name.text] = true; + var _name = el.propertyName || el.name; + exisingImports[_name.text] = true; }); } if (ts.isEmpty(exisingImports)) { @@ -33536,13 +33649,13 @@ var ts; } existingMemberNames[m.name.text] = true; }); - var filteredMembers = []; + var _filteredMembers = []; ts.forEach(contextualMemberSymbols, function (s) { if (!existingMemberNames[s.name]) { - filteredMembers.push(s); + _filteredMembers.push(s); } }); - return filteredMembers; + return _filteredMembers; } } function getCompletionEntryDetails(fileName, position, entryName) { @@ -33553,10 +33666,10 @@ var ts; } var symbol = ts.lookUp(activeCompletionSession.symbols, ts.escapeIdentifier(entryName)); if (symbol) { - var location = ts.getTouchingPropertyName(sourceFile, position); - var completionEntry = createCompletionEntry(symbol, session.typeChecker, location); - ts.Debug.assert(session.typeChecker.getTypeOfSymbolAtLocation(symbol, location) !== undefined, "Could not find type for symbol"); - var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location, session.typeChecker, location, 7); + var _location = ts.getTouchingPropertyName(sourceFile, position); + var completionEntry = createCompletionEntry(symbol, session.typeChecker, _location); + ts.Debug.assert(session.typeChecker.getTypeOfSymbolAtLocation(symbol, _location) !== undefined, "Could not find type for symbol"); + var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), _location, session.typeChecker, _location, 7); return { name: entryName, kind: displayPartsDocumentationsAndSymbolKind.symbolKind, @@ -33679,11 +33792,13 @@ var ts; var symbolFlags = symbol.flags; var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, typeResolver, location); var hasAddedSymbolInfo; + var type; if (symbolKind !== ScriptElementKind.unknown || symbolFlags & 32 || symbolFlags & 8388608) { if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { symbolKind = ScriptElementKind.memberVariableElement; } - var type = typeResolver.getTypeOfSymbolAtLocation(symbol, location); + var signature; + type = typeResolver.getTypeOfSymbolAtLocation(symbol, location); if (type) { if (location.parent && location.parent.kind === 153) { var right = location.parent.name; @@ -33754,14 +33869,13 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || (location.kind === 113 && location.parent.kind === 133)) { - var signature; var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 133 ? type.getConstructSignatures() : type.getCallSignatures(); + var _allSignatures = functionDeclaration.kind === 133 ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeResolver.isImplementationOfOverload(functionDeclaration)) { signature = typeResolver.getSignatureFromDeclaration(functionDeclaration); } else { - signature = allSignatures[0]; + signature = _allSignatures[0]; } if (functionDeclaration.kind === 133) { symbolKind = ScriptElementKind.constructorImplementationElement; @@ -33770,7 +33884,7 @@ var ts; else { addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 136 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } - addSignatureDisplayParts(signature, allSignatures); + addSignatureDisplayParts(signature, _allSignatures); hasAddedSymbolInfo = true; } } @@ -33830,7 +33944,7 @@ var ts; } else { var signatureDeclaration = ts.getDeclarationOfKind(symbol, 127).parent; - var signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); + var _signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); if (signatureDeclaration.kind === 137) { displayParts.push(ts.keywordPart(87)); displayParts.push(ts.spacePart()); @@ -33838,7 +33952,7 @@ var ts; else if (signatureDeclaration.kind !== 136 && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } - displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeResolver, signature, sourceFile, 32)); + displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeResolver, _signature, sourceFile, 32)); } } if (symbolFlags & 8) { @@ -33902,8 +34016,8 @@ var ts; } } else if (symbolFlags & 16 || symbolFlags & 8192 || symbolFlags & 16384 || symbolFlags & 131072 || symbolFlags & 98304 || symbolKind === ScriptElementKind.memberFunctionElement) { - var allSignatures = type.getCallSignatures(); - addSignatureDisplayParts(allSignatures[0], allSignatures); + var _allSignatures_1 = type.getCallSignatures(); + addSignatureDisplayParts(_allSignatures_1[0], _allSignatures_1); } } } @@ -33952,10 +34066,10 @@ var ts; documentation = signature.getDocumentationComment(); } function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { - var typeParameterParts = ts.mapToDisplayParts(function (writer) { + var _typeParameterParts = ts.mapToDisplayParts(function (writer) { typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration); }); - displayParts.push.apply(displayParts, typeParameterParts); + displayParts.push.apply(displayParts, _typeParameterParts); } } function getQuickInfoAtPosition(fileName, position) { @@ -34072,11 +34186,11 @@ var ts; }; } function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { - var declarations = []; + var _declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { if ((selectConstructors && d.kind === 133) || (!selectConstructors && (d.kind === 195 || d.kind === 132 || d.kind === 131))) { - declarations.push(d); + _declarations.push(d); if (d.body) definition = d; } @@ -34085,8 +34199,8 @@ var ts; result.push(getDefinitionInfo(definition, symbolKind, symbolName, containerName)); return true; } - else if (declarations.length) { - result.push(getDefinitionInfo(declarations[declarations.length - 1], symbolKind, symbolName, containerName)); + else if (_declarations.length) { + result.push(getDefinitionInfo(_declarations[_declarations.length - 1], symbolKind, symbolName, containerName)); return true; } return false; @@ -34200,8 +34314,8 @@ var ts; while (ifStatement) { var children = ifStatement.getChildren(); pushKeywordIf(keywords, children[0], 83); - for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 75)) { + for (var _i = children.length - 1; _i >= 0; _i--) { + if (pushKeywordIf(keywords, children[_i], 75)) { break; } } @@ -34211,10 +34325,10 @@ var ts; ifStatement = ifStatement.elseStatement; } var result = []; - for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 75 && i < keywords.length - 1) { - var elseKeyword = keywords[i]; - var ifKeyword = keywords[i + 1]; + for (var _i_1 = 0; _i_1 < keywords.length; _i_1++) { + if (keywords[_i_1].kind === 75 && _i_1 < keywords.length - 1) { + var elseKeyword = keywords[_i_1]; + var ifKeyword = keywords[_i_1 + 1]; var shouldHighlightNextKeyword = true; for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { if (!ts.isWhiteSpace(sourceFile.text.charCodeAt(j))) { @@ -34228,11 +34342,11 @@ var ts; textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), isWriteAccess: false }); - i++; + _i_1++; continue; } } - result.push(getReferenceEntryFromNode(keywords[i])); + result.push(getReferenceEntryFromNode(keywords[_i_1])); } return result; } @@ -34295,17 +34409,17 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 221) { - return parent; + var _parent = child.parent; + if (ts.isFunctionBlock(_parent) || _parent.kind === 221) { + return _parent; } - if (parent.kind === 191) { - var tryStatement = parent; + if (_parent.kind === 191) { + var tryStatement = _parent; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent; + child = _parent; } return undefined; } @@ -34326,8 +34440,8 @@ var ts; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 81, 99, 74)) { if (loopNode.kind === 179) { var loopTokens = loopNode.getChildren(); - for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 99)) { + for (var _i = loopTokens.length - 1; _i >= 0; _i--) { + if (pushKeywordIf(keywords, loopTokens[_i], 99)) { break; } } @@ -34390,8 +34504,8 @@ var ts; return actualOwner && actualOwner === owner; } function getBreakOrContinueOwner(statement) { - for (var node = statement.parent; node; node = node.parent) { - switch (node.kind) { + for (var _node = statement.parent; _node; _node = _node.parent) { + switch (_node.kind) { case 188: if (statement.kind === 184) { continue; @@ -34401,12 +34515,12 @@ var ts; case 183: case 180: case 179: - if (!statement.label || isLabeledBy(node, statement.label.text)) { - return node; + if (!statement.label || isLabeledBy(_node, statement.label.text)) { + return _node; } break; default: - if (ts.isFunctionLike(node)) { + if (ts.isFunctionLike(_node)) { return undefined; } break; @@ -34614,14 +34728,15 @@ var ts; var functionExpression = ts.forEach(symbol.declarations, function (d) { return d.kind === 160 ? d : undefined; }); + var _name; if (functionExpression && functionExpression.name) { - var name = functionExpression.name.text; + _name = functionExpression.name.text; } if (isImportOrExportSpecifierName(location)) { return location.getText(); } - var name = typeInfoResolver.symbolToString(symbol); - return stripQuotes(name); + _name = typeInfoResolver.symbolToString(symbol); + return stripQuotes(_name); } function getInternedName(symbol, location, declarations) { if (isImportOrExportSpecifierName(location)) { @@ -34630,18 +34745,13 @@ var ts; var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 160 ? d : undefined; }); - if (functionExpression && functionExpression.name) { - var name = functionExpression.name.text; - } - else { - var name = symbol.name; - } - return stripQuotes(name); + var _name = functionExpression && functionExpression.name ? functionExpression.name.text : symbol.name; + return stripQuotes(_name); } function stripQuotes(name) { - var length = name.length; - if (length >= 2 && name.charCodeAt(0) === 34 && name.charCodeAt(length - 1) === 34) { - return name.substring(1, length - 1); + var _length = name.length; + if (_length >= 2 && name.charCodeAt(0) === 34 && name.charCodeAt(_length - 1) === 34) { + return name.substring(1, _length - 1); } ; return name; @@ -34661,24 +34771,25 @@ var ts; if (symbol.parent || (symbol.flags & 268435456)) { return undefined; } - var scope = undefined; - var declarations = symbol.getDeclarations(); - if (declarations) { - for (var i = 0, n = declarations.length; i < n; i++) { - var container = getContainerNode(declarations[i]); + var _scope = undefined; + var _declarations = symbol.getDeclarations(); + if (_declarations) { + for (var _i = 0; _i < _declarations.length; _i++) { + var declaration = _declarations[_i]; + var container = getContainerNode(declaration); if (!container) { return undefined; } - if (scope && scope !== container) { + if (_scope && _scope !== container) { return undefined; } if (container.kind === 221 && !ts.isExternalModule(container)) { return undefined; } - scope = container; + _scope = container; } } - return scope; + return _scope; } function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { var positions = []; @@ -34702,21 +34813,21 @@ var ts; return positions; } function getLabelReferencesInNode(container, targetLabel) { - var result = []; + var _result = []; var sourceFile = container.getSourceFile(); var labelName = targetLabel.text; var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.getWidth() !== labelName.length) { + var _node = ts.getTouchingWord(sourceFile, position); + if (!_node || _node.getWidth() !== labelName.length) { return; } - if (node === targetLabel || (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { - result.push(getReferenceEntryFromNode(node)); + if (_node === targetLabel || (isJumpStatementTarget(_node) && getTargetLabel(_node, labelName) === targetLabel)) { + _result.push(getReferenceEntryFromNode(_node)); } }); - return result; + return _result; } function isValidReferencePosition(node, searchSymbolName) { if (node) { @@ -34812,21 +34923,21 @@ var ts; default: return undefined; } - var result = []; + var _result = []; var sourceFile = searchSpaceNode.getSourceFile(); var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 90) { + var _node = ts.getTouchingWord(sourceFile, position); + if (!_node || _node.kind !== 90) { return; } - var container = ts.getSuperContainer(node, false); + var container = ts.getSuperContainer(_node, false); if (container && (128 & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { - result.push(getReferenceEntryFromNode(node)); + _result.push(getReferenceEntryFromNode(_node)); } }); - return result; + return _result; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); @@ -34855,48 +34966,49 @@ var ts; default: return undefined; } - var result = []; + var _result = []; + var possiblePositions; if (searchSpaceNode.kind === 221) { ts.forEach(sourceFiles, function (sourceFile) { - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); - getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, result); + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); + getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, _result); }); } else { var sourceFile = searchSpaceNode.getSourceFile(); - var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); - getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result); + possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, _result); } - return result; + return _result; function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); - var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 92) { + var _node = ts.getTouchingWord(sourceFile, position); + if (!_node || _node.kind !== 92) { return; } - var container = ts.getThisContainer(node, false); + var container = ts.getThisContainer(_node, false); switch (searchSpaceNode.kind) { case 160: case 195: if (searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); + result.push(getReferenceEntryFromNode(_node)); } break; case 132: case 131: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { - result.push(getReferenceEntryFromNode(node)); + result.push(getReferenceEntryFromNode(_node)); } break; case 196: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { - result.push(getReferenceEntryFromNode(node)); + result.push(getReferenceEntryFromNode(_node)); } break; case 221: if (container.kind === 221 && !ts.isExternalModule(container)) { - result.push(getReferenceEntryFromNode(node)); + result.push(getReferenceEntryFromNode(_node)); } break; } @@ -34904,30 +35016,30 @@ var ts; } } function populateSearchSymbolSet(symbol, location) { - var result = [ + var _result = [ symbol ]; if (isImportOrExportSpecifierImportSymbol(symbol)) { - result.push(typeInfoResolver.getAliasedSymbol(symbol)); + _result.push(typeInfoResolver.getAliasedSymbol(symbol)); } if (isNameOfPropertyAssignment(location)) { ts.forEach(getPropertySymbolsFromContextualType(location), function (contextualSymbol) { - result.push.apply(result, typeInfoResolver.getRootSymbols(contextualSymbol)); + _result.push.apply(_result, typeInfoResolver.getRootSymbols(contextualSymbol)); }); var shorthandValueSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(location.parent); if (shorthandValueSymbol) { - result.push(shorthandValueSymbol); + _result.push(shorthandValueSymbol); } } ts.forEach(typeInfoResolver.getRootSymbols(symbol), function (rootSymbol) { if (rootSymbol !== symbol) { - result.push(rootSymbol); + _result.push(rootSymbol); } if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), _result); } }); - return result; + return _result; } function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 | 64)) { @@ -34974,9 +35086,9 @@ var ts; return true; } if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - var result = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); - return ts.forEach(result, function (s) { + var _result = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), _result); + return ts.forEach(_result, function (s) { return searchSymbols.indexOf(s) >= 0; }); } @@ -34987,31 +35099,31 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeInfoResolver.getContextualType(objectLiteral); - var name = node.text; + var _name = node.text; if (contextualType) { if (contextualType.flags & 16384) { - var unionProperty = contextualType.getProperty(name); + var unionProperty = contextualType.getProperty(_name); if (unionProperty) { return [ unionProperty ]; } else { - var result = []; + var _result = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name); - if (symbol) { - result.push(symbol); + var _symbol = t.getProperty(_name); + if (_symbol) { + _result.push(_symbol); } }); - return result; + return _result; } } else { - var symbol = contextualType.getProperty(name); - if (symbol) { + var _symbol = contextualType.getProperty(_name); + if (_symbol) { return [ - symbol + _symbol ]; } } @@ -35021,10 +35133,12 @@ var ts; } function getIntersectingMeaningFromDeclarations(meaning, declarations) { if (declarations) { + var lastIterationMeaning; do { - var lastIterationMeaning = meaning; - for (var i = 0, n = declarations.length; i < n; i++) { - var declarationMeaning = getMeaningFromDeclaration(declarations[i]); + lastIterationMeaning = meaning; + for (var _i = 0; _i < declarations.length; _i++) { + var declaration = declarations[_i]; + var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; } @@ -35051,13 +35165,13 @@ var ts; if (node.kind === 64 && ts.isDeclarationName(node)) { return true; } - var parent = node.parent; - if (parent) { - if (parent.kind === 166 || parent.kind === 165) { + var _parent = node.parent; + if (_parent) { + if (_parent.kind === 166 || _parent.kind === 165) { return true; } - else if (parent.kind === 167 && parent.left === node) { - var operator = parent.operatorToken.kind; + else if (_parent.kind === 167 && _parent.left === node) { + var operator = _parent.operatorToken.kind; return 52 <= operator && operator <= 63; } } @@ -35453,8 +35567,8 @@ var ts; function processElement(element) { if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var i = 0, n = children.length; i < n; i++) { - var child = children[i]; + for (var _i = 0; _i < children.length; _i++) { + var child = children[_i]; if (ts.isToken(child)) { classifyToken(child); } @@ -35478,8 +35592,8 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var i = 0, n = childNodes.length; i < n; i++) { - var current = childNodes[i]; + for (var _i = 0; _i < childNodes.length; _i++) { + var current = childNodes[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); var range2 = ts.createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); @@ -35521,7 +35635,7 @@ var ts; var start = new Date().getTime(); var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); log("getIndentationAtPosition: getCurrentSourceFile: " + (new Date().getTime() - start)); - var start = new Date().getTime(); + start = new Date().getTime(); var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, editorOptions); log("getIndentationAtPosition: computeIndentation : " + (new Date().getTime() - start)); return result; @@ -35567,9 +35681,9 @@ var ts; continue; } var descriptor = undefined; - for (var i = 0, n = descriptors.length; i < n; i++) { - if (matchArray[i + firstDescriptorCaptureIndex]) { - descriptor = descriptors[i]; + for (var _i = 0, n = descriptors.length; _i < n; _i++) { + if (matchArray[_i + firstDescriptorCaptureIndex]) { + descriptor = descriptors[_i]; } } ts.Debug.assert(descriptor !== undefined); @@ -35592,14 +35706,14 @@ var ts; var singleLineCommentStart = /(?:\/\/+\s*)/.source; var multiLineCommentStart = /(?:\/\*+\s*)/.source; var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; - var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + var _preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; var messageRemainder = /(?:.*?)/.source; var messagePortion = "(" + literals + messageRemainder + ")"; - var regExpString = preamble + messagePortion + endOfLineOrEndOfComment; + var regExpString = _preamble + messagePortion + endOfLineOrEndOfComment; return new RegExp(regExpString, "gim"); } function isLetterOrDigit(char) { @@ -35617,9 +35731,10 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var i = 0; i < declarations.length; i++) { - var sourceFile = declarations[i].getSourceFile(); - if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { + for (var _i = 0; _i < declarations.length; _i++) { + var current = declarations[_i]; + var _sourceFile = current.getSourceFile(); + if (_sourceFile && getCanonicalFileName(ts.normalizePath(_sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); } } @@ -35717,7 +35832,7 @@ var ts; return node && node.parent && node.parent.kind === 154 && node.parent.argumentExpression === node; } function createClassifier() { - var scanner = ts.createScanner(2, false); + var _scanner = ts.createScanner(2, false); var noRegexTable = []; noRegexTable[64] = true; noRegexTable[8] = true; @@ -35781,17 +35896,17 @@ var ts; templateStack.push(11); break; } - scanner.setText(text); + _scanner.setText(text); var result = { finalLexState: 0, entries: [] }; var angleBracketStack = 0; do { - token = scanner.scan(); + token = _scanner.scan(); if (!ts.isTrivia(token)) { if ((token === 36 || token === 56) && !noRegexTable[lastNonTriviaToken]) { - if (scanner.reScanSlashToken() === 9) { + if (_scanner.reScanSlashToken() === 9) { token = 9; } } @@ -35824,7 +35939,7 @@ var ts; if (templateStack.length > 0) { var lastTemplateStackToken = ts.lastOrUndefined(templateStack); if (lastTemplateStackToken === 11) { - token = scanner.reScanTemplateToken(); + token = _scanner.reScanTemplateToken(); if (token === 13) { templateStack.pop(); } @@ -35844,13 +35959,13 @@ var ts; } while (token !== 1); return result; function processToken() { - var start = scanner.getTokenPos(); - var end = scanner.getTextPos(); + var start = _scanner.getTokenPos(); + var end = _scanner.getTextPos(); addResult(end - start, classFromKind(token)); if (end >= text.length) { if (token === 8) { - var tokenText = scanner.getTokenText(); - if (scanner.isUnterminated()) { + var tokenText = _scanner.getTokenText(); + if (_scanner.isUnterminated()) { var lastCharIndex = tokenText.length - 1; var numBackslashes = 0; while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === 92) { @@ -35863,12 +35978,12 @@ var ts; } } else if (token === 3) { - if (scanner.isUnterminated()) { + if (_scanner.isUnterminated()) { result.finalLexState = 1; } } else if (ts.isTemplateLiteralKind(token)) { - if (scanner.isUnterminated()) { + if (_scanner.isUnterminated()) { if (token === 13) { result.finalLexState = 5; } diff --git a/bin/typescriptServices_internal.d.ts b/bin/typescriptServices_internal.d.ts index a899c1e240b..7fba731f25e 100644 --- a/bin/typescriptServices_internal.d.ts +++ b/bin/typescriptServices_internal.d.ts @@ -62,7 +62,7 @@ declare module ts { * index in the array will be the one associated with the produced key. */ function arrayToMap(array: T[], makeKey: (value: T) => string): Map; - var localizedDiagnosticMessages: Map; + let localizedDiagnosticMessages: Map; function getLocaleSpecificMessage(message: string): string; function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic; function createCompilerDiagnostic(message: DiagnosticMessage, ...args: any[]): Diagnostic; @@ -74,7 +74,7 @@ declare module ts { function deduplicateSortedDiagnostics(diagnostics: Diagnostic[]): Diagnostic[]; function normalizeSlashes(path: string): string; function getRootLength(path: string): number; - var directorySeparator: string; + let directorySeparator: string; function normalizePath(path: string): string; function getDirectoryPath(path: string): string; function isUrl(path: string): boolean; @@ -94,7 +94,7 @@ declare module ts { getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type; getSignatureConstructor(): new (checker: TypeChecker) => Signature; } - var objectAllocator: ObjectAllocator; + let objectAllocator: ObjectAllocator; const enum AssertionLevel { None = 0, Normal = 1, @@ -186,7 +186,7 @@ declare module ts { function isPrologueDirective(node: Node): boolean; function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode?: SourceFile): CommentRange[]; function getJsDocComments(node: Node, sourceFileOfNode: SourceFile): CommentRange[]; - var fullTripleSlashReferencePathRegEx: RegExp; + let fullTripleSlashReferencePathRegEx: RegExp; function forEachReturnStatement(body: Block, visitor: (stmt: ReturnStatement) => T): T; function isFunctionLike(node: Node): boolean; function isFunctionBlock(node: Node): boolean; @@ -257,7 +257,7 @@ declare module ts { function textChangeRangeNewSpan(range: TextChangeRange): TextSpan; function textChangeRangeIsUnchanged(range: TextChangeRange): boolean; function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange; - var unchangedTextChangeRange: TextChangeRange; + let unchangedTextChangeRange: TextChangeRange; /** * Called to merge all the changes that occurred across several versions of a script snapshot * into a single change. i.e. if a user keeps making successive edits to a script we will diff --git a/bin/typescript_internal.d.ts b/bin/typescript_internal.d.ts index d01fe853505..2d5973e5877 100644 --- a/bin/typescript_internal.d.ts +++ b/bin/typescript_internal.d.ts @@ -62,7 +62,7 @@ declare module "typescript" { * index in the array will be the one associated with the produced key. */ function arrayToMap(array: T[], makeKey: (value: T) => string): Map; - var localizedDiagnosticMessages: Map; + let localizedDiagnosticMessages: Map; function getLocaleSpecificMessage(message: string): string; function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic; function createCompilerDiagnostic(message: DiagnosticMessage, ...args: any[]): Diagnostic; @@ -74,7 +74,7 @@ declare module "typescript" { function deduplicateSortedDiagnostics(diagnostics: Diagnostic[]): Diagnostic[]; function normalizeSlashes(path: string): string; function getRootLength(path: string): number; - var directorySeparator: string; + let directorySeparator: string; function normalizePath(path: string): string; function getDirectoryPath(path: string): string; function isUrl(path: string): boolean; @@ -94,7 +94,7 @@ declare module "typescript" { getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type; getSignatureConstructor(): new (checker: TypeChecker) => Signature; } - var objectAllocator: ObjectAllocator; + let objectAllocator: ObjectAllocator; const enum AssertionLevel { None = 0, Normal = 1, @@ -186,7 +186,7 @@ declare module "typescript" { function isPrologueDirective(node: Node): boolean; function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode?: SourceFile): CommentRange[]; function getJsDocComments(node: Node, sourceFileOfNode: SourceFile): CommentRange[]; - var fullTripleSlashReferencePathRegEx: RegExp; + let fullTripleSlashReferencePathRegEx: RegExp; function forEachReturnStatement(body: Block, visitor: (stmt: ReturnStatement) => T): T; function isFunctionLike(node: Node): boolean; function isFunctionBlock(node: Node): boolean; @@ -257,7 +257,7 @@ declare module "typescript" { function textChangeRangeNewSpan(range: TextChangeRange): TextSpan; function textChangeRangeIsUnchanged(range: TextChangeRange): boolean; function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange; - var unchangedTextChangeRange: TextChangeRange; + let unchangedTextChangeRange: TextChangeRange; /** * Called to merge all the changes that occurred across several versions of a script snapshot * into a single change. i.e. if a user keeps making successive edits to a script we will From 4a9187172e48f5b5f261e87b0e690076d749b68c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 15:55:17 -0700 Subject: [PATCH 079/101] Use 'let' in the compiler layer. --- src/compiler/binder.ts | 2 +- src/compiler/emitter.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index d0d6005d979..7c1e4c57a4c 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -58,7 +58,7 @@ module ts { } function bindSourceFileWorker(file: SourceFile): void { - var parent: Node; + let parent: Node; let container: Node; let blockScopeContainer: Node; let lastContainer: Node; diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 661544749e6..525f56ca2c3 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2853,7 +2853,7 @@ module ts { case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: - var { firstAccessor, getAccessor, setAccessor } = getAllAccessorDeclarations(objectLiteral.properties, property); + let { firstAccessor, getAccessor, setAccessor } = getAllAccessorDeclarations(objectLiteral.properties, property); // Only emit the first accessor. if (firstAccessor !== property) { From d163205da6281cb840312b7c8ee9d5a75512d375 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Fri, 13 Mar 2015 15:59:22 -0700 Subject: [PATCH 080/101] accepted baselines --- .../shadowingViaLocalValueOrBindingElement.errors.txt | 4 ++-- .../reference/shadowingViaLocalValueOrBindingElement.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.errors.txt b/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.errors.txt index 663f83c1ffb..4fc1d47c383 100644 --- a/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.errors.txt +++ b/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.errors.txt @@ -18,10 +18,10 @@ tests/cases/compiler/shadowingViaLocalValueOrBindingElement.ts(8,18): error TS24 var { x: x = 0 } = { x: 0 }; // Error ~ !!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. - var { x } = { x: 0 }; // No error, even though the let x is being initialized + var { x } = { x: 0 }; // Error ~ !!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. - var { x: x } = { x: 0 }; // No error, even though the let x is being initialized + var { x: x } = { x: 0 }; // Error ~ !!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. } diff --git a/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.js b/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.js index 8d6319f5ea7..76c4a7ac3a6 100644 --- a/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.js +++ b/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.js @@ -5,8 +5,8 @@ if (true) { var x = 0; // Error var { x = 0 } = { x: 0 }; // Error var { x: x = 0 } = { x: 0 }; // Error - var { x } = { x: 0 }; // No error, even though the let x is being initialized - var { x: x } = { x: 0 }; // No error, even though the let x is being initialized + var { x } = { x: 0 }; // Error + var { x: x } = { x: 0 }; // Error } } @@ -23,9 +23,9 @@ if (true) { }).x, x = _b === void 0 ? 0 : _b; // Error var x = ({ _x: 0 - }).x; // No error, even though the let x is being initialized + }).x; // Error var x = ({ _x: 0 - }).x; // No error, even though the let x is being initialized + }).x; // Error } } From d8d4719765941da44f8763c819ef4ca9f708c327 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 16:15:25 -0700 Subject: [PATCH 081/101] Add experimental option to cache the .length access in downlevel for-of emit. --- Jakefile | 2 + bin/tsc.js | 39 ++++++++++++++----- bin/tsserver.js | 39 ++++++++++++++----- bin/typescript.d.ts | 1 + bin/typescript.js | 39 ++++++++++++++----- bin/typescriptServices.d.ts | 1 + bin/typescriptServices.js | 39 ++++++++++++++----- src/compiler/commandLineParser.ts | 6 +++ src/compiler/emitter.ts | 22 ++++++++++- src/compiler/types.ts | 1 + .../baselines/reference/APISample_compile.js | 1 + .../reference/APISample_compile.types | 3 ++ tests/baselines/reference/APISample_linter.js | 1 + .../reference/APISample_linter.types | 3 ++ .../reference/APISample_transform.js | 1 + .../reference/APISample_transform.types | 3 ++ .../baselines/reference/APISample_watcher.js | 1 + .../reference/APISample_watcher.types | 3 ++ 18 files changed, 163 insertions(+), 42 deletions(-) diff --git a/Jakefile b/Jakefile index 324356a4af5..adecd9568db 100644 --- a/Jakefile +++ b/Jakefile @@ -252,6 +252,8 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu options += " --stripInternal" } + // options += " --cacheDownlevelForOfLength"; + var cmd = host + " " + dir + compilerFilename + " " + options + " "; cmd = cmd + sources.join(" "); console.log(cmd + "\n"); diff --git a/bin/tsc.js b/bin/tsc.js index 47dd801eadc..87039731d93 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -11815,7 +11815,7 @@ var ts; } ts.bindSourceFile = bindSourceFile; function bindSourceFileWorker(file) { - var parent; + var _parent; var container; var blockScopeContainer; var lastContainer; @@ -11956,10 +11956,10 @@ var ts; if (symbolKind & 255504) { node.locals = {}; } - var saveParent = parent; + var saveParent = _parent; var saveContainer = container; var savedBlockScopeContainer = blockScopeContainer; - parent = node; + _parent = node; if (symbolKind & 262128) { container = node; if (lastContainer) { @@ -11972,7 +11972,7 @@ var ts; } ts.forEachChild(node, bind); container = saveContainer; - parent = saveParent; + _parent = saveParent; blockScopeContainer = savedBlockScopeContainer; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { @@ -12075,7 +12075,7 @@ var ts; return "__" + ts.indexOf(node.parent.parameters, node); } function bind(node) { - node.parent = parent; + node.parent = _parent; switch (node.kind) { case 127: bindDeclaration(node, 262144, 530912, false); @@ -12209,10 +12209,10 @@ var ts; bindChildren(node, 0, true); break; default: - var saveParent = parent; - parent = node; + var saveParent = _parent; + _parent = node; ts.forEachChild(node, bind); - parent = saveParent; + _parent = saveParent; } } function bindParameter(node) { @@ -24542,6 +24542,7 @@ var ts; var rhsIsIdentifier = node.expression.kind === 64; var counter = createTempVariable(node, true); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, false); + var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, false) : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -24555,12 +24556,24 @@ var ts; emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); } + if (cachedLength) { + write(", "); + emitNodeWithoutSourceMap(cachedLength); + write(" = "); + emitNodeWithoutSourceMap(rhsReference); + write(".length"); + } write("; "); emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - emitNodeWithoutSourceMap(rhsReference); - write(".length"); + if (cachedLength) { + emitNodeWithoutSourceMap(cachedLength); + } + else { + emitNodeWithoutSourceMap(rhsReference); + write(".length"); + } emitEnd(node.initializer); write("; "); emitStart(node.initializer); @@ -26921,6 +26934,12 @@ var ts; description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, experimental: true }, + { + name: "cacheDownlevelForOfLength", + type: "boolean", + description: "Cache length access when downlevel emitting for-of statements", + experimental: true + }, { name: "target", shortName: "t", diff --git a/bin/tsserver.js b/bin/tsserver.js index fd087d9a138..c534380b8f3 100644 --- a/bin/tsserver.js +++ b/bin/tsserver.js @@ -7473,6 +7473,12 @@ var ts; description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, experimental: true }, + { + name: "cacheDownlevelForOfLength", + type: "boolean", + description: "Cache length access when downlevel emitting for-of statements", + experimental: true + }, { name: "target", shortName: "t", @@ -12165,7 +12171,7 @@ var ts; } ts.bindSourceFile = bindSourceFile; function bindSourceFileWorker(file) { - var parent; + var _parent; var container; var blockScopeContainer; var lastContainer; @@ -12306,10 +12312,10 @@ var ts; if (symbolKind & 255504) { node.locals = {}; } - var saveParent = parent; + var saveParent = _parent; var saveContainer = container; var savedBlockScopeContainer = blockScopeContainer; - parent = node; + _parent = node; if (symbolKind & 262128) { container = node; if (lastContainer) { @@ -12322,7 +12328,7 @@ var ts; } ts.forEachChild(node, bind); container = saveContainer; - parent = saveParent; + _parent = saveParent; blockScopeContainer = savedBlockScopeContainer; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { @@ -12425,7 +12431,7 @@ var ts; return "__" + ts.indexOf(node.parent.parameters, node); } function bind(node) { - node.parent = parent; + node.parent = _parent; switch (node.kind) { case 127: bindDeclaration(node, 262144, 530912, false); @@ -12559,10 +12565,10 @@ var ts; bindChildren(node, 0, true); break; default: - var saveParent = parent; - parent = node; + var saveParent = _parent; + _parent = node; ts.forEachChild(node, bind); - parent = saveParent; + _parent = saveParent; } } function bindParameter(node) { @@ -24892,6 +24898,7 @@ var ts; var rhsIsIdentifier = node.expression.kind === 64; var counter = createTempVariable(node, true); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, false); + var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, false) : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -24905,12 +24912,24 @@ var ts; emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); } + if (cachedLength) { + write(", "); + emitNodeWithoutSourceMap(cachedLength); + write(" = "); + emitNodeWithoutSourceMap(rhsReference); + write(".length"); + } write("; "); emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - emitNodeWithoutSourceMap(rhsReference); - write(".length"); + if (cachedLength) { + emitNodeWithoutSourceMap(cachedLength); + } + else { + emitNodeWithoutSourceMap(rhsReference); + write(".length"); + } emitEnd(node.initializer); write("; "); emitStart(node.initializer); diff --git a/bin/typescript.d.ts b/bin/typescript.d.ts index 4319e2d1375..e6f4bf572d7 100644 --- a/bin/typescript.d.ts +++ b/bin/typescript.d.ts @@ -1202,6 +1202,7 @@ declare module "typescript" { watch?: boolean; stripInternal?: boolean; preserveNewLines?: boolean; + cacheDownlevelForOfLength?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/bin/typescript.js b/bin/typescript.js index 623e6341f90..cc1ec309618 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -12444,7 +12444,7 @@ var ts; } ts.bindSourceFile = bindSourceFile; function bindSourceFileWorker(file) { - var parent; + var _parent; var container; var blockScopeContainer; var lastContainer; @@ -12585,10 +12585,10 @@ var ts; if (symbolKind & 255504) { node.locals = {}; } - var saveParent = parent; + var saveParent = _parent; var saveContainer = container; var savedBlockScopeContainer = blockScopeContainer; - parent = node; + _parent = node; if (symbolKind & 262128) { container = node; if (lastContainer) { @@ -12601,7 +12601,7 @@ var ts; } ts.forEachChild(node, bind); container = saveContainer; - parent = saveParent; + _parent = saveParent; blockScopeContainer = savedBlockScopeContainer; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { @@ -12704,7 +12704,7 @@ var ts; return "__" + ts.indexOf(node.parent.parameters, node); } function bind(node) { - node.parent = parent; + node.parent = _parent; switch (node.kind) { case 127: bindDeclaration(node, 262144, 530912, false); @@ -12838,10 +12838,10 @@ var ts; bindChildren(node, 0, true); break; default: - var saveParent = parent; - parent = node; + var saveParent = _parent; + _parent = node; ts.forEachChild(node, bind); - parent = saveParent; + _parent = saveParent; } } function bindParameter(node) { @@ -25171,6 +25171,7 @@ var ts; var rhsIsIdentifier = node.expression.kind === 64; var counter = createTempVariable(node, true); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, false); + var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, false) : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -25184,12 +25185,24 @@ var ts; emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); } + if (cachedLength) { + write(", "); + emitNodeWithoutSourceMap(cachedLength); + write(" = "); + emitNodeWithoutSourceMap(rhsReference); + write(".length"); + } write("; "); emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - emitNodeWithoutSourceMap(rhsReference); - write(".length"); + if (cachedLength) { + emitNodeWithoutSourceMap(cachedLength); + } + else { + emitNodeWithoutSourceMap(rhsReference); + write(".length"); + } emitEnd(node.initializer); write("; "); emitStart(node.initializer); @@ -27550,6 +27563,12 @@ var ts; description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, experimental: true }, + { + name: "cacheDownlevelForOfLength", + type: "boolean", + description: "Cache length access when downlevel emitting for-of statements", + experimental: true + }, { name: "target", shortName: "t", diff --git a/bin/typescriptServices.d.ts b/bin/typescriptServices.d.ts index d5293c99b3b..913bb206f63 100644 --- a/bin/typescriptServices.d.ts +++ b/bin/typescriptServices.d.ts @@ -1202,6 +1202,7 @@ declare module ts { watch?: boolean; stripInternal?: boolean; preserveNewLines?: boolean; + cacheDownlevelForOfLength?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index 623e6341f90..cc1ec309618 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -12444,7 +12444,7 @@ var ts; } ts.bindSourceFile = bindSourceFile; function bindSourceFileWorker(file) { - var parent; + var _parent; var container; var blockScopeContainer; var lastContainer; @@ -12585,10 +12585,10 @@ var ts; if (symbolKind & 255504) { node.locals = {}; } - var saveParent = parent; + var saveParent = _parent; var saveContainer = container; var savedBlockScopeContainer = blockScopeContainer; - parent = node; + _parent = node; if (symbolKind & 262128) { container = node; if (lastContainer) { @@ -12601,7 +12601,7 @@ var ts; } ts.forEachChild(node, bind); container = saveContainer; - parent = saveParent; + _parent = saveParent; blockScopeContainer = savedBlockScopeContainer; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { @@ -12704,7 +12704,7 @@ var ts; return "__" + ts.indexOf(node.parent.parameters, node); } function bind(node) { - node.parent = parent; + node.parent = _parent; switch (node.kind) { case 127: bindDeclaration(node, 262144, 530912, false); @@ -12838,10 +12838,10 @@ var ts; bindChildren(node, 0, true); break; default: - var saveParent = parent; - parent = node; + var saveParent = _parent; + _parent = node; ts.forEachChild(node, bind); - parent = saveParent; + _parent = saveParent; } } function bindParameter(node) { @@ -25171,6 +25171,7 @@ var ts; var rhsIsIdentifier = node.expression.kind === 64; var counter = createTempVariable(node, true); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, false); + var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, false) : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -25184,12 +25185,24 @@ var ts; emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); } + if (cachedLength) { + write(", "); + emitNodeWithoutSourceMap(cachedLength); + write(" = "); + emitNodeWithoutSourceMap(rhsReference); + write(".length"); + } write("; "); emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - emitNodeWithoutSourceMap(rhsReference); - write(".length"); + if (cachedLength) { + emitNodeWithoutSourceMap(cachedLength); + } + else { + emitNodeWithoutSourceMap(rhsReference); + write(".length"); + } emitEnd(node.initializer); write("; "); emitStart(node.initializer); @@ -27550,6 +27563,12 @@ var ts; description: ts.Diagnostics.Preserve_new_lines_when_emitting_code, experimental: true }, + { + name: "cacheDownlevelForOfLength", + type: "boolean", + description: "Cache length access when downlevel emitting for-of statements", + experimental: true + }, { name: "target", shortName: "t", diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index e79d762524c..269f23492e2 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -146,6 +146,12 @@ module ts { description: Diagnostics.Preserve_new_lines_when_emitting_code, experimental: true }, + { + name: "cacheDownlevelForOfLength", + type: "boolean", + description: "Cache length access when downlevel emitting for-of statements", + experimental: true, + }, { name: "target", shortName: "t", diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 525f56ca2c3..230b5eac310 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3583,6 +3583,8 @@ module ts { let counter = createTempVariable(node, /*forLoopVariable*/ true); let rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, /*forLoopVariable*/ false); + var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, /*forLoopVariable:*/ false) : undefined; + // This is the let keyword for the counter and rhsReference. The let keyword for // the LHS will be emitted inside the body. emitStart(node.expression); @@ -3602,14 +3604,30 @@ module ts { emitNodeWithoutSourceMap(node.expression); emitEnd(node.expression); } + + if (cachedLength) { + write(", "); + emitNodeWithoutSourceMap(cachedLength); + write(" = "); + emitNodeWithoutSourceMap(rhsReference); + write(".length"); + } + write("; "); // _i < _a.length; emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - emitNodeWithoutSourceMap(rhsReference); - write(".length"); + + if (cachedLength) { + emitNodeWithoutSourceMap(cachedLength); + } + else { + emitNodeWithoutSourceMap(rhsReference); + write(".length"); + } + emitEnd(node.initializer); write("; "); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 7301e087ae1..a2fde2c5768 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1560,6 +1560,7 @@ module ts { watch?: boolean; stripInternal?: boolean; preserveNewLines?: boolean; + cacheDownlevelForOfLength?: boolean; [option: string]: string | number | boolean; } diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index eb2153aafc7..8560d213641 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1239,6 +1239,7 @@ declare module "typescript" { watch?: boolean; stripInternal?: boolean; preserveNewLines?: boolean; + cacheDownlevelForOfLength?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index d09e4f983cc..018e48c30ba 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -3953,6 +3953,9 @@ declare module "typescript" { preserveNewLines?: boolean; >preserveNewLines : boolean + cacheDownlevelForOfLength?: boolean; +>cacheDownlevelForOfLength : boolean + [option: string]: string | number | boolean; >option : string } diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 0c1f84bc359..62346784619 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1270,6 +1270,7 @@ declare module "typescript" { watch?: boolean; stripInternal?: boolean; preserveNewLines?: boolean; + cacheDownlevelForOfLength?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 53e61101078..442c8a6ca06 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -4099,6 +4099,9 @@ declare module "typescript" { preserveNewLines?: boolean; >preserveNewLines : boolean + cacheDownlevelForOfLength?: boolean; +>cacheDownlevelForOfLength : boolean + [option: string]: string | number | boolean; >option : string } diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 5f62d8757c4..5c913a4d13d 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -1271,6 +1271,7 @@ declare module "typescript" { watch?: boolean; stripInternal?: boolean; preserveNewLines?: boolean; + cacheDownlevelForOfLength?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 381c90b8333..3673a5472a7 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -4049,6 +4049,9 @@ declare module "typescript" { preserveNewLines?: boolean; >preserveNewLines : boolean + cacheDownlevelForOfLength?: boolean; +>cacheDownlevelForOfLength : boolean + [option: string]: string | number | boolean; >option : string } diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 240123d8177..0983fedbaff 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1308,6 +1308,7 @@ declare module "typescript" { watch?: boolean; stripInternal?: boolean; preserveNewLines?: boolean; + cacheDownlevelForOfLength?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 0bbaee0062f..c4211de6ce6 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -4222,6 +4222,9 @@ declare module "typescript" { preserveNewLines?: boolean; >preserveNewLines : boolean + cacheDownlevelForOfLength?: boolean; +>cacheDownlevelForOfLength : boolean + [option: string]: string | number | boolean; >option : string } From 5e85595df6393e4c039a514611383d67e4db2d61 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 16:19:17 -0700 Subject: [PATCH 082/101] Use the new option to cache .length access --- Jakefile | 2 +- bin/tsc.js | 196 ++++++++++++++--------------- bin/tsserver.js | 252 +++++++++++++++++++------------------- bin/typescript.js | 252 +++++++++++++++++++------------------- bin/typescriptServices.js | 252 +++++++++++++++++++------------------- 5 files changed, 477 insertions(+), 477 deletions(-) diff --git a/Jakefile b/Jakefile index adecd9568db..a6ba420c54a 100644 --- a/Jakefile +++ b/Jakefile @@ -252,7 +252,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu options += " --stripInternal" } - // options += " --cacheDownlevelForOfLength"; + options += " --cacheDownlevelForOfLength"; var cmd = host + " " + dir + compilerFilename + " " + options + " "; cmd = cmd + sources.join(" "); diff --git a/bin/tsc.js b/bin/tsc.js index 87039731d93..08acd0a760e 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -44,7 +44,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; if (v === value) { return true; @@ -68,7 +68,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -82,7 +82,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var _item = array[_i]; if (f(_item)) { result.push(_item); @@ -96,7 +96,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; result.push(f(v)); } @@ -116,7 +116,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var _item = array[_i]; if (!contains(result, _item)) { result.push(_item); @@ -128,7 +128,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; result += v[prop]; } @@ -136,7 +136,7 @@ var ts; } ts.sum = sum; function addRange(to, from) { - for (var _i = 0; _i < from.length; _i++) { + for (var _i = 0, _a = from.length; _i < _a; _i++) { var v = from[_i]; to.push(v); } @@ -400,7 +400,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0; _i < parts.length; _i++) { + for (var _i = 0, _a = parts.length; _i < _a; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -552,7 +552,7 @@ var ts; ".js" ]; function removeFileExtension(path) { - for (var _i = 0; _i < supportedExtensions.length; _i++) { + for (var _i = 0, _a = supportedExtensions.length; _i < _a; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -710,15 +710,15 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0; _i < files.length; _i++) { + for (var _i = 0, _a = files.length; _i < _a; _i++) { var _name = files[_i]; if (!extension || ts.fileExtensionIs(_name, extension)) { result.push(ts.combinePaths(path, _name)); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0; _a < subfolders.length; _a++) { - var current = subfolders[_a]; + for (var _b = 0, _c = subfolders.length; _b < _c; _b++) { + var current = subfolders[_b]; visitDirectory(ts.combinePaths(path, current)); } } @@ -804,7 +804,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0; _i < files.length; _i++) { + for (var _i = 0, _a = files.length; _i < _a; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -817,8 +817,8 @@ var ts; directories.push(name); } } - for (var _a = 0; _a < directories.length; _a++) { - var _current = directories[_a]; + for (var _b = 0, _c = directories.length; _b < _c; _b++) { + var _current = directories[_b]; visitDirectory(_current); } } @@ -7333,7 +7333,7 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -8040,7 +8040,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0; _i < clauses.length; _i++) { + for (var _i = 0, _a = clauses.length; _i < _a; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -8431,7 +8431,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -8732,7 +8732,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var node = array[_i]; visitNode(node); } @@ -8796,7 +8796,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var node = array[_i]; visitNode(node); } @@ -12953,7 +12953,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0; _i < members.length; _i++) { + for (var _i = 0, _a = members.length; _i < _a; _i++) { var member = members[_i]; if (member.kind === 133 && ts.nodeIsPresent(member.body)) { return member; @@ -13277,7 +13277,7 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { + for (var _i = 0, _a = accessibleSymbolChain.length; _i < _a; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -13458,14 +13458,14 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { + for (var _i = 0, _a = resolved.callSignatures, _b = _a.length; _i < _b; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { - var _signature = _c[_b]; + for (var _c = 0, _d = resolved.constructSignatures, _e = _d.length; _c < _e; _c++) { + var _signature = _d[_c]; writeKeyword(writer, 87); writeSpace(writer); buildSignatureDisplay(_signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); @@ -13498,13 +13498,13 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { - var p = _e[_d]; + for (var _f = 0, _g = resolved.properties, _h = _g.length; _f < _h; _f++) { + var p = _g[_f]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _f = 0; _f < signatures.length; _f++) { - var _signature_1 = signatures[_f]; + for (var _j = 0, _k = signatures.length; _j < _k; _j++) { + var _signature_1 = signatures[_j]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); @@ -14208,7 +14208,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { + for (var _i = 0, _a = symbols.length; _i < _a; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -14216,14 +14216,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { + for (var _i = 0, _a = symbols.length; _i < _a; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0; _i < baseSymbols.length; _i++) { + for (var _i = 0, _a = baseSymbols.length; _i < _a; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -14232,7 +14232,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0; _i < baseSignatures.length; _i++) { + for (var _i = 0, _a = baseSignatures.length; _i < _a; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -14334,7 +14334,7 @@ var ts; return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var _i = 0; _i < signatures.length; _i++) { + for (var _i = 0, _a = signatures.length; _i < _a; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; @@ -14357,7 +14357,7 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -14493,7 +14493,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -14513,8 +14513,8 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0; _a < props.length; _a++) { - var _prop = props[_a]; + for (var _b = 0, _c = props.length; _b < _c; _b++) { + var _prop = props[_b]; if (_prop.declarations) { declarations.push.apply(declarations, _prop.declarations); } @@ -14754,7 +14754,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -14802,7 +14802,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; result |= type.flags; } @@ -14900,7 +14900,7 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { case 196: @@ -14985,13 +14985,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -15009,7 +15009,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -15125,7 +15125,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0; _i < items.length; _i++) { + for (var _i = 0, _a = items.length; _i < _a; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -15177,7 +15177,7 @@ var ts; return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0; _i < sources.length; _i++) { + for (var _i = 0, _a = sources.length; _i < _a; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -15463,7 +15463,7 @@ var ts; function unionTypeRelatedToUnionType(source, target) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { + for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { @@ -15486,7 +15486,7 @@ var ts; function unionTypeRelatedToType(source, target, reportErrors) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { + for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { @@ -15624,7 +15624,7 @@ var ts; var _result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -15695,7 +15695,7 @@ var ts; return 0; } var _result = -1; - for (var _i = 0; _i < sourceProperties.length; _i++) { + for (var _i = 0, _a = sourceProperties.length; _i < _a; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -15720,12 +15720,12 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var _result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0; _i < targetSignatures.length; _i++) { + outer: for (var _i = 0, _a = targetSignatures.length; _i < _a; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _a = 0; _a < sourceSignatures.length; _a++) { - var s = sourceSignatures[_a]; + for (var _b = 0, _c = sourceSignatures.length; _b < _c; _b++) { + var s = sourceSignatures[_b]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); if (related) { @@ -15940,7 +15940,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -16125,7 +16125,7 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0; _i < typeParameters.length; _i++) { + for (var _i = 0, _a = typeParameters.length; _i < _a; _i++) { var unused = typeParameters[_i]; inferences.push({ primary: undefined, @@ -16195,7 +16195,7 @@ var ts; var _targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _a = 0; _a < _targetTypes.length; _a++) { + for (var _a = 0, _b = _targetTypes.length; _a < _b; _a++) { var t = _targetTypes[_a]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; @@ -16213,8 +16213,8 @@ var ts; } else if (source.flags & 16384) { var _sourceTypes = source.types; - for (var _b = 0; _b < _sourceTypes.length; _b++) { - var sourceType = _sourceTypes[_b]; + for (var _c = 0, _d = _sourceTypes.length; _c < _d; _c++) { + var sourceType = _sourceTypes[_c]; inferFromTypes(sourceType, target); } } @@ -16239,7 +16239,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -16856,7 +16856,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -16995,7 +16995,7 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; @@ -17100,7 +17100,7 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { @@ -17366,7 +17366,7 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0; _i < signatures.length; _i++) { + for (var _i = 0, _a = signatures.length; _i < _a; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var _parent = signature.declaration && signature.declaration.parent; @@ -17617,7 +17617,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0; _i < candidates.length; _i++) { + for (var _i = 0, _a = candidates.length; _i < _a; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -17626,8 +17626,8 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _a = 0; _a < candidates.length; _a++) { - var current = candidates[_a]; + for (var _b = 0, _c = candidates.length; _b < _c; _b++) { + var current = candidates[_b]; if (!hasCorrectArity(node, args, current)) { continue; } @@ -18074,7 +18074,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -18090,7 +18090,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -18126,7 +18126,7 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var _name = p.name; @@ -18566,7 +18566,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -18756,7 +18756,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0; _i < signaturesToCheck.length; _i++) { + for (var _i = 0, _a = signaturesToCheck.length; _i < _a; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -18862,7 +18862,7 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); @@ -18921,8 +18921,8 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _a = 0; _a < signatures.length; _a++) { - var signature = signatures[_a]; + for (var _b = 0, _c = signatures.length; _b < _c; _b++) { + var signature = signatures[_b]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -19565,7 +19565,7 @@ var ts; }); if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 196) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { + for (var _i = 0, _a = classDeclaration.members, _b = _a.length; _i < _b; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -19699,7 +19699,7 @@ var ts; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0; _i < baseProperties.length; _i++) { + for (var _i = 0, _a = baseProperties.length; _i < _a; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -19781,11 +19781,11 @@ var ts; }; }); var ok = true; - for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { + for (var _i = 0, _a = type.baseTypes, _b = _a.length; _i < _b; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _b = 0; _b < properties.length; _b++) { - var prop = properties[_b]; + for (var _c = 0, _d = properties.length; _c < _d; _c++) { + var prop = properties[_c]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, @@ -20035,7 +20035,7 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; if ((declaration.kind === 196 || (declaration.kind === 195 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; @@ -20203,19 +20203,19 @@ var ts; } function hasExportedMembers(moduleSymbol) { var declarations = moduleSymbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var current = declarations[_i]; var statements = getModuleStatements(current); - for (var _a = 0; _a < statements.length; _a++) { - var node = statements[_a]; + for (var _b = 0, _c = statements.length; _b < _c; _b++) { + var node = statements[_b]; if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; } var specifiers = exportClause.elements; - for (var _b = 0; _b < specifiers.length; _b++) { - var specifier = specifiers[_b]; + for (var _d = 0, _e = specifiers.length; _d < _e; _d++) { + var specifier = specifiers[_d]; if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) { return true; } @@ -21119,7 +21119,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { + for (var _i = 0, _a = node.modifiers, _b = _a.length; _i < _b; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 108: @@ -21323,7 +21323,7 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0; _i < arguments.length; _i++) { + for (var _i = 0, _a = arguments.length; _i < _a; _i++) { var arg = arguments[_i]; if (arg.kind === 172) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); @@ -21349,7 +21349,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -21377,7 +21377,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -21423,7 +21423,7 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { var prop = _a[_i]; var _name = prop.name; if (prop.kind === 172 || _name.kind === 126) { @@ -21668,7 +21668,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0; _i < elements.length; _i++) { + for (var _i = 0, _a = elements.length; _i < _a; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -21726,7 +21726,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { + for (var _i = 0, _a = enumDecl.members, _b = _a.length; _i < _b; _i++) { var node = _a[_i]; if (node.name.kind === 126) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -21816,7 +21816,7 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + for (var _i = 0, _a = file.statements, _b = _a.length; _i < _b; _i++) { var decl = _a[_i]; if (ts.isDeclaration(decl) || decl.kind === 175) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { @@ -22279,14 +22279,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -24846,7 +24846,7 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var propName = (p.name); @@ -25270,7 +25270,7 @@ var ts; decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { + for (var _i = 0, _a = body.statements, _b = _a.length; _i < _b; _i++) { var statement = _a[_i]; write(" "); emit(statement); @@ -25887,7 +25887,7 @@ var ts; } function getExternalImportInfo(node) { if (externalImports) { - for (var _i = 0; _i < externalImports.length; _i++) { + for (var _i = 0, _a = externalImports.length; _i < _a; _i++) { var info = externalImports[_i]; if (info.rootNode === node) { return info; diff --git a/bin/tsserver.js b/bin/tsserver.js index c534380b8f3..e0e51feb685 100644 --- a/bin/tsserver.js +++ b/bin/tsserver.js @@ -44,7 +44,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; if (v === value) { return true; @@ -68,7 +68,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -82,7 +82,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var _item = array[_i]; if (f(_item)) { result.push(_item); @@ -96,7 +96,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; result.push(f(v)); } @@ -116,7 +116,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var _item = array[_i]; if (!contains(result, _item)) { result.push(_item); @@ -128,7 +128,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; result += v[prop]; } @@ -136,7 +136,7 @@ var ts; } ts.sum = sum; function addRange(to, from) { - for (var _i = 0; _i < from.length; _i++) { + for (var _i = 0, _a = from.length; _i < _a; _i++) { var v = from[_i]; to.push(v); } @@ -400,7 +400,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0; _i < parts.length; _i++) { + for (var _i = 0, _a = parts.length; _i < _a; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -552,7 +552,7 @@ var ts; ".js" ]; function removeFileExtension(path) { - for (var _i = 0; _i < supportedExtensions.length; _i++) { + for (var _i = 0, _a = supportedExtensions.length; _i < _a; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -710,15 +710,15 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0; _i < files.length; _i++) { + for (var _i = 0, _a = files.length; _i < _a; _i++) { var _name = files[_i]; if (!extension || ts.fileExtensionIs(_name, extension)) { result.push(ts.combinePaths(path, _name)); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0; _a < subfolders.length; _a++) { - var current = subfolders[_a]; + for (var _b = 0, _c = subfolders.length; _b < _c; _b++) { + var current = subfolders[_b]; visitDirectory(ts.combinePaths(path, current)); } } @@ -804,7 +804,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0; _i < files.length; _i++) { + for (var _i = 0, _a = files.length; _i < _a; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -817,8 +817,8 @@ var ts; directories.push(name); } } - for (var _a = 0; _a < directories.length; _a++) { - var _current = directories[_a]; + for (var _b = 0, _c = directories.length; _b < _c; _b++) { + var _current = directories[_b]; visitDirectory(_current); } } @@ -7689,7 +7689,7 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -8396,7 +8396,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0; _i < clauses.length; _i++) { + for (var _i = 0, _a = clauses.length; _i < _a; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -8787,7 +8787,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -9088,7 +9088,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var node = array[_i]; visitNode(node); } @@ -9152,7 +9152,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var node = array[_i]; visitNode(node); } @@ -13309,7 +13309,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0; _i < members.length; _i++) { + for (var _i = 0, _a = members.length; _i < _a; _i++) { var member = members[_i]; if (member.kind === 133 && ts.nodeIsPresent(member.body)) { return member; @@ -13633,7 +13633,7 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { + for (var _i = 0, _a = accessibleSymbolChain.length; _i < _a; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -13814,14 +13814,14 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { + for (var _i = 0, _a = resolved.callSignatures, _b = _a.length; _i < _b; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { - var _signature = _c[_b]; + for (var _c = 0, _d = resolved.constructSignatures, _e = _d.length; _c < _e; _c++) { + var _signature = _d[_c]; writeKeyword(writer, 87); writeSpace(writer); buildSignatureDisplay(_signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); @@ -13854,13 +13854,13 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { - var p = _e[_d]; + for (var _f = 0, _g = resolved.properties, _h = _g.length; _f < _h; _f++) { + var p = _g[_f]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _f = 0; _f < signatures.length; _f++) { - var _signature_1 = signatures[_f]; + for (var _j = 0, _k = signatures.length; _j < _k; _j++) { + var _signature_1 = signatures[_j]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); @@ -14564,7 +14564,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { + for (var _i = 0, _a = symbols.length; _i < _a; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -14572,14 +14572,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { + for (var _i = 0, _a = symbols.length; _i < _a; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0; _i < baseSymbols.length; _i++) { + for (var _i = 0, _a = baseSymbols.length; _i < _a; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -14588,7 +14588,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0; _i < baseSignatures.length; _i++) { + for (var _i = 0, _a = baseSignatures.length; _i < _a; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -14690,7 +14690,7 @@ var ts; return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var _i = 0; _i < signatures.length; _i++) { + for (var _i = 0, _a = signatures.length; _i < _a; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; @@ -14713,7 +14713,7 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -14849,7 +14849,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -14869,8 +14869,8 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0; _a < props.length; _a++) { - var _prop = props[_a]; + for (var _b = 0, _c = props.length; _b < _c; _b++) { + var _prop = props[_b]; if (_prop.declarations) { declarations.push.apply(declarations, _prop.declarations); } @@ -15110,7 +15110,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -15158,7 +15158,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; result |= type.flags; } @@ -15256,7 +15256,7 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { case 196: @@ -15341,13 +15341,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -15365,7 +15365,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -15481,7 +15481,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0; _i < items.length; _i++) { + for (var _i = 0, _a = items.length; _i < _a; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -15533,7 +15533,7 @@ var ts; return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0; _i < sources.length; _i++) { + for (var _i = 0, _a = sources.length; _i < _a; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -15819,7 +15819,7 @@ var ts; function unionTypeRelatedToUnionType(source, target) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { + for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { @@ -15842,7 +15842,7 @@ var ts; function unionTypeRelatedToType(source, target, reportErrors) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { + for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { @@ -15980,7 +15980,7 @@ var ts; var _result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -16051,7 +16051,7 @@ var ts; return 0; } var _result = -1; - for (var _i = 0; _i < sourceProperties.length; _i++) { + for (var _i = 0, _a = sourceProperties.length; _i < _a; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -16076,12 +16076,12 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var _result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0; _i < targetSignatures.length; _i++) { + outer: for (var _i = 0, _a = targetSignatures.length; _i < _a; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _a = 0; _a < sourceSignatures.length; _a++) { - var s = sourceSignatures[_a]; + for (var _b = 0, _c = sourceSignatures.length; _b < _c; _b++) { + var s = sourceSignatures[_b]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); if (related) { @@ -16296,7 +16296,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -16481,7 +16481,7 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0; _i < typeParameters.length; _i++) { + for (var _i = 0, _a = typeParameters.length; _i < _a; _i++) { var unused = typeParameters[_i]; inferences.push({ primary: undefined, @@ -16551,7 +16551,7 @@ var ts; var _targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _a = 0; _a < _targetTypes.length; _a++) { + for (var _a = 0, _b = _targetTypes.length; _a < _b; _a++) { var t = _targetTypes[_a]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; @@ -16569,8 +16569,8 @@ var ts; } else if (source.flags & 16384) { var _sourceTypes = source.types; - for (var _b = 0; _b < _sourceTypes.length; _b++) { - var sourceType = _sourceTypes[_b]; + for (var _c = 0, _d = _sourceTypes.length; _c < _d; _c++) { + var sourceType = _sourceTypes[_c]; inferFromTypes(sourceType, target); } } @@ -16595,7 +16595,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -17212,7 +17212,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -17351,7 +17351,7 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; @@ -17456,7 +17456,7 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { @@ -17722,7 +17722,7 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0; _i < signatures.length; _i++) { + for (var _i = 0, _a = signatures.length; _i < _a; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var _parent = signature.declaration && signature.declaration.parent; @@ -17973,7 +17973,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0; _i < candidates.length; _i++) { + for (var _i = 0, _a = candidates.length; _i < _a; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -17982,8 +17982,8 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _a = 0; _a < candidates.length; _a++) { - var current = candidates[_a]; + for (var _b = 0, _c = candidates.length; _b < _c; _b++) { + var current = candidates[_b]; if (!hasCorrectArity(node, args, current)) { continue; } @@ -18430,7 +18430,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -18446,7 +18446,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -18482,7 +18482,7 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var _name = p.name; @@ -18922,7 +18922,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -19112,7 +19112,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0; _i < signaturesToCheck.length; _i++) { + for (var _i = 0, _a = signaturesToCheck.length; _i < _a; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -19218,7 +19218,7 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); @@ -19277,8 +19277,8 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _a = 0; _a < signatures.length; _a++) { - var signature = signatures[_a]; + for (var _b = 0, _c = signatures.length; _b < _c; _b++) { + var signature = signatures[_b]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -19921,7 +19921,7 @@ var ts; }); if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 196) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { + for (var _i = 0, _a = classDeclaration.members, _b = _a.length; _i < _b; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -20055,7 +20055,7 @@ var ts; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0; _i < baseProperties.length; _i++) { + for (var _i = 0, _a = baseProperties.length; _i < _a; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -20137,11 +20137,11 @@ var ts; }; }); var ok = true; - for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { + for (var _i = 0, _a = type.baseTypes, _b = _a.length; _i < _b; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _b = 0; _b < properties.length; _b++) { - var prop = properties[_b]; + for (var _c = 0, _d = properties.length; _c < _d; _c++) { + var prop = properties[_c]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, @@ -20391,7 +20391,7 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; if ((declaration.kind === 196 || (declaration.kind === 195 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; @@ -20559,19 +20559,19 @@ var ts; } function hasExportedMembers(moduleSymbol) { var declarations = moduleSymbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var current = declarations[_i]; var statements = getModuleStatements(current); - for (var _a = 0; _a < statements.length; _a++) { - var node = statements[_a]; + for (var _b = 0, _c = statements.length; _b < _c; _b++) { + var node = statements[_b]; if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; } var specifiers = exportClause.elements; - for (var _b = 0; _b < specifiers.length; _b++) { - var specifier = specifiers[_b]; + for (var _d = 0, _e = specifiers.length; _d < _e; _d++) { + var specifier = specifiers[_d]; if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) { return true; } @@ -21475,7 +21475,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { + for (var _i = 0, _a = node.modifiers, _b = _a.length; _i < _b; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 108: @@ -21679,7 +21679,7 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0; _i < arguments.length; _i++) { + for (var _i = 0, _a = arguments.length; _i < _a; _i++) { var arg = arguments[_i]; if (arg.kind === 172) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); @@ -21705,7 +21705,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -21733,7 +21733,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -21779,7 +21779,7 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { var prop = _a[_i]; var _name = prop.name; if (prop.kind === 172 || _name.kind === 126) { @@ -22024,7 +22024,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0; _i < elements.length; _i++) { + for (var _i = 0, _a = elements.length; _i < _a; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -22082,7 +22082,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { + for (var _i = 0, _a = enumDecl.members, _b = _a.length; _i < _b; _i++) { var node = _a[_i]; if (node.name.kind === 126) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -22172,7 +22172,7 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + for (var _i = 0, _a = file.statements, _b = _a.length; _i < _b; _i++) { var decl = _a[_i]; if (ts.isDeclaration(decl) || decl.kind === 175) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { @@ -22635,14 +22635,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -25202,7 +25202,7 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var propName = (p.name); @@ -25626,7 +25626,7 @@ var ts; decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { + for (var _i = 0, _a = body.statements, _b = _a.length; _i < _b; _i++) { var statement = _a[_i]; write(" "); emit(statement); @@ -26243,7 +26243,7 @@ var ts; } function getExternalImportInfo(node) { if (externalImports) { - for (var _i = 0; _i < externalImports.length; _i++) { + for (var _i = 0, _a = externalImports.length; _i < _a; _i++) { var info = externalImports[_i]; if (info.rootNode === node) { return info; @@ -27604,7 +27604,7 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; var name = getDeclarationName(declaration); if (name !== undefined) { @@ -27642,7 +27642,7 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var _i = 0; _i < matches.length; _i++) { + for (var _i = 0, _a = matches.length; _i < _a; _i++) { var match = matches[_i]; if (!match.isCaseSensitive) { return false; @@ -27721,7 +27721,7 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var _bestMatchKind = 3; - for (var _i = 0; _i < matches.length; _i++) { + for (var _i = 0, _a = matches.length; _i < _a; _i++) { var match = matches[_i]; var kind = match.kind; if (kind < _bestMatchKind) { @@ -27858,7 +27858,7 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; switch (node.kind) { case 196: @@ -27899,7 +27899,7 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var child = nodes[_i]; var _item = createItem(child); if (_item !== undefined) { @@ -27924,10 +27924,10 @@ var ts; if (!target.childItems) { target.childItems = []; } - outer: for (var _i = 0, _a = source.childItems; _i < _a.length; _i++) { + outer: for (var _i = 0, _a = source.childItems, _b = _a.length; _i < _b; _i++) { var sourceChild = _a[_i]; - for (var _b = 0, _c = target.childItems; _b < _c.length; _b++) { - var targetChild = _c[_b]; + for (var _c = 0, _d = target.childItems, _e = _d.length; _c < _e; _c++) { + var targetChild = _d[_c]; if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { merge(targetChild, sourceChild); continue outer; @@ -28227,7 +28227,7 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var _i = 0; _i < wordSpans.length; _i++) { + for (var _i = 0, _a = wordSpans.length; _i < _a; _i++) { var span = wordSpans[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(2, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); @@ -28282,7 +28282,7 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var _i = 0; _i < subWordTextChunks.length; _i++) { + for (var _i = 0, _a = subWordTextChunks.length; _i < _a; _i++) { var subWordTextChunk = subWordTextChunks[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { @@ -28671,7 +28671,7 @@ var ts; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var _i = 0; _i < listChildren.length; _i++) { + for (var _i = 0, _a = listChildren.length; _i < _a; _i++) { var child = listChildren[_i]; if (child === node) { break; @@ -28996,7 +28996,7 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0; _i < children.length; _i++) { + for (var _i = 0, _a = children.length; _i < _a; _i++) { var child = children[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { @@ -29645,7 +29645,7 @@ var ts; if (this.IsAny()) { return true; } - for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) { + for (var _i = 0, _a = this.customContextChecks, _b = _a.length; _i < _b; _i++) { var check = _a[_i]; if (!check(context)) { return false; @@ -30133,7 +30133,7 @@ var ts; var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) { + for (var _i = 0, _a = bucket.Rules(), _b = _a.length; _i < _b; _i++) { var rule = _a[_i]; if (rule.Operation.Context.InContext(context)) { return rule; @@ -30811,7 +30811,7 @@ var ts; } } var inheritedIndentation = -1; - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var child = nodes[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, _startLine, true); } @@ -30856,7 +30856,7 @@ var ts; if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { + for (var _i = 0, _a = currentTokenInfo.leadingTrivia, _b = _a.length; _i < _b; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; @@ -30891,7 +30891,7 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var _i = 0; _i < trivia.length; _i++) { + for (var _i = 0, _a = trivia.length; _i < _a; _i++) { var triviaItem = trivia[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); @@ -31618,7 +31618,7 @@ var ts; var list = createNode(222, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); @@ -31677,7 +31677,7 @@ var ts; }; NodeObject.prototype.getFirstToken = function (sourceFile) { var children = this.getChildren(); - for (var _i = 0; _i < children.length; _i++) { + for (var _i = 0, _a = children.length; _i < _a; _i++) { var child = children[_i]; if (child.kind < 125) { return child; @@ -32295,7 +32295,7 @@ var ts; this.host = host; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); - for (var _i = 0; _i < rootFileNames.length; _i++) { + for (var _i = 0, _a = rootFileNames.length; _i < _a; _i++) { var fileName = rootFileNames[_i]; this.createEntry(fileName); } @@ -32874,7 +32874,7 @@ var ts; }); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var _i = 0; _i < oldSourceFiles.length; _i++) { + for (var _i = 0, _a = oldSourceFiles.length; _i < _a; _i++) { var oldSourceFile = oldSourceFiles[_i]; var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { @@ -32909,8 +32909,8 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var _a = 0; _a < rootFileNames.length; _a++) { - var _fileName = rootFileNames[_a]; + for (var _b = 0, _c = rootFileNames.length; _b < _c; _b++) { + var _fileName = rootFileNames[_b]; if (!sourceFileUpToDate(program.getSourceFile(_fileName))) { return false; } @@ -34431,7 +34431,7 @@ var ts; var _scope = undefined; var _declarations = symbol.getDeclarations(); if (_declarations) { - for (var _i = 0; _i < _declarations.length; _i++) { + for (var _i = 0, _a = _declarations.length; _i < _a; _i++) { var declaration = _declarations[_i]; var container = getContainerNode(declaration); if (!container) { @@ -34793,7 +34793,7 @@ var ts; var lastIterationMeaning; do { lastIterationMeaning = meaning; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { @@ -35224,7 +35224,7 @@ var ts; function processElement(element) { if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var _i = 0; _i < children.length; _i++) { + for (var _i = 0, _a = children.length; _i < _a; _i++) { var child = children[_i]; if (ts.isToken(child)) { classifyToken(child); @@ -35249,7 +35249,7 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0; _i < childNodes.length; _i++) { + for (var _i = 0, _a = childNodes.length; _i < _a; _i++) { var current = childNodes[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); @@ -35388,7 +35388,7 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var current = declarations[_i]; var _sourceFile = current.getSourceFile(); if (_sourceFile && getCanonicalFileName(ts.normalizePath(_sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { diff --git a/bin/typescript.js b/bin/typescript.js index cc1ec309618..7d12ccab74f 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -625,7 +625,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; if (v === value) { return true; @@ -649,7 +649,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -663,7 +663,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var _item = array[_i]; if (f(_item)) { result.push(_item); @@ -677,7 +677,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; result.push(f(v)); } @@ -697,7 +697,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var _item = array[_i]; if (!contains(result, _item)) { result.push(_item); @@ -709,7 +709,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; result += v[prop]; } @@ -717,7 +717,7 @@ var ts; } ts.sum = sum; function addRange(to, from) { - for (var _i = 0; _i < from.length; _i++) { + for (var _i = 0, _a = from.length; _i < _a; _i++) { var v = from[_i]; to.push(v); } @@ -981,7 +981,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0; _i < parts.length; _i++) { + for (var _i = 0, _a = parts.length; _i < _a; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -1133,7 +1133,7 @@ var ts; ".js" ]; function removeFileExtension(path) { - for (var _i = 0; _i < supportedExtensions.length; _i++) { + for (var _i = 0, _a = supportedExtensions.length; _i < _a; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -1298,15 +1298,15 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0; _i < files.length; _i++) { + for (var _i = 0, _a = files.length; _i < _a; _i++) { var _name = files[_i]; if (!extension || ts.fileExtensionIs(_name, extension)) { result.push(ts.combinePaths(path, _name)); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0; _a < subfolders.length; _a++) { - var current = subfolders[_a]; + for (var _b = 0, _c = subfolders.length; _b < _c; _b++) { + var current = subfolders[_b]; visitDirectory(ts.combinePaths(path, current)); } } @@ -1392,7 +1392,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0; _i < files.length; _i++) { + for (var _i = 0, _a = files.length; _i < _a; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -1405,8 +1405,8 @@ var ts; directories.push(name); } } - for (var _a = 0; _a < directories.length; _a++) { - var _current = directories[_a]; + for (var _b = 0, _c = directories.length; _b < _c; _b++) { + var _current = directories[_b]; visitDirectory(_current); } } @@ -7921,7 +7921,7 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -8628,7 +8628,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0; _i < clauses.length; _i++) { + for (var _i = 0, _a = clauses.length; _i < _a; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -9019,7 +9019,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -9351,7 +9351,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var node = array[_i]; visitNode(node); } @@ -9415,7 +9415,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var node = array[_i]; visitNode(node); } @@ -13582,7 +13582,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0; _i < members.length; _i++) { + for (var _i = 0, _a = members.length; _i < _a; _i++) { var member = members[_i]; if (member.kind === 133 && ts.nodeIsPresent(member.body)) { return member; @@ -13906,7 +13906,7 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { + for (var _i = 0, _a = accessibleSymbolChain.length; _i < _a; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -14087,14 +14087,14 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { + for (var _i = 0, _a = resolved.callSignatures, _b = _a.length; _i < _b; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { - var _signature = _c[_b]; + for (var _c = 0, _d = resolved.constructSignatures, _e = _d.length; _c < _e; _c++) { + var _signature = _d[_c]; writeKeyword(writer, 87); writeSpace(writer); buildSignatureDisplay(_signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); @@ -14127,13 +14127,13 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { - var p = _e[_d]; + for (var _f = 0, _g = resolved.properties, _h = _g.length; _f < _h; _f++) { + var p = _g[_f]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _f = 0; _f < signatures.length; _f++) { - var _signature_1 = signatures[_f]; + for (var _j = 0, _k = signatures.length; _j < _k; _j++) { + var _signature_1 = signatures[_j]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); @@ -14837,7 +14837,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { + for (var _i = 0, _a = symbols.length; _i < _a; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -14845,14 +14845,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { + for (var _i = 0, _a = symbols.length; _i < _a; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0; _i < baseSymbols.length; _i++) { + for (var _i = 0, _a = baseSymbols.length; _i < _a; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -14861,7 +14861,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0; _i < baseSignatures.length; _i++) { + for (var _i = 0, _a = baseSignatures.length; _i < _a; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -14963,7 +14963,7 @@ var ts; return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var _i = 0; _i < signatures.length; _i++) { + for (var _i = 0, _a = signatures.length; _i < _a; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; @@ -14986,7 +14986,7 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -15122,7 +15122,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -15142,8 +15142,8 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0; _a < props.length; _a++) { - var _prop = props[_a]; + for (var _b = 0, _c = props.length; _b < _c; _b++) { + var _prop = props[_b]; if (_prop.declarations) { declarations.push.apply(declarations, _prop.declarations); } @@ -15383,7 +15383,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -15431,7 +15431,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; result |= type.flags; } @@ -15529,7 +15529,7 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { case 196: @@ -15614,13 +15614,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -15638,7 +15638,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -15754,7 +15754,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0; _i < items.length; _i++) { + for (var _i = 0, _a = items.length; _i < _a; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -15806,7 +15806,7 @@ var ts; return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0; _i < sources.length; _i++) { + for (var _i = 0, _a = sources.length; _i < _a; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -16092,7 +16092,7 @@ var ts; function unionTypeRelatedToUnionType(source, target) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { + for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { @@ -16115,7 +16115,7 @@ var ts; function unionTypeRelatedToType(source, target, reportErrors) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { + for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { @@ -16253,7 +16253,7 @@ var ts; var _result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -16324,7 +16324,7 @@ var ts; return 0; } var _result = -1; - for (var _i = 0; _i < sourceProperties.length; _i++) { + for (var _i = 0, _a = sourceProperties.length; _i < _a; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -16349,12 +16349,12 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var _result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0; _i < targetSignatures.length; _i++) { + outer: for (var _i = 0, _a = targetSignatures.length; _i < _a; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _a = 0; _a < sourceSignatures.length; _a++) { - var s = sourceSignatures[_a]; + for (var _b = 0, _c = sourceSignatures.length; _b < _c; _b++) { + var s = sourceSignatures[_b]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); if (related) { @@ -16569,7 +16569,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -16754,7 +16754,7 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0; _i < typeParameters.length; _i++) { + for (var _i = 0, _a = typeParameters.length; _i < _a; _i++) { var unused = typeParameters[_i]; inferences.push({ primary: undefined, @@ -16824,7 +16824,7 @@ var ts; var _targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _a = 0; _a < _targetTypes.length; _a++) { + for (var _a = 0, _b = _targetTypes.length; _a < _b; _a++) { var t = _targetTypes[_a]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; @@ -16842,8 +16842,8 @@ var ts; } else if (source.flags & 16384) { var _sourceTypes = source.types; - for (var _b = 0; _b < _sourceTypes.length; _b++) { - var sourceType = _sourceTypes[_b]; + for (var _c = 0, _d = _sourceTypes.length; _c < _d; _c++) { + var sourceType = _sourceTypes[_c]; inferFromTypes(sourceType, target); } } @@ -16868,7 +16868,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -17485,7 +17485,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -17624,7 +17624,7 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; @@ -17729,7 +17729,7 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { @@ -17995,7 +17995,7 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0; _i < signatures.length; _i++) { + for (var _i = 0, _a = signatures.length; _i < _a; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var _parent = signature.declaration && signature.declaration.parent; @@ -18246,7 +18246,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0; _i < candidates.length; _i++) { + for (var _i = 0, _a = candidates.length; _i < _a; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -18255,8 +18255,8 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _a = 0; _a < candidates.length; _a++) { - var current = candidates[_a]; + for (var _b = 0, _c = candidates.length; _b < _c; _b++) { + var current = candidates[_b]; if (!hasCorrectArity(node, args, current)) { continue; } @@ -18703,7 +18703,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -18719,7 +18719,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -18755,7 +18755,7 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var _name = p.name; @@ -19195,7 +19195,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -19385,7 +19385,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0; _i < signaturesToCheck.length; _i++) { + for (var _i = 0, _a = signaturesToCheck.length; _i < _a; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -19491,7 +19491,7 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); @@ -19550,8 +19550,8 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _a = 0; _a < signatures.length; _a++) { - var signature = signatures[_a]; + for (var _b = 0, _c = signatures.length; _b < _c; _b++) { + var signature = signatures[_b]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -20194,7 +20194,7 @@ var ts; }); if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 196) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { + for (var _i = 0, _a = classDeclaration.members, _b = _a.length; _i < _b; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -20328,7 +20328,7 @@ var ts; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0; _i < baseProperties.length; _i++) { + for (var _i = 0, _a = baseProperties.length; _i < _a; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -20410,11 +20410,11 @@ var ts; }; }); var ok = true; - for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { + for (var _i = 0, _a = type.baseTypes, _b = _a.length; _i < _b; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _b = 0; _b < properties.length; _b++) { - var prop = properties[_b]; + for (var _c = 0, _d = properties.length; _c < _d; _c++) { + var prop = properties[_c]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, @@ -20664,7 +20664,7 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; if ((declaration.kind === 196 || (declaration.kind === 195 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; @@ -20832,19 +20832,19 @@ var ts; } function hasExportedMembers(moduleSymbol) { var declarations = moduleSymbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var current = declarations[_i]; var statements = getModuleStatements(current); - for (var _a = 0; _a < statements.length; _a++) { - var node = statements[_a]; + for (var _b = 0, _c = statements.length; _b < _c; _b++) { + var node = statements[_b]; if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; } var specifiers = exportClause.elements; - for (var _b = 0; _b < specifiers.length; _b++) { - var specifier = specifiers[_b]; + for (var _d = 0, _e = specifiers.length; _d < _e; _d++) { + var specifier = specifiers[_d]; if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) { return true; } @@ -21748,7 +21748,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { + for (var _i = 0, _a = node.modifiers, _b = _a.length; _i < _b; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 108: @@ -21952,7 +21952,7 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0; _i < arguments.length; _i++) { + for (var _i = 0, _a = arguments.length; _i < _a; _i++) { var arg = arguments[_i]; if (arg.kind === 172) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); @@ -21978,7 +21978,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -22006,7 +22006,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -22052,7 +22052,7 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { var prop = _a[_i]; var _name = prop.name; if (prop.kind === 172 || _name.kind === 126) { @@ -22297,7 +22297,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0; _i < elements.length; _i++) { + for (var _i = 0, _a = elements.length; _i < _a; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -22355,7 +22355,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { + for (var _i = 0, _a = enumDecl.members, _b = _a.length; _i < _b; _i++) { var node = _a[_i]; if (node.name.kind === 126) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -22445,7 +22445,7 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + for (var _i = 0, _a = file.statements, _b = _a.length; _i < _b; _i++) { var decl = _a[_i]; if (ts.isDeclaration(decl) || decl.kind === 175) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { @@ -22908,14 +22908,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -25475,7 +25475,7 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var propName = (p.name); @@ -25899,7 +25899,7 @@ var ts; decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { + for (var _i = 0, _a = body.statements, _b = _a.length; _i < _b; _i++) { var statement = _a[_i]; write(" "); emit(statement); @@ -26516,7 +26516,7 @@ var ts; } function getExternalImportInfo(node) { if (externalImports) { - for (var _i = 0; _i < externalImports.length; _i++) { + for (var _i = 0, _a = externalImports.length; _i < _a; _i++) { var info = externalImports[_i]; if (info.rootNode === node) { return info; @@ -27879,7 +27879,7 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; var name = getDeclarationName(declaration); if (name !== undefined) { @@ -27917,7 +27917,7 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var _i = 0; _i < matches.length; _i++) { + for (var _i = 0, _a = matches.length; _i < _a; _i++) { var match = matches[_i]; if (!match.isCaseSensitive) { return false; @@ -27996,7 +27996,7 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var _bestMatchKind = 3; - for (var _i = 0; _i < matches.length; _i++) { + for (var _i = 0, _a = matches.length; _i < _a; _i++) { var match = matches[_i]; var kind = match.kind; if (kind < _bestMatchKind) { @@ -28133,7 +28133,7 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; switch (node.kind) { case 196: @@ -28174,7 +28174,7 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var child = nodes[_i]; var _item = createItem(child); if (_item !== undefined) { @@ -28199,10 +28199,10 @@ var ts; if (!target.childItems) { target.childItems = []; } - outer: for (var _i = 0, _a = source.childItems; _i < _a.length; _i++) { + outer: for (var _i = 0, _a = source.childItems, _b = _a.length; _i < _b; _i++) { var sourceChild = _a[_i]; - for (var _b = 0, _c = target.childItems; _b < _c.length; _b++) { - var targetChild = _c[_b]; + for (var _c = 0, _d = target.childItems, _e = _d.length; _c < _e; _c++) { + var targetChild = _d[_c]; if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { merge(targetChild, sourceChild); continue outer; @@ -28502,7 +28502,7 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var _i = 0; _i < wordSpans.length; _i++) { + for (var _i = 0, _a = wordSpans.length; _i < _a; _i++) { var span = wordSpans[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(2, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); @@ -28557,7 +28557,7 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var _i = 0; _i < subWordTextChunks.length; _i++) { + for (var _i = 0, _a = subWordTextChunks.length; _i < _a; _i++) { var subWordTextChunk = subWordTextChunks[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { @@ -28952,7 +28952,7 @@ var ts; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var _i = 0; _i < listChildren.length; _i++) { + for (var _i = 0, _a = listChildren.length; _i < _a; _i++) { var child = listChildren[_i]; if (child === node) { break; @@ -29277,7 +29277,7 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0; _i < children.length; _i++) { + for (var _i = 0, _a = children.length; _i < _a; _i++) { var child = children[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { @@ -29968,7 +29968,7 @@ var ts; if (this.IsAny()) { return true; } - for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) { + for (var _i = 0, _a = this.customContextChecks, _b = _a.length; _i < _b; _i++) { var check = _a[_i]; if (!check(context)) { return false; @@ -30456,7 +30456,7 @@ var ts; var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) { + for (var _i = 0, _a = bucket.Rules(), _b = _a.length; _i < _b; _i++) { var rule = _a[_i]; if (rule.Operation.Context.InContext(context)) { return rule; @@ -31138,7 +31138,7 @@ var ts; } } var inheritedIndentation = -1; - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var child = nodes[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, _startLine, true); } @@ -31183,7 +31183,7 @@ var ts; if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { + for (var _i = 0, _a = currentTokenInfo.leadingTrivia, _b = _a.length; _i < _b; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; @@ -31218,7 +31218,7 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var _i = 0; _i < trivia.length; _i++) { + for (var _i = 0, _a = trivia.length; _i < _a; _i++) { var triviaItem = trivia[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); @@ -31949,7 +31949,7 @@ var ts; var list = createNode(222, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); @@ -32008,7 +32008,7 @@ var ts; }; NodeObject.prototype.getFirstToken = function (sourceFile) { var children = this.getChildren(); - for (var _i = 0; _i < children.length; _i++) { + for (var _i = 0, _a = children.length; _i < _a; _i++) { var child = children[_i]; if (child.kind < 125) { return child; @@ -32642,7 +32642,7 @@ var ts; this.host = host; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); - for (var _i = 0; _i < rootFileNames.length; _i++) { + for (var _i = 0, _a = rootFileNames.length; _i < _a; _i++) { var fileName = rootFileNames[_i]; this.createEntry(fileName); } @@ -33236,7 +33236,7 @@ var ts; }); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var _i = 0; _i < oldSourceFiles.length; _i++) { + for (var _i = 0, _a = oldSourceFiles.length; _i < _a; _i++) { var oldSourceFile = oldSourceFiles[_i]; var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { @@ -33271,8 +33271,8 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var _a = 0; _a < rootFileNames.length; _a++) { - var _fileName = rootFileNames[_a]; + for (var _b = 0, _c = rootFileNames.length; _b < _c; _b++) { + var _fileName = rootFileNames[_b]; if (!sourceFileUpToDate(program.getSourceFile(_fileName))) { return false; } @@ -34793,7 +34793,7 @@ var ts; var _scope = undefined; var _declarations = symbol.getDeclarations(); if (_declarations) { - for (var _i = 0; _i < _declarations.length; _i++) { + for (var _i = 0, _a = _declarations.length; _i < _a; _i++) { var declaration = _declarations[_i]; var container = getContainerNode(declaration); if (!container) { @@ -35155,7 +35155,7 @@ var ts; var lastIterationMeaning; do { lastIterationMeaning = meaning; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { @@ -35586,7 +35586,7 @@ var ts; function processElement(element) { if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var _i = 0; _i < children.length; _i++) { + for (var _i = 0, _a = children.length; _i < _a; _i++) { var child = children[_i]; if (ts.isToken(child)) { classifyToken(child); @@ -35611,7 +35611,7 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0; _i < childNodes.length; _i++) { + for (var _i = 0, _a = childNodes.length; _i < _a; _i++) { var current = childNodes[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); @@ -35750,7 +35750,7 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var current = declarations[_i]; var _sourceFile = current.getSourceFile(); if (_sourceFile && getCanonicalFileName(ts.normalizePath(_sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index cc1ec309618..7d12ccab74f 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -625,7 +625,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; if (v === value) { return true; @@ -649,7 +649,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -663,7 +663,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var _item = array[_i]; if (f(_item)) { result.push(_item); @@ -677,7 +677,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; result.push(f(v)); } @@ -697,7 +697,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var _item = array[_i]; if (!contains(result, _item)) { result.push(_item); @@ -709,7 +709,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var v = array[_i]; result += v[prop]; } @@ -717,7 +717,7 @@ var ts; } ts.sum = sum; function addRange(to, from) { - for (var _i = 0; _i < from.length; _i++) { + for (var _i = 0, _a = from.length; _i < _a; _i++) { var v = from[_i]; to.push(v); } @@ -981,7 +981,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0; _i < parts.length; _i++) { + for (var _i = 0, _a = parts.length; _i < _a; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -1133,7 +1133,7 @@ var ts; ".js" ]; function removeFileExtension(path) { - for (var _i = 0; _i < supportedExtensions.length; _i++) { + for (var _i = 0, _a = supportedExtensions.length; _i < _a; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -1298,15 +1298,15 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0; _i < files.length; _i++) { + for (var _i = 0, _a = files.length; _i < _a; _i++) { var _name = files[_i]; if (!extension || ts.fileExtensionIs(_name, extension)) { result.push(ts.combinePaths(path, _name)); } } var subfolders = getNames(folder.subfolders); - for (var _a = 0; _a < subfolders.length; _a++) { - var current = subfolders[_a]; + for (var _b = 0, _c = subfolders.length; _b < _c; _b++) { + var current = subfolders[_b]; visitDirectory(ts.combinePaths(path, current)); } } @@ -1392,7 +1392,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0; _i < files.length; _i++) { + for (var _i = 0, _a = files.length; _i < _a; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -1405,8 +1405,8 @@ var ts; directories.push(name); } } - for (var _a = 0; _a < directories.length; _a++) { - var _current = directories[_a]; + for (var _b = 0, _c = directories.length; _b < _c; _b++) { + var _current = directories[_b]; visitDirectory(_current); } } @@ -7921,7 +7921,7 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -8628,7 +8628,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0; _i < clauses.length; _i++) { + for (var _i = 0, _a = clauses.length; _i < _a; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -9019,7 +9019,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -9351,7 +9351,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var node = array[_i]; visitNode(node); } @@ -9415,7 +9415,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0; _i < array.length; _i++) { + for (var _i = 0, _a = array.length; _i < _a; _i++) { var node = array[_i]; visitNode(node); } @@ -13582,7 +13582,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0; _i < members.length; _i++) { + for (var _i = 0, _a = members.length; _i < _a; _i++) { var member = members[_i]; if (member.kind === 133 && ts.nodeIsPresent(member.body)) { return member; @@ -13906,7 +13906,7 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0; _i < accessibleSymbolChain.length; _i++) { + for (var _i = 0, _a = accessibleSymbolChain.length; _i < _a; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -14087,14 +14087,14 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { + for (var _i = 0, _a = resolved.callSignatures, _b = _a.length; _i < _b; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { - var _signature = _c[_b]; + for (var _c = 0, _d = resolved.constructSignatures, _e = _d.length; _c < _e; _c++) { + var _signature = _d[_c]; writeKeyword(writer, 87); writeSpace(writer); buildSignatureDisplay(_signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); @@ -14127,13 +14127,13 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { - var p = _e[_d]; + for (var _f = 0, _g = resolved.properties, _h = _g.length; _f < _h; _f++) { + var p = _g[_f]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _f = 0; _f < signatures.length; _f++) { - var _signature_1 = signatures[_f]; + for (var _j = 0, _k = signatures.length; _j < _k; _j++) { + var _signature_1 = signatures[_j]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); @@ -14837,7 +14837,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { + for (var _i = 0, _a = symbols.length; _i < _a; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -14845,14 +14845,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0; _i < symbols.length; _i++) { + for (var _i = 0, _a = symbols.length; _i < _a; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0; _i < baseSymbols.length; _i++) { + for (var _i = 0, _a = baseSymbols.length; _i < _a; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -14861,7 +14861,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0; _i < baseSignatures.length; _i++) { + for (var _i = 0, _a = baseSignatures.length; _i < _a; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -14963,7 +14963,7 @@ var ts; return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var _i = 0; _i < signatures.length; _i++) { + for (var _i = 0, _a = signatures.length; _i < _a; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; @@ -14986,7 +14986,7 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -15122,7 +15122,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -15142,8 +15142,8 @@ var ts; } var propTypes = []; var declarations = []; - for (var _a = 0; _a < props.length; _a++) { - var _prop = props[_a]; + for (var _b = 0, _c = props.length; _b < _c; _b++) { + var _prop = props[_b]; if (_prop.declarations) { declarations.push.apply(declarations, _prop.declarations); } @@ -15383,7 +15383,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -15431,7 +15431,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; result |= type.flags; } @@ -15529,7 +15529,7 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { case 196: @@ -15614,13 +15614,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -15638,7 +15638,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -15754,7 +15754,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0; _i < items.length; _i++) { + for (var _i = 0, _a = items.length; _i < _a; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -15806,7 +15806,7 @@ var ts; return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0; _i < sources.length; _i++) { + for (var _i = 0, _a = sources.length; _i < _a; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -16092,7 +16092,7 @@ var ts; function unionTypeRelatedToUnionType(source, target) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { + for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { @@ -16115,7 +16115,7 @@ var ts; function unionTypeRelatedToType(source, target, reportErrors) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0; _i < sourceTypes.length; _i++) { + for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { @@ -16253,7 +16253,7 @@ var ts; var _result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -16324,7 +16324,7 @@ var ts; return 0; } var _result = -1; - for (var _i = 0; _i < sourceProperties.length; _i++) { + for (var _i = 0, _a = sourceProperties.length; _i < _a; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -16349,12 +16349,12 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var _result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0; _i < targetSignatures.length; _i++) { + outer: for (var _i = 0, _a = targetSignatures.length; _i < _a; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _a = 0; _a < sourceSignatures.length; _a++) { - var s = sourceSignatures[_a]; + for (var _b = 0, _c = sourceSignatures.length; _b < _c; _b++) { + var s = sourceSignatures[_b]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); if (related) { @@ -16569,7 +16569,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -16754,7 +16754,7 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0; _i < typeParameters.length; _i++) { + for (var _i = 0, _a = typeParameters.length; _i < _a; _i++) { var unused = typeParameters[_i]; inferences.push({ primary: undefined, @@ -16824,7 +16824,7 @@ var ts; var _targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _a = 0; _a < _targetTypes.length; _a++) { + for (var _a = 0, _b = _targetTypes.length; _a < _b; _a++) { var t = _targetTypes[_a]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; @@ -16842,8 +16842,8 @@ var ts; } else if (source.flags & 16384) { var _sourceTypes = source.types; - for (var _b = 0; _b < _sourceTypes.length; _b++) { - var sourceType = _sourceTypes[_b]; + for (var _c = 0, _d = _sourceTypes.length; _c < _d; _c++) { + var sourceType = _sourceTypes[_c]; inferFromTypes(sourceType, target); } } @@ -16868,7 +16868,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -17485,7 +17485,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -17624,7 +17624,7 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; @@ -17729,7 +17729,7 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { @@ -17995,7 +17995,7 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0; _i < signatures.length; _i++) { + for (var _i = 0, _a = signatures.length; _i < _a; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var _parent = signature.declaration && signature.declaration.parent; @@ -18246,7 +18246,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0; _i < candidates.length; _i++) { + for (var _i = 0, _a = candidates.length; _i < _a; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -18255,8 +18255,8 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _a = 0; _a < candidates.length; _a++) { - var current = candidates[_a]; + for (var _b = 0, _c = candidates.length; _b < _c; _b++) { + var current = candidates[_b]; if (!hasCorrectArity(node, args, current)) { continue; } @@ -18703,7 +18703,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -18719,7 +18719,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0; _i < types.length; _i++) { + for (var _i = 0, _a = types.length; _i < _a; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -18755,7 +18755,7 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var _name = p.name; @@ -19195,7 +19195,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -19385,7 +19385,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0; _i < signaturesToCheck.length; _i++) { + for (var _i = 0, _a = signaturesToCheck.length; _i < _a; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -19491,7 +19491,7 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); @@ -19550,8 +19550,8 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _a = 0; _a < signatures.length; _a++) { - var signature = signatures[_a]; + for (var _b = 0, _c = signatures.length; _b < _c; _b++) { + var signature = signatures[_b]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -20194,7 +20194,7 @@ var ts; }); if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 196) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { + for (var _i = 0, _a = classDeclaration.members, _b = _a.length; _i < _b; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -20328,7 +20328,7 @@ var ts; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0; _i < baseProperties.length; _i++) { + for (var _i = 0, _a = baseProperties.length; _i < _a; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -20410,11 +20410,11 @@ var ts; }; }); var ok = true; - for (var _i = 0, _a = type.baseTypes; _i < _a.length; _i++) { + for (var _i = 0, _a = type.baseTypes, _b = _a.length; _i < _b; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _b = 0; _b < properties.length; _b++) { - var prop = properties[_b]; + for (var _c = 0, _d = properties.length; _c < _d; _c++) { + var prop = properties[_c]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, @@ -20664,7 +20664,7 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; if ((declaration.kind === 196 || (declaration.kind === 195 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; @@ -20832,19 +20832,19 @@ var ts; } function hasExportedMembers(moduleSymbol) { var declarations = moduleSymbol.declarations; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var current = declarations[_i]; var statements = getModuleStatements(current); - for (var _a = 0; _a < statements.length; _a++) { - var node = statements[_a]; + for (var _b = 0, _c = statements.length; _b < _c; _b++) { + var node = statements[_b]; if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; } var specifiers = exportClause.elements; - for (var _b = 0; _b < specifiers.length; _b++) { - var specifier = specifiers[_b]; + for (var _d = 0, _e = specifiers.length; _d < _e; _d++) { + var specifier = specifiers[_d]; if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) { return true; } @@ -21748,7 +21748,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { + for (var _i = 0, _a = node.modifiers, _b = _a.length; _i < _b; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 108: @@ -21952,7 +21952,7 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0; _i < arguments.length; _i++) { + for (var _i = 0, _a = arguments.length; _i < _a; _i++) { var arg = arguments[_i]; if (arg.kind === 172) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); @@ -21978,7 +21978,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -22006,7 +22006,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { + for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -22052,7 +22052,7 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { var prop = _a[_i]; var _name = prop.name; if (prop.kind === 172 || _name.kind === 126) { @@ -22297,7 +22297,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0; _i < elements.length; _i++) { + for (var _i = 0, _a = elements.length; _i < _a; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -22355,7 +22355,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { + for (var _i = 0, _a = enumDecl.members, _b = _a.length; _i < _b; _i++) { var node = _a[_i]; if (node.name.kind === 126) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -22445,7 +22445,7 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + for (var _i = 0, _a = file.statements, _b = _a.length; _i < _b; _i++) { var decl = _a[_i]; if (ts.isDeclaration(decl) || decl.kind === 175) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { @@ -22908,14 +22908,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -25475,7 +25475,7 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _i = 0; _i < properties.length; _i++) { + for (var _i = 0, _a = properties.length; _i < _a; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var propName = (p.name); @@ -25899,7 +25899,7 @@ var ts; decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { + for (var _i = 0, _a = body.statements, _b = _a.length; _i < _b; _i++) { var statement = _a[_i]; write(" "); emit(statement); @@ -26516,7 +26516,7 @@ var ts; } function getExternalImportInfo(node) { if (externalImports) { - for (var _i = 0; _i < externalImports.length; _i++) { + for (var _i = 0, _a = externalImports.length; _i < _a; _i++) { var info = externalImports[_i]; if (info.rootNode === node) { return info; @@ -27879,7 +27879,7 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; var name = getDeclarationName(declaration); if (name !== undefined) { @@ -27917,7 +27917,7 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var _i = 0; _i < matches.length; _i++) { + for (var _i = 0, _a = matches.length; _i < _a; _i++) { var match = matches[_i]; if (!match.isCaseSensitive) { return false; @@ -27996,7 +27996,7 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var _bestMatchKind = 3; - for (var _i = 0; _i < matches.length; _i++) { + for (var _i = 0, _a = matches.length; _i < _a; _i++) { var match = matches[_i]; var kind = match.kind; if (kind < _bestMatchKind) { @@ -28133,7 +28133,7 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; switch (node.kind) { case 196: @@ -28174,7 +28174,7 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var child = nodes[_i]; var _item = createItem(child); if (_item !== undefined) { @@ -28199,10 +28199,10 @@ var ts; if (!target.childItems) { target.childItems = []; } - outer: for (var _i = 0, _a = source.childItems; _i < _a.length; _i++) { + outer: for (var _i = 0, _a = source.childItems, _b = _a.length; _i < _b; _i++) { var sourceChild = _a[_i]; - for (var _b = 0, _c = target.childItems; _b < _c.length; _b++) { - var targetChild = _c[_b]; + for (var _c = 0, _d = target.childItems, _e = _d.length; _c < _e; _c++) { + var targetChild = _d[_c]; if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { merge(targetChild, sourceChild); continue outer; @@ -28502,7 +28502,7 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var _i = 0; _i < wordSpans.length; _i++) { + for (var _i = 0, _a = wordSpans.length; _i < _a; _i++) { var span = wordSpans[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(2, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); @@ -28557,7 +28557,7 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var _i = 0; _i < subWordTextChunks.length; _i++) { + for (var _i = 0, _a = subWordTextChunks.length; _i < _a; _i++) { var subWordTextChunk = subWordTextChunks[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { @@ -28952,7 +28952,7 @@ var ts; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var _i = 0; _i < listChildren.length; _i++) { + for (var _i = 0, _a = listChildren.length; _i < _a; _i++) { var child = listChildren[_i]; if (child === node) { break; @@ -29277,7 +29277,7 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0; _i < children.length; _i++) { + for (var _i = 0, _a = children.length; _i < _a; _i++) { var child = children[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { @@ -29968,7 +29968,7 @@ var ts; if (this.IsAny()) { return true; } - for (var _i = 0, _a = this.customContextChecks; _i < _a.length; _i++) { + for (var _i = 0, _a = this.customContextChecks, _b = _a.length; _i < _b; _i++) { var check = _a[_i]; if (!check(context)) { return false; @@ -30456,7 +30456,7 @@ var ts; var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var _i = 0, _a = bucket.Rules(); _i < _a.length; _i++) { + for (var _i = 0, _a = bucket.Rules(), _b = _a.length; _i < _b; _i++) { var rule = _a[_i]; if (rule.Operation.Context.InContext(context)) { return rule; @@ -31138,7 +31138,7 @@ var ts; } } var inheritedIndentation = -1; - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var child = nodes[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, _startLine, true); } @@ -31183,7 +31183,7 @@ var ts; if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var _i = 0, _a = currentTokenInfo.leadingTrivia; _i < _a.length; _i++) { + for (var _i = 0, _a = currentTokenInfo.leadingTrivia, _b = _a.length; _i < _b; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; @@ -31218,7 +31218,7 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var _i = 0; _i < trivia.length; _i++) { + for (var _i = 0, _a = trivia.length; _i < _a; _i++) { var triviaItem = trivia[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); @@ -31949,7 +31949,7 @@ var ts; var list = createNode(222, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; - for (var _i = 0; _i < nodes.length; _i++) { + for (var _i = 0, _a = nodes.length; _i < _a; _i++) { var node = nodes[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); @@ -32008,7 +32008,7 @@ var ts; }; NodeObject.prototype.getFirstToken = function (sourceFile) { var children = this.getChildren(); - for (var _i = 0; _i < children.length; _i++) { + for (var _i = 0, _a = children.length; _i < _a; _i++) { var child = children[_i]; if (child.kind < 125) { return child; @@ -32642,7 +32642,7 @@ var ts; this.host = host; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); - for (var _i = 0; _i < rootFileNames.length; _i++) { + for (var _i = 0, _a = rootFileNames.length; _i < _a; _i++) { var fileName = rootFileNames[_i]; this.createEntry(fileName); } @@ -33236,7 +33236,7 @@ var ts; }); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var _i = 0; _i < oldSourceFiles.length; _i++) { + for (var _i = 0, _a = oldSourceFiles.length; _i < _a; _i++) { var oldSourceFile = oldSourceFiles[_i]; var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { @@ -33271,8 +33271,8 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var _a = 0; _a < rootFileNames.length; _a++) { - var _fileName = rootFileNames[_a]; + for (var _b = 0, _c = rootFileNames.length; _b < _c; _b++) { + var _fileName = rootFileNames[_b]; if (!sourceFileUpToDate(program.getSourceFile(_fileName))) { return false; } @@ -34793,7 +34793,7 @@ var ts; var _scope = undefined; var _declarations = symbol.getDeclarations(); if (_declarations) { - for (var _i = 0; _i < _declarations.length; _i++) { + for (var _i = 0, _a = _declarations.length; _i < _a; _i++) { var declaration = _declarations[_i]; var container = getContainerNode(declaration); if (!container) { @@ -35155,7 +35155,7 @@ var ts; var lastIterationMeaning; do { lastIterationMeaning = meaning; - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var declaration = declarations[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { @@ -35586,7 +35586,7 @@ var ts; function processElement(element) { if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var _i = 0; _i < children.length; _i++) { + for (var _i = 0, _a = children.length; _i < _a; _i++) { var child = children[_i]; if (ts.isToken(child)) { classifyToken(child); @@ -35611,7 +35611,7 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0; _i < childNodes.length; _i++) { + for (var _i = 0, _a = childNodes.length; _i < _a; _i++) { var current = childNodes[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); @@ -35750,7 +35750,7 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var _i = 0; _i < declarations.length; _i++) { + for (var _i = 0, _a = declarations.length; _i < _a; _i++) { var current = declarations[_i]; var _sourceFile = current.getSourceFile(); if (_sourceFile && getCanonicalFileName(ts.normalizePath(_sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { From 285497edf804af2959df41bdaa689d76588e043a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 16:45:58 -0700 Subject: [PATCH 083/101] Reserve _i and _n as names we often want to generate --- src/compiler/emitter.ts | 39 +++++++++------- ...gedTemplateStringsTypeArgumentInference.js | 44 +++++++++---------- ...dTemplateStringsWithOverloadResolution3.js | 22 +++++----- 3 files changed, 56 insertions(+), 49 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 230b5eac310..51b74436673 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2116,16 +2116,23 @@ module ts { // Create a temporary variable with a unique unused name. The forLoopVariable parameter signals that the // name should be one that is appropriate for a for loop variable. - function createTempVariable(location: Node, forLoopVariable?: boolean): Identifier { - let name = forLoopVariable ? "_i" : undefined; - while (true) { - if (name && !isExistingName(location, name)) { - break; - } + function createTempVariable(location: Node, preferredName?: string): Identifier { + let name = preferredName; + for ( ; !name || isExistingName(location, name); tempCount++) { // _a .. _h, _j ... _z, _0, _1, ... - // Note that _i is skipped - name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + CharacterCodes.a) : tempCount - 25); - tempCount++; + + // Note: we avoid generating _i and _n as those are common names we want in other places. + var char = CharacterCodes.a + tempCount; + if (char === CharacterCodes.i || char === CharacterCodes.n) { + continue; + } + + if (tempCount < 26) { + name = "_" + String.fromCharCode(char); + } + else { + name = "_" + (tempCount - 26); + } } // This is necessary so that a name generated via renameNonTopLevelLetAndConst will see the name @@ -2144,8 +2151,8 @@ module ts { tempVariables.push(name); } - function createAndRecordTempVariable(location: Node): Identifier { - let temp = createTempVariable(location, /*forLoopVariable*/ false); + function createAndRecordTempVariable(location: Node, preferredName?: string): Identifier { + let temp = createTempVariable(location, preferredName); recordTempDeclaration(temp); return temp; @@ -3580,10 +3587,10 @@ module ts { // // we don't want to emit a temporary variable for the RHS, just use it directly. let rhsIsIdentifier = node.expression.kind === SyntaxKind.Identifier; - let counter = createTempVariable(node, /*forLoopVariable*/ true); - let rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, /*forLoopVariable*/ false); + let counter = createTempVariable(node, /*preferredName*/ "_i"); + let rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node); - var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, /*forLoopVariable:*/ false) : undefined; + var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, /*preferredName:*/ "_n") : undefined; // This is the let keyword for the counter and rhsReference. The let keyword for // the LHS will be emitted inside the body. @@ -3668,7 +3675,7 @@ module ts { else { // It's an empty declaration list. This can only happen in an error case, if the user wrote // for (let of []) {} - emitNodeWithoutSourceMap(createTempVariable(node, /*forLoopVariable*/ false)); + emitNodeWithoutSourceMap(createTempVariable(node)); write(" = "); emitNodeWithoutSourceMap(rhsIterationValue); } @@ -4251,7 +4258,7 @@ module ts { if (languageVersion < ScriptTarget.ES6 && hasRestParameters(node)) { let restIndex = node.parameters.length - 1; let restParam = node.parameters[restIndex]; - let tempName = createTempVariable(node, /*forLoopVariable*/ true).text; + let tempName = createTempVariable(node, /*preferredName:*/ "_i").text; writeLine(); emitLeadingComments(restParam); emitStart(restParam); diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js index 663969caefc..5b128221aa6 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js @@ -145,23 +145,16 @@ function someGenerics4(strs, n, f) { // 2 parameter generic tag with argument 2 of type parameter type and argument 1 of function type whose parameter is of type parameter type function someGenerics5(strs, n, f) { } -(_n = ["", " ", ""], _n.raw = ["", " ", ""], someGenerics5(_n, 4, function () { +(_o = ["", " ", ""], _o.raw = ["", " ", ""], someGenerics5(_o, 4, function () { return null; })); -(_o = ["", "", ""], _o.raw = ["", "", ""], someGenerics5(_o, '', function () { +(_p = ["", "", ""], _p.raw = ["", "", ""], someGenerics5(_p, '', function () { return 3; })); -(_p = ["", "", ""], _p.raw = ["", "", ""], someGenerics5(_p, null, null)); +(_q = ["", "", ""], _q.raw = ["", "", ""], someGenerics5(_q, null, null)); // Generic tag with multiple arguments of function types that each have parameters of the same generic type function someGenerics6(strs, a, b, c) { } -(_q = ["", "", "", ""], _q.raw = ["", "", "", ""], someGenerics6(_q, function (n) { - return n; -}, function (n) { - return n; -}, function (n) { - return n; -})); (_r = ["", "", "", ""], _r.raw = ["", "", "", ""], someGenerics6(_r, function (n) { return n; }, function (n) { @@ -176,16 +169,16 @@ function someGenerics6(strs, a, b, c) { }, function (n) { return n; })); -// Generic tag with multiple arguments of function types that each have parameters of different generic type -function someGenerics7(strs, a, b, c) { -} -(_t = ["", "", "", ""], _t.raw = ["", "", "", ""], someGenerics7(_t, function (n) { +(_t = ["", "", "", ""], _t.raw = ["", "", "", ""], someGenerics6(_t, function (n) { return n; }, function (n) { return n; }, function (n) { return n; })); +// Generic tag with multiple arguments of function types that each have parameters of different generic type +function someGenerics7(strs, a, b, c) { +} (_u = ["", "", "", ""], _u.raw = ["", "", "", ""], someGenerics7(_u, function (n) { return n; }, function (n) { @@ -200,19 +193,26 @@ function someGenerics7(strs, a, b, c) { }, function (n) { return n; })); +(_w = ["", "", "", ""], _w.raw = ["", "", "", ""], someGenerics7(_w, function (n) { + return n; +}, function (n) { + return n; +}, function (n) { + return n; +})); // Generic tag with argument of generic function type function someGenerics8(strs, n) { return n; } -var x = (_w = ["", ""], _w.raw = ["", ""], someGenerics8(_w, someGenerics7)); -(_x = ["", "", "", ""], _x.raw = ["", "", "", ""], x(_x, null, null, null)); +var x = (_x = ["", ""], _x.raw = ["", ""], someGenerics8(_x, someGenerics7)); +(_y = ["", "", "", ""], _y.raw = ["", "", "", ""], x(_y, null, null, null)); // Generic tag with multiple parameters of generic type passed arguments with no best common type function someGenerics9(strs, a, b, c) { return null; } -var a9a = (_y = ["", "", "", ""], _y.raw = ["", "", "", ""], someGenerics9(_y, '', 0, [])); +var a9a = (_z = ["", "", "", ""], _z.raw = ["", "", "", ""], someGenerics9(_z, '', 0, [])); var a9a; -var a9e = (_z = ["", "", "", ""], _z.raw = ["", "", "", ""], someGenerics9(_z, undefined, { +var a9e = (_0 = ["", "", "", ""], _0.raw = ["", "", "", ""], someGenerics9(_0, undefined, { x: 6, z: new Date() }, { @@ -221,7 +221,7 @@ var a9e = (_z = ["", "", "", ""], _z.raw = ["", "", "", ""], someGenerics9(_z, u })); var a9e; // Generic tag with multiple parameters of generic type passed arguments with a single best common type -var a9d = (_0 = ["", "", "", ""], _0.raw = ["", "", "", ""], someGenerics9(_0, { +var a9d = (_1 = ["", "", "", ""], _1.raw = ["", "", "", ""], someGenerics9(_1, { x: 3 }, { x: 6 @@ -231,9 +231,9 @@ var a9d = (_0 = ["", "", "", ""], _0.raw = ["", "", "", ""], someGenerics9(_0, { var a9d; // Generic tag with multiple parameters of generic type where one argument is of type 'any' var anyVar; -var a = (_1 = ["", "", "", ""], _1.raw = ["", "", "", ""], someGenerics9(_1, 7, anyVar, 4)); +var a = (_2 = ["", "", "", ""], _2.raw = ["", "", "", ""], someGenerics9(_2, 7, anyVar, 4)); var a; // Generic tag with multiple parameters of generic type where one argument is [] and the other is not 'any' -var arr = (_2 = ["", "", "", ""], _2.raw = ["", "", "", ""], someGenerics9(_2, [], null, undefined)); +var arr = (_3 = ["", "", "", ""], _3.raw = ["", "", "", ""], someGenerics9(_3, [], null, undefined)); var arr; -var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2; +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js index 1840fed234b..24b0b16ea35 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js @@ -103,26 +103,26 @@ var s = (_k = ["", ""], _k.raw = ["", ""], fn3(_k, 4)); var s = (_l = ["", "", "", ""], _l.raw = ["", "", "", ""], fn3(_l, '', '', '')); var n = (_m = ["", "", "", ""], _m.raw = ["", "", "", ""], fn3(_m, '', '', 3)); // Generic overloads with differing arity tagging with argument count that doesn't match any overload -(_n = [""], _n.raw = [""], fn3(_n)); // Error +(_o = [""], _o.raw = [""], fn3(_o)); // Error function fn4() { } // Generic overloads with constraints tagged with types that satisfy the constraints -(_o = ["", "", ""], _o.raw = ["", "", ""], fn4(_o, '', 3)); -(_p = ["", "", ""], _p.raw = ["", "", ""], fn4(_p, 3, '')); -(_q = ["", "", ""], _q.raw = ["", "", ""], fn4(_q, 3, undefined)); -(_r = ["", "", ""], _r.raw = ["", "", ""], fn4(_r, '', null)); +(_p = ["", "", ""], _p.raw = ["", "", ""], fn4(_p, '', 3)); +(_q = ["", "", ""], _q.raw = ["", "", ""], fn4(_q, 3, '')); +(_r = ["", "", ""], _r.raw = ["", "", ""], fn4(_r, 3, undefined)); +(_s = ["", "", ""], _s.raw = ["", "", ""], fn4(_s, '', null)); // Generic overloads with constraints called with type arguments that do not satisfy the constraints -(_s = ["", "", ""], _s.raw = ["", "", ""], fn4(_s, null, null)); // Error +(_t = ["", "", ""], _t.raw = ["", "", ""], fn4(_t, null, null)); // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints -(_t = ["", "", ""], _t.raw = ["", "", ""], fn4(_t, true, null)); -(_u = ["", "", ""], _u.raw = ["", "", ""], fn4(_u, null, true)); +(_u = ["", "", ""], _u.raw = ["", "", ""], fn4(_u, true, null)); +(_v = ["", "", ""], _v.raw = ["", "", ""], fn4(_v, null, true)); function fn5() { return undefined; } -(_v = ["", ""], _v.raw = ["", ""], fn5(_v, function (n) { +(_w = ["", ""], _w.raw = ["", ""], fn5(_w, function (n) { return n.toFixed(); })); // will error; 'n' should have type 'string'. -(_w = ["", ""], _w.raw = ["", ""], fn5(_w, function (n) { +(_x = ["", ""], _x.raw = ["", ""], fn5(_x, function (n) { return n.substr(0); })); -var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w; +var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x; From e5cd5eca3c97396b455af79d250c8ecef4a5b45f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 16:49:22 -0700 Subject: [PATCH 084/101] Update LKG. --- bin/tsc.js | 33 +++-- bin/tsserver.js | 285 +++++++++++++++++++------------------- bin/typescript.js | 285 +++++++++++++++++++------------------- bin/typescriptServices.js | 285 +++++++++++++++++++------------------- src/compiler/emitter.ts | 5 +- 5 files changed, 456 insertions(+), 437 deletions(-) diff --git a/bin/tsc.js b/bin/tsc.js index 08acd0a760e..ea41491d3b6 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -23436,14 +23436,19 @@ var ts; function writeJavaScriptFile(emitOutput, writeByteOrderMark) { writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } - function createTempVariable(location, forLoopVariable) { - var _name = forLoopVariable ? "_i" : undefined; - while (true) { - if (_name && !isExistingName(location, _name)) { - break; + function createTempVariable(location, preferredName) { + var _name = preferredName; + for (; !_name || isExistingName(location, _name); tempCount++) { + var char = 97 + tempCount; + if (char === 105 || char === 110) { + continue; + } + if (tempCount < 26) { + _name = "_" + String.fromCharCode(char); + } + else { + _name = "_" + (tempCount - 26); } - _name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); - tempCount++; } recordNameInCurrentScope(_name); var result = ts.createSynthesizedNode(64); @@ -23456,8 +23461,8 @@ var ts; } tempVariables.push(name); } - function createAndRecordTempVariable(location) { - var temp = createTempVariable(location, false); + function createAndRecordTempVariable(location, preferredName) { + var temp = createTempVariable(location, preferredName); recordTempDeclaration(temp); return temp; } @@ -24540,9 +24545,9 @@ var ts; write(" "); endPos = emitToken(16, endPos); var rhsIsIdentifier = node.expression.kind === 64; - var counter = createTempVariable(node, true); - var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, false); - var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, false) : undefined; + var counter = createTempVariable(node, "_i"); + var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node); + var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, "_n") : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -24601,7 +24606,7 @@ var ts; } } else { - emitNodeWithoutSourceMap(createTempVariable(node, false)); + emitNodeWithoutSourceMap(createTempVariable(node)); write(" = "); emitNodeWithoutSourceMap(rhsIterationValue); } @@ -25071,7 +25076,7 @@ var ts; if (languageVersion < 2 && ts.hasRestParameters(node)) { var restIndex = node.parameters.length - 1; var restParam = node.parameters[restIndex]; - var tempName = createTempVariable(node, true).text; + var tempName = createTempVariable(node, "_i").text; writeLine(); emitLeadingComments(restParam); emitStart(restParam); diff --git a/bin/tsserver.js b/bin/tsserver.js index e0e51feb685..8d08738bec7 100644 --- a/bin/tsserver.js +++ b/bin/tsserver.js @@ -44,7 +44,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; if (v === value) { return true; @@ -68,7 +68,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -82,7 +82,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var _item = array[_i]; if (f(_item)) { result.push(_item); @@ -96,7 +96,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; result.push(f(v)); } @@ -116,7 +116,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var _item = array[_i]; if (!contains(result, _item)) { result.push(_item); @@ -128,7 +128,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; result += v[prop]; } @@ -136,7 +136,7 @@ var ts; } ts.sum = sum; function addRange(to, from) { - for (var _i = 0, _a = from.length; _i < _a; _i++) { + for (var _i = 0, _n = from.length; _i < _n; _i++) { var v = from[_i]; to.push(v); } @@ -400,7 +400,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0, _a = parts.length; _i < _a; _i++) { + for (var _i = 0, _n = parts.length; _i < _n; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -552,7 +552,7 @@ var ts; ".js" ]; function removeFileExtension(path) { - for (var _i = 0, _a = supportedExtensions.length; _i < _a; _i++) { + for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -710,15 +710,15 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0, _a = files.length; _i < _a; _i++) { + for (var _i = 0, _n = files.length; _i < _n; _i++) { var _name = files[_i]; if (!extension || ts.fileExtensionIs(_name, extension)) { result.push(ts.combinePaths(path, _name)); } } var subfolders = getNames(folder.subfolders); - for (var _b = 0, _c = subfolders.length; _b < _c; _b++) { - var current = subfolders[_b]; + for (var _a = 0, _b = subfolders.length; _a < _b; _a++) { + var current = subfolders[_a]; visitDirectory(ts.combinePaths(path, current)); } } @@ -804,7 +804,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0, _a = files.length; _i < _a; _i++) { + for (var _i = 0, _n = files.length; _i < _n; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -817,8 +817,8 @@ var ts; directories.push(name); } } - for (var _b = 0, _c = directories.length; _b < _c; _b++) { - var _current = directories[_b]; + for (var _a = 0, _b = directories.length; _a < _b; _a++) { + var _current = directories[_a]; visitDirectory(_current); } } @@ -7689,7 +7689,7 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -8396,7 +8396,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0, _a = clauses.length; _i < _a; _i++) { + for (var _i = 0, _n = clauses.length; _i < _n; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -8787,7 +8787,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -9088,7 +9088,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var node = array[_i]; visitNode(node); } @@ -9152,7 +9152,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var node = array[_i]; visitNode(node); } @@ -13309,7 +13309,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0, _a = members.length; _i < _a; _i++) { + for (var _i = 0, _n = members.length; _i < _n; _i++) { var member = members[_i]; if (member.kind === 133 && ts.nodeIsPresent(member.body)) { return member; @@ -13633,7 +13633,7 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0, _a = accessibleSymbolChain.length; _i < _a; _i++) { + for (var _i = 0, _n = accessibleSymbolChain.length; _i < _n; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -13814,14 +13814,14 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = resolved.callSignatures, _n = _a.length; _i < _n; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _c = 0, _d = resolved.constructSignatures, _e = _d.length; _c < _e; _c++) { - var _signature = _d[_c]; + for (var _b = 0, _c = resolved.constructSignatures, _d = _c.length; _b < _d; _b++) { + var _signature = _c[_b]; writeKeyword(writer, 87); writeSpace(writer); buildSignatureDisplay(_signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); @@ -13854,13 +13854,13 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _f = 0, _g = resolved.properties, _h = _g.length; _f < _h; _f++) { - var p = _g[_f]; + for (var _e = 0, _f = resolved.properties, _g = _f.length; _e < _g; _e++) { + var p = _f[_e]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _j = 0, _k = signatures.length; _j < _k; _j++) { - var _signature_1 = signatures[_j]; + for (var _h = 0, _j = signatures.length; _h < _j; _h++) { + var _signature_1 = signatures[_h]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); @@ -14564,7 +14564,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0, _a = symbols.length; _i < _a; _i++) { + for (var _i = 0, _n = symbols.length; _i < _n; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -14572,14 +14572,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0, _a = symbols.length; _i < _a; _i++) { + for (var _i = 0, _n = symbols.length; _i < _n; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0, _a = baseSymbols.length; _i < _a; _i++) { + for (var _i = 0, _n = baseSymbols.length; _i < _n; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -14588,7 +14588,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0, _a = baseSignatures.length; _i < _a; _i++) { + for (var _i = 0, _n = baseSignatures.length; _i < _n; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -14690,7 +14690,7 @@ var ts; return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var _i = 0, _a = signatures.length; _i < _a; _i++) { + for (var _i = 0, _n = signatures.length; _i < _n; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; @@ -14713,7 +14713,7 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -14849,7 +14849,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -14869,8 +14869,8 @@ var ts; } var propTypes = []; var declarations = []; - for (var _b = 0, _c = props.length; _b < _c; _b++) { - var _prop = props[_b]; + for (var _a = 0, _b = props.length; _a < _b; _a++) { + var _prop = props[_a]; if (_prop.declarations) { declarations.push.apply(declarations, _prop.declarations); } @@ -15110,7 +15110,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -15158,7 +15158,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; result |= type.flags; } @@ -15256,7 +15256,7 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { case 196: @@ -15341,13 +15341,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -15365,7 +15365,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -15481,7 +15481,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0, _a = items.length; _i < _a; _i++) { + for (var _i = 0, _n = items.length; _i < _n; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -15533,7 +15533,7 @@ var ts; return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0, _a = sources.length; _i < _a; _i++) { + for (var _i = 0, _n = sources.length; _i < _n; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -15819,7 +15819,7 @@ var ts; function unionTypeRelatedToUnionType(source, target) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { + for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { @@ -15842,7 +15842,7 @@ var ts; function unionTypeRelatedToType(source, target, reportErrors) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { + for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { @@ -15980,7 +15980,7 @@ var ts; var _result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -16051,7 +16051,7 @@ var ts; return 0; } var _result = -1; - for (var _i = 0, _a = sourceProperties.length; _i < _a; _i++) { + for (var _i = 0, _n = sourceProperties.length; _i < _n; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -16076,12 +16076,12 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var _result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0, _a = targetSignatures.length; _i < _a; _i++) { + outer: for (var _i = 0, _n = targetSignatures.length; _i < _n; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _b = 0, _c = sourceSignatures.length; _b < _c; _b++) { - var s = sourceSignatures[_b]; + for (var _a = 0, _b = sourceSignatures.length; _a < _b; _a++) { + var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); if (related) { @@ -16296,7 +16296,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -16481,7 +16481,7 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0, _a = typeParameters.length; _i < _a; _i++) { + for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { var unused = typeParameters[_i]; inferences.push({ primary: undefined, @@ -16551,7 +16551,7 @@ var ts; var _targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _a = 0, _b = _targetTypes.length; _a < _b; _a++) { + for (var _a = 0, _n = _targetTypes.length; _a < _n; _a++) { var t = _targetTypes[_a]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; @@ -16569,8 +16569,8 @@ var ts; } else if (source.flags & 16384) { var _sourceTypes = source.types; - for (var _c = 0, _d = _sourceTypes.length; _c < _d; _c++) { - var sourceType = _sourceTypes[_c]; + for (var _b = 0, _c = _sourceTypes.length; _b < _c; _b++) { + var sourceType = _sourceTypes[_b]; inferFromTypes(sourceType, target); } } @@ -16595,7 +16595,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -17212,7 +17212,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -17351,7 +17351,7 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; @@ -17456,7 +17456,7 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { @@ -17722,7 +17722,7 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, _a = signatures.length; _i < _a; _i++) { + for (var _i = 0, _n = signatures.length; _i < _n; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var _parent = signature.declaration && signature.declaration.parent; @@ -17973,7 +17973,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0, _a = candidates.length; _i < _a; _i++) { + for (var _i = 0, _n = candidates.length; _i < _n; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -17982,8 +17982,8 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _b = 0, _c = candidates.length; _b < _c; _b++) { - var current = candidates[_b]; + for (var _a = 0, _b = candidates.length; _a < _b; _a++) { + var current = candidates[_a]; if (!hasCorrectArity(node, args, current)) { continue; } @@ -18430,7 +18430,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -18446,7 +18446,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -18482,7 +18482,7 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var _name = p.name; @@ -18922,7 +18922,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -19112,7 +19112,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0, _a = signaturesToCheck.length; _i < _a; _i++) { + for (var _i = 0, _n = signaturesToCheck.length; _i < _n; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -19218,7 +19218,7 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); @@ -19277,8 +19277,8 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _b = 0, _c = signatures.length; _b < _c; _b++) { - var signature = signatures[_b]; + for (var _a = 0, _b = signatures.length; _a < _b; _a++) { + var signature = signatures[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -19921,7 +19921,7 @@ var ts; }); if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 196) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = classDeclaration.members, _n = _a.length; _i < _n; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -20055,7 +20055,7 @@ var ts; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0, _a = baseProperties.length; _i < _a; _i++) { + for (var _i = 0, _n = baseProperties.length; _i < _n; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -20137,11 +20137,11 @@ var ts; }; }); var ok = true; - for (var _i = 0, _a = type.baseTypes, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _c = 0, _d = properties.length; _c < _d; _c++) { - var prop = properties[_c]; + for (var _b = 0, _c = properties.length; _b < _c; _b++) { + var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, @@ -20391,7 +20391,7 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; if ((declaration.kind === 196 || (declaration.kind === 195 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; @@ -20559,19 +20559,19 @@ var ts; } function hasExportedMembers(moduleSymbol) { var declarations = moduleSymbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var current = declarations[_i]; var statements = getModuleStatements(current); - for (var _b = 0, _c = statements.length; _b < _c; _b++) { - var node = statements[_b]; + for (var _a = 0, _b = statements.length; _a < _b; _a++) { + var node = statements[_a]; if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; } var specifiers = exportClause.elements; - for (var _d = 0, _e = specifiers.length; _d < _e; _d++) { - var specifier = specifiers[_d]; + for (var _c = 0, _d = specifiers.length; _c < _d; _c++) { + var specifier = specifiers[_c]; if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) { return true; } @@ -21475,7 +21475,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.modifiers, _n = _a.length; _i < _n; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 108: @@ -21679,7 +21679,7 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0, _a = arguments.length; _i < _a; _i++) { + for (var _i = 0, _n = arguments.length; _i < _n; _i++) { var arg = arguments[_i]; if (arg.kind === 172) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); @@ -21705,7 +21705,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -21733,7 +21733,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -21779,7 +21779,7 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var prop = _a[_i]; var _name = prop.name; if (prop.kind === 172 || _name.kind === 126) { @@ -22024,7 +22024,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, _a = elements.length; _i < _a; _i++) { + for (var _i = 0, _n = elements.length; _i < _n; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -22082,7 +22082,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = enumDecl.members, _n = _a.length; _i < _n; _i++) { var node = _a[_i]; if (node.name.kind === 126) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -22172,7 +22172,7 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = file.statements, _n = _a.length; _i < _n; _i++) { var decl = _a[_i]; if (ts.isDeclaration(decl) || decl.kind === 175) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { @@ -22635,14 +22635,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -23792,14 +23792,19 @@ var ts; function writeJavaScriptFile(emitOutput, writeByteOrderMark) { writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } - function createTempVariable(location, forLoopVariable) { - var _name = forLoopVariable ? "_i" : undefined; - while (true) { - if (_name && !isExistingName(location, _name)) { - break; + function createTempVariable(location, preferredName) { + var _name = preferredName; + for (; !_name || isExistingName(location, _name); tempCount++) { + var char = 97 + tempCount; + if (char === 105 || char === 110) { + continue; + } + if (tempCount < 26) { + _name = "_" + String.fromCharCode(char); + } + else { + _name = "_" + (tempCount - 26); } - _name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); - tempCount++; } recordNameInCurrentScope(_name); var result = ts.createSynthesizedNode(64); @@ -23812,8 +23817,8 @@ var ts; } tempVariables.push(name); } - function createAndRecordTempVariable(location) { - var temp = createTempVariable(location, false); + function createAndRecordTempVariable(location, preferredName) { + var temp = createTempVariable(location, preferredName); recordTempDeclaration(temp); return temp; } @@ -24896,9 +24901,9 @@ var ts; write(" "); endPos = emitToken(16, endPos); var rhsIsIdentifier = node.expression.kind === 64; - var counter = createTempVariable(node, true); - var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, false); - var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, false) : undefined; + var counter = createTempVariable(node, "_i"); + var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node); + var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, "_n") : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -24957,7 +24962,7 @@ var ts; } } else { - emitNodeWithoutSourceMap(createTempVariable(node, false)); + emitNodeWithoutSourceMap(createTempVariable(node)); write(" = "); emitNodeWithoutSourceMap(rhsIterationValue); } @@ -25202,7 +25207,7 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var propName = (p.name); @@ -25427,7 +25432,7 @@ var ts; if (languageVersion < 2 && ts.hasRestParameters(node)) { var restIndex = node.parameters.length - 1; var restParam = node.parameters[restIndex]; - var tempName = createTempVariable(node, true).text; + var tempName = createTempVariable(node, "_i").text; writeLine(); emitLeadingComments(restParam); emitStart(restParam); @@ -25626,7 +25631,7 @@ var ts; decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _i = 0, _a = body.statements, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = body.statements, _n = _a.length; _i < _n; _i++) { var statement = _a[_i]; write(" "); emit(statement); @@ -26243,7 +26248,7 @@ var ts; } function getExternalImportInfo(node) { if (externalImports) { - for (var _i = 0, _a = externalImports.length; _i < _a; _i++) { + for (var _i = 0, _n = externalImports.length; _i < _n; _i++) { var info = externalImports[_i]; if (info.rootNode === node) { return info; @@ -27604,7 +27609,7 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; var name = getDeclarationName(declaration); if (name !== undefined) { @@ -27642,7 +27647,7 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var _i = 0, _a = matches.length; _i < _a; _i++) { + for (var _i = 0, _n = matches.length; _i < _n; _i++) { var match = matches[_i]; if (!match.isCaseSensitive) { return false; @@ -27721,7 +27726,7 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var _bestMatchKind = 3; - for (var _i = 0, _a = matches.length; _i < _a; _i++) { + for (var _i = 0, _n = matches.length; _i < _n; _i++) { var match = matches[_i]; var kind = match.kind; if (kind < _bestMatchKind) { @@ -27858,7 +27863,7 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; switch (node.kind) { case 196: @@ -27899,7 +27904,7 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var child = nodes[_i]; var _item = createItem(child); if (_item !== undefined) { @@ -27924,10 +27929,10 @@ var ts; if (!target.childItems) { target.childItems = []; } - outer: for (var _i = 0, _a = source.childItems, _b = _a.length; _i < _b; _i++) { + outer: for (var _i = 0, _a = source.childItems, _n = _a.length; _i < _n; _i++) { var sourceChild = _a[_i]; - for (var _c = 0, _d = target.childItems, _e = _d.length; _c < _e; _c++) { - var targetChild = _d[_c]; + for (var _b = 0, _c = target.childItems, _d = _c.length; _b < _d; _b++) { + var targetChild = _c[_b]; if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { merge(targetChild, sourceChild); continue outer; @@ -28227,7 +28232,7 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var _i = 0, _a = wordSpans.length; _i < _a; _i++) { + for (var _i = 0, _n = wordSpans.length; _i < _n; _i++) { var span = wordSpans[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(2, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); @@ -28282,7 +28287,7 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var _i = 0, _a = subWordTextChunks.length; _i < _a; _i++) { + for (var _i = 0, _n = subWordTextChunks.length; _i < _n; _i++) { var subWordTextChunk = subWordTextChunks[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { @@ -28671,7 +28676,7 @@ var ts; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var _i = 0, _a = listChildren.length; _i < _a; _i++) { + for (var _i = 0, _n = listChildren.length; _i < _n; _i++) { var child = listChildren[_i]; if (child === node) { break; @@ -28996,7 +29001,7 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0, _a = children.length; _i < _a; _i++) { + for (var _i = 0, _n = children.length; _i < _n; _i++) { var child = children[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { @@ -29645,7 +29650,7 @@ var ts; if (this.IsAny()) { return true; } - for (var _i = 0, _a = this.customContextChecks, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = this.customContextChecks, _n = _a.length; _i < _n; _i++) { var check = _a[_i]; if (!check(context)) { return false; @@ -30133,7 +30138,7 @@ var ts; var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var _i = 0, _a = bucket.Rules(), _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = bucket.Rules(), _n = _a.length; _i < _n; _i++) { var rule = _a[_i]; if (rule.Operation.Context.InContext(context)) { return rule; @@ -30811,7 +30816,7 @@ var ts; } } var inheritedIndentation = -1; - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var child = nodes[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, _startLine, true); } @@ -30856,7 +30861,7 @@ var ts; if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var _i = 0, _a = currentTokenInfo.leadingTrivia, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = currentTokenInfo.leadingTrivia, _n = _a.length; _i < _n; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; @@ -30891,7 +30896,7 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var _i = 0, _a = trivia.length; _i < _a; _i++) { + for (var _i = 0, _n = trivia.length; _i < _n; _i++) { var triviaItem = trivia[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); @@ -31618,7 +31623,7 @@ var ts; var list = createNode(222, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); @@ -31677,7 +31682,7 @@ var ts; }; NodeObject.prototype.getFirstToken = function (sourceFile) { var children = this.getChildren(); - for (var _i = 0, _a = children.length; _i < _a; _i++) { + for (var _i = 0, _n = children.length; _i < _n; _i++) { var child = children[_i]; if (child.kind < 125) { return child; @@ -32295,7 +32300,7 @@ var ts; this.host = host; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); - for (var _i = 0, _a = rootFileNames.length; _i < _a; _i++) { + for (var _i = 0, _n = rootFileNames.length; _i < _n; _i++) { var fileName = rootFileNames[_i]; this.createEntry(fileName); } @@ -32874,7 +32879,7 @@ var ts; }); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var _i = 0, _a = oldSourceFiles.length; _i < _a; _i++) { + for (var _i = 0, _n = oldSourceFiles.length; _i < _n; _i++) { var oldSourceFile = oldSourceFiles[_i]; var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { @@ -32909,8 +32914,8 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var _b = 0, _c = rootFileNames.length; _b < _c; _b++) { - var _fileName = rootFileNames[_b]; + for (var _a = 0, _b = rootFileNames.length; _a < _b; _a++) { + var _fileName = rootFileNames[_a]; if (!sourceFileUpToDate(program.getSourceFile(_fileName))) { return false; } @@ -34431,7 +34436,7 @@ var ts; var _scope = undefined; var _declarations = symbol.getDeclarations(); if (_declarations) { - for (var _i = 0, _a = _declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = _declarations.length; _i < _n; _i++) { var declaration = _declarations[_i]; var container = getContainerNode(declaration); if (!container) { @@ -34793,7 +34798,7 @@ var ts; var lastIterationMeaning; do { lastIterationMeaning = meaning; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { @@ -35224,7 +35229,7 @@ var ts; function processElement(element) { if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var _i = 0, _a = children.length; _i < _a; _i++) { + for (var _i = 0, _n = children.length; _i < _n; _i++) { var child = children[_i]; if (ts.isToken(child)) { classifyToken(child); @@ -35249,7 +35254,7 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0, _a = childNodes.length; _i < _a; _i++) { + for (var _i = 0, _n = childNodes.length; _i < _n; _i++) { var current = childNodes[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); @@ -35388,7 +35393,7 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var current = declarations[_i]; var _sourceFile = current.getSourceFile(); if (_sourceFile && getCanonicalFileName(ts.normalizePath(_sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { diff --git a/bin/typescript.js b/bin/typescript.js index 7d12ccab74f..1afa7187c5e 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -625,7 +625,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; if (v === value) { return true; @@ -649,7 +649,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -663,7 +663,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var _item = array[_i]; if (f(_item)) { result.push(_item); @@ -677,7 +677,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; result.push(f(v)); } @@ -697,7 +697,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var _item = array[_i]; if (!contains(result, _item)) { result.push(_item); @@ -709,7 +709,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; result += v[prop]; } @@ -717,7 +717,7 @@ var ts; } ts.sum = sum; function addRange(to, from) { - for (var _i = 0, _a = from.length; _i < _a; _i++) { + for (var _i = 0, _n = from.length; _i < _n; _i++) { var v = from[_i]; to.push(v); } @@ -981,7 +981,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0, _a = parts.length; _i < _a; _i++) { + for (var _i = 0, _n = parts.length; _i < _n; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -1133,7 +1133,7 @@ var ts; ".js" ]; function removeFileExtension(path) { - for (var _i = 0, _a = supportedExtensions.length; _i < _a; _i++) { + for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -1298,15 +1298,15 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0, _a = files.length; _i < _a; _i++) { + for (var _i = 0, _n = files.length; _i < _n; _i++) { var _name = files[_i]; if (!extension || ts.fileExtensionIs(_name, extension)) { result.push(ts.combinePaths(path, _name)); } } var subfolders = getNames(folder.subfolders); - for (var _b = 0, _c = subfolders.length; _b < _c; _b++) { - var current = subfolders[_b]; + for (var _a = 0, _b = subfolders.length; _a < _b; _a++) { + var current = subfolders[_a]; visitDirectory(ts.combinePaths(path, current)); } } @@ -1392,7 +1392,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0, _a = files.length; _i < _a; _i++) { + for (var _i = 0, _n = files.length; _i < _n; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -1405,8 +1405,8 @@ var ts; directories.push(name); } } - for (var _b = 0, _c = directories.length; _b < _c; _b++) { - var _current = directories[_b]; + for (var _a = 0, _b = directories.length; _a < _b; _a++) { + var _current = directories[_a]; visitDirectory(_current); } } @@ -7921,7 +7921,7 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -8628,7 +8628,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0, _a = clauses.length; _i < _a; _i++) { + for (var _i = 0, _n = clauses.length; _i < _n; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -9019,7 +9019,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -9351,7 +9351,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var node = array[_i]; visitNode(node); } @@ -9415,7 +9415,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var node = array[_i]; visitNode(node); } @@ -13582,7 +13582,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0, _a = members.length; _i < _a; _i++) { + for (var _i = 0, _n = members.length; _i < _n; _i++) { var member = members[_i]; if (member.kind === 133 && ts.nodeIsPresent(member.body)) { return member; @@ -13906,7 +13906,7 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0, _a = accessibleSymbolChain.length; _i < _a; _i++) { + for (var _i = 0, _n = accessibleSymbolChain.length; _i < _n; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -14087,14 +14087,14 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = resolved.callSignatures, _n = _a.length; _i < _n; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _c = 0, _d = resolved.constructSignatures, _e = _d.length; _c < _e; _c++) { - var _signature = _d[_c]; + for (var _b = 0, _c = resolved.constructSignatures, _d = _c.length; _b < _d; _b++) { + var _signature = _c[_b]; writeKeyword(writer, 87); writeSpace(writer); buildSignatureDisplay(_signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); @@ -14127,13 +14127,13 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _f = 0, _g = resolved.properties, _h = _g.length; _f < _h; _f++) { - var p = _g[_f]; + for (var _e = 0, _f = resolved.properties, _g = _f.length; _e < _g; _e++) { + var p = _f[_e]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _j = 0, _k = signatures.length; _j < _k; _j++) { - var _signature_1 = signatures[_j]; + for (var _h = 0, _j = signatures.length; _h < _j; _h++) { + var _signature_1 = signatures[_h]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); @@ -14837,7 +14837,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0, _a = symbols.length; _i < _a; _i++) { + for (var _i = 0, _n = symbols.length; _i < _n; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -14845,14 +14845,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0, _a = symbols.length; _i < _a; _i++) { + for (var _i = 0, _n = symbols.length; _i < _n; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0, _a = baseSymbols.length; _i < _a; _i++) { + for (var _i = 0, _n = baseSymbols.length; _i < _n; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -14861,7 +14861,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0, _a = baseSignatures.length; _i < _a; _i++) { + for (var _i = 0, _n = baseSignatures.length; _i < _n; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -14963,7 +14963,7 @@ var ts; return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var _i = 0, _a = signatures.length; _i < _a; _i++) { + for (var _i = 0, _n = signatures.length; _i < _n; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; @@ -14986,7 +14986,7 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -15122,7 +15122,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -15142,8 +15142,8 @@ var ts; } var propTypes = []; var declarations = []; - for (var _b = 0, _c = props.length; _b < _c; _b++) { - var _prop = props[_b]; + for (var _a = 0, _b = props.length; _a < _b; _a++) { + var _prop = props[_a]; if (_prop.declarations) { declarations.push.apply(declarations, _prop.declarations); } @@ -15383,7 +15383,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -15431,7 +15431,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; result |= type.flags; } @@ -15529,7 +15529,7 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { case 196: @@ -15614,13 +15614,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -15638,7 +15638,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -15754,7 +15754,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0, _a = items.length; _i < _a; _i++) { + for (var _i = 0, _n = items.length; _i < _n; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -15806,7 +15806,7 @@ var ts; return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0, _a = sources.length; _i < _a; _i++) { + for (var _i = 0, _n = sources.length; _i < _n; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -16092,7 +16092,7 @@ var ts; function unionTypeRelatedToUnionType(source, target) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { + for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { @@ -16115,7 +16115,7 @@ var ts; function unionTypeRelatedToType(source, target, reportErrors) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { + for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { @@ -16253,7 +16253,7 @@ var ts; var _result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -16324,7 +16324,7 @@ var ts; return 0; } var _result = -1; - for (var _i = 0, _a = sourceProperties.length; _i < _a; _i++) { + for (var _i = 0, _n = sourceProperties.length; _i < _n; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -16349,12 +16349,12 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var _result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0, _a = targetSignatures.length; _i < _a; _i++) { + outer: for (var _i = 0, _n = targetSignatures.length; _i < _n; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _b = 0, _c = sourceSignatures.length; _b < _c; _b++) { - var s = sourceSignatures[_b]; + for (var _a = 0, _b = sourceSignatures.length; _a < _b; _a++) { + var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); if (related) { @@ -16569,7 +16569,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -16754,7 +16754,7 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0, _a = typeParameters.length; _i < _a; _i++) { + for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { var unused = typeParameters[_i]; inferences.push({ primary: undefined, @@ -16824,7 +16824,7 @@ var ts; var _targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _a = 0, _b = _targetTypes.length; _a < _b; _a++) { + for (var _a = 0, _n = _targetTypes.length; _a < _n; _a++) { var t = _targetTypes[_a]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; @@ -16842,8 +16842,8 @@ var ts; } else if (source.flags & 16384) { var _sourceTypes = source.types; - for (var _c = 0, _d = _sourceTypes.length; _c < _d; _c++) { - var sourceType = _sourceTypes[_c]; + for (var _b = 0, _c = _sourceTypes.length; _b < _c; _b++) { + var sourceType = _sourceTypes[_b]; inferFromTypes(sourceType, target); } } @@ -16868,7 +16868,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -17485,7 +17485,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -17624,7 +17624,7 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; @@ -17729,7 +17729,7 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { @@ -17995,7 +17995,7 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, _a = signatures.length; _i < _a; _i++) { + for (var _i = 0, _n = signatures.length; _i < _n; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var _parent = signature.declaration && signature.declaration.parent; @@ -18246,7 +18246,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0, _a = candidates.length; _i < _a; _i++) { + for (var _i = 0, _n = candidates.length; _i < _n; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -18255,8 +18255,8 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _b = 0, _c = candidates.length; _b < _c; _b++) { - var current = candidates[_b]; + for (var _a = 0, _b = candidates.length; _a < _b; _a++) { + var current = candidates[_a]; if (!hasCorrectArity(node, args, current)) { continue; } @@ -18703,7 +18703,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -18719,7 +18719,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -18755,7 +18755,7 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var _name = p.name; @@ -19195,7 +19195,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -19385,7 +19385,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0, _a = signaturesToCheck.length; _i < _a; _i++) { + for (var _i = 0, _n = signaturesToCheck.length; _i < _n; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -19491,7 +19491,7 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); @@ -19550,8 +19550,8 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _b = 0, _c = signatures.length; _b < _c; _b++) { - var signature = signatures[_b]; + for (var _a = 0, _b = signatures.length; _a < _b; _a++) { + var signature = signatures[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -20194,7 +20194,7 @@ var ts; }); if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 196) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = classDeclaration.members, _n = _a.length; _i < _n; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -20328,7 +20328,7 @@ var ts; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0, _a = baseProperties.length; _i < _a; _i++) { + for (var _i = 0, _n = baseProperties.length; _i < _n; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -20410,11 +20410,11 @@ var ts; }; }); var ok = true; - for (var _i = 0, _a = type.baseTypes, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _c = 0, _d = properties.length; _c < _d; _c++) { - var prop = properties[_c]; + for (var _b = 0, _c = properties.length; _b < _c; _b++) { + var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, @@ -20664,7 +20664,7 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; if ((declaration.kind === 196 || (declaration.kind === 195 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; @@ -20832,19 +20832,19 @@ var ts; } function hasExportedMembers(moduleSymbol) { var declarations = moduleSymbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var current = declarations[_i]; var statements = getModuleStatements(current); - for (var _b = 0, _c = statements.length; _b < _c; _b++) { - var node = statements[_b]; + for (var _a = 0, _b = statements.length; _a < _b; _a++) { + var node = statements[_a]; if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; } var specifiers = exportClause.elements; - for (var _d = 0, _e = specifiers.length; _d < _e; _d++) { - var specifier = specifiers[_d]; + for (var _c = 0, _d = specifiers.length; _c < _d; _c++) { + var specifier = specifiers[_c]; if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) { return true; } @@ -21748,7 +21748,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.modifiers, _n = _a.length; _i < _n; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 108: @@ -21952,7 +21952,7 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0, _a = arguments.length; _i < _a; _i++) { + for (var _i = 0, _n = arguments.length; _i < _n; _i++) { var arg = arguments[_i]; if (arg.kind === 172) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); @@ -21978,7 +21978,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -22006,7 +22006,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -22052,7 +22052,7 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var prop = _a[_i]; var _name = prop.name; if (prop.kind === 172 || _name.kind === 126) { @@ -22297,7 +22297,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, _a = elements.length; _i < _a; _i++) { + for (var _i = 0, _n = elements.length; _i < _n; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -22355,7 +22355,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = enumDecl.members, _n = _a.length; _i < _n; _i++) { var node = _a[_i]; if (node.name.kind === 126) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -22445,7 +22445,7 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = file.statements, _n = _a.length; _i < _n; _i++) { var decl = _a[_i]; if (ts.isDeclaration(decl) || decl.kind === 175) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { @@ -22908,14 +22908,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -24065,14 +24065,19 @@ var ts; function writeJavaScriptFile(emitOutput, writeByteOrderMark) { writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } - function createTempVariable(location, forLoopVariable) { - var _name = forLoopVariable ? "_i" : undefined; - while (true) { - if (_name && !isExistingName(location, _name)) { - break; + function createTempVariable(location, preferredName) { + var _name = preferredName; + for (; !_name || isExistingName(location, _name); tempCount++) { + var char = 97 + tempCount; + if (char === 105 || char === 110) { + continue; + } + if (tempCount < 26) { + _name = "_" + String.fromCharCode(char); + } + else { + _name = "_" + (tempCount - 26); } - _name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); - tempCount++; } recordNameInCurrentScope(_name); var result = ts.createSynthesizedNode(64); @@ -24085,8 +24090,8 @@ var ts; } tempVariables.push(name); } - function createAndRecordTempVariable(location) { - var temp = createTempVariable(location, false); + function createAndRecordTempVariable(location, preferredName) { + var temp = createTempVariable(location, preferredName); recordTempDeclaration(temp); return temp; } @@ -25169,9 +25174,9 @@ var ts; write(" "); endPos = emitToken(16, endPos); var rhsIsIdentifier = node.expression.kind === 64; - var counter = createTempVariable(node, true); - var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, false); - var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, false) : undefined; + var counter = createTempVariable(node, "_i"); + var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node); + var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, "_n") : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -25230,7 +25235,7 @@ var ts; } } else { - emitNodeWithoutSourceMap(createTempVariable(node, false)); + emitNodeWithoutSourceMap(createTempVariable(node)); write(" = "); emitNodeWithoutSourceMap(rhsIterationValue); } @@ -25475,7 +25480,7 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var propName = (p.name); @@ -25700,7 +25705,7 @@ var ts; if (languageVersion < 2 && ts.hasRestParameters(node)) { var restIndex = node.parameters.length - 1; var restParam = node.parameters[restIndex]; - var tempName = createTempVariable(node, true).text; + var tempName = createTempVariable(node, "_i").text; writeLine(); emitLeadingComments(restParam); emitStart(restParam); @@ -25899,7 +25904,7 @@ var ts; decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _i = 0, _a = body.statements, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = body.statements, _n = _a.length; _i < _n; _i++) { var statement = _a[_i]; write(" "); emit(statement); @@ -26516,7 +26521,7 @@ var ts; } function getExternalImportInfo(node) { if (externalImports) { - for (var _i = 0, _a = externalImports.length; _i < _a; _i++) { + for (var _i = 0, _n = externalImports.length; _i < _n; _i++) { var info = externalImports[_i]; if (info.rootNode === node) { return info; @@ -27879,7 +27884,7 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; var name = getDeclarationName(declaration); if (name !== undefined) { @@ -27917,7 +27922,7 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var _i = 0, _a = matches.length; _i < _a; _i++) { + for (var _i = 0, _n = matches.length; _i < _n; _i++) { var match = matches[_i]; if (!match.isCaseSensitive) { return false; @@ -27996,7 +28001,7 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var _bestMatchKind = 3; - for (var _i = 0, _a = matches.length; _i < _a; _i++) { + for (var _i = 0, _n = matches.length; _i < _n; _i++) { var match = matches[_i]; var kind = match.kind; if (kind < _bestMatchKind) { @@ -28133,7 +28138,7 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; switch (node.kind) { case 196: @@ -28174,7 +28179,7 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var child = nodes[_i]; var _item = createItem(child); if (_item !== undefined) { @@ -28199,10 +28204,10 @@ var ts; if (!target.childItems) { target.childItems = []; } - outer: for (var _i = 0, _a = source.childItems, _b = _a.length; _i < _b; _i++) { + outer: for (var _i = 0, _a = source.childItems, _n = _a.length; _i < _n; _i++) { var sourceChild = _a[_i]; - for (var _c = 0, _d = target.childItems, _e = _d.length; _c < _e; _c++) { - var targetChild = _d[_c]; + for (var _b = 0, _c = target.childItems, _d = _c.length; _b < _d; _b++) { + var targetChild = _c[_b]; if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { merge(targetChild, sourceChild); continue outer; @@ -28502,7 +28507,7 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var _i = 0, _a = wordSpans.length; _i < _a; _i++) { + for (var _i = 0, _n = wordSpans.length; _i < _n; _i++) { var span = wordSpans[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(2, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); @@ -28557,7 +28562,7 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var _i = 0, _a = subWordTextChunks.length; _i < _a; _i++) { + for (var _i = 0, _n = subWordTextChunks.length; _i < _n; _i++) { var subWordTextChunk = subWordTextChunks[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { @@ -28952,7 +28957,7 @@ var ts; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var _i = 0, _a = listChildren.length; _i < _a; _i++) { + for (var _i = 0, _n = listChildren.length; _i < _n; _i++) { var child = listChildren[_i]; if (child === node) { break; @@ -29277,7 +29282,7 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0, _a = children.length; _i < _a; _i++) { + for (var _i = 0, _n = children.length; _i < _n; _i++) { var child = children[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { @@ -29968,7 +29973,7 @@ var ts; if (this.IsAny()) { return true; } - for (var _i = 0, _a = this.customContextChecks, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = this.customContextChecks, _n = _a.length; _i < _n; _i++) { var check = _a[_i]; if (!check(context)) { return false; @@ -30456,7 +30461,7 @@ var ts; var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var _i = 0, _a = bucket.Rules(), _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = bucket.Rules(), _n = _a.length; _i < _n; _i++) { var rule = _a[_i]; if (rule.Operation.Context.InContext(context)) { return rule; @@ -31138,7 +31143,7 @@ var ts; } } var inheritedIndentation = -1; - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var child = nodes[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, _startLine, true); } @@ -31183,7 +31188,7 @@ var ts; if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var _i = 0, _a = currentTokenInfo.leadingTrivia, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = currentTokenInfo.leadingTrivia, _n = _a.length; _i < _n; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; @@ -31218,7 +31223,7 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var _i = 0, _a = trivia.length; _i < _a; _i++) { + for (var _i = 0, _n = trivia.length; _i < _n; _i++) { var triviaItem = trivia[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); @@ -31949,7 +31954,7 @@ var ts; var list = createNode(222, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); @@ -32008,7 +32013,7 @@ var ts; }; NodeObject.prototype.getFirstToken = function (sourceFile) { var children = this.getChildren(); - for (var _i = 0, _a = children.length; _i < _a; _i++) { + for (var _i = 0, _n = children.length; _i < _n; _i++) { var child = children[_i]; if (child.kind < 125) { return child; @@ -32642,7 +32647,7 @@ var ts; this.host = host; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); - for (var _i = 0, _a = rootFileNames.length; _i < _a; _i++) { + for (var _i = 0, _n = rootFileNames.length; _i < _n; _i++) { var fileName = rootFileNames[_i]; this.createEntry(fileName); } @@ -33236,7 +33241,7 @@ var ts; }); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var _i = 0, _a = oldSourceFiles.length; _i < _a; _i++) { + for (var _i = 0, _n = oldSourceFiles.length; _i < _n; _i++) { var oldSourceFile = oldSourceFiles[_i]; var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { @@ -33271,8 +33276,8 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var _b = 0, _c = rootFileNames.length; _b < _c; _b++) { - var _fileName = rootFileNames[_b]; + for (var _a = 0, _b = rootFileNames.length; _a < _b; _a++) { + var _fileName = rootFileNames[_a]; if (!sourceFileUpToDate(program.getSourceFile(_fileName))) { return false; } @@ -34793,7 +34798,7 @@ var ts; var _scope = undefined; var _declarations = symbol.getDeclarations(); if (_declarations) { - for (var _i = 0, _a = _declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = _declarations.length; _i < _n; _i++) { var declaration = _declarations[_i]; var container = getContainerNode(declaration); if (!container) { @@ -35155,7 +35160,7 @@ var ts; var lastIterationMeaning; do { lastIterationMeaning = meaning; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { @@ -35586,7 +35591,7 @@ var ts; function processElement(element) { if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var _i = 0, _a = children.length; _i < _a; _i++) { + for (var _i = 0, _n = children.length; _i < _n; _i++) { var child = children[_i]; if (ts.isToken(child)) { classifyToken(child); @@ -35611,7 +35616,7 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0, _a = childNodes.length; _i < _a; _i++) { + for (var _i = 0, _n = childNodes.length; _i < _n; _i++) { var current = childNodes[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); @@ -35750,7 +35755,7 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var current = declarations[_i]; var _sourceFile = current.getSourceFile(); if (_sourceFile && getCanonicalFileName(ts.normalizePath(_sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index 7d12ccab74f..1afa7187c5e 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -625,7 +625,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; if (v === value) { return true; @@ -649,7 +649,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -663,7 +663,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var _item = array[_i]; if (f(_item)) { result.push(_item); @@ -677,7 +677,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; result.push(f(v)); } @@ -697,7 +697,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var _item = array[_i]; if (!contains(result, _item)) { result.push(_item); @@ -709,7 +709,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; result += v[prop]; } @@ -717,7 +717,7 @@ var ts; } ts.sum = sum; function addRange(to, from) { - for (var _i = 0, _a = from.length; _i < _a; _i++) { + for (var _i = 0, _n = from.length; _i < _n; _i++) { var v = from[_i]; to.push(v); } @@ -981,7 +981,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0, _a = parts.length; _i < _a; _i++) { + for (var _i = 0, _n = parts.length; _i < _n; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -1133,7 +1133,7 @@ var ts; ".js" ]; function removeFileExtension(path) { - for (var _i = 0, _a = supportedExtensions.length; _i < _a; _i++) { + for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -1298,15 +1298,15 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0, _a = files.length; _i < _a; _i++) { + for (var _i = 0, _n = files.length; _i < _n; _i++) { var _name = files[_i]; if (!extension || ts.fileExtensionIs(_name, extension)) { result.push(ts.combinePaths(path, _name)); } } var subfolders = getNames(folder.subfolders); - for (var _b = 0, _c = subfolders.length; _b < _c; _b++) { - var current = subfolders[_b]; + for (var _a = 0, _b = subfolders.length; _a < _b; _a++) { + var current = subfolders[_a]; visitDirectory(ts.combinePaths(path, current)); } } @@ -1392,7 +1392,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0, _a = files.length; _i < _a; _i++) { + for (var _i = 0, _n = files.length; _i < _n; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -1405,8 +1405,8 @@ var ts; directories.push(name); } } - for (var _b = 0, _c = directories.length; _b < _c; _b++) { - var _current = directories[_b]; + for (var _a = 0, _b = directories.length; _a < _b; _a++) { + var _current = directories[_a]; visitDirectory(_current); } } @@ -7921,7 +7921,7 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -8628,7 +8628,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0, _a = clauses.length; _i < _a; _i++) { + for (var _i = 0, _n = clauses.length; _i < _n; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -9019,7 +9019,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -9351,7 +9351,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var node = array[_i]; visitNode(node); } @@ -9415,7 +9415,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var node = array[_i]; visitNode(node); } @@ -13582,7 +13582,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0, _a = members.length; _i < _a; _i++) { + for (var _i = 0, _n = members.length; _i < _n; _i++) { var member = members[_i]; if (member.kind === 133 && ts.nodeIsPresent(member.body)) { return member; @@ -13906,7 +13906,7 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0, _a = accessibleSymbolChain.length; _i < _a; _i++) { + for (var _i = 0, _n = accessibleSymbolChain.length; _i < _n; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -14087,14 +14087,14 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = resolved.callSignatures, _n = _a.length; _i < _n; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _c = 0, _d = resolved.constructSignatures, _e = _d.length; _c < _e; _c++) { - var _signature = _d[_c]; + for (var _b = 0, _c = resolved.constructSignatures, _d = _c.length; _b < _d; _b++) { + var _signature = _c[_b]; writeKeyword(writer, 87); writeSpace(writer); buildSignatureDisplay(_signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); @@ -14127,13 +14127,13 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _f = 0, _g = resolved.properties, _h = _g.length; _f < _h; _f++) { - var p = _g[_f]; + for (var _e = 0, _f = resolved.properties, _g = _f.length; _e < _g; _e++) { + var p = _f[_e]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _j = 0, _k = signatures.length; _j < _k; _j++) { - var _signature_1 = signatures[_j]; + for (var _h = 0, _j = signatures.length; _h < _j; _h++) { + var _signature_1 = signatures[_h]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); @@ -14837,7 +14837,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0, _a = symbols.length; _i < _a; _i++) { + for (var _i = 0, _n = symbols.length; _i < _n; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -14845,14 +14845,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0, _a = symbols.length; _i < _a; _i++) { + for (var _i = 0, _n = symbols.length; _i < _n; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0, _a = baseSymbols.length; _i < _a; _i++) { + for (var _i = 0, _n = baseSymbols.length; _i < _n; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -14861,7 +14861,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0, _a = baseSignatures.length; _i < _a; _i++) { + for (var _i = 0, _n = baseSignatures.length; _i < _n; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -14963,7 +14963,7 @@ var ts; return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var _i = 0, _a = signatures.length; _i < _a; _i++) { + for (var _i = 0, _n = signatures.length; _i < _n; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; @@ -14986,7 +14986,7 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -15122,7 +15122,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -15142,8 +15142,8 @@ var ts; } var propTypes = []; var declarations = []; - for (var _b = 0, _c = props.length; _b < _c; _b++) { - var _prop = props[_b]; + for (var _a = 0, _b = props.length; _a < _b; _a++) { + var _prop = props[_a]; if (_prop.declarations) { declarations.push.apply(declarations, _prop.declarations); } @@ -15383,7 +15383,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -15431,7 +15431,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; result |= type.flags; } @@ -15529,7 +15529,7 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { case 196: @@ -15614,13 +15614,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -15638,7 +15638,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -15754,7 +15754,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0, _a = items.length; _i < _a; _i++) { + for (var _i = 0, _n = items.length; _i < _n; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -15806,7 +15806,7 @@ var ts; return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0, _a = sources.length; _i < _a; _i++) { + for (var _i = 0, _n = sources.length; _i < _n; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -16092,7 +16092,7 @@ var ts; function unionTypeRelatedToUnionType(source, target) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { + for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { @@ -16115,7 +16115,7 @@ var ts; function unionTypeRelatedToType(source, target, reportErrors) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { + for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { @@ -16253,7 +16253,7 @@ var ts; var _result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -16324,7 +16324,7 @@ var ts; return 0; } var _result = -1; - for (var _i = 0, _a = sourceProperties.length; _i < _a; _i++) { + for (var _i = 0, _n = sourceProperties.length; _i < _n; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -16349,12 +16349,12 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var _result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0, _a = targetSignatures.length; _i < _a; _i++) { + outer: for (var _i = 0, _n = targetSignatures.length; _i < _n; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _b = 0, _c = sourceSignatures.length; _b < _c; _b++) { - var s = sourceSignatures[_b]; + for (var _a = 0, _b = sourceSignatures.length; _a < _b; _a++) { + var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); if (related) { @@ -16569,7 +16569,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -16754,7 +16754,7 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0, _a = typeParameters.length; _i < _a; _i++) { + for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { var unused = typeParameters[_i]; inferences.push({ primary: undefined, @@ -16824,7 +16824,7 @@ var ts; var _targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _a = 0, _b = _targetTypes.length; _a < _b; _a++) { + for (var _a = 0, _n = _targetTypes.length; _a < _n; _a++) { var t = _targetTypes[_a]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; @@ -16842,8 +16842,8 @@ var ts; } else if (source.flags & 16384) { var _sourceTypes = source.types; - for (var _c = 0, _d = _sourceTypes.length; _c < _d; _c++) { - var sourceType = _sourceTypes[_c]; + for (var _b = 0, _c = _sourceTypes.length; _b < _c; _b++) { + var sourceType = _sourceTypes[_b]; inferFromTypes(sourceType, target); } } @@ -16868,7 +16868,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -17485,7 +17485,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -17624,7 +17624,7 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; @@ -17729,7 +17729,7 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { @@ -17995,7 +17995,7 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, _a = signatures.length; _i < _a; _i++) { + for (var _i = 0, _n = signatures.length; _i < _n; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var _parent = signature.declaration && signature.declaration.parent; @@ -18246,7 +18246,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0, _a = candidates.length; _i < _a; _i++) { + for (var _i = 0, _n = candidates.length; _i < _n; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -18255,8 +18255,8 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _b = 0, _c = candidates.length; _b < _c; _b++) { - var current = candidates[_b]; + for (var _a = 0, _b = candidates.length; _a < _b; _a++) { + var current = candidates[_a]; if (!hasCorrectArity(node, args, current)) { continue; } @@ -18703,7 +18703,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -18719,7 +18719,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -18755,7 +18755,7 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var _name = p.name; @@ -19195,7 +19195,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -19385,7 +19385,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0, _a = signaturesToCheck.length; _i < _a; _i++) { + for (var _i = 0, _n = signaturesToCheck.length; _i < _n; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -19491,7 +19491,7 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); @@ -19550,8 +19550,8 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _b = 0, _c = signatures.length; _b < _c; _b++) { - var signature = signatures[_b]; + for (var _a = 0, _b = signatures.length; _a < _b; _a++) { + var signature = signatures[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -20194,7 +20194,7 @@ var ts; }); if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 196) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = classDeclaration.members, _n = _a.length; _i < _n; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -20328,7 +20328,7 @@ var ts; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0, _a = baseProperties.length; _i < _a; _i++) { + for (var _i = 0, _n = baseProperties.length; _i < _n; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -20410,11 +20410,11 @@ var ts; }; }); var ok = true; - for (var _i = 0, _a = type.baseTypes, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _c = 0, _d = properties.length; _c < _d; _c++) { - var prop = properties[_c]; + for (var _b = 0, _c = properties.length; _b < _c; _b++) { + var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, @@ -20664,7 +20664,7 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; if ((declaration.kind === 196 || (declaration.kind === 195 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; @@ -20832,19 +20832,19 @@ var ts; } function hasExportedMembers(moduleSymbol) { var declarations = moduleSymbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var current = declarations[_i]; var statements = getModuleStatements(current); - for (var _b = 0, _c = statements.length; _b < _c; _b++) { - var node = statements[_b]; + for (var _a = 0, _b = statements.length; _a < _b; _a++) { + var node = statements[_a]; if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; } var specifiers = exportClause.elements; - for (var _d = 0, _e = specifiers.length; _d < _e; _d++) { - var specifier = specifiers[_d]; + for (var _c = 0, _d = specifiers.length; _c < _d; _c++) { + var specifier = specifiers[_c]; if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) { return true; } @@ -21748,7 +21748,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.modifiers, _n = _a.length; _i < _n; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 108: @@ -21952,7 +21952,7 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0, _a = arguments.length; _i < _a; _i++) { + for (var _i = 0, _n = arguments.length; _i < _n; _i++) { var arg = arguments[_i]; if (arg.kind === 172) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); @@ -21978,7 +21978,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -22006,7 +22006,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -22052,7 +22052,7 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var prop = _a[_i]; var _name = prop.name; if (prop.kind === 172 || _name.kind === 126) { @@ -22297,7 +22297,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, _a = elements.length; _i < _a; _i++) { + for (var _i = 0, _n = elements.length; _i < _n; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -22355,7 +22355,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = enumDecl.members, _n = _a.length; _i < _n; _i++) { var node = _a[_i]; if (node.name.kind === 126) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -22445,7 +22445,7 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = file.statements, _n = _a.length; _i < _n; _i++) { var decl = _a[_i]; if (ts.isDeclaration(decl) || decl.kind === 175) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { @@ -22908,14 +22908,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -24065,14 +24065,19 @@ var ts; function writeJavaScriptFile(emitOutput, writeByteOrderMark) { writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } - function createTempVariable(location, forLoopVariable) { - var _name = forLoopVariable ? "_i" : undefined; - while (true) { - if (_name && !isExistingName(location, _name)) { - break; + function createTempVariable(location, preferredName) { + var _name = preferredName; + for (; !_name || isExistingName(location, _name); tempCount++) { + var char = 97 + tempCount; + if (char === 105 || char === 110) { + continue; + } + if (tempCount < 26) { + _name = "_" + String.fromCharCode(char); + } + else { + _name = "_" + (tempCount - 26); } - _name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); - tempCount++; } recordNameInCurrentScope(_name); var result = ts.createSynthesizedNode(64); @@ -24085,8 +24090,8 @@ var ts; } tempVariables.push(name); } - function createAndRecordTempVariable(location) { - var temp = createTempVariable(location, false); + function createAndRecordTempVariable(location, preferredName) { + var temp = createTempVariable(location, preferredName); recordTempDeclaration(temp); return temp; } @@ -25169,9 +25174,9 @@ var ts; write(" "); endPos = emitToken(16, endPos); var rhsIsIdentifier = node.expression.kind === 64; - var counter = createTempVariable(node, true); - var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node, false); - var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, false) : undefined; + var counter = createTempVariable(node, "_i"); + var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(node); + var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(node, "_n") : undefined; emitStart(node.expression); write("var "); emitNodeWithoutSourceMap(counter); @@ -25230,7 +25235,7 @@ var ts; } } else { - emitNodeWithoutSourceMap(createTempVariable(node, false)); + emitNodeWithoutSourceMap(createTempVariable(node)); write(" = "); emitNodeWithoutSourceMap(rhsIterationValue); } @@ -25475,7 +25480,7 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var propName = (p.name); @@ -25700,7 +25705,7 @@ var ts; if (languageVersion < 2 && ts.hasRestParameters(node)) { var restIndex = node.parameters.length - 1; var restParam = node.parameters[restIndex]; - var tempName = createTempVariable(node, true).text; + var tempName = createTempVariable(node, "_i").text; writeLine(); emitLeadingComments(restParam); emitStart(restParam); @@ -25899,7 +25904,7 @@ var ts; decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _i = 0, _a = body.statements, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = body.statements, _n = _a.length; _i < _n; _i++) { var statement = _a[_i]; write(" "); emit(statement); @@ -26516,7 +26521,7 @@ var ts; } function getExternalImportInfo(node) { if (externalImports) { - for (var _i = 0, _a = externalImports.length; _i < _a; _i++) { + for (var _i = 0, _n = externalImports.length; _i < _n; _i++) { var info = externalImports[_i]; if (info.rootNode === node) { return info; @@ -27879,7 +27884,7 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var declarations = sourceFile.getNamedDeclarations(); - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; var name = getDeclarationName(declaration); if (name !== undefined) { @@ -27917,7 +27922,7 @@ var ts; return items; function allMatchesAreCaseSensitive(matches) { ts.Debug.assert(matches.length > 0); - for (var _i = 0, _a = matches.length; _i < _a; _i++) { + for (var _i = 0, _n = matches.length; _i < _n; _i++) { var match = matches[_i]; if (!match.isCaseSensitive) { return false; @@ -27996,7 +28001,7 @@ var ts; function bestMatchKind(matches) { ts.Debug.assert(matches.length > 0); var _bestMatchKind = 3; - for (var _i = 0, _a = matches.length; _i < _a; _i++) { + for (var _i = 0, _n = matches.length; _i < _n; _i++) { var match = matches[_i]; var kind = match.kind; if (kind < _bestMatchKind) { @@ -28133,7 +28138,7 @@ var ts; } function addTopLevelNodes(nodes, topLevelNodes) { nodes = sortNodes(nodes); - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; switch (node.kind) { case 196: @@ -28174,7 +28179,7 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var child = nodes[_i]; var _item = createItem(child); if (_item !== undefined) { @@ -28199,10 +28204,10 @@ var ts; if (!target.childItems) { target.childItems = []; } - outer: for (var _i = 0, _a = source.childItems, _b = _a.length; _i < _b; _i++) { + outer: for (var _i = 0, _a = source.childItems, _n = _a.length; _i < _n; _i++) { var sourceChild = _a[_i]; - for (var _c = 0, _d = target.childItems, _e = _d.length; _c < _e; _c++) { - var targetChild = _d[_c]; + for (var _b = 0, _c = target.childItems, _d = _c.length; _b < _d; _b++) { + var targetChild = _c[_b]; if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { merge(targetChild, sourceChild); continue outer; @@ -28502,7 +28507,7 @@ var ts; if (isLowercase) { if (index > 0) { var wordSpans = getWordSpans(candidate); - for (var _i = 0, _a = wordSpans.length; _i < _a; _i++) { + for (var _i = 0, _n = wordSpans.length; _i < _n; _i++) { var span = wordSpans[_i]; if (partStartsWith(candidate, span, chunk.text, true)) { return createPatternMatch(2, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); @@ -28557,7 +28562,7 @@ var ts; } var subWordTextChunks = segment.subWordTextChunks; var matches = undefined; - for (var _i = 0, _a = subWordTextChunks.length; _i < _a; _i++) { + for (var _i = 0, _n = subWordTextChunks.length; _i < _n; _i++) { var subWordTextChunk = subWordTextChunks[_i]; var result = matchTextChunk(candidate, subWordTextChunk, true); if (!result) { @@ -28952,7 +28957,7 @@ var ts; function getArgumentIndex(argumentsList, node) { var argumentIndex = 0; var listChildren = argumentsList.getChildren(); - for (var _i = 0, _a = listChildren.length; _i < _a; _i++) { + for (var _i = 0, _n = listChildren.length; _i < _n; _i++) { var child = listChildren[_i]; if (child === node) { break; @@ -29277,7 +29282,7 @@ var ts; return n; } var children = n.getChildren(); - for (var _i = 0, _a = children.length; _i < _a; _i++) { + for (var _i = 0, _n = children.length; _i < _n; _i++) { var child = children[_i]; var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { @@ -29968,7 +29973,7 @@ var ts; if (this.IsAny()) { return true; } - for (var _i = 0, _a = this.customContextChecks, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = this.customContextChecks, _n = _a.length; _i < _n; _i++) { var check = _a[_i]; if (!check(context)) { return false; @@ -30456,7 +30461,7 @@ var ts; var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); var bucket = this.map[bucketIndex]; if (bucket != null) { - for (var _i = 0, _a = bucket.Rules(), _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = bucket.Rules(), _n = _a.length; _i < _n; _i++) { var rule = _a[_i]; if (rule.Operation.Context.InContext(context)) { return rule; @@ -31138,7 +31143,7 @@ var ts; } } var inheritedIndentation = -1; - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var child = nodes[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, _startLine, true); } @@ -31183,7 +31188,7 @@ var ts; if (indentToken) { var indentNextTokenOrTrivia = true; if (currentTokenInfo.leadingTrivia) { - for (var _i = 0, _a = currentTokenInfo.leadingTrivia, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = currentTokenInfo.leadingTrivia, _n = _a.length; _i < _n; _i++) { var triviaItem = _a[_i]; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; @@ -31218,7 +31223,7 @@ var ts; } } function processTrivia(trivia, parent, contextNode, dynamicIndentation) { - for (var _i = 0, _a = trivia.length; _i < _a; _i++) { + for (var _i = 0, _n = trivia.length; _i < _n; _i++) { var triviaItem = trivia[_i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); @@ -31949,7 +31954,7 @@ var ts; var list = createNode(222, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); @@ -32008,7 +32013,7 @@ var ts; }; NodeObject.prototype.getFirstToken = function (sourceFile) { var children = this.getChildren(); - for (var _i = 0, _a = children.length; _i < _a; _i++) { + for (var _i = 0, _n = children.length; _i < _n; _i++) { var child = children[_i]; if (child.kind < 125) { return child; @@ -32642,7 +32647,7 @@ var ts; this.host = host; this.fileNameToEntry = {}; var rootFileNames = host.getScriptFileNames(); - for (var _i = 0, _a = rootFileNames.length; _i < _a; _i++) { + for (var _i = 0, _n = rootFileNames.length; _i < _n; _i++) { var fileName = rootFileNames[_i]; this.createEntry(fileName); } @@ -33236,7 +33241,7 @@ var ts; }); if (program) { var oldSourceFiles = program.getSourceFiles(); - for (var _i = 0, _a = oldSourceFiles.length; _i < _a; _i++) { + for (var _i = 0, _n = oldSourceFiles.length; _i < _n; _i++) { var oldSourceFile = oldSourceFiles[_i]; var fileName = oldSourceFile.fileName; if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { @@ -33271,8 +33276,8 @@ var ts; if (program.getSourceFiles().length !== rootFileNames.length) { return false; } - for (var _b = 0, _c = rootFileNames.length; _b < _c; _b++) { - var _fileName = rootFileNames[_b]; + for (var _a = 0, _b = rootFileNames.length; _a < _b; _a++) { + var _fileName = rootFileNames[_a]; if (!sourceFileUpToDate(program.getSourceFile(_fileName))) { return false; } @@ -34793,7 +34798,7 @@ var ts; var _scope = undefined; var _declarations = symbol.getDeclarations(); if (_declarations) { - for (var _i = 0, _a = _declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = _declarations.length; _i < _n; _i++) { var declaration = _declarations[_i]; var container = getContainerNode(declaration); if (!container) { @@ -35155,7 +35160,7 @@ var ts; var lastIterationMeaning; do { lastIterationMeaning = meaning; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; var declarationMeaning = getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { @@ -35586,7 +35591,7 @@ var ts; function processElement(element) { if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { var children = element.getChildren(); - for (var _i = 0, _a = children.length; _i < _a; _i++) { + for (var _i = 0, _n = children.length; _i < _n; _i++) { var child = children[_i]; if (ts.isToken(child)) { classifyToken(child); @@ -35611,7 +35616,7 @@ var ts; if (matchKind) { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var _i = 0, _a = childNodes.length; _i < _a; _i++) { + for (var _i = 0, _n = childNodes.length; _i < _n; _i++) { var current = childNodes[_i]; if (current.kind === matchKind) { var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); @@ -35750,7 +35755,7 @@ var ts; if (declarations && declarations.length > 0) { var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); if (defaultLibFileName) { - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var current = declarations[_i]; var _sourceFile = current.getSourceFile(); if (_sourceFile && getCanonicalFileName(ts.normalizePath(_sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 51b74436673..54ec39a5b55 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2117,8 +2117,7 @@ module ts { // Create a temporary variable with a unique unused name. The forLoopVariable parameter signals that the // name should be one that is appropriate for a for loop variable. function createTempVariable(location: Node, preferredName?: string): Identifier { - let name = preferredName; - for ( ; !name || isExistingName(location, name); tempCount++) { + for (var name = preferredName; !name || isExistingName(location, name); tempCount++) { // _a .. _h, _j ... _z, _0, _1, ... // Note: we avoid generating _i and _n as those are common names we want in other places. @@ -2126,7 +2125,7 @@ module ts { if (char === CharacterCodes.i || char === CharacterCodes.n) { continue; } - + if (tempCount < 26) { name = "_" + String.fromCharCode(char); } From 8e9e5e2184c9069552f789465bfaa8dd09586d31 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 16:52:49 -0700 Subject: [PATCH 085/101] Update LKG. --- bin/tsc.js | 207 +++++++++++++++++++------------------- bin/tsserver.js | 11 +- bin/typescript.js | 11 +- bin/typescriptServices.js | 11 +- 4 files changed, 118 insertions(+), 122 deletions(-) diff --git a/bin/tsc.js b/bin/tsc.js index ea41491d3b6..136311b7712 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -44,7 +44,7 @@ var ts; ts.forEach = forEach; function contains(array, value) { if (array) { - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; if (v === value) { return true; @@ -68,7 +68,7 @@ var ts; function countWhere(array, predicate) { var count = 0; if (array) { - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; if (predicate(v)) { count++; @@ -82,7 +82,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var _item = array[_i]; if (f(_item)) { result.push(_item); @@ -96,7 +96,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; result.push(f(v)); } @@ -116,7 +116,7 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var _item = array[_i]; if (!contains(result, _item)) { result.push(_item); @@ -128,7 +128,7 @@ var ts; ts.deduplicate = deduplicate; function sum(array, prop) { var result = 0; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var v = array[_i]; result += v[prop]; } @@ -136,7 +136,7 @@ var ts; } ts.sum = sum; function addRange(to, from) { - for (var _i = 0, _a = from.length; _i < _a; _i++) { + for (var _i = 0, _n = from.length; _i < _n; _i++) { var v = from[_i]; to.push(v); } @@ -400,7 +400,7 @@ var ts; function getNormalizedParts(normalizedSlashedPath, rootLength) { var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); var normalized = []; - for (var _i = 0, _a = parts.length; _i < _a; _i++) { + for (var _i = 0, _n = parts.length; _i < _n; _i++) { var part = parts[_i]; if (part !== ".") { if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { @@ -552,7 +552,7 @@ var ts; ".js" ]; function removeFileExtension(path) { - for (var _i = 0, _a = supportedExtensions.length; _i < _a; _i++) { + for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { var ext = supportedExtensions[_i]; if (fileExtensionIs(path, ext)) { return path.substr(0, path.length - ext.length); @@ -710,15 +710,15 @@ var ts; function visitDirectory(path) { var folder = fso.GetFolder(path || "."); var files = getNames(folder.files); - for (var _i = 0, _a = files.length; _i < _a; _i++) { + for (var _i = 0, _n = files.length; _i < _n; _i++) { var _name = files[_i]; if (!extension || ts.fileExtensionIs(_name, extension)) { result.push(ts.combinePaths(path, _name)); } } var subfolders = getNames(folder.subfolders); - for (var _b = 0, _c = subfolders.length; _b < _c; _b++) { - var current = subfolders[_b]; + for (var _a = 0, _b = subfolders.length; _a < _b; _a++) { + var current = subfolders[_a]; visitDirectory(ts.combinePaths(path, current)); } } @@ -804,7 +804,7 @@ var ts; function visitDirectory(path) { var files = _fs.readdirSync(path || ".").sort(); var directories = []; - for (var _i = 0, _a = files.length; _i < _a; _i++) { + for (var _i = 0, _n = files.length; _i < _n; _i++) { var current = files[_i]; var name = ts.combinePaths(path, current); var stat = _fs.lstatSync(name); @@ -817,8 +817,8 @@ var ts; directories.push(name); } } - for (var _b = 0, _c = directories.length; _b < _c; _b++) { - var _current = directories[_b]; + for (var _a = 0, _b = directories.length; _a < _b; _a++) { + var _current = directories[_a]; visitDirectory(_current); } } @@ -7333,7 +7333,7 @@ var ts; (function (ts) { function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; if (declaration.kind === kind) { return declaration; @@ -8040,7 +8040,7 @@ var ts; ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; function getHeritageClause(clauses, kind) { if (clauses) { - for (var _i = 0, _a = clauses.length; _i < _a; _i++) { + for (var _i = 0, _n = clauses.length; _i < _n; _i++) { var clause = clauses[_i]; if (clause.token === kind) { return clause; @@ -8431,7 +8431,7 @@ var ts; } function visitEachNode(cbNode, nodes) { if (nodes) { - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; var result = cbNode(node); if (result) { @@ -8732,7 +8732,7 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var node = array[_i]; visitNode(node); } @@ -8796,7 +8796,7 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0, _a = array.length; _i < _a; _i++) { + for (var _i = 0, _n = array.length; _i < _n; _i++) { var node = array[_i]; visitNode(node); } @@ -12953,7 +12953,7 @@ var ts; } function findConstructorDeclaration(node) { var members = node.members; - for (var _i = 0, _a = members.length; _i < _a; _i++) { + for (var _i = 0, _n = members.length; _i < _n; _i++) { var member = members[_i]; if (member.kind === 133 && ts.nodeIsPresent(member.body)) { return member; @@ -13277,7 +13277,7 @@ var ts; walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { - for (var _i = 0, _a = accessibleSymbolChain.length; _i < _a; _i++) { + for (var _i = 0, _n = accessibleSymbolChain.length; _i < _n; _i++) { var accessibleSymbol = accessibleSymbolChain[_i]; appendParentTypeArgumentsAndSymbolName(accessibleSymbol); } @@ -13458,14 +13458,14 @@ var ts; writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); - for (var _i = 0, _a = resolved.callSignatures, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = resolved.callSignatures, _n = _a.length; _i < _n; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); writePunctuation(writer, 22); writer.writeLine(); } - for (var _c = 0, _d = resolved.constructSignatures, _e = _d.length; _c < _e; _c++) { - var _signature = _d[_c]; + for (var _b = 0, _c = resolved.constructSignatures, _d = _c.length; _b < _d; _b++) { + var _signature = _c[_b]; writeKeyword(writer, 87); writeSpace(writer); buildSignatureDisplay(_signature, writer, enclosingDeclaration, globalFlagsToPass, typeStack); @@ -13498,13 +13498,13 @@ var ts; writePunctuation(writer, 22); writer.writeLine(); } - for (var _f = 0, _g = resolved.properties, _h = _g.length; _f < _h; _f++) { - var p = _g[_f]; + for (var _e = 0, _f = resolved.properties, _g = _f.length; _e < _g; _e++) { + var p = _f[_e]; var t = getTypeOfSymbol(p); if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { var signatures = getSignaturesOfType(t, 0); - for (var _j = 0, _k = signatures.length; _j < _k; _j++) { - var _signature_1 = signatures[_j]; + for (var _h = 0, _j = signatures.length; _h < _j; _h++) { + var _signature_1 = signatures[_h]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { writePunctuation(writer, 50); @@ -14208,7 +14208,7 @@ var ts; } function createSymbolTable(symbols) { var result = {}; - for (var _i = 0, _a = symbols.length; _i < _a; _i++) { + for (var _i = 0, _n = symbols.length; _i < _n; _i++) { var symbol = symbols[_i]; result[symbol.name] = symbol; } @@ -14216,14 +14216,14 @@ var ts; } function createInstantiatedSymbolTable(symbols, mapper) { var result = {}; - for (var _i = 0, _a = symbols.length; _i < _a; _i++) { + for (var _i = 0, _n = symbols.length; _i < _n; _i++) { var symbol = symbols[_i]; result[symbol.name] = instantiateSymbol(symbol, mapper); } return result; } function addInheritedMembers(symbols, baseSymbols) { - for (var _i = 0, _a = baseSymbols.length; _i < _a; _i++) { + for (var _i = 0, _n = baseSymbols.length; _i < _n; _i++) { var s = baseSymbols[_i]; if (!ts.hasProperty(symbols, s.name)) { symbols[s.name] = s; @@ -14232,7 +14232,7 @@ var ts; } function addInheritedSignatures(signatures, baseSignatures) { if (baseSignatures) { - for (var _i = 0, _a = baseSignatures.length; _i < _a; _i++) { + for (var _i = 0, _n = baseSignatures.length; _i < _n; _i++) { var signature = baseSignatures[_i]; signatures.push(signature); } @@ -14334,7 +14334,7 @@ var ts; return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; - for (var _i = 0, _a = signatures.length; _i < _a; _i++) { + for (var _i = 0, _n = signatures.length; _i < _n; _i++) { var signature = signatures[_i]; if (signature.typeParameters) { return emptyArray; @@ -14357,7 +14357,7 @@ var ts; } function getUnionIndexType(types, kind) { var indexTypes = []; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; var indexType = getIndexTypeOfType(type, kind); if (!indexType) { @@ -14493,7 +14493,7 @@ var ts; function createUnionProperty(unionType, name) { var types = unionType.types; var props; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; var type = getApparentType(current); if (type !== unknownType) { @@ -14513,8 +14513,8 @@ var ts; } var propTypes = []; var declarations = []; - for (var _b = 0, _c = props.length; _b < _c; _b++) { - var _prop = props[_b]; + for (var _a = 0, _b = props.length; _a < _b; _a++) { + var _prop = props[_a]; if (_prop.declarations) { declarations.push.apply(declarations, _prop.declarations); } @@ -14754,7 +14754,7 @@ var ts; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; - for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { var decl = _a[_i]; var node = decl; if (node.parameters.length === 1) { @@ -14802,7 +14802,7 @@ var ts; } function getWideningFlagsOfTypes(types) { var result = 0; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; result |= type.flags; } @@ -14900,7 +14900,7 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { case 196: @@ -14985,13 +14985,13 @@ var ts; } } function addTypesToSortedSet(sortedTypes, types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; addTypeToSortedSet(sortedTypes, type); } } function isSubtypeOfAny(candidate, types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; if (candidate !== type && isTypeSubtypeOf(candidate, type)) { return true; @@ -15009,7 +15009,7 @@ var ts; } } function containsAnyType(types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; if (type.flags & 1) { return true; @@ -15125,7 +15125,7 @@ var ts; function instantiateList(items, mapper, instantiator) { if (items && items.length) { var result = []; - for (var _i = 0, _a = items.length; _i < _a; _i++) { + for (var _i = 0, _n = items.length; _i < _n; _i++) { var v = items[_i]; result.push(instantiator(v, mapper)); } @@ -15177,7 +15177,7 @@ var ts; return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { - for (var _i = 0, _a = sources.length; _i < _a; _i++) { + for (var _i = 0, _n = sources.length; _i < _n; _i++) { var source = sources[_i]; if (t === source) { return anyType; @@ -15463,7 +15463,7 @@ var ts; function unionTypeRelatedToUnionType(source, target) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { + for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { var sourceType = sourceTypes[_i]; var related = typeRelatedToUnionType(sourceType, target, false); if (!related) { @@ -15486,7 +15486,7 @@ var ts; function unionTypeRelatedToType(source, target, reportErrors) { var _result = -1; var sourceTypes = source.types; - for (var _i = 0, _a = sourceTypes.length; _i < _a; _i++) { + for (var _i = 0, _n = sourceTypes.length; _i < _n; _i++) { var sourceType = sourceTypes[_i]; var related = isRelatedTo(sourceType, target, reportErrors); if (!related) { @@ -15624,7 +15624,7 @@ var ts; var _result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { @@ -15695,7 +15695,7 @@ var ts; return 0; } var _result = -1; - for (var _i = 0, _a = sourceProperties.length; _i < _a; _i++) { + for (var _i = 0, _n = sourceProperties.length; _i < _n; _i++) { var sourceProp = sourceProperties[_i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { @@ -15720,12 +15720,12 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var _result = -1; var saveErrorInfo = errorInfo; - outer: for (var _i = 0, _a = targetSignatures.length; _i < _a; _i++) { + outer: for (var _i = 0, _n = targetSignatures.length; _i < _n; _i++) { var t = targetSignatures[_i]; if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; - for (var _b = 0, _c = sourceSignatures.length; _b < _c; _b++) { - var s = sourceSignatures[_b]; + for (var _a = 0, _b = sourceSignatures.length; _a < _b; _a++) { + var s = sourceSignatures[_a]; if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); if (related) { @@ -15940,7 +15940,7 @@ var ts; return result; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var type = types[_i]; if (candidate !== type && !isTypeSubtypeOf(type, candidate)) return false; @@ -16125,7 +16125,7 @@ var ts; } function createInferenceContext(typeParameters, inferUnionTypes) { var inferences = []; - for (var _i = 0, _a = typeParameters.length; _i < _a; _i++) { + for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { var unused = typeParameters[_i]; inferences.push({ primary: undefined, @@ -16195,7 +16195,7 @@ var ts; var _targetTypes = target.types; var typeParameterCount = 0; var typeParameter; - for (var _a = 0, _b = _targetTypes.length; _a < _b; _a++) { + for (var _a = 0, _n = _targetTypes.length; _a < _n; _a++) { var t = _targetTypes[_a]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; @@ -16213,8 +16213,8 @@ var ts; } else if (source.flags & 16384) { var _sourceTypes = source.types; - for (var _c = 0, _d = _sourceTypes.length; _c < _d; _c++) { - var sourceType = _sourceTypes[_c]; + for (var _b = 0, _c = _sourceTypes.length; _b < _c; _b++) { + var sourceType = _sourceTypes[_b]; inferFromTypes(sourceType, target); } } @@ -16239,7 +16239,7 @@ var ts; } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var targetProp = properties[_i]; var sourceProp = getPropertyOfObjectType(source, targetProp.name); if (sourceProp) { @@ -16856,7 +16856,7 @@ var ts; var types = type.types; var mappedType; var mappedTypes; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; var t = mapper(current); if (t) { @@ -16995,7 +16995,7 @@ var ts; } var signatureList; var types = type.types; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; @@ -17100,7 +17100,7 @@ var ts; var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { @@ -17366,7 +17366,7 @@ var ts; var specializedIndex = -1; var spliceIndex; ts.Debug.assert(!result.length); - for (var _i = 0, _a = signatures.length; _i < _a; _i++) { + for (var _i = 0, _n = signatures.length; _i < _n; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); var _parent = signature.declaration && signature.declaration.parent; @@ -17617,7 +17617,7 @@ var ts; error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); } if (!produceDiagnostics) { - for (var _i = 0, _a = candidates.length; _i < _a; _i++) { + for (var _i = 0, _n = candidates.length; _i < _n; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { return candidate; @@ -17626,8 +17626,8 @@ var ts; } return resolveErrorCall(node); function chooseOverload(candidates, relation) { - for (var _b = 0, _c = candidates.length; _b < _c; _b++) { - var current = candidates[_b]; + for (var _a = 0, _b = candidates.length; _a < _b; _a++) { + var current = candidates[_a]; if (!hasCorrectArity(node, args, current)) { continue; } @@ -18074,7 +18074,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; if (current.flags & kind) { return true; @@ -18090,7 +18090,7 @@ var ts; } if (type.flags & 16384) { var types = type.types; - for (var _i = 0, _a = types.length; _i < _a; _i++) { + for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; if (!(current.flags & kind)) { return false; @@ -18126,7 +18126,7 @@ var ts; } function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { var properties = node.properties; - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var _name = p.name; @@ -18566,7 +18566,7 @@ var ts; if (indexSymbol) { var seenNumericIndexer = false; var seenStringIndexer = false; - for (var _i = 0, _a = indexSymbol.declarations, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = indexSymbol.declarations, _n = _a.length; _i < _n; _i++) { var decl = _a[_i]; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { @@ -18756,7 +18756,7 @@ var ts; else { signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); } - for (var _i = 0, _a = signaturesToCheck.length; _i < _a; _i++) { + for (var _i = 0, _n = signaturesToCheck.length; _i < _n; _i++) { var otherSignature = signaturesToCheck[_i]; if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { return; @@ -18862,7 +18862,7 @@ var ts; var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); @@ -18921,8 +18921,8 @@ var ts; var signatures = getSignaturesOfSymbol(symbol); var bodySignature = getSignatureFromDeclaration(bodyDeclaration); if (!bodySignature.hasStringLiterals) { - for (var _b = 0, _c = signatures.length; _b < _c; _b++) { - var signature = signatures[_b]; + for (var _a = 0, _b = signatures.length; _a < _b; _a++) { + var signature = signatures[_a]; if (!signature.hasStringLiterals && !isSignatureAssignableTo(bodySignature, signature)) { error(signature.declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); break; @@ -19565,7 +19565,7 @@ var ts; }); if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 196) { var classDeclaration = type.symbol.valueDeclaration; - for (var _i = 0, _a = classDeclaration.members, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = classDeclaration.members, _n = _a.length; _i < _n; _i++) { var member = _a[_i]; if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); @@ -19699,7 +19699,7 @@ var ts; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); - for (var _i = 0, _a = baseProperties.length; _i < _a; _i++) { + for (var _i = 0, _n = baseProperties.length; _i < _n; _i++) { var baseProperty = baseProperties[_i]; var base = getTargetSymbol(baseProperty); if (base.flags & 134217728) { @@ -19781,11 +19781,11 @@ var ts; }; }); var ok = true; - for (var _i = 0, _a = type.baseTypes, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { var base = _a[_i]; var properties = getPropertiesOfObjectType(base); - for (var _c = 0, _d = properties.length; _c < _d; _c++) { - var prop = properties[_c]; + for (var _b = 0, _c = properties.length; _b < _c; _b++) { + var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { seen[prop.name] = { prop: prop, @@ -20035,7 +20035,7 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var declaration = declarations[_i]; if ((declaration.kind === 196 || (declaration.kind === 195 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; @@ -20203,19 +20203,19 @@ var ts; } function hasExportedMembers(moduleSymbol) { var declarations = moduleSymbol.declarations; - for (var _i = 0, _a = declarations.length; _i < _a; _i++) { + for (var _i = 0, _n = declarations.length; _i < _n; _i++) { var current = declarations[_i]; var statements = getModuleStatements(current); - for (var _b = 0, _c = statements.length; _b < _c; _b++) { - var node = statements[_b]; + for (var _a = 0, _b = statements.length; _a < _b; _a++) { + var node = statements[_a]; if (node.kind === 210) { var exportClause = node.exportClause; if (!exportClause) { return true; } var specifiers = exportClause.elements; - for (var _d = 0, _e = specifiers.length; _d < _e; _d++) { - var specifier = specifiers[_d]; + for (var _c = 0, _d = specifiers.length; _c < _d; _c++) { + var specifier = specifiers[_c]; if (!(specifier.propertyName && specifier.name && specifier.name.text === "default")) { return true; } @@ -21119,7 +21119,7 @@ var ts; } var lastStatic, lastPrivate, lastProtected, lastDeclare; var flags = 0; - for (var _i = 0, _a = node.modifiers, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.modifiers, _n = _a.length; _i < _n; _i++) { var modifier = _a[_i]; switch (modifier.kind) { case 108: @@ -21323,7 +21323,7 @@ var ts; function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0, _a = arguments.length; _i < _a; _i++) { + for (var _i = 0, _n = arguments.length; _i < _n; _i++) { var arg = arguments[_i]; if (arg.kind === 172) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); @@ -21349,7 +21349,7 @@ var ts; var seenExtendsClause = false; var seenImplementsClause = false; if (!checkGrammarModifiers(node) && node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -21377,7 +21377,7 @@ var ts; function checkGrammarInterfaceDeclaration(node) { var seenExtendsClause = false; if (node.heritageClauses) { - for (var _i = 0, _a = node.heritageClauses, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.heritageClauses, _n = _a.length; _i < _n; _i++) { var heritageClause = _a[_i]; if (heritageClause.token === 78) { if (seenExtendsClause) { @@ -21423,7 +21423,7 @@ var ts; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; var inStrictMode = (node.parserContextFlags & 1) !== 0; - for (var _i = 0, _a = node.properties, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var prop = _a[_i]; var _name = prop.name; if (prop.kind === 172 || _name.kind === 126) { @@ -21668,7 +21668,7 @@ var ts; } else { var elements = name.elements; - for (var _i = 0, _a = elements.length; _i < _a; _i++) { + for (var _i = 0, _n = elements.length; _i < _n; _i++) { var element = elements[_i]; checkGrammarNameInLetOrConstDeclarations(element.name); } @@ -21726,7 +21726,7 @@ var ts; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); - for (var _i = 0, _a = enumDecl.members, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = enumDecl.members, _n = _a.length; _i < _n; _i++) { var node = _a[_i]; if (node.name.kind === 126) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); @@ -21816,7 +21816,7 @@ var ts; return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { - for (var _i = 0, _a = file.statements, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = file.statements, _n = _a.length; _i < _n; _i++) { var decl = _a[_i]; if (ts.isDeclaration(decl) || decl.kind === 175) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { @@ -22279,14 +22279,14 @@ var ts; } } function emitLines(nodes) { - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; emit(node); } } function emitSeparatedList(nodes, separator, eachNodeEmitFn) { var currentWriterPos = writer.getTextPos(); - for (var _i = 0, _a = nodes.length; _i < _a; _i++) { + for (var _i = 0, _n = nodes.length; _i < _n; _i++) { var node = nodes[_i]; if (currentWriterPos !== writer.getTextPos()) { write(separator); @@ -23437,22 +23437,21 @@ var ts; writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } function createTempVariable(location, preferredName) { - var _name = preferredName; - for (; !_name || isExistingName(location, _name); tempCount++) { + for (var name = preferredName; !name || isExistingName(location, name); tempCount++) { var char = 97 + tempCount; if (char === 105 || char === 110) { continue; } if (tempCount < 26) { - _name = "_" + String.fromCharCode(char); + name = "_" + String.fromCharCode(char); } else { - _name = "_" + (tempCount - 26); + name = "_" + (tempCount - 26); } } - recordNameInCurrentScope(_name); + recordNameInCurrentScope(name); var result = ts.createSynthesizedNode(64); - result.text = _name; + result.text = name; return result; } function recordTempDeclaration(name) { @@ -24851,7 +24850,7 @@ var ts; if (properties.length !== 1) { value = ensureIdentifier(value); } - for (var _i = 0, _a = properties.length; _i < _a; _i++) { + for (var _i = 0, _n = properties.length; _i < _n; _i++) { var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var propName = (p.name); @@ -25275,7 +25274,7 @@ var ts; decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; if (preserveNewLines && !preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { - for (var _i = 0, _a = body.statements, _b = _a.length; _i < _b; _i++) { + for (var _i = 0, _a = body.statements, _n = _a.length; _i < _n; _i++) { var statement = _a[_i]; write(" "); emit(statement); @@ -25892,7 +25891,7 @@ var ts; } function getExternalImportInfo(node) { if (externalImports) { - for (var _i = 0, _a = externalImports.length; _i < _a; _i++) { + for (var _i = 0, _n = externalImports.length; _i < _n; _i++) { var info = externalImports[_i]; if (info.rootNode === node) { return info; diff --git a/bin/tsserver.js b/bin/tsserver.js index 8d08738bec7..d44ebe93392 100644 --- a/bin/tsserver.js +++ b/bin/tsserver.js @@ -23793,22 +23793,21 @@ var ts; writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } function createTempVariable(location, preferredName) { - var _name = preferredName; - for (; !_name || isExistingName(location, _name); tempCount++) { + for (var name = preferredName; !name || isExistingName(location, name); tempCount++) { var char = 97 + tempCount; if (char === 105 || char === 110) { continue; } if (tempCount < 26) { - _name = "_" + String.fromCharCode(char); + name = "_" + String.fromCharCode(char); } else { - _name = "_" + (tempCount - 26); + name = "_" + (tempCount - 26); } } - recordNameInCurrentScope(_name); + recordNameInCurrentScope(name); var result = ts.createSynthesizedNode(64); - result.text = _name; + result.text = name; return result; } function recordTempDeclaration(name) { diff --git a/bin/typescript.js b/bin/typescript.js index 1afa7187c5e..1cefda2a274 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -24066,22 +24066,21 @@ var ts; writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } function createTempVariable(location, preferredName) { - var _name = preferredName; - for (; !_name || isExistingName(location, _name); tempCount++) { + for (var name = preferredName; !name || isExistingName(location, name); tempCount++) { var char = 97 + tempCount; if (char === 105 || char === 110) { continue; } if (tempCount < 26) { - _name = "_" + String.fromCharCode(char); + name = "_" + String.fromCharCode(char); } else { - _name = "_" + (tempCount - 26); + name = "_" + (tempCount - 26); } } - recordNameInCurrentScope(_name); + recordNameInCurrentScope(name); var result = ts.createSynthesizedNode(64); - result.text = _name; + result.text = name; return result; } function recordTempDeclaration(name) { diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index 1afa7187c5e..1cefda2a274 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -24066,22 +24066,21 @@ var ts; writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } function createTempVariable(location, preferredName) { - var _name = preferredName; - for (; !_name || isExistingName(location, _name); tempCount++) { + for (var name = preferredName; !name || isExistingName(location, name); tempCount++) { var char = 97 + tempCount; if (char === 105 || char === 110) { continue; } if (tempCount < 26) { - _name = "_" + String.fromCharCode(char); + name = "_" + String.fromCharCode(char); } else { - _name = "_" + (tempCount - 26); + name = "_" + (tempCount - 26); } } - recordNameInCurrentScope(_name); + recordNameInCurrentScope(name); var result = ts.createSynthesizedNode(64); - result.text = _name; + result.text = name; return result; } function recordTempDeclaration(name) { From 9445b0311024f4a0d154ed4b4666077207e99b50 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 16:56:19 -0700 Subject: [PATCH 086/101] Do not include experimental options in the public API. --- src/compiler/types.ts | 6 +++--- tests/baselines/reference/APISample_compile.js | 3 --- tests/baselines/reference/APISample_compile.types | 9 --------- tests/baselines/reference/APISample_linter.js | 3 --- tests/baselines/reference/APISample_linter.types | 9 --------- tests/baselines/reference/APISample_transform.js | 3 --- tests/baselines/reference/APISample_transform.types | 9 --------- tests/baselines/reference/APISample_watcher.js | 3 --- tests/baselines/reference/APISample_watcher.types | 9 --------- 9 files changed, 3 insertions(+), 51 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index a2fde2c5768..c43591911ab 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1558,9 +1558,9 @@ module ts { target?: ScriptTarget; version?: boolean; watch?: boolean; - stripInternal?: boolean; - preserveNewLines?: boolean; - cacheDownlevelForOfLength?: boolean; + /* @internal */ stripInternal?: boolean; + /* @internal */ preserveNewLines?: boolean; + /* @internal */ cacheDownlevelForOfLength?: boolean; [option: string]: string | number | boolean; } diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 8560d213641..98571823181 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1237,9 +1237,6 @@ declare module "typescript" { target?: ScriptTarget; version?: boolean; watch?: boolean; - stripInternal?: boolean; - preserveNewLines?: boolean; - cacheDownlevelForOfLength?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 018e48c30ba..087c0389d0f 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -3947,15 +3947,6 @@ declare module "typescript" { watch?: boolean; >watch : boolean - stripInternal?: boolean; ->stripInternal : boolean - - preserveNewLines?: boolean; ->preserveNewLines : boolean - - cacheDownlevelForOfLength?: boolean; ->cacheDownlevelForOfLength : boolean - [option: string]: string | number | boolean; >option : string } diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 62346784619..d43d6220072 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1268,9 +1268,6 @@ declare module "typescript" { target?: ScriptTarget; version?: boolean; watch?: boolean; - stripInternal?: boolean; - preserveNewLines?: boolean; - cacheDownlevelForOfLength?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 442c8a6ca06..14eb2936242 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -4093,15 +4093,6 @@ declare module "typescript" { watch?: boolean; >watch : boolean - stripInternal?: boolean; ->stripInternal : boolean - - preserveNewLines?: boolean; ->preserveNewLines : boolean - - cacheDownlevelForOfLength?: boolean; ->cacheDownlevelForOfLength : boolean - [option: string]: string | number | boolean; >option : string } diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 5c913a4d13d..bfe62135a0d 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -1269,9 +1269,6 @@ declare module "typescript" { target?: ScriptTarget; version?: boolean; watch?: boolean; - stripInternal?: boolean; - preserveNewLines?: boolean; - cacheDownlevelForOfLength?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 3673a5472a7..baa497c95fa 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -4043,15 +4043,6 @@ declare module "typescript" { watch?: boolean; >watch : boolean - stripInternal?: boolean; ->stripInternal : boolean - - preserveNewLines?: boolean; ->preserveNewLines : boolean - - cacheDownlevelForOfLength?: boolean; ->cacheDownlevelForOfLength : boolean - [option: string]: string | number | boolean; >option : string } diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 0983fedbaff..ee1fd062515 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1306,9 +1306,6 @@ declare module "typescript" { target?: ScriptTarget; version?: boolean; watch?: boolean; - stripInternal?: boolean; - preserveNewLines?: boolean; - cacheDownlevelForOfLength?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index c4211de6ce6..a8b534439d5 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -4216,15 +4216,6 @@ declare module "typescript" { watch?: boolean; >watch : boolean - stripInternal?: boolean; ->stripInternal : boolean - - preserveNewLines?: boolean; ->preserveNewLines : boolean - - cacheDownlevelForOfLength?: boolean; ->cacheDownlevelForOfLength : boolean - [option: string]: string | number | boolean; >option : string } From beb7fc4f8556238f04b9cbf04d21b5e765f134cc Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 13 Mar 2015 17:03:56 -0700 Subject: [PATCH 087/101] Preserve newlines in our own compiler. This aids debugging as it keeps lines at a reasonable length and more closely matches the original source. --- Jakefile | 2 +- bin/tsc.js | 7502 ++++++----------------------- bin/tsserver.js | 9013 ++++++++--------------------------- bin/typescript.d.ts | 3 - bin/typescript.js | 8610 ++++++++------------------------- bin/typescriptServices.d.ts | 3 - bin/typescriptServices.js | 8610 ++++++++------------------------- 7 files changed, 7478 insertions(+), 26265 deletions(-) diff --git a/Jakefile b/Jakefile index a6ba420c54a..3a19812b958 100644 --- a/Jakefile +++ b/Jakefile @@ -252,7 +252,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu options += " --stripInternal" } - options += " --cacheDownlevelForOfLength"; + options += " --cacheDownlevelForOfLength --preserveNewLines"; var cmd = host + " " + dir + compilerFilename + " " + options + " "; cmd = cmd + sources.join(" "); diff --git a/bin/tsc.js b/bin/tsc.js index 136311b7712..1d7c008595d 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -253,13 +253,13 @@ var ts; ts.arrayToMap = arrayToMap; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (match, index) { - return args[+index + baseIndex]; - }); + return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); } ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { - return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] ? ts.localizedDiagnosticMessages[message] : message; + return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] + ? ts.localizedDiagnosticMessages[message] + : message; } ts.getLocaleSpecificMessage = getLocaleSpecificMessage; function createFileDiagnostic(file, start, length, message) { @@ -330,7 +330,12 @@ var ts; return diagnostic.file ? diagnostic.file.fileName : undefined; } function compareDiagnostics(d1, d2) { - return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0; + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || + compareValues(d1.start, d2.start) || + compareValues(d1.length, d2.length) || + compareValues(d1.code, d2.code) || + compareMessageText(d1.messageText, d2.messageText) || + 0; } ts.compareDiagnostics = compareDiagnostics; function compareMessageText(text1, text2) { @@ -357,9 +362,7 @@ var ts; if (diagnostics.length < 2) { return diagnostics; } - var newDiagnostics = [ - diagnostics[0] - ]; + var newDiagnostics = [diagnostics[0]]; var previousDiagnostic = diagnostics[0]; for (var i = 1; i < diagnostics.length; i++) { var currentDiagnostic = diagnostics[i]; @@ -436,9 +439,7 @@ var ts; ts.isRootedDiskPath = isRootedDiskPath; function normalizedPathComponents(path, rootLength) { var normalizedParts = getNormalizedParts(path, rootLength); - return [ - path.substr(0, rootLength) - ].concat(normalizedParts); + return [path.substr(0, rootLength)].concat(normalizedParts); } function getNormalizedPathComponents(path, currentDirectory) { path = normalizeSlashes(path); @@ -472,9 +473,7 @@ var ts; } } if (rootLength === urlLength) { - return [ - url - ]; + return [url]; } var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); if (indexOfNextSlash !== -1) { @@ -482,9 +481,7 @@ var ts; return normalizedPathComponents(url, rootLength); } else { - return [ - url + ts.directorySeparator - ]; + return [url + ts.directorySeparator]; } } function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { @@ -546,11 +543,7 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [ - ".d.ts", - ".ts", - ".js" - ]; + var supportedExtensions = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { var ext = supportedExtensions[_i]; @@ -604,15 +597,9 @@ var ts; }; return Node; }, - getSymbolConstructor: function () { - return Symbol; - }, - getTypeConstructor: function () { - return Type; - }, - getSignatureConstructor: function () { - return Signature; - } + getSymbolConstructor: function () { return Symbol; }, + getTypeConstructor: function () { return Type; }, + getSignatureConstructor: function () { return Signature; } }; var Debug; (function (Debug) { @@ -833,14 +820,9 @@ var ts; readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { - _fs.watchFile(fileName, { - persistent: true, - interval: 250 - }, fileChanged); + _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); return { - close: function () { - _fs.unwatchFile(fileName, fileChanged); - } + close: function () { _fs.unwatchFile(fileName, fileChanged); } }; function fileChanged(curr, prev) { if (+curr.mtime <= +prev.mtime) { @@ -896,2431 +878,491 @@ var ts; var ts; (function (ts) { ts.Diagnostics = { - Unterminated_string_literal: { - code: 1002, - category: 1, - key: "Unterminated string literal." - }, - Identifier_expected: { - code: 1003, - category: 1, - key: "Identifier expected." - }, - _0_expected: { - code: 1005, - category: 1, - key: "'{0}' expected." - }, - A_file_cannot_have_a_reference_to_itself: { - code: 1006, - category: 1, - key: "A file cannot have a reference to itself." - }, - Trailing_comma_not_allowed: { - code: 1009, - category: 1, - key: "Trailing comma not allowed." - }, - Asterisk_Slash_expected: { - code: 1010, - category: 1, - key: "'*/' expected." - }, - Unexpected_token: { - code: 1012, - category: 1, - key: "Unexpected token." - }, - A_rest_parameter_must_be_last_in_a_parameter_list: { - code: 1014, - category: 1, - key: "A rest parameter must be last in a parameter list." - }, - Parameter_cannot_have_question_mark_and_initializer: { - code: 1015, - category: 1, - key: "Parameter cannot have question mark and initializer." - }, - A_required_parameter_cannot_follow_an_optional_parameter: { - code: 1016, - category: 1, - key: "A required parameter cannot follow an optional parameter." - }, - An_index_signature_cannot_have_a_rest_parameter: { - code: 1017, - category: 1, - key: "An index signature cannot have a rest parameter." - }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { - code: 1018, - category: 1, - key: "An index signature parameter cannot have an accessibility modifier." - }, - An_index_signature_parameter_cannot_have_a_question_mark: { - code: 1019, - category: 1, - key: "An index signature parameter cannot have a question mark." - }, - An_index_signature_parameter_cannot_have_an_initializer: { - code: 1020, - category: 1, - key: "An index signature parameter cannot have an initializer." - }, - An_index_signature_must_have_a_type_annotation: { - code: 1021, - category: 1, - key: "An index signature must have a type annotation." - }, - An_index_signature_parameter_must_have_a_type_annotation: { - code: 1022, - category: 1, - key: "An index signature parameter must have a type annotation." - }, - An_index_signature_parameter_type_must_be_string_or_number: { - code: 1023, - category: 1, - key: "An index signature parameter type must be 'string' or 'number'." - }, - A_class_or_interface_declaration_can_only_have_one_extends_clause: { - code: 1024, - category: 1, - key: "A class or interface declaration can only have one 'extends' clause." - }, - An_extends_clause_must_precede_an_implements_clause: { - code: 1025, - category: 1, - key: "An 'extends' clause must precede an 'implements' clause." - }, - A_class_can_only_extend_a_single_class: { - code: 1026, - category: 1, - key: "A class can only extend a single class." - }, - A_class_declaration_can_only_have_one_implements_clause: { - code: 1027, - category: 1, - key: "A class declaration can only have one 'implements' clause." - }, - Accessibility_modifier_already_seen: { - code: 1028, - category: 1, - key: "Accessibility modifier already seen." - }, - _0_modifier_must_precede_1_modifier: { - code: 1029, - category: 1, - key: "'{0}' modifier must precede '{1}' modifier." - }, - _0_modifier_already_seen: { - code: 1030, - category: 1, - key: "'{0}' modifier already seen." - }, - _0_modifier_cannot_appear_on_a_class_element: { - code: 1031, - category: 1, - key: "'{0}' modifier cannot appear on a class element." - }, - An_interface_declaration_cannot_have_an_implements_clause: { - code: 1032, - category: 1, - key: "An interface declaration cannot have an 'implements' clause." - }, - super_must_be_followed_by_an_argument_list_or_member_access: { - code: 1034, - category: 1, - key: "'super' must be followed by an argument list or member access." - }, - Only_ambient_modules_can_use_quoted_names: { - code: 1035, - category: 1, - key: "Only ambient modules can use quoted names." - }, - Statements_are_not_allowed_in_ambient_contexts: { - code: 1036, - category: 1, - key: "Statements are not allowed in ambient contexts." - }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { - code: 1038, - category: 1, - key: "A 'declare' modifier cannot be used in an already ambient context." - }, - Initializers_are_not_allowed_in_ambient_contexts: { - code: 1039, - category: 1, - key: "Initializers are not allowed in ambient contexts." - }, - _0_modifier_cannot_appear_on_a_module_element: { - code: 1044, - category: 1, - key: "'{0}' modifier cannot appear on a module element." - }, - A_declare_modifier_cannot_be_used_with_an_interface_declaration: { - code: 1045, - category: 1, - key: "A 'declare' modifier cannot be used with an interface declaration." - }, - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { - code: 1046, - category: 1, - key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." - }, - A_rest_parameter_cannot_be_optional: { - code: 1047, - category: 1, - key: "A rest parameter cannot be optional." - }, - A_rest_parameter_cannot_have_an_initializer: { - code: 1048, - category: 1, - key: "A rest parameter cannot have an initializer." - }, - A_set_accessor_must_have_exactly_one_parameter: { - code: 1049, - category: 1, - key: "A 'set' accessor must have exactly one parameter." - }, - A_set_accessor_cannot_have_an_optional_parameter: { - code: 1051, - category: 1, - key: "A 'set' accessor cannot have an optional parameter." - }, - A_set_accessor_parameter_cannot_have_an_initializer: { - code: 1052, - category: 1, - key: "A 'set' accessor parameter cannot have an initializer." - }, - A_set_accessor_cannot_have_rest_parameter: { - code: 1053, - category: 1, - key: "A 'set' accessor cannot have rest parameter." - }, - A_get_accessor_cannot_have_parameters: { - code: 1054, - category: 1, - key: "A 'get' accessor cannot have parameters." - }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { - code: 1056, - category: 1, - key: "Accessors are only available when targeting ECMAScript 5 and higher." - }, - Enum_member_must_have_initializer: { - code: 1061, - category: 1, - key: "Enum member must have initializer." - }, - An_export_assignment_cannot_be_used_in_an_internal_module: { - code: 1063, - category: 1, - key: "An export assignment cannot be used in an internal module." - }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { - code: 1066, - category: 1, - key: "Ambient enum elements can only have integer literal initializers." - }, - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { - code: 1068, - category: 1, - key: "Unexpected token. A constructor, method, accessor, or property was expected." - }, - A_declare_modifier_cannot_be_used_with_an_import_declaration: { - code: 1079, - category: 1, - key: "A 'declare' modifier cannot be used with an import declaration." - }, - Invalid_reference_directive_syntax: { - code: 1084, - category: 1, - key: "Invalid 'reference' directive syntax." - }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { - code: 1085, - category: 1, - key: "Octal literals are not available when targeting ECMAScript 5 and higher." - }, - An_accessor_cannot_be_declared_in_an_ambient_context: { - code: 1086, - category: 1, - key: "An accessor cannot be declared in an ambient context." - }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { - code: 1089, - category: 1, - key: "'{0}' modifier cannot appear on a constructor declaration." - }, - _0_modifier_cannot_appear_on_a_parameter: { - code: 1090, - category: 1, - key: "'{0}' modifier cannot appear on a parameter." - }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { - code: 1091, - category: 1, - key: "Only a single variable declaration is allowed in a 'for...in' statement." - }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { - code: 1092, - category: 1, - key: "Type parameters cannot appear on a constructor declaration." - }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { - code: 1093, - category: 1, - key: "Type annotation cannot appear on a constructor declaration." - }, - An_accessor_cannot_have_type_parameters: { - code: 1094, - category: 1, - key: "An accessor cannot have type parameters." - }, - A_set_accessor_cannot_have_a_return_type_annotation: { - code: 1095, - category: 1, - key: "A 'set' accessor cannot have a return type annotation." - }, - An_index_signature_must_have_exactly_one_parameter: { - code: 1096, - category: 1, - key: "An index signature must have exactly one parameter." - }, - _0_list_cannot_be_empty: { - code: 1097, - category: 1, - key: "'{0}' list cannot be empty." - }, - Type_parameter_list_cannot_be_empty: { - code: 1098, - category: 1, - key: "Type parameter list cannot be empty." - }, - Type_argument_list_cannot_be_empty: { - code: 1099, - category: 1, - key: "Type argument list cannot be empty." - }, - Invalid_use_of_0_in_strict_mode: { - code: 1100, - category: 1, - key: "Invalid use of '{0}' in strict mode." - }, - with_statements_are_not_allowed_in_strict_mode: { - code: 1101, - category: 1, - key: "'with' statements are not allowed in strict mode." - }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { - code: 1102, - category: 1, - key: "'delete' cannot be called on an identifier in strict mode." - }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { - code: 1104, - category: 1, - key: "A 'continue' statement can only be used within an enclosing iteration statement." - }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { - code: 1105, - category: 1, - key: "A 'break' statement can only be used within an enclosing iteration or switch statement." - }, - Jump_target_cannot_cross_function_boundary: { - code: 1107, - category: 1, - key: "Jump target cannot cross function boundary." - }, - A_return_statement_can_only_be_used_within_a_function_body: { - code: 1108, - category: 1, - key: "A 'return' statement can only be used within a function body." - }, - Expression_expected: { - code: 1109, - category: 1, - key: "Expression expected." - }, - Type_expected: { - code: 1110, - category: 1, - key: "Type expected." - }, - A_class_member_cannot_be_declared_optional: { - code: 1112, - category: 1, - key: "A class member cannot be declared optional." - }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { - code: 1113, - category: 1, - key: "A 'default' clause cannot appear more than once in a 'switch' statement." - }, - Duplicate_label_0: { - code: 1114, - category: 1, - key: "Duplicate label '{0}'" - }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { - code: 1115, - category: 1, - key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." - }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { - code: 1116, - category: 1, - key: "A 'break' statement can only jump to a label of an enclosing statement." - }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { - code: 1117, - category: 1, - key: "An object literal cannot have multiple properties with the same name in strict mode." - }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { - code: 1118, - category: 1, - key: "An object literal cannot have multiple get/set accessors with the same name." - }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { - code: 1119, - category: 1, - key: "An object literal cannot have property and accessor with the same name." - }, - An_export_assignment_cannot_have_modifiers: { - code: 1120, - category: 1, - key: "An export assignment cannot have modifiers." - }, - Octal_literals_are_not_allowed_in_strict_mode: { - code: 1121, - category: 1, - key: "Octal literals are not allowed in strict mode." - }, - A_tuple_type_element_list_cannot_be_empty: { - code: 1122, - category: 1, - key: "A tuple type element list cannot be empty." - }, - Variable_declaration_list_cannot_be_empty: { - code: 1123, - category: 1, - key: "Variable declaration list cannot be empty." - }, - Digit_expected: { - code: 1124, - category: 1, - key: "Digit expected." - }, - Hexadecimal_digit_expected: { - code: 1125, - category: 1, - key: "Hexadecimal digit expected." - }, - Unexpected_end_of_text: { - code: 1126, - category: 1, - key: "Unexpected end of text." - }, - Invalid_character: { - code: 1127, - category: 1, - key: "Invalid character." - }, - Declaration_or_statement_expected: { - code: 1128, - category: 1, - key: "Declaration or statement expected." - }, - Statement_expected: { - code: 1129, - category: 1, - key: "Statement expected." - }, - case_or_default_expected: { - code: 1130, - category: 1, - key: "'case' or 'default' expected." - }, - Property_or_signature_expected: { - code: 1131, - category: 1, - key: "Property or signature expected." - }, - Enum_member_expected: { - code: 1132, - category: 1, - key: "Enum member expected." - }, - Type_reference_expected: { - code: 1133, - category: 1, - key: "Type reference expected." - }, - Variable_declaration_expected: { - code: 1134, - category: 1, - key: "Variable declaration expected." - }, - Argument_expression_expected: { - code: 1135, - category: 1, - key: "Argument expression expected." - }, - Property_assignment_expected: { - code: 1136, - category: 1, - key: "Property assignment expected." - }, - Expression_or_comma_expected: { - code: 1137, - category: 1, - key: "Expression or comma expected." - }, - Parameter_declaration_expected: { - code: 1138, - category: 1, - key: "Parameter declaration expected." - }, - Type_parameter_declaration_expected: { - code: 1139, - category: 1, - key: "Type parameter declaration expected." - }, - Type_argument_expected: { - code: 1140, - category: 1, - key: "Type argument expected." - }, - String_literal_expected: { - code: 1141, - category: 1, - key: "String literal expected." - }, - Line_break_not_permitted_here: { - code: 1142, - category: 1, - key: "Line break not permitted here." - }, - or_expected: { - code: 1144, - category: 1, - key: "'{' or ';' expected." - }, - Modifiers_not_permitted_on_index_signature_members: { - code: 1145, - category: 1, - key: "Modifiers not permitted on index signature members." - }, - Declaration_expected: { - code: 1146, - category: 1, - key: "Declaration expected." - }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { - code: 1147, - category: 1, - key: "Import declarations in an internal module cannot reference an external module." - }, - Cannot_compile_external_modules_unless_the_module_flag_is_provided: { - code: 1148, - category: 1, - key: "Cannot compile external modules unless the '--module' flag is provided." - }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { - code: 1149, - category: 1, - key: "File name '{0}' differs from already included file name '{1}' only in casing" - }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { - code: 1150, - category: 1, - key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." - }, - var_let_or_const_expected: { - code: 1152, - category: 1, - key: "'var', 'let' or 'const' expected." - }, - let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 1153, - category: 1, - key: "'let' declarations are only available when targeting ECMAScript 6 and higher." - }, - const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 1154, - category: 1, - key: "'const' declarations are only available when targeting ECMAScript 6 and higher." - }, - const_declarations_must_be_initialized: { - code: 1155, - category: 1, - key: "'const' declarations must be initialized" - }, - const_declarations_can_only_be_declared_inside_a_block: { - code: 1156, - category: 1, - key: "'const' declarations can only be declared inside a block." - }, - let_declarations_can_only_be_declared_inside_a_block: { - code: 1157, - category: 1, - key: "'let' declarations can only be declared inside a block." - }, - Unterminated_template_literal: { - code: 1160, - category: 1, - key: "Unterminated template literal." - }, - Unterminated_regular_expression_literal: { - code: 1161, - category: 1, - key: "Unterminated regular expression literal." - }, - An_object_member_cannot_be_declared_optional: { - code: 1162, - category: 1, - key: "An object member cannot be declared optional." - }, - yield_expression_must_be_contained_within_a_generator_declaration: { - code: 1163, - category: 1, - key: "'yield' expression must be contained_within a generator declaration." - }, - Computed_property_names_are_not_allowed_in_enums: { - code: 1164, - category: 1, - key: "Computed property names are not allowed in enums." - }, - A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { - code: 1165, - category: 1, - key: "A computed property name in an ambient context must directly refer to a built-in symbol." - }, - A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { - code: 1166, - category: 1, - key: "A computed property name in a class property declaration must directly refer to a built-in symbol." - }, - Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 1167, - category: 1, - key: "Computed property names are only available when targeting ECMAScript 6 and higher." - }, - A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { - code: 1168, - category: 1, - key: "A computed property name in a method overload must directly refer to a built-in symbol." - }, - A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { - code: 1169, - category: 1, - key: "A computed property name in an interface must directly refer to a built-in symbol." - }, - A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { - code: 1170, - category: 1, - key: "A computed property name in a type literal must directly refer to a built-in symbol." - }, - A_comma_expression_is_not_allowed_in_a_computed_property_name: { - code: 1171, - category: 1, - key: "A comma expression is not allowed in a computed property name." - }, - extends_clause_already_seen: { - code: 1172, - category: 1, - key: "'extends' clause already seen." - }, - extends_clause_must_precede_implements_clause: { - code: 1173, - category: 1, - key: "'extends' clause must precede 'implements' clause." - }, - Classes_can_only_extend_a_single_class: { - code: 1174, - category: 1, - key: "Classes can only extend a single class." - }, - implements_clause_already_seen: { - code: 1175, - category: 1, - key: "'implements' clause already seen." - }, - Interface_declaration_cannot_have_implements_clause: { - code: 1176, - category: 1, - key: "Interface declaration cannot have 'implements' clause." - }, - Binary_digit_expected: { - code: 1177, - category: 1, - key: "Binary digit expected." - }, - Octal_digit_expected: { - code: 1178, - category: 1, - key: "Octal digit expected." - }, - Unexpected_token_expected: { - code: 1179, - category: 1, - key: "Unexpected token. '{' expected." - }, - Property_destructuring_pattern_expected: { - code: 1180, - category: 1, - key: "Property destructuring pattern expected." - }, - Array_element_destructuring_pattern_expected: { - code: 1181, - category: 1, - key: "Array element destructuring pattern expected." - }, - A_destructuring_declaration_must_have_an_initializer: { - code: 1182, - category: 1, - key: "A destructuring declaration must have an initializer." - }, - Destructuring_declarations_are_not_allowed_in_ambient_contexts: { - code: 1183, - category: 1, - key: "Destructuring declarations are not allowed in ambient contexts." - }, - An_implementation_cannot_be_declared_in_ambient_contexts: { - code: 1184, - category: 1, - key: "An implementation cannot be declared in ambient contexts." - }, - Modifiers_cannot_appear_here: { - code: 1184, - category: 1, - key: "Modifiers cannot appear here." - }, - Merge_conflict_marker_encountered: { - code: 1185, - category: 1, - key: "Merge conflict marker encountered." - }, - A_rest_element_cannot_have_an_initializer: { - code: 1186, - category: 1, - key: "A rest element cannot have an initializer." - }, - A_parameter_property_may_not_be_a_binding_pattern: { - code: 1187, - category: 1, - key: "A parameter property may not be a binding pattern." - }, - Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { - code: 1188, - category: 1, - key: "Only a single variable declaration is allowed in a 'for...of' statement." - }, - The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { - code: 1189, - category: 1, - key: "The variable declaration of a 'for...in' statement cannot have an initializer." - }, - The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { - code: 1190, - category: 1, - key: "The variable declaration of a 'for...of' statement cannot have an initializer." - }, - An_import_declaration_cannot_have_modifiers: { - code: 1191, - category: 1, - key: "An import declaration cannot have modifiers." - }, - External_module_0_has_no_default_export_or_export_assignment: { - code: 1192, - category: 1, - key: "External module '{0}' has no default export or export assignment." - }, - An_export_declaration_cannot_have_modifiers: { - code: 1193, - category: 1, - key: "An export declaration cannot have modifiers." - }, - Export_declarations_are_not_permitted_in_an_internal_module: { - code: 1194, - category: 1, - key: "Export declarations are not permitted in an internal module." - }, - Catch_clause_variable_name_must_be_an_identifier: { - code: 1195, - category: 1, - key: "Catch clause variable name must be an identifier." - }, - Catch_clause_variable_cannot_have_a_type_annotation: { - code: 1196, - category: 1, - key: "Catch clause variable cannot have a type annotation." - }, - Catch_clause_variable_cannot_have_an_initializer: { - code: 1197, - category: 1, - key: "Catch clause variable cannot have an initializer." - }, - An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { - code: 1198, - category: 1, - key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." - }, - Unterminated_Unicode_escape_sequence: { - code: 1199, - category: 1, - key: "Unterminated Unicode escape sequence." - }, - Duplicate_identifier_0: { - code: 2300, - category: 1, - key: "Duplicate identifier '{0}'." - }, - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { - code: 2301, - category: 1, - key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." - }, - Static_members_cannot_reference_class_type_parameters: { - code: 2302, - category: 1, - key: "Static members cannot reference class type parameters." - }, - Circular_definition_of_import_alias_0: { - code: 2303, - category: 1, - key: "Circular definition of import alias '{0}'." - }, - Cannot_find_name_0: { - code: 2304, - category: 1, - key: "Cannot find name '{0}'." - }, - Module_0_has_no_exported_member_1: { - code: 2305, - category: 1, - key: "Module '{0}' has no exported member '{1}'." - }, - File_0_is_not_an_external_module: { - code: 2306, - category: 1, - key: "File '{0}' is not an external module." - }, - Cannot_find_external_module_0: { - code: 2307, - category: 1, - key: "Cannot find external module '{0}'." - }, - A_module_cannot_have_more_than_one_export_assignment: { - code: 2308, - category: 1, - key: "A module cannot have more than one export assignment." - }, - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { - code: 2309, - category: 1, - key: "An export assignment cannot be used in a module with other exported elements." - }, - Type_0_recursively_references_itself_as_a_base_type: { - code: 2310, - category: 1, - key: "Type '{0}' recursively references itself as a base type." - }, - A_class_may_only_extend_another_class: { - code: 2311, - category: 1, - key: "A class may only extend another class." - }, - An_interface_may_only_extend_a_class_or_another_interface: { - code: 2312, - category: 1, - key: "An interface may only extend a class or another interface." - }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { - code: 2313, - category: 1, - key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." - }, - Generic_type_0_requires_1_type_argument_s: { - code: 2314, - category: 1, - key: "Generic type '{0}' requires {1} type argument(s)." - }, - Type_0_is_not_generic: { - code: 2315, - category: 1, - key: "Type '{0}' is not generic." - }, - Global_type_0_must_be_a_class_or_interface_type: { - code: 2316, - category: 1, - key: "Global type '{0}' must be a class or interface type." - }, - Global_type_0_must_have_1_type_parameter_s: { - code: 2317, - category: 1, - key: "Global type '{0}' must have {1} type parameter(s)." - }, - Cannot_find_global_type_0: { - code: 2318, - category: 1, - key: "Cannot find global type '{0}'." - }, - Named_property_0_of_types_1_and_2_are_not_identical: { - code: 2319, - category: 1, - key: "Named property '{0}' of types '{1}' and '{2}' are not identical." - }, - Interface_0_cannot_simultaneously_extend_types_1_and_2: { - code: 2320, - category: 1, - key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." - }, - Excessive_stack_depth_comparing_types_0_and_1: { - code: 2321, - category: 1, - key: "Excessive stack depth comparing types '{0}' and '{1}'." - }, - Type_0_is_not_assignable_to_type_1: { - code: 2322, - category: 1, - key: "Type '{0}' is not assignable to type '{1}'." - }, - Property_0_is_missing_in_type_1: { - code: 2324, - category: 1, - key: "Property '{0}' is missing in type '{1}'." - }, - Property_0_is_private_in_type_1_but_not_in_type_2: { - code: 2325, - category: 1, - key: "Property '{0}' is private in type '{1}' but not in type '{2}'." - }, - Types_of_property_0_are_incompatible: { - code: 2326, - category: 1, - key: "Types of property '{0}' are incompatible." - }, - Property_0_is_optional_in_type_1_but_required_in_type_2: { - code: 2327, - category: 1, - key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." - }, - Types_of_parameters_0_and_1_are_incompatible: { - code: 2328, - category: 1, - key: "Types of parameters '{0}' and '{1}' are incompatible." - }, - Index_signature_is_missing_in_type_0: { - code: 2329, - category: 1, - key: "Index signature is missing in type '{0}'." - }, - Index_signatures_are_incompatible: { - code: 2330, - category: 1, - key: "Index signatures are incompatible." - }, - this_cannot_be_referenced_in_a_module_body: { - code: 2331, - category: 1, - key: "'this' cannot be referenced in a module body." - }, - this_cannot_be_referenced_in_current_location: { - code: 2332, - category: 1, - key: "'this' cannot be referenced in current location." - }, - this_cannot_be_referenced_in_constructor_arguments: { - code: 2333, - category: 1, - key: "'this' cannot be referenced in constructor arguments." - }, - this_cannot_be_referenced_in_a_static_property_initializer: { - code: 2334, - category: 1, - key: "'this' cannot be referenced in a static property initializer." - }, - super_can_only_be_referenced_in_a_derived_class: { - code: 2335, - category: 1, - key: "'super' can only be referenced in a derived class." - }, - super_cannot_be_referenced_in_constructor_arguments: { - code: 2336, - category: 1, - key: "'super' cannot be referenced in constructor arguments." - }, - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { - code: 2337, - category: 1, - key: "Super calls are not permitted outside constructors or in nested functions inside constructors" - }, - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { - code: 2338, - category: 1, - key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" - }, - Property_0_does_not_exist_on_type_1: { - code: 2339, - category: 1, - key: "Property '{0}' does not exist on type '{1}'." - }, - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { - code: 2340, - category: 1, - key: "Only public and protected methods of the base class are accessible via the 'super' keyword" - }, - Property_0_is_private_and_only_accessible_within_class_1: { - code: 2341, - category: 1, - key: "Property '{0}' is private and only accessible within class '{1}'." - }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { - code: 2342, - category: 1, - key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." - }, - Type_0_does_not_satisfy_the_constraint_1: { - code: 2344, - category: 1, - key: "Type '{0}' does not satisfy the constraint '{1}'." - }, - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { - code: 2345, - category: 1, - key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." - }, - Supplied_parameters_do_not_match_any_signature_of_call_target: { - code: 2346, - category: 1, - key: "Supplied parameters do not match any signature of call target." - }, - Untyped_function_calls_may_not_accept_type_arguments: { - code: 2347, - category: 1, - key: "Untyped function calls may not accept type arguments." - }, - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { - code: 2348, - category: 1, - key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" - }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { - code: 2349, - category: 1, - key: "Cannot invoke an expression whose type lacks a call signature." - }, - Only_a_void_function_can_be_called_with_the_new_keyword: { - code: 2350, - category: 1, - key: "Only a void function can be called with the 'new' keyword." - }, - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { - code: 2351, - category: 1, - key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." - }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { - code: 2352, - category: 1, - key: "Neither type '{0}' nor type '{1}' is assignable to the other." - }, - No_best_common_type_exists_among_return_expressions: { - code: 2354, - category: 1, - key: "No best common type exists among return expressions." - }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { - code: 2355, - category: 1, - key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." - }, - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { - code: 2356, - category: 1, - key: "An arithmetic operand must be of type 'any', 'number' or an enum type." - }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { - code: 2357, - category: 1, - key: "The operand of an increment or decrement operator must be a variable, property or indexer." - }, - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: 2358, - category: 1, - key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." - }, - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { - code: 2359, - category: 1, - key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." - }, - The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { - code: 2360, - category: 1, - key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." - }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: 2361, - category: 1, - key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" - }, - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { - code: 2362, - category: 1, - key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." - }, - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { - code: 2363, - category: 1, - key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." - }, - Invalid_left_hand_side_of_assignment_expression: { - code: 2364, - category: 1, - key: "Invalid left-hand side of assignment expression." - }, - Operator_0_cannot_be_applied_to_types_1_and_2: { - code: 2365, - category: 1, - key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." - }, - Type_parameter_name_cannot_be_0: { - code: 2368, - category: 1, - key: "Type parameter name cannot be '{0}'" - }, - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { - code: 2369, - category: 1, - key: "A parameter property is only allowed in a constructor implementation." - }, - A_rest_parameter_must_be_of_an_array_type: { - code: 2370, - category: 1, - key: "A rest parameter must be of an array type." - }, - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { - code: 2371, - category: 1, - key: "A parameter initializer is only allowed in a function or constructor implementation." - }, - Parameter_0_cannot_be_referenced_in_its_initializer: { - code: 2372, - category: 1, - key: "Parameter '{0}' cannot be referenced in its initializer." - }, - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { - code: 2373, - category: 1, - key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." - }, - Duplicate_string_index_signature: { - code: 2374, - category: 1, - key: "Duplicate string index signature." - }, - Duplicate_number_index_signature: { - code: 2375, - category: 1, - key: "Duplicate number index signature." - }, - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { - code: 2376, - category: 1, - key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." - }, - Constructors_for_derived_classes_must_contain_a_super_call: { - code: 2377, - category: 1, - key: "Constructors for derived classes must contain a 'super' call." - }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { - code: 2378, - category: 1, - key: "A 'get' accessor must return a value or consist of a single 'throw' statement." - }, - Getter_and_setter_accessors_do_not_agree_in_visibility: { - code: 2379, - category: 1, - key: "Getter and setter accessors do not agree in visibility." - }, - get_and_set_accessor_must_have_the_same_type: { - code: 2380, - category: 1, - key: "'get' and 'set' accessor must have the same type." - }, - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { - code: 2381, - category: 1, - key: "A signature with an implementation cannot use a string literal type." - }, - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { - code: 2382, - category: 1, - key: "Specialized overload signature is not assignable to any non-specialized signature." - }, - Overload_signatures_must_all_be_exported_or_not_exported: { - code: 2383, - category: 1, - key: "Overload signatures must all be exported or not exported." - }, - Overload_signatures_must_all_be_ambient_or_non_ambient: { - code: 2384, - category: 1, - key: "Overload signatures must all be ambient or non-ambient." - }, - Overload_signatures_must_all_be_public_private_or_protected: { - code: 2385, - category: 1, - key: "Overload signatures must all be public, private or protected." - }, - Overload_signatures_must_all_be_optional_or_required: { - code: 2386, - category: 1, - key: "Overload signatures must all be optional or required." - }, - Function_overload_must_be_static: { - code: 2387, - category: 1, - key: "Function overload must be static." - }, - Function_overload_must_not_be_static: { - code: 2388, - category: 1, - key: "Function overload must not be static." - }, - Function_implementation_name_must_be_0: { - code: 2389, - category: 1, - key: "Function implementation name must be '{0}'." - }, - Constructor_implementation_is_missing: { - code: 2390, - category: 1, - key: "Constructor implementation is missing." - }, - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { - code: 2391, - category: 1, - key: "Function implementation is missing or not immediately following the declaration." - }, - Multiple_constructor_implementations_are_not_allowed: { - code: 2392, - category: 1, - key: "Multiple constructor implementations are not allowed." - }, - Duplicate_function_implementation: { - code: 2393, - category: 1, - key: "Duplicate function implementation." - }, - Overload_signature_is_not_compatible_with_function_implementation: { - code: 2394, - category: 1, - key: "Overload signature is not compatible with function implementation." - }, - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { - code: 2395, - category: 1, - key: "Individual declarations in merged declaration {0} must be all exported or all local." - }, - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { - code: 2396, - category: 1, - key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." - }, - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { - code: 2399, - category: 1, - key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." - }, - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { - code: 2400, - category: 1, - key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." - }, - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { - code: 2401, - category: 1, - key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." - }, - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { - code: 2402, - category: 1, - key: "Expression resolves to '_super' that compiler uses to capture base class reference." - }, - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { - code: 2403, - category: 1, - key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." - }, - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { - code: 2404, - category: 1, - key: "The left-hand side of a 'for...in' statement cannot use a type annotation." - }, - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { - code: 2405, - category: 1, - key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." - }, - Invalid_left_hand_side_in_for_in_statement: { - code: 2406, - category: 1, - key: "Invalid left-hand side in 'for...in' statement." - }, - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: 2407, - category: 1, - key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." - }, - Setters_cannot_return_a_value: { - code: 2408, - category: 1, - key: "Setters cannot return a value." - }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { - code: 2409, - category: 1, - key: "Return type of constructor signature must be assignable to the instance type of the class" - }, - All_symbols_within_a_with_block_will_be_resolved_to_any: { - code: 2410, - category: 1, - key: "All symbols within a 'with' block will be resolved to 'any'." - }, - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { - code: 2411, - category: 1, - key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." - }, - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { - code: 2412, - category: 1, - key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." - }, - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { - code: 2413, - category: 1, - key: "Numeric index type '{0}' is not assignable to string index type '{1}'." - }, - Class_name_cannot_be_0: { - code: 2414, - category: 1, - key: "Class name cannot be '{0}'" - }, - Class_0_incorrectly_extends_base_class_1: { - code: 2415, - category: 1, - key: "Class '{0}' incorrectly extends base class '{1}'." - }, - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { - code: 2417, - category: 1, - key: "Class static side '{0}' incorrectly extends base class static side '{1}'." - }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { - code: 2419, - category: 1, - key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." - }, - Class_0_incorrectly_implements_interface_1: { - code: 2420, - category: 1, - key: "Class '{0}' incorrectly implements interface '{1}'." - }, - A_class_may_only_implement_another_class_or_interface: { - code: 2422, - category: 1, - key: "A class may only implement another class or interface." - }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { - code: 2423, - category: 1, - key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." - }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { - code: 2424, - category: 1, - key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." - }, - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { - code: 2425, - category: 1, - key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." - }, - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { - code: 2426, - category: 1, - key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." - }, - Interface_name_cannot_be_0: { - code: 2427, - category: 1, - key: "Interface name cannot be '{0}'" - }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { - code: 2428, - category: 1, - key: "All declarations of an interface must have identical type parameters." - }, - Interface_0_incorrectly_extends_interface_1: { - code: 2430, - category: 1, - key: "Interface '{0}' incorrectly extends interface '{1}'." - }, - Enum_name_cannot_be_0: { - code: 2431, - category: 1, - key: "Enum name cannot be '{0}'" - }, - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { - code: 2432, - category: 1, - key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." - }, - A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { - code: 2433, - category: 1, - key: "A module declaration cannot be in a different file from a class or function with which it is merged" - }, - A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { - code: 2434, - category: 1, - key: "A module declaration cannot be located prior to a class or function with which it is merged" - }, - Ambient_external_modules_cannot_be_nested_in_other_modules: { - code: 2435, - category: 1, - key: "Ambient external modules cannot be nested in other modules." - }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { - code: 2436, - category: 1, - key: "Ambient external module declaration cannot specify relative module name." - }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { - code: 2437, - category: 1, - key: "Module '{0}' is hidden by a local declaration with the same name" - }, - Import_name_cannot_be_0: { - code: 2438, - category: 1, - key: "Import name cannot be '{0}'" - }, - Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { - code: 2439, - category: 1, - key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." - }, - Import_declaration_conflicts_with_local_declaration_of_0: { - code: 2440, - category: 1, - key: "Import declaration conflicts with local declaration of '{0}'" - }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { - code: 2441, - category: 1, - key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." - }, - Types_have_separate_declarations_of_a_private_property_0: { - code: 2442, - category: 1, - key: "Types have separate declarations of a private property '{0}'." - }, - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { - code: 2443, - category: 1, - key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." - }, - Property_0_is_protected_in_type_1_but_public_in_type_2: { - code: 2444, - category: 1, - key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." - }, - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { - code: 2445, - category: 1, - key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." - }, - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { - code: 2446, - category: 1, - key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." - }, - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { - code: 2447, - category: 1, - key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." - }, - Block_scoped_variable_0_used_before_its_declaration: { - code: 2448, - category: 1, - key: "Block-scoped variable '{0}' used before its declaration." - }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { - code: 2449, - category: 1, - key: "The operand of an increment or decrement operator cannot be a constant." - }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { - code: 2450, - category: 1, - key: "Left-hand side of assignment expression cannot be a constant." - }, - Cannot_redeclare_block_scoped_variable_0: { - code: 2451, - category: 1, - key: "Cannot redeclare block-scoped variable '{0}'." - }, - An_enum_member_cannot_have_a_numeric_name: { - code: 2452, - category: 1, - key: "An enum member cannot have a numeric name." - }, - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { - code: 2453, - category: 1, - key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." - }, - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { - code: 2455, - category: 1, - key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." - }, - Type_alias_0_circularly_references_itself: { - code: 2456, - category: 1, - key: "Type alias '{0}' circularly references itself." - }, - Type_alias_name_cannot_be_0: { - code: 2457, - category: 1, - key: "Type alias name cannot be '{0}'" - }, - An_AMD_module_cannot_have_multiple_name_assignments: { - code: 2458, - category: 1, - key: "An AMD module cannot have multiple name assignments." - }, - Type_0_has_no_property_1_and_no_string_index_signature: { - code: 2459, - category: 1, - key: "Type '{0}' has no property '{1}' and no string index signature." - }, - Type_0_has_no_property_1: { - code: 2460, - category: 1, - key: "Type '{0}' has no property '{1}'." - }, - Type_0_is_not_an_array_type: { - code: 2461, - category: 1, - key: "Type '{0}' is not an array type." - }, - A_rest_element_must_be_last_in_an_array_destructuring_pattern: { - code: 2462, - category: 1, - key: "A rest element must be last in an array destructuring pattern" - }, - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { - code: 2463, - category: 1, - key: "A binding pattern parameter cannot be optional in an implementation signature." - }, - A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { - code: 2464, - category: 1, - key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." - }, - this_cannot_be_referenced_in_a_computed_property_name: { - code: 2465, - category: 1, - key: "'this' cannot be referenced in a computed property name." - }, - super_cannot_be_referenced_in_a_computed_property_name: { - code: 2466, - category: 1, - key: "'super' cannot be referenced in a computed property name." - }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { - code: 2467, - category: 1, - key: "A computed property name cannot reference a type parameter from its containing type." - }, - Cannot_find_global_value_0: { - code: 2468, - category: 1, - key: "Cannot find global value '{0}'." - }, - The_0_operator_cannot_be_applied_to_type_symbol: { - code: 2469, - category: 1, - key: "The '{0}' operator cannot be applied to type 'symbol'." - }, - Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { - code: 2470, - category: 1, - key: "'Symbol' reference does not refer to the global Symbol constructor object." - }, - A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { - code: 2471, - category: 1, - key: "A computed property name of the form '{0}' must be of type 'symbol'." - }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 2472, - category: 1, - key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." - }, - Enum_declarations_must_all_be_const_or_non_const: { - code: 2473, - category: 1, - key: "Enum declarations must all be const or non-const." - }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { - code: 2474, - category: 1, - key: "In 'const' enum declarations member initializer must be constant expression." - }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { - code: 2475, - category: 1, - key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." - }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { - code: 2476, - category: 1, - key: "A const enum member can only be accessed using a string literal." - }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { - code: 2477, - category: 1, - key: "'const' enum member initializer was evaluated to a non-finite value." - }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { - code: 2478, - category: 1, - key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." - }, - Property_0_does_not_exist_on_const_enum_1: { - code: 2479, - category: 1, - key: "Property '{0}' does not exist on 'const' enum '{1}'." - }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { - code: 2480, - category: 1, - key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." - }, - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { - code: 2481, - category: 1, - key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." - }, - The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { - code: 2483, - category: 1, - key: "The left-hand side of a 'for...of' statement cannot use a type annotation." - }, - Export_declaration_conflicts_with_exported_declaration_of_0: { - code: 2484, - category: 1, - key: "Export declaration conflicts with exported declaration of '{0}'" - }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { - code: 2485, - category: 1, - key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." - }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { - code: 2486, - category: 1, - key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." - }, - Invalid_left_hand_side_in_for_of_statement: { - code: 2487, - category: 1, - key: "Invalid left-hand side in 'for...of' statement." - }, - The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { - code: 2488, - category: 1, - key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." - }, - The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { - code: 2489, - category: 1, - key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." - }, - The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { - code: 2490, - category: 1, - key: "The type returned by the 'next()' method of an iterator must have a 'value' property." - }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { - code: 2491, - category: 1, - key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." - }, - Cannot_redeclare_identifier_0_in_catch_clause: { - code: 2492, - category: 1, - key: "Cannot redeclare identifier '{0}' in catch clause" - }, - Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { - code: 2493, - category: 1, - key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." - }, - Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { - code: 2494, - category: 1, - key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." - }, - Type_0_is_not_an_array_type_or_a_string_type: { - code: 2461, - category: 1, - key: "Type '{0}' is not an array type or a string type." - }, - Import_declaration_0_is_using_private_name_1: { - code: 4000, - category: 1, - key: "Import declaration '{0}' is using private name '{1}'." - }, - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { - code: 4002, - category: 1, - key: "Type parameter '{0}' of exported class has or is using private name '{1}'." - }, - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { - code: 4004, - category: 1, - key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4006, - category: 1, - key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4008, - category: 1, - key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4010, - category: 1, - key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." - }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4012, - category: 1, - key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." - }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { - code: 4014, - category: 1, - key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { - code: 4016, - category: 1, - key: "Type parameter '{0}' of exported function has or is using private name '{1}'." - }, - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { - code: 4019, - category: 1, - key: "Implements clause of exported class '{0}' has or is using private name '{1}'." - }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { - code: 4020, - category: 1, - key: "Extends clause of exported class '{0}' has or is using private name '{1}'." - }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { - code: 4022, - category: 1, - key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." - }, - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4023, - category: 1, - key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." - }, - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { - code: 4024, - category: 1, - key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." - }, - Exported_variable_0_has_or_is_using_private_name_1: { - code: 4025, - category: 1, - key: "Exported variable '{0}' has or is using private name '{1}'." - }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4026, - category: 1, - key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4027, - category: 1, - key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." - }, - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { - code: 4028, - category: 1, - key: "Public static property '{0}' of exported class has or is using private name '{1}'." - }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4029, - category: 1, - key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4030, - category: 1, - key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." - }, - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { - code: 4031, - category: 1, - key: "Public property '{0}' of exported class has or is using private name '{1}'." - }, - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4032, - category: 1, - key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." - }, - Property_0_of_exported_interface_has_or_is_using_private_name_1: { - code: 4033, - category: 1, - key: "Property '{0}' of exported interface has or is using private name '{1}'." - }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4034, - category: 1, - key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { - code: 4035, - category: 1, - key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." - }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4036, - category: 1, - key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { - code: 4037, - category: 1, - key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." - }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4038, - category: 1, - key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4039, - category: 1, - key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { - code: 4040, - category: 1, - key: "Return type of public static property getter from exported class has or is using private name '{0}'." - }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4041, - category: 1, - key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4042, - category: 1, - key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { - code: 4043, - category: 1, - key: "Return type of public property getter from exported class has or is using private name '{0}'." - }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4044, - category: 1, - key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: 4045, - category: 1, - key: "Return type of constructor signature from exported interface has or is using private name '{0}'." - }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4046, - category: 1, - key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: 4047, - category: 1, - key: "Return type of call signature from exported interface has or is using private name '{0}'." - }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4048, - category: 1, - key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: 4049, - category: 1, - key: "Return type of index signature from exported interface has or is using private name '{0}'." - }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4050, - category: 1, - key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4051, - category: 1, - key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { - code: 4052, - category: 1, - key: "Return type of public static method from exported class has or is using private name '{0}'." - }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4053, - category: 1, - key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4054, - category: 1, - key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { - code: 4055, - category: 1, - key: "Return type of public method from exported class has or is using private name '{0}'." - }, - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4056, - category: 1, - key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { - code: 4057, - category: 1, - key: "Return type of method from exported interface has or is using private name '{0}'." - }, - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4058, - category: 1, - key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { - code: 4059, - category: 1, - key: "Return type of exported function has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_exported_function_has_or_is_using_private_name_0: { - code: 4060, - category: 1, - key: "Return type of exported function has or is using private name '{0}'." - }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4061, - category: 1, - key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4062, - category: 1, - key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { - code: 4063, - category: 1, - key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." - }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4064, - category: 1, - key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4065, - category: 1, - key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." - }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4066, - category: 1, - key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4067, - category: 1, - key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." - }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4068, - category: 1, - key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4069, - category: 1, - key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4070, - category: 1, - key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." - }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4071, - category: 1, - key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4072, - category: 1, - key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4073, - category: 1, - key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." - }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4074, - category: 1, - key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { - code: 4075, - category: 1, - key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." - }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4076, - category: 1, - key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { - code: 4077, - category: 1, - key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { - code: 4078, - category: 1, - key: "Parameter '{0}' of exported function has or is using private name '{1}'." - }, - Exported_type_alias_0_has_or_is_using_private_name_1: { - code: 4081, - category: 1, - key: "Exported type alias '{0}' has or is using private name '{1}'." - }, - Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { - code: 4091, - category: 1, - key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." - }, - The_current_host_does_not_support_the_0_option: { - code: 5001, - category: 1, - key: "The current host does not support the '{0}' option." - }, - Cannot_find_the_common_subdirectory_path_for_the_input_files: { - code: 5009, - category: 1, - key: "Cannot find the common subdirectory path for the input files." - }, - Cannot_read_file_0_Colon_1: { - code: 5012, - category: 1, - key: "Cannot read file '{0}': {1}" - }, - Unsupported_file_encoding: { - code: 5013, - category: 1, - key: "Unsupported file encoding." - }, - Unknown_compiler_option_0: { - code: 5023, - category: 1, - key: "Unknown compiler option '{0}'." - }, - Compiler_option_0_requires_a_value_of_type_1: { - code: 5024, - category: 1, - key: "Compiler option '{0}' requires a value of type {1}." - }, - Could_not_write_file_0_Colon_1: { - code: 5033, - category: 1, - key: "Could not write file '{0}': {1}" - }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { - code: 5038, - category: 1, - key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." - }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { - code: 5039, - category: 1, - key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." - }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { - code: 5040, - category: 1, - key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." - }, - Option_noEmit_cannot_be_specified_with_option_declaration: { - code: 5041, - category: 1, - key: "Option 'noEmit' cannot be specified with option 'declaration'." - }, - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { - code: 5042, - category: 1, - key: "Option 'project' cannot be mixed with source files on a command line." - }, - Concatenate_and_emit_output_to_single_file: { - code: 6001, - category: 2, - key: "Concatenate and emit output to single file." - }, - Generates_corresponding_d_ts_file: { - code: 6002, - category: 2, - key: "Generates corresponding '.d.ts' file." - }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { - code: 6003, - category: 2, - key: "Specifies the location where debugger should locate map files instead of generated locations." - }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { - code: 6004, - category: 2, - key: "Specifies the location where debugger should locate TypeScript files instead of source locations." - }, - Watch_input_files: { - code: 6005, - category: 2, - key: "Watch input files." - }, - Redirect_output_structure_to_the_directory: { - code: 6006, - category: 2, - key: "Redirect output structure to the directory." - }, - Do_not_erase_const_enum_declarations_in_generated_code: { - code: 6007, - category: 2, - key: "Do not erase const enum declarations in generated code." - }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { - code: 6008, - category: 2, - key: "Do not emit outputs if any type checking errors were reported." - }, - Do_not_emit_comments_to_output: { - code: 6009, - category: 2, - key: "Do not emit comments to output." - }, - Do_not_emit_outputs: { - code: 6010, - category: 2, - key: "Do not emit outputs." - }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { - code: 6015, - category: 2, - key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" - }, - Specify_module_code_generation_Colon_commonjs_or_amd: { - code: 6016, - category: 2, - key: "Specify module code generation: 'commonjs' or 'amd'" - }, - Print_this_message: { - code: 6017, - category: 2, - key: "Print this message." - }, - Print_the_compiler_s_version: { - code: 6019, - category: 2, - key: "Print the compiler's version." - }, - Compile_the_project_in_the_given_directory: { - code: 6020, - category: 2, - key: "Compile the project in the given directory." - }, - Syntax_Colon_0: { - code: 6023, - category: 2, - key: "Syntax: {0}" - }, - options: { - code: 6024, - category: 2, - key: "options" - }, - file: { - code: 6025, - category: 2, - key: "file" - }, - Examples_Colon_0: { - code: 6026, - category: 2, - key: "Examples: {0}" - }, - Options_Colon: { - code: 6027, - category: 2, - key: "Options:" - }, - Version_0: { - code: 6029, - category: 2, - key: "Version {0}" - }, - Insert_command_line_options_and_files_from_a_file: { - code: 6030, - category: 2, - key: "Insert command line options and files from a file." - }, - File_change_detected_Starting_incremental_compilation: { - code: 6032, - category: 2, - key: "File change detected. Starting incremental compilation..." - }, - KIND: { - code: 6034, - category: 2, - key: "KIND" - }, - FILE: { - code: 6035, - category: 2, - key: "FILE" - }, - VERSION: { - code: 6036, - category: 2, - key: "VERSION" - }, - LOCATION: { - code: 6037, - category: 2, - key: "LOCATION" - }, - DIRECTORY: { - code: 6038, - category: 2, - key: "DIRECTORY" - }, - Compilation_complete_Watching_for_file_changes: { - code: 6042, - category: 2, - key: "Compilation complete. Watching for file changes." - }, - Generates_corresponding_map_file: { - code: 6043, - category: 2, - key: "Generates corresponding '.map' file." - }, - Compiler_option_0_expects_an_argument: { - code: 6044, - category: 1, - key: "Compiler option '{0}' expects an argument." - }, - Unterminated_quoted_string_in_response_file_0: { - code: 6045, - category: 1, - key: "Unterminated quoted string in response file '{0}'." - }, - Argument_for_module_option_must_be_commonjs_or_amd: { - code: 6046, - category: 1, - key: "Argument for '--module' option must be 'commonjs' or 'amd'." - }, - Argument_for_target_option_must_be_es3_es5_or_es6: { - code: 6047, - category: 1, - key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." - }, - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { - code: 6048, - category: 1, - key: "Locale must be of the form or -. For example '{0}' or '{1}'." - }, - Unsupported_locale_0: { - code: 6049, - category: 1, - key: "Unsupported locale '{0}'." - }, - Unable_to_open_file_0: { - code: 6050, - category: 1, - key: "Unable to open file '{0}'." - }, - Corrupted_locale_file_0: { - code: 6051, - category: 1, - key: "Corrupted locale file {0}." - }, - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { - code: 6052, - category: 2, - key: "Raise error on expressions and declarations with an implied 'any' type." - }, - File_0_not_found: { - code: 6053, - category: 1, - key: "File '{0}' not found." - }, - File_0_must_have_extension_ts_or_d_ts: { - code: 6054, - category: 1, - key: "File '{0}' must have extension '.ts' or '.d.ts'." - }, - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { - code: 6055, - category: 2, - key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." - }, - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { - code: 6056, - category: 2, - key: "Do not emit declarations for code that has an '@internal' annotation." - }, - Preserve_new_lines_when_emitting_code: { - code: 6057, - category: 2, - key: "Preserve new-lines when emitting code." - }, - Variable_0_implicitly_has_an_1_type: { - code: 7005, - category: 1, - key: "Variable '{0}' implicitly has an '{1}' type." - }, - Parameter_0_implicitly_has_an_1_type: { - code: 7006, - category: 1, - key: "Parameter '{0}' implicitly has an '{1}' type." - }, - Member_0_implicitly_has_an_1_type: { - code: 7008, - category: 1, - key: "Member '{0}' implicitly has an '{1}' type." - }, - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { - code: 7009, - category: 1, - key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." - }, - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { - code: 7010, - category: 1, - key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." - }, - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { - code: 7011, - category: 1, - key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." - }, - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { - code: 7013, - category: 1, - key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." - }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { - code: 7016, - category: 1, - key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." - }, - Index_signature_of_object_type_implicitly_has_an_any_type: { - code: 7017, - category: 1, - key: "Index signature of object type implicitly has an 'any' type." - }, - Object_literal_s_property_0_implicitly_has_an_1_type: { - code: 7018, - category: 1, - key: "Object literal's property '{0}' implicitly has an '{1}' type." - }, - Rest_parameter_0_implicitly_has_an_any_type: { - code: 7019, - category: 1, - key: "Rest parameter '{0}' implicitly has an 'any[]' type." - }, - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { - code: 7020, - category: 1, - key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." - }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { - code: 7021, - category: 1, - key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." - }, - _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { - code: 7022, - category: 1, - key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." - }, - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { - code: 7023, - category: 1, - key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." - }, - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { - code: 7024, - category: 1, - key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." - }, - You_cannot_rename_this_element: { - code: 8000, - category: 1, - key: "You cannot rename this element." - }, - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { - code: 8001, - category: 1, - key: "You cannot rename elements that are defined in the standard TypeScript library." - }, - yield_expressions_are_not_currently_supported: { - code: 9000, - category: 1, - key: "'yield' expressions are not currently supported." - }, - Generators_are_not_currently_supported: { - code: 9001, - category: 1, - key: "Generators are not currently supported." - }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { - code: 9002, - category: 1, - key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." - } + Unterminated_string_literal: { code: 1002, category: 1, key: "Unterminated string literal." }, + Identifier_expected: { code: 1003, category: 1, key: "Identifier expected." }, + _0_expected: { code: 1005, category: 1, key: "'{0}' expected." }, + A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1, key: "A file cannot have a reference to itself." }, + Trailing_comma_not_allowed: { code: 1009, category: 1, key: "Trailing comma not allowed." }, + Asterisk_Slash_expected: { code: 1010, category: 1, key: "'*/' expected." }, + Unexpected_token: { code: 1012, category: 1, key: "Unexpected token." }, + A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1, key: "A rest parameter must be last in a parameter list." }, + Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1, key: "Parameter cannot have question mark and initializer." }, + A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1, key: "A required parameter cannot follow an optional parameter." }, + An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1, key: "An index signature cannot have a rest parameter." }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1, key: "An index signature parameter cannot have an accessibility modifier." }, + An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1, key: "An index signature parameter cannot have a question mark." }, + An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1, key: "An index signature parameter cannot have an initializer." }, + An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1, key: "An index signature must have a type annotation." }, + An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1, key: "An index signature parameter must have a type annotation." }, + An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1, key: "An index signature parameter type must be 'string' or 'number'." }, + A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1, key: "A class or interface declaration can only have one 'extends' clause." }, + An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1, key: "An 'extends' clause must precede an 'implements' clause." }, + A_class_can_only_extend_a_single_class: { code: 1026, category: 1, key: "A class can only extend a single class." }, + A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1, key: "A class declaration can only have one 'implements' clause." }, + Accessibility_modifier_already_seen: { code: 1028, category: 1, key: "Accessibility modifier already seen." }, + _0_modifier_must_precede_1_modifier: { code: 1029, category: 1, key: "'{0}' modifier must precede '{1}' modifier." }, + _0_modifier_already_seen: { code: 1030, category: 1, key: "'{0}' modifier already seen." }, + _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1, key: "'{0}' modifier cannot appear on a class element." }, + An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1, key: "An interface declaration cannot have an 'implements' clause." }, + super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1, key: "'super' must be followed by an argument list or member access." }, + Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1, key: "Only ambient modules can use quoted names." }, + Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1, key: "Statements are not allowed in ambient contexts." }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1, key: "A 'declare' modifier cannot be used in an already ambient context." }, + Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1, key: "Initializers are not allowed in ambient contexts." }, + _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1, key: "'{0}' modifier cannot appear on a module element." }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1, key: "A 'declare' modifier cannot be used with an interface declaration." }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, + A_rest_parameter_cannot_be_optional: { code: 1047, category: 1, key: "A rest parameter cannot be optional." }, + A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1, key: "A rest parameter cannot have an initializer." }, + A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1, key: "A 'set' accessor must have exactly one parameter." }, + A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1, key: "A 'set' accessor cannot have an optional parameter." }, + A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1, key: "A 'set' accessor parameter cannot have an initializer." }, + A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1, key: "A 'set' accessor cannot have rest parameter." }, + A_get_accessor_cannot_have_parameters: { code: 1054, category: 1, key: "A 'get' accessor cannot have parameters." }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, + Enum_member_must_have_initializer: { code: 1061, category: 1, key: "Enum member must have initializer." }, + An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1, key: "An export assignment cannot be used in an internal module." }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1, key: "Ambient enum elements can only have integer literal initializers." }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1, key: "A 'declare' modifier cannot be used with an import declaration." }, + Invalid_reference_directive_syntax: { code: 1084, category: 1, key: "Invalid 'reference' directive syntax." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1, key: "An accessor cannot be declared in an ambient context." }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1, key: "'{0}' modifier cannot appear on a constructor declaration." }, + _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1, key: "'{0}' modifier cannot appear on a parameter." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1, key: "Type parameters cannot appear on a constructor declaration." }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1, key: "Type annotation cannot appear on a constructor declaration." }, + An_accessor_cannot_have_type_parameters: { code: 1094, category: 1, key: "An accessor cannot have type parameters." }, + A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1, key: "A 'set' accessor cannot have a return type annotation." }, + An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1, key: "An index signature must have exactly one parameter." }, + _0_list_cannot_be_empty: { code: 1097, category: 1, key: "'{0}' list cannot be empty." }, + Type_parameter_list_cannot_be_empty: { code: 1098, category: 1, key: "Type parameter list cannot be empty." }, + Type_argument_list_cannot_be_empty: { code: 1099, category: 1, key: "Type argument list cannot be empty." }, + Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1, key: "Invalid use of '{0}' in strict mode." }, + with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1, key: "'with' statements are not allowed in strict mode." }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1, key: "'delete' cannot be called on an identifier in strict mode." }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, + Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1, key: "Jump target cannot cross function boundary." }, + A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1, key: "A 'return' statement can only be used within a function body." }, + Expression_expected: { code: 1109, category: 1, key: "Expression expected." }, + Type_expected: { code: 1110, category: 1, key: "Type expected." }, + A_class_member_cannot_be_declared_optional: { code: 1112, category: 1, key: "A class member cannot be declared optional." }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, + Duplicate_label_0: { code: 1114, category: 1, key: "Duplicate label '{0}'" }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1, key: "A 'break' statement can only jump to a label of an enclosing statement." }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1, key: "An object literal cannot have multiple properties with the same name in strict mode." }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1, key: "An object literal cannot have multiple get/set accessors with the same name." }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1, key: "An object literal cannot have property and accessor with the same name." }, + An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1, key: "An export assignment cannot have modifiers." }, + Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1, key: "A tuple type element list cannot be empty." }, + Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1, key: "Variable declaration list cannot be empty." }, + Digit_expected: { code: 1124, category: 1, key: "Digit expected." }, + Hexadecimal_digit_expected: { code: 1125, category: 1, key: "Hexadecimal digit expected." }, + Unexpected_end_of_text: { code: 1126, category: 1, key: "Unexpected end of text." }, + Invalid_character: { code: 1127, category: 1, key: "Invalid character." }, + Declaration_or_statement_expected: { code: 1128, category: 1, key: "Declaration or statement expected." }, + Statement_expected: { code: 1129, category: 1, key: "Statement expected." }, + case_or_default_expected: { code: 1130, category: 1, key: "'case' or 'default' expected." }, + Property_or_signature_expected: { code: 1131, category: 1, key: "Property or signature expected." }, + Enum_member_expected: { code: 1132, category: 1, key: "Enum member expected." }, + Type_reference_expected: { code: 1133, category: 1, key: "Type reference expected." }, + Variable_declaration_expected: { code: 1134, category: 1, key: "Variable declaration expected." }, + Argument_expression_expected: { code: 1135, category: 1, key: "Argument expression expected." }, + Property_assignment_expected: { code: 1136, category: 1, key: "Property assignment expected." }, + Expression_or_comma_expected: { code: 1137, category: 1, key: "Expression or comma expected." }, + Parameter_declaration_expected: { code: 1138, category: 1, key: "Parameter declaration expected." }, + Type_parameter_declaration_expected: { code: 1139, category: 1, key: "Type parameter declaration expected." }, + Type_argument_expected: { code: 1140, category: 1, key: "Type argument expected." }, + String_literal_expected: { code: 1141, category: 1, key: "String literal expected." }, + Line_break_not_permitted_here: { code: 1142, category: 1, key: "Line break not permitted here." }, + or_expected: { code: 1144, category: 1, key: "'{' or ';' expected." }, + Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1, key: "Modifiers not permitted on index signature members." }, + Declaration_expected: { code: 1146, category: 1, key: "Declaration expected." }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1, key: "Import declarations in an internal module cannot reference an external module." }, + Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1, key: "Cannot compile external modules unless the '--module' flag is provided." }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: 1, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, + var_let_or_const_expected: { code: 1152, category: 1, key: "'var', 'let' or 'const' expected." }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_must_be_initialized: { code: 1155, category: 1, key: "'const' declarations must be initialized" }, + const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1, key: "'const' declarations can only be declared inside a block." }, + let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1, key: "'let' declarations can only be declared inside a block." }, + Unterminated_template_literal: { code: 1160, category: 1, key: "Unterminated template literal." }, + Unterminated_regular_expression_literal: { code: 1161, category: 1, key: "Unterminated regular expression literal." }, + An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, + yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, + Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, + Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, + A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, + extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, + extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, + Classes_can_only_extend_a_single_class: { code: 1174, category: 1, key: "Classes can only extend a single class." }, + implements_clause_already_seen: { code: 1175, category: 1, key: "'implements' clause already seen." }, + Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1, key: "Interface declaration cannot have 'implements' clause." }, + Binary_digit_expected: { code: 1177, category: 1, key: "Binary digit expected." }, + Octal_digit_expected: { code: 1178, category: 1, key: "Octal digit expected." }, + Unexpected_token_expected: { code: 1179, category: 1, key: "Unexpected token. '{' expected." }, + Property_destructuring_pattern_expected: { code: 1180, category: 1, key: "Property destructuring pattern expected." }, + Array_element_destructuring_pattern_expected: { code: 1181, category: 1, key: "Array element destructuring pattern expected." }, + A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: 1, key: "A destructuring declaration must have an initializer." }, + Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: 1, key: "Destructuring declarations are not allowed in ambient contexts." }, + An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: 1, key: "An implementation cannot be declared in ambient contexts." }, + Modifiers_cannot_appear_here: { code: 1184, category: 1, key: "Modifiers cannot appear here." }, + Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, + A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, + A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, + An_import_declaration_cannot_have_modifiers: { code: 1191, category: 1, key: "An import declaration cannot have modifiers." }, + External_module_0_has_no_default_export_or_export_assignment: { code: 1192, category: 1, key: "External module '{0}' has no default export or export assignment." }, + An_export_declaration_cannot_have_modifiers: { code: 1193, category: 1, key: "An export declaration cannot have modifiers." }, + Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: 1, key: "Export declarations are not permitted in an internal module." }, + Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: 1, key: "Catch clause variable name must be an identifier." }, + Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: 1, key: "Catch clause variable cannot have a type annotation." }, + Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: 1, key: "Catch clause variable cannot have an initializer." }, + An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: 1, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, + Unterminated_Unicode_escape_sequence: { code: 1199, category: 1, key: "Unterminated Unicode escape sequence." }, + Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, + Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1, key: "Static members cannot reference class type parameters." }, + Circular_definition_of_import_alias_0: { code: 2303, category: 1, key: "Circular definition of import alias '{0}'." }, + Cannot_find_name_0: { code: 2304, category: 1, key: "Cannot find name '{0}'." }, + Module_0_has_no_exported_member_1: { code: 2305, category: 1, key: "Module '{0}' has no exported member '{1}'." }, + File_0_is_not_an_external_module: { code: 2306, category: 1, key: "File '{0}' is not an external module." }, + Cannot_find_external_module_0: { code: 2307, category: 1, key: "Cannot find external module '{0}'." }, + A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1, key: "A module cannot have more than one export assignment." }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1, key: "An export assignment cannot be used in a module with other exported elements." }, + Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1, key: "Type '{0}' recursively references itself as a base type." }, + A_class_may_only_extend_another_class: { code: 2311, category: 1, key: "A class may only extend another class." }, + An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1, key: "An interface may only extend a class or another interface." }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, + Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1, key: "Generic type '{0}' requires {1} type argument(s)." }, + Type_0_is_not_generic: { code: 2315, category: 1, key: "Type '{0}' is not generic." }, + Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, + Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, + Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, + Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, + Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, + Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, + Property_0_is_missing_in_type_1: { code: 2324, category: 1, key: "Property '{0}' is missing in type '{1}'." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, + Types_of_property_0_are_incompatible: { code: 2326, category: 1, key: "Types of property '{0}' are incompatible." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, + Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1, key: "Types of parameters '{0}' and '{1}' are incompatible." }, + Index_signature_is_missing_in_type_0: { code: 2329, category: 1, key: "Index signature is missing in type '{0}'." }, + Index_signatures_are_incompatible: { code: 2330, category: 1, key: "Index signatures are incompatible." }, + this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1, key: "'this' cannot be referenced in a module body." }, + this_cannot_be_referenced_in_current_location: { code: 2332, category: 1, key: "'this' cannot be referenced in current location." }, + this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1, key: "'this' cannot be referenced in constructor arguments." }, + this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1, key: "'this' cannot be referenced in a static property initializer." }, + super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1, key: "'super' can only be referenced in a derived class." }, + super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1, key: "'super' cannot be referenced in constructor arguments." }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, + Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, + Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, + Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1, key: "Untyped function calls may not accept type arguments." }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1, key: "Cannot invoke an expression whose type lacks a call signature." }, + Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1, key: "Only a void function can be called with the 'new' keyword." }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1, key: "No best common type exists among return expressions." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1, key: "Invalid left-hand side of assignment expression." }, + Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Type_parameter_name_cannot_be_0: { code: 2368, category: 1, key: "Type parameter name cannot be '{0}'" }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1, key: "A parameter property is only allowed in a constructor implementation." }, + A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1, key: "A rest parameter must be of an array type." }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1, key: "A parameter initializer is only allowed in a function or constructor implementation." }, + Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1, key: "Parameter '{0}' cannot be referenced in its initializer." }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, + Duplicate_string_index_signature: { code: 2374, category: 1, key: "Duplicate string index signature." }, + Duplicate_number_index_signature: { code: 2375, category: 1, key: "Duplicate number index signature." }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, + Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1, key: "Constructors for derived classes must contain a 'super' call." }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1, key: "Getter and setter accessors do not agree in visibility." }, + get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1, key: "'get' and 'set' accessor must have the same type." }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1, key: "A signature with an implementation cannot use a string literal type." }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1, key: "Specialized overload signature is not assignable to any non-specialized signature." }, + Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1, key: "Overload signatures must all be exported or not exported." }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1, key: "Overload signatures must all be ambient or non-ambient." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1, key: "Overload signatures must all be public, private or protected." }, + Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1, key: "Overload signatures must all be optional or required." }, + Function_overload_must_be_static: { code: 2387, category: 1, key: "Function overload must be static." }, + Function_overload_must_not_be_static: { code: 2388, category: 1, key: "Function overload must not be static." }, + Function_implementation_name_must_be_0: { code: 2389, category: 1, key: "Function implementation name must be '{0}'." }, + Constructor_implementation_is_missing: { code: 2390, category: 1, key: "Constructor implementation is missing." }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1, key: "Function implementation is missing or not immediately following the declaration." }, + Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1, key: "Multiple constructor implementations are not allowed." }, + Duplicate_function_implementation: { code: 2393, category: 1, key: "Duplicate function implementation." }, + Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1, key: "Overload signature is not compatible with function implementation." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, + Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1, key: "Invalid left-hand side in 'for...in' statement." }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, + Setters_cannot_return_a_value: { code: 2408, category: 1, key: "Setters cannot return a value." }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1, key: "Return type of constructor signature must be assignable to the instance type of the class" }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1, key: "All symbols within a 'with' block will be resolved to 'any'." }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, + Class_name_cannot_be_0: { code: 2414, category: 1, key: "Class name cannot be '{0}'" }, + Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1, key: "Class '{0}' incorrectly extends base class '{1}'." }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, + Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1, key: "Class '{0}' incorrectly implements interface '{1}'." }, + A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1, key: "A class may only implement another class or interface." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, + Interface_name_cannot_be_0: { code: 2427, category: 1, key: "Interface name cannot be '{0}'" }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1, key: "All declarations of an interface must have identical type parameters." }, + Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1, key: "Interface '{0}' incorrectly extends interface '{1}'." }, + Enum_name_cannot_be_0: { code: 2431, category: 1, key: "Enum name cannot be '{0}'" }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1, key: "Ambient external modules cannot be nested in other modules." }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1, key: "Ambient external module declaration cannot specify relative module name." }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1, key: "Module '{0}' is hidden by a local declaration with the same name" }, + Import_name_cannot_be_0: { code: 2438, category: 1, key: "Import name cannot be '{0}'" }, + Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1, key: "Import declaration conflicts with local declaration of '{0}'" }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1, key: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, + Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1, key: "Block-scoped variable '{0}' used before its declaration." }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1, key: "The operand of an increment or decrement operator cannot be a constant." }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1, key: "Left-hand side of assignment expression cannot be a constant." }, + Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1, key: "Cannot redeclare block-scoped variable '{0}'." }, + An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1, key: "An enum member cannot have a numeric name." }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, + Type_alias_0_circularly_references_itself: { code: 2456, category: 1, key: "Type alias '{0}' circularly references itself." }, + Type_alias_name_cannot_be_0: { code: 2457, category: 1, key: "Type alias name cannot be '{0}'" }, + An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1, key: "An AMD module cannot have multiple name assignments." }, + Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: 1, key: "Type '{0}' has no property '{1}' and no string index signature." }, + Type_0_has_no_property_1: { code: 2460, category: 1, key: "Type '{0}' has no property '{1}'." }, + Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, + A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, + this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, + super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, + Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, + The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, + Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: 1, key: "Export declaration conflicts with exported declaration of '{0}'" }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: 1, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, + Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: 1, key: "Invalid left-hand side in 'for...of' statement." }, + The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: 1, key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." }, + The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { code: 2489, category: 1, key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." }, + The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: 1, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, + Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: 1, key: "Cannot redeclare identifier '{0}' in catch clause" }, + Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: 1, key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: 1, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, + Type_0_is_not_an_array_type_or_a_string_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type or a string type." }, + Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, + Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1, key: "Exported variable '{0}' has or is using private name '{1}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1, key: "Return type of public static method from exported class has or is using private name '{0}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1, key: "Return type of public method from exported class has or is using private name '{0}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1, key: "Return type of method from exported interface has or is using private name '{0}'." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1, key: "Return type of exported function has or is using private name '{0}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, + Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, + Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { code: 4091, category: 1, key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." }, + The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, + Unsupported_file_encoding: { code: 5013, category: 1, key: "Unsupported file encoding." }, + Unknown_compiler_option_0: { code: 5023, category: 1, key: "Unknown compiler option '{0}'." }, + Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1, key: "Compiler option '{0}' requires a value of type {1}." }, + Could_not_write_file_0_Colon_1: { code: 5033, category: 1, key: "Could not write file '{0}': {1}" }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, + Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: 1, key: "Option 'project' cannot be mixed with source files on a command line." }, + Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2, key: "Concatenate and emit output to single file." }, + Generates_corresponding_d_ts_file: { code: 6002, category: 2, key: "Generates corresponding '.d.ts' file." }, + Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2, key: "Specifies the location where debugger should locate map files instead of generated locations." }, + Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + Watch_input_files: { code: 6005, category: 2, key: "Watch input files." }, + Redirect_output_structure_to_the_directory: { code: 6006, category: 2, key: "Redirect output structure to the directory." }, + Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2, key: "Do not erase const enum declarations in generated code." }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_comments_to_output: { code: 6009, category: 2, key: "Do not emit comments to output." }, + Do_not_emit_outputs: { code: 6010, category: 2, key: "Do not emit outputs." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, + Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2, key: "Specify module code generation: 'commonjs' or 'amd'" }, + Print_this_message: { code: 6017, category: 2, key: "Print this message." }, + Print_the_compiler_s_version: { code: 6019, category: 2, key: "Print the compiler's version." }, + Compile_the_project_in_the_given_directory: { code: 6020, category: 2, key: "Compile the project in the given directory." }, + Syntax_Colon_0: { code: 6023, category: 2, key: "Syntax: {0}" }, + options: { code: 6024, category: 2, key: "options" }, + file: { code: 6025, category: 2, key: "file" }, + Examples_Colon_0: { code: 6026, category: 2, key: "Examples: {0}" }, + Options_Colon: { code: 6027, category: 2, key: "Options:" }, + Version_0: { code: 6029, category: 2, key: "Version {0}" }, + Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2, key: "Insert command line options and files from a file." }, + File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2, key: "File change detected. Starting incremental compilation..." }, + KIND: { code: 6034, category: 2, key: "KIND" }, + FILE: { code: 6035, category: 2, key: "FILE" }, + VERSION: { code: 6036, category: 2, key: "VERSION" }, + LOCATION: { code: 6037, category: 2, key: "LOCATION" }, + DIRECTORY: { code: 6038, category: 2, key: "DIRECTORY" }, + Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2, key: "Compilation complete. Watching for file changes." }, + Generates_corresponding_map_file: { code: 6043, category: 2, key: "Generates corresponding '.map' file." }, + Compiler_option_0_expects_an_argument: { code: 6044, category: 1, key: "Compiler option '{0}' expects an argument." }, + Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1, key: "Unterminated quoted string in response file '{0}'." }, + Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, + Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, + Unsupported_locale_0: { code: 6049, category: 1, key: "Unsupported locale '{0}'." }, + Unable_to_open_file_0: { code: 6050, category: 1, key: "Unable to open file '{0}'." }, + Corrupted_locale_file_0: { code: 6051, category: 1, key: "Corrupted locale file {0}." }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2, key: "Raise error on expressions and declarations with an implied 'any' type." }, + File_0_not_found: { code: 6053, category: 1, key: "File '{0}' not found." }, + File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: 2, key: "Do not emit declarations for code that has an '@internal' annotation." }, + Preserve_new_lines_when_emitting_code: { code: 6057, category: 2, key: "Preserve new-lines when emitting code." }, + Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1, key: "Variable '{0}' implicitly has an '{1}' type." }, + Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1, key: "Parameter '{0}' implicitly has an '{1}' type." }, + Member_0_implicitly_has_an_1_type: { code: 7008, category: 1, key: "Member '{0}' implicitly has an '{1}' type." }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, + Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1, key: "Index signature of object type implicitly has an 'any' type." }, + Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, + Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + You_cannot_rename_this_element: { code: 8000, category: 1, key: "You cannot rename this element." }, + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, + yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, + Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." }, + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." } }; })(ts || (ts = {})); var ts; @@ -3437,2806 +1479,10 @@ var ts; "|=": 62, "^=": 63 }; - var unicodeES3IdentifierStart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 543, - 546, - 563, - 592, - 685, - 688, - 696, - 699, - 705, - 720, - 721, - 736, - 740, - 750, - 750, - 890, - 890, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 974, - 976, - 983, - 986, - 1011, - 1024, - 1153, - 1164, - 1220, - 1223, - 1224, - 1227, - 1228, - 1232, - 1269, - 1272, - 1273, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1488, - 1514, - 1520, - 1522, - 1569, - 1594, - 1600, - 1610, - 1649, - 1747, - 1749, - 1749, - 1765, - 1766, - 1786, - 1788, - 1808, - 1808, - 1810, - 1836, - 1920, - 1957, - 2309, - 2361, - 2365, - 2365, - 2384, - 2384, - 2392, - 2401, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2524, - 2525, - 2527, - 2529, - 2544, - 2545, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2649, - 2652, - 2654, - 2654, - 2674, - 2676, - 2693, - 2699, - 2701, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2749, - 2749, - 2768, - 2768, - 2784, - 2784, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2870, - 2873, - 2877, - 2877, - 2908, - 2909, - 2911, - 2913, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 2997, - 2999, - 3001, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3168, - 3169, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3294, - 3294, - 3296, - 3297, - 3333, - 3340, - 3342, - 3344, - 3346, - 3368, - 3370, - 3385, - 3424, - 3425, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3585, - 3632, - 3634, - 3635, - 3648, - 3654, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3760, - 3762, - 3763, - 3773, - 3773, - 3776, - 3780, - 3782, - 3782, - 3804, - 3805, - 3840, - 3840, - 3904, - 3911, - 3913, - 3946, - 3976, - 3979, - 4096, - 4129, - 4131, - 4135, - 4137, - 4138, - 4176, - 4181, - 4256, - 4293, - 4304, - 4342, - 4352, - 4441, - 4447, - 4514, - 4520, - 4601, - 4608, - 4614, - 4616, - 4678, - 4680, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4742, - 4744, - 4744, - 4746, - 4749, - 4752, - 4782, - 4784, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4814, - 4816, - 4822, - 4824, - 4846, - 4848, - 4878, - 4880, - 4880, - 4882, - 4885, - 4888, - 4894, - 4896, - 4934, - 4936, - 4954, - 5024, - 5108, - 5121, - 5740, - 5743, - 5750, - 5761, - 5786, - 5792, - 5866, - 6016, - 6067, - 6176, - 6263, - 6272, - 6312, - 7680, - 7835, - 7840, - 7929, - 7936, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8319, - 8319, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8497, - 8499, - 8505, - 8544, - 8579, - 12293, - 12295, - 12321, - 12329, - 12337, - 12341, - 12344, - 12346, - 12353, - 12436, - 12445, - 12446, - 12449, - 12538, - 12540, - 12542, - 12549, - 12588, - 12593, - 12686, - 12704, - 12727, - 13312, - 19893, - 19968, - 40869, - 40960, - 42124, - 44032, - 55203, - 63744, - 64045, - 64256, - 64262, - 64275, - 64279, - 64285, - 64285, - 64287, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65136, - 65138, - 65140, - 65140, - 65142, - 65276, - 65313, - 65338, - 65345, - 65370, - 65382, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; - var unicodeES3IdentifierPart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 543, - 546, - 563, - 592, - 685, - 688, - 696, - 699, - 705, - 720, - 721, - 736, - 740, - 750, - 750, - 768, - 846, - 864, - 866, - 890, - 890, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 974, - 976, - 983, - 986, - 1011, - 1024, - 1153, - 1155, - 1158, - 1164, - 1220, - 1223, - 1224, - 1227, - 1228, - 1232, - 1269, - 1272, - 1273, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1425, - 1441, - 1443, - 1465, - 1467, - 1469, - 1471, - 1471, - 1473, - 1474, - 1476, - 1476, - 1488, - 1514, - 1520, - 1522, - 1569, - 1594, - 1600, - 1621, - 1632, - 1641, - 1648, - 1747, - 1749, - 1756, - 1759, - 1768, - 1770, - 1773, - 1776, - 1788, - 1808, - 1836, - 1840, - 1866, - 1920, - 1968, - 2305, - 2307, - 2309, - 2361, - 2364, - 2381, - 2384, - 2388, - 2392, - 2403, - 2406, - 2415, - 2433, - 2435, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2492, - 2492, - 2494, - 2500, - 2503, - 2504, - 2507, - 2509, - 2519, - 2519, - 2524, - 2525, - 2527, - 2531, - 2534, - 2545, - 2562, - 2562, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2620, - 2620, - 2622, - 2626, - 2631, - 2632, - 2635, - 2637, - 2649, - 2652, - 2654, - 2654, - 2662, - 2676, - 2689, - 2691, - 2693, - 2699, - 2701, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2748, - 2757, - 2759, - 2761, - 2763, - 2765, - 2768, - 2768, - 2784, - 2784, - 2790, - 2799, - 2817, - 2819, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2870, - 2873, - 2876, - 2883, - 2887, - 2888, - 2891, - 2893, - 2902, - 2903, - 2908, - 2909, - 2911, - 2913, - 2918, - 2927, - 2946, - 2947, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 2997, - 2999, - 3001, - 3006, - 3010, - 3014, - 3016, - 3018, - 3021, - 3031, - 3031, - 3047, - 3055, - 3073, - 3075, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3134, - 3140, - 3142, - 3144, - 3146, - 3149, - 3157, - 3158, - 3168, - 3169, - 3174, - 3183, - 3202, - 3203, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3262, - 3268, - 3270, - 3272, - 3274, - 3277, - 3285, - 3286, - 3294, - 3294, - 3296, - 3297, - 3302, - 3311, - 3330, - 3331, - 3333, - 3340, - 3342, - 3344, - 3346, - 3368, - 3370, - 3385, - 3390, - 3395, - 3398, - 3400, - 3402, - 3405, - 3415, - 3415, - 3424, - 3425, - 3430, - 3439, - 3458, - 3459, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3530, - 3530, - 3535, - 3540, - 3542, - 3542, - 3544, - 3551, - 3570, - 3571, - 3585, - 3642, - 3648, - 3662, - 3664, - 3673, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3769, - 3771, - 3773, - 3776, - 3780, - 3782, - 3782, - 3784, - 3789, - 3792, - 3801, - 3804, - 3805, - 3840, - 3840, - 3864, - 3865, - 3872, - 3881, - 3893, - 3893, - 3895, - 3895, - 3897, - 3897, - 3902, - 3911, - 3913, - 3946, - 3953, - 3972, - 3974, - 3979, - 3984, - 3991, - 3993, - 4028, - 4038, - 4038, - 4096, - 4129, - 4131, - 4135, - 4137, - 4138, - 4140, - 4146, - 4150, - 4153, - 4160, - 4169, - 4176, - 4185, - 4256, - 4293, - 4304, - 4342, - 4352, - 4441, - 4447, - 4514, - 4520, - 4601, - 4608, - 4614, - 4616, - 4678, - 4680, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4742, - 4744, - 4744, - 4746, - 4749, - 4752, - 4782, - 4784, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4814, - 4816, - 4822, - 4824, - 4846, - 4848, - 4878, - 4880, - 4880, - 4882, - 4885, - 4888, - 4894, - 4896, - 4934, - 4936, - 4954, - 4969, - 4977, - 5024, - 5108, - 5121, - 5740, - 5743, - 5750, - 5761, - 5786, - 5792, - 5866, - 6016, - 6099, - 6112, - 6121, - 6160, - 6169, - 6176, - 6263, - 6272, - 6313, - 7680, - 7835, - 7840, - 7929, - 7936, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8255, - 8256, - 8319, - 8319, - 8400, - 8412, - 8417, - 8417, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8497, - 8499, - 8505, - 8544, - 8579, - 12293, - 12295, - 12321, - 12335, - 12337, - 12341, - 12344, - 12346, - 12353, - 12436, - 12441, - 12442, - 12445, - 12446, - 12449, - 12542, - 12549, - 12588, - 12593, - 12686, - 12704, - 12727, - 13312, - 19893, - 19968, - 40869, - 40960, - 42124, - 44032, - 55203, - 63744, - 64045, - 64256, - 64262, - 64275, - 64279, - 64285, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65056, - 65059, - 65075, - 65076, - 65101, - 65103, - 65136, - 65138, - 65140, - 65140, - 65142, - 65276, - 65296, - 65305, - 65313, - 65338, - 65343, - 65343, - 65345, - 65370, - 65381, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; - var unicodeES5IdentifierStart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 705, - 710, - 721, - 736, - 740, - 748, - 748, - 750, - 750, - 880, - 884, - 886, - 887, - 890, - 893, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 1013, - 1015, - 1153, - 1162, - 1319, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1488, - 1514, - 1520, - 1522, - 1568, - 1610, - 1646, - 1647, - 1649, - 1747, - 1749, - 1749, - 1765, - 1766, - 1774, - 1775, - 1786, - 1788, - 1791, - 1791, - 1808, - 1808, - 1810, - 1839, - 1869, - 1957, - 1969, - 1969, - 1994, - 2026, - 2036, - 2037, - 2042, - 2042, - 2048, - 2069, - 2074, - 2074, - 2084, - 2084, - 2088, - 2088, - 2112, - 2136, - 2208, - 2208, - 2210, - 2220, - 2308, - 2361, - 2365, - 2365, - 2384, - 2384, - 2392, - 2401, - 2417, - 2423, - 2425, - 2431, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2493, - 2493, - 2510, - 2510, - 2524, - 2525, - 2527, - 2529, - 2544, - 2545, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2649, - 2652, - 2654, - 2654, - 2674, - 2676, - 2693, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2749, - 2749, - 2768, - 2768, - 2784, - 2785, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2869, - 2873, - 2877, - 2877, - 2908, - 2909, - 2911, - 2913, - 2929, - 2929, - 2947, - 2947, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 3001, - 3024, - 3024, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3133, - 3133, - 3160, - 3161, - 3168, - 3169, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3261, - 3261, - 3294, - 3294, - 3296, - 3297, - 3313, - 3314, - 3333, - 3340, - 3342, - 3344, - 3346, - 3386, - 3389, - 3389, - 3406, - 3406, - 3424, - 3425, - 3450, - 3455, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3585, - 3632, - 3634, - 3635, - 3648, - 3654, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3760, - 3762, - 3763, - 3773, - 3773, - 3776, - 3780, - 3782, - 3782, - 3804, - 3807, - 3840, - 3840, - 3904, - 3911, - 3913, - 3948, - 3976, - 3980, - 4096, - 4138, - 4159, - 4159, - 4176, - 4181, - 4186, - 4189, - 4193, - 4193, - 4197, - 4198, - 4206, - 4208, - 4213, - 4225, - 4238, - 4238, - 4256, - 4293, - 4295, - 4295, - 4301, - 4301, - 4304, - 4346, - 4348, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4744, - 4746, - 4749, - 4752, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4822, - 4824, - 4880, - 4882, - 4885, - 4888, - 4954, - 4992, - 5007, - 5024, - 5108, - 5121, - 5740, - 5743, - 5759, - 5761, - 5786, - 5792, - 5866, - 5870, - 5872, - 5888, - 5900, - 5902, - 5905, - 5920, - 5937, - 5952, - 5969, - 5984, - 5996, - 5998, - 6000, - 6016, - 6067, - 6103, - 6103, - 6108, - 6108, - 6176, - 6263, - 6272, - 6312, - 6314, - 6314, - 6320, - 6389, - 6400, - 6428, - 6480, - 6509, - 6512, - 6516, - 6528, - 6571, - 6593, - 6599, - 6656, - 6678, - 6688, - 6740, - 6823, - 6823, - 6917, - 6963, - 6981, - 6987, - 7043, - 7072, - 7086, - 7087, - 7098, - 7141, - 7168, - 7203, - 7245, - 7247, - 7258, - 7293, - 7401, - 7404, - 7406, - 7409, - 7413, - 7414, - 7424, - 7615, - 7680, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8305, - 8305, - 8319, - 8319, - 8336, - 8348, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8505, - 8508, - 8511, - 8517, - 8521, - 8526, - 8526, - 8544, - 8584, - 11264, - 11310, - 11312, - 11358, - 11360, - 11492, - 11499, - 11502, - 11506, - 11507, - 11520, - 11557, - 11559, - 11559, - 11565, - 11565, - 11568, - 11623, - 11631, - 11631, - 11648, - 11670, - 11680, - 11686, - 11688, - 11694, - 11696, - 11702, - 11704, - 11710, - 11712, - 11718, - 11720, - 11726, - 11728, - 11734, - 11736, - 11742, - 11823, - 11823, - 12293, - 12295, - 12321, - 12329, - 12337, - 12341, - 12344, - 12348, - 12353, - 12438, - 12445, - 12447, - 12449, - 12538, - 12540, - 12543, - 12549, - 12589, - 12593, - 12686, - 12704, - 12730, - 12784, - 12799, - 13312, - 19893, - 19968, - 40908, - 40960, - 42124, - 42192, - 42237, - 42240, - 42508, - 42512, - 42527, - 42538, - 42539, - 42560, - 42606, - 42623, - 42647, - 42656, - 42735, - 42775, - 42783, - 42786, - 42888, - 42891, - 42894, - 42896, - 42899, - 42912, - 42922, - 43000, - 43009, - 43011, - 43013, - 43015, - 43018, - 43020, - 43042, - 43072, - 43123, - 43138, - 43187, - 43250, - 43255, - 43259, - 43259, - 43274, - 43301, - 43312, - 43334, - 43360, - 43388, - 43396, - 43442, - 43471, - 43471, - 43520, - 43560, - 43584, - 43586, - 43588, - 43595, - 43616, - 43638, - 43642, - 43642, - 43648, - 43695, - 43697, - 43697, - 43701, - 43702, - 43705, - 43709, - 43712, - 43712, - 43714, - 43714, - 43739, - 43741, - 43744, - 43754, - 43762, - 43764, - 43777, - 43782, - 43785, - 43790, - 43793, - 43798, - 43808, - 43814, - 43816, - 43822, - 43968, - 44002, - 44032, - 55203, - 55216, - 55238, - 55243, - 55291, - 63744, - 64109, - 64112, - 64217, - 64256, - 64262, - 64275, - 64279, - 64285, - 64285, - 64287, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65136, - 65140, - 65142, - 65276, - 65313, - 65338, - 65345, - 65370, - 65382, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; - var unicodeES5IdentifierPart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 705, - 710, - 721, - 736, - 740, - 748, - 748, - 750, - 750, - 768, - 884, - 886, - 887, - 890, - 893, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 1013, - 1015, - 1153, - 1155, - 1159, - 1162, - 1319, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1425, - 1469, - 1471, - 1471, - 1473, - 1474, - 1476, - 1477, - 1479, - 1479, - 1488, - 1514, - 1520, - 1522, - 1552, - 1562, - 1568, - 1641, - 1646, - 1747, - 1749, - 1756, - 1759, - 1768, - 1770, - 1788, - 1791, - 1791, - 1808, - 1866, - 1869, - 1969, - 1984, - 2037, - 2042, - 2042, - 2048, - 2093, - 2112, - 2139, - 2208, - 2208, - 2210, - 2220, - 2276, - 2302, - 2304, - 2403, - 2406, - 2415, - 2417, - 2423, - 2425, - 2431, - 2433, - 2435, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2492, - 2500, - 2503, - 2504, - 2507, - 2510, - 2519, - 2519, - 2524, - 2525, - 2527, - 2531, - 2534, - 2545, - 2561, - 2563, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2620, - 2620, - 2622, - 2626, - 2631, - 2632, - 2635, - 2637, - 2641, - 2641, - 2649, - 2652, - 2654, - 2654, - 2662, - 2677, - 2689, - 2691, - 2693, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2748, - 2757, - 2759, - 2761, - 2763, - 2765, - 2768, - 2768, - 2784, - 2787, - 2790, - 2799, - 2817, - 2819, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2869, - 2873, - 2876, - 2884, - 2887, - 2888, - 2891, - 2893, - 2902, - 2903, - 2908, - 2909, - 2911, - 2915, - 2918, - 2927, - 2929, - 2929, - 2946, - 2947, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 3001, - 3006, - 3010, - 3014, - 3016, - 3018, - 3021, - 3024, - 3024, - 3031, - 3031, - 3046, - 3055, - 3073, - 3075, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3133, - 3140, - 3142, - 3144, - 3146, - 3149, - 3157, - 3158, - 3160, - 3161, - 3168, - 3171, - 3174, - 3183, - 3202, - 3203, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3260, - 3268, - 3270, - 3272, - 3274, - 3277, - 3285, - 3286, - 3294, - 3294, - 3296, - 3299, - 3302, - 3311, - 3313, - 3314, - 3330, - 3331, - 3333, - 3340, - 3342, - 3344, - 3346, - 3386, - 3389, - 3396, - 3398, - 3400, - 3402, - 3406, - 3415, - 3415, - 3424, - 3427, - 3430, - 3439, - 3450, - 3455, - 3458, - 3459, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3530, - 3530, - 3535, - 3540, - 3542, - 3542, - 3544, - 3551, - 3570, - 3571, - 3585, - 3642, - 3648, - 3662, - 3664, - 3673, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3769, - 3771, - 3773, - 3776, - 3780, - 3782, - 3782, - 3784, - 3789, - 3792, - 3801, - 3804, - 3807, - 3840, - 3840, - 3864, - 3865, - 3872, - 3881, - 3893, - 3893, - 3895, - 3895, - 3897, - 3897, - 3902, - 3911, - 3913, - 3948, - 3953, - 3972, - 3974, - 3991, - 3993, - 4028, - 4038, - 4038, - 4096, - 4169, - 4176, - 4253, - 4256, - 4293, - 4295, - 4295, - 4301, - 4301, - 4304, - 4346, - 4348, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4744, - 4746, - 4749, - 4752, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4822, - 4824, - 4880, - 4882, - 4885, - 4888, - 4954, - 4957, - 4959, - 4992, - 5007, - 5024, - 5108, - 5121, - 5740, - 5743, - 5759, - 5761, - 5786, - 5792, - 5866, - 5870, - 5872, - 5888, - 5900, - 5902, - 5908, - 5920, - 5940, - 5952, - 5971, - 5984, - 5996, - 5998, - 6000, - 6002, - 6003, - 6016, - 6099, - 6103, - 6103, - 6108, - 6109, - 6112, - 6121, - 6155, - 6157, - 6160, - 6169, - 6176, - 6263, - 6272, - 6314, - 6320, - 6389, - 6400, - 6428, - 6432, - 6443, - 6448, - 6459, - 6470, - 6509, - 6512, - 6516, - 6528, - 6571, - 6576, - 6601, - 6608, - 6617, - 6656, - 6683, - 6688, - 6750, - 6752, - 6780, - 6783, - 6793, - 6800, - 6809, - 6823, - 6823, - 6912, - 6987, - 6992, - 7001, - 7019, - 7027, - 7040, - 7155, - 7168, - 7223, - 7232, - 7241, - 7245, - 7293, - 7376, - 7378, - 7380, - 7414, - 7424, - 7654, - 7676, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8204, - 8205, - 8255, - 8256, - 8276, - 8276, - 8305, - 8305, - 8319, - 8319, - 8336, - 8348, - 8400, - 8412, - 8417, - 8417, - 8421, - 8432, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8505, - 8508, - 8511, - 8517, - 8521, - 8526, - 8526, - 8544, - 8584, - 11264, - 11310, - 11312, - 11358, - 11360, - 11492, - 11499, - 11507, - 11520, - 11557, - 11559, - 11559, - 11565, - 11565, - 11568, - 11623, - 11631, - 11631, - 11647, - 11670, - 11680, - 11686, - 11688, - 11694, - 11696, - 11702, - 11704, - 11710, - 11712, - 11718, - 11720, - 11726, - 11728, - 11734, - 11736, - 11742, - 11744, - 11775, - 11823, - 11823, - 12293, - 12295, - 12321, - 12335, - 12337, - 12341, - 12344, - 12348, - 12353, - 12438, - 12441, - 12442, - 12445, - 12447, - 12449, - 12538, - 12540, - 12543, - 12549, - 12589, - 12593, - 12686, - 12704, - 12730, - 12784, - 12799, - 13312, - 19893, - 19968, - 40908, - 40960, - 42124, - 42192, - 42237, - 42240, - 42508, - 42512, - 42539, - 42560, - 42607, - 42612, - 42621, - 42623, - 42647, - 42655, - 42737, - 42775, - 42783, - 42786, - 42888, - 42891, - 42894, - 42896, - 42899, - 42912, - 42922, - 43000, - 43047, - 43072, - 43123, - 43136, - 43204, - 43216, - 43225, - 43232, - 43255, - 43259, - 43259, - 43264, - 43309, - 43312, - 43347, - 43360, - 43388, - 43392, - 43456, - 43471, - 43481, - 43520, - 43574, - 43584, - 43597, - 43600, - 43609, - 43616, - 43638, - 43642, - 43643, - 43648, - 43714, - 43739, - 43741, - 43744, - 43759, - 43762, - 43766, - 43777, - 43782, - 43785, - 43790, - 43793, - 43798, - 43808, - 43814, - 43816, - 43822, - 43968, - 44010, - 44012, - 44013, - 44016, - 44025, - 44032, - 55203, - 55216, - 55238, - 55243, - 55291, - 63744, - 64109, - 64112, - 64217, - 64256, - 64262, - 64275, - 64279, - 64285, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65024, - 65039, - 65056, - 65062, - 65075, - 65076, - 65101, - 65103, - 65136, - 65140, - 65142, - 65276, - 65296, - 65305, - 65313, - 65338, - 65343, - 65343, - 65345, - 65370, - 65382, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; + var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; function lookupInUnicodeMap(code, map) { if (code < map[0]) { return false; @@ -6260,11 +1506,15 @@ var ts; return false; } function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); + return languageVersion >= 1 ? + lookupInUnicodeMap(code, unicodeES5IdentifierStart) : + lookupInUnicodeMap(code, unicodeES3IdentifierStart); } ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); + return languageVersion >= 1 ? + lookupInUnicodeMap(code, unicodeES5IdentifierPart) : + lookupInUnicodeMap(code, unicodeES3IdentifierPart); } function makeReverseMap(source) { var result = []; @@ -6337,7 +1587,9 @@ var ts; ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { - return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || + ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || + ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { @@ -6424,7 +1676,8 @@ var ts; return false; } } - return ch === 61 || text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + return ch === 61 || + text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } return false; @@ -6504,11 +1757,7 @@ var ts; if (collecting) { if (!result) result = []; - result.push({ - pos: startPos, - end: pos, - hasTrailingNewLine: hasTrailingNewLine - }); + result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); } continue; } @@ -6535,11 +1784,15 @@ var ts; } ts.getTrailingCommentRanges = getTrailingCommentRanges; function isIdentifierStart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } ts.isIdentifierStart = isIdentifierStart; function isIdentifierPart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; function createScanner(languageVersion, skipTrivia, text, onError) { @@ -6558,10 +1811,14 @@ var ts; } } function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } function isIdentifierPart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } function scanNumber() { var start = pos; @@ -7284,39 +2541,17 @@ var ts; } setText(text); return { - getStartPos: function () { - return startPos; - }, - getTextPos: function () { - return pos; - }, - getToken: function () { - return token; - }, - getTokenPos: function () { - return tokenPos; - }, - getTokenText: function () { - return text.substring(tokenPos, pos); - }, - getTokenValue: function () { - return tokenValue; - }, - hasExtendedUnicodeEscape: function () { - return hasExtendedUnicodeEscape; - }, - hasPrecedingLineBreak: function () { - return precedingLineBreak; - }, - isIdentifier: function () { - return token === 64 || token > 100; - }, - isReservedWord: function () { - return token >= 65 && token <= 100; - }, - isUnterminated: function () { - return tokenIsUnterminated; - }, + getStartPos: function () { return startPos; }, + getTextPos: function () { return pos; }, + getToken: function () { return token; }, + getTokenPos: function () { return tokenPos; }, + getTokenText: function () { return text.substring(tokenPos, pos); }, + getTokenValue: function () { return tokenValue; }, + hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, + hasPrecedingLineBreak: function () { return precedingLineBreak; }, + isIdentifier: function () { return token === 64 || token > 100; }, + isReservedWord: function () { return token >= 65 && token <= 100; }, + isUnterminated: function () { return tokenIsUnterminated; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, @@ -7346,13 +2581,9 @@ var ts; function getSingleLineStringWriter() { if (stringWriters.length == 0) { var str = ""; - var writeText = function (text) { - return str += text; - }; + var writeText = function (text) { return str += text; }; return { - string: function () { - return str; - }, + string: function () { return str; }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -7360,18 +2591,11 @@ var ts; writeStringLiteral: writeText, writeParameter: writeText, writeSymbol: writeText, - writeLine: function () { - return str += " "; - }, - increaseIndent: function () { - }, - decreaseIndent: function () { - }, - clear: function () { - return str = ""; - }, - trackSymbol: function () { - } + writeLine: function () { return str += " "; }, + increaseIndent: function () { }, + decreaseIndent: function () { }, + clear: function () { return str = ""; }, + trackSymbol: function () { } }; } return stringWriters.pop(); @@ -7393,7 +2617,8 @@ var ts; ts.containsParseError = containsParseError; function aggregateChildData(node) { if (!(node.parserContextFlags & 64)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || ts.forEachChild(node, containsParseError); + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || + ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { node.parserContextFlags |= 32; } @@ -7472,7 +2697,8 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 12288) !== 0 || isCatchClauseVariableDeclaration(declaration); + return (getCombinedNodeFlags(declaration) & 12288) !== 0 || + isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function getEnclosingBlockScopeContainer(node) { @@ -7500,7 +2726,10 @@ var ts; } ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { - return declaration && declaration.kind === 193 && declaration.parent && declaration.parent.kind === 217; + return declaration && + declaration.kind === 193 && + declaration.parent && + declaration.parent.kind === 217; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -7552,7 +2781,9 @@ var ts; if (errorNode === undefined) { return getSpanOfTokenAtPosition(sourceFile, node.pos); } - var pos = nodeIsMissing(errorNode) ? errorNode.pos : ts.skipTrivia(sourceFile.text, errorNode.pos); + var pos = nodeIsMissing(errorNode) + ? errorNode.pos + : ts.skipTrivia(sourceFile.text, errorNode.pos); return createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; @@ -7615,7 +2846,9 @@ var ts; function getJsDocComments(node, sourceFileOfNode) { return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); function isJsDocComment(comment) { - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; + return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; } } ts.getJsDocComments = getJsDocComments; @@ -7841,11 +3074,14 @@ var ts; return _parent.expression === node; case 181: var forStatement = _parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || forStatement.condition === node || forStatement.iterator === node; + return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || + forStatement.condition === node || + forStatement.iterator === node; case 182: case 183: var forInStatement = _parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || forInStatement.expression === node; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || + forInStatement.expression === node; case 158: return node === _parent.expression; case 173: @@ -7863,7 +3099,8 @@ var ts; ts.isExpression = isExpression; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 || (preserveConstEnums && moduleState === 2); + return moduleState === 1 || + (preserveConstEnums && moduleState === 2); } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { @@ -8111,7 +3348,9 @@ var ts; } ts.isTrivia = isTrivia; function hasDynamicName(declaration) { - return declaration.name && declaration.name.kind === 126 && !isWellKnownSymbolSyntactically(declaration.name.expression); + return declaration.name && + declaration.name.kind === 126 && + !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { @@ -8215,10 +3454,7 @@ var ts; if (length < 0) { throw new Error("length < 0"); } - return { - start: start, - length: length - }; + return { start: start, length: length }; } ts.createTextSpan = createTextSpan; function createTextSpanFromBounds(start, end) { @@ -8237,10 +3473,7 @@ var ts; if (newLength < 0) { throw new Error("newLength < 0"); } - return { - span: span, - newLength: newLength - }; + return { span: span, newLength: newLength }; } ts.createTextChangeRange = createTextChangeRange; ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); @@ -8401,9 +3634,9 @@ var ts; } var nonAsciiCharacters = /[^\u0000-\u007F]/g; function escapeNonAsciiCharacters(s) { - return nonAsciiCharacters.test(s) ? s.replace(nonAsciiCharacters, function (c) { - return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - }) : s; + return nonAsciiCharacters.test(s) ? + s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) : + s; } ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters; })(ts || (ts = {})); @@ -8448,9 +3681,12 @@ var ts; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { case 125: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); case 127: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.expression); case 128: case 130: case 129: @@ -8458,13 +3694,22 @@ var ts; case 219: case 193: case 150: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); case 140: case 141: case 136: case 137: case 138: - return visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); case 132: case 131: case 133: @@ -8473,9 +3718,17 @@ var ts; case 160: case 195: case 161: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); case 139: - return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); + return visitNode(cbNode, node.typeName) || + visitNodes(cbNodes, node.typeArguments); case 142: return visitNode(cbNode, node.exprName); case 143: @@ -8496,16 +3749,23 @@ var ts; case 152: return visitNodes(cbNodes, node.properties); case 153: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.dotToken) || + visitNode(cbNode, node.name); case 154: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.argumentExpression); case 155: case 156: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments) || + visitNodes(cbNodes, node.arguments); case 157: - return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.template); case 158: - return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); case 159: return visitNode(cbNode, node.expression); case 162: @@ -8517,91 +3777,142 @@ var ts; case 165: return visitNode(cbNode, node.operand); case 170: - return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); case 166: return visitNode(cbNode, node.operand); case 167: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); case 168: - return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); case 171: return visitNode(cbNode, node.expression); case 174: case 201: return visitNodes(cbNodes, node.statements); case 221: - return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); + return visitNodes(cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); case 175: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); case 194: return visitNodes(cbNodes, node.declarations); case 177: return visitNode(cbNode, node.expression); case 178: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); case 179: - return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); case 180: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 181: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.iterator) || + visitNode(cbNode, node.statement); case 182: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 183: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 184: case 185: return visitNode(cbNode, node.label); case 186: return visitNode(cbNode, node.expression); case 187: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 188: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); case 202: return visitNodes(cbNodes, node.clauses); case 214: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); case 215: return visitNodes(cbNodes, node.statements); case 189: - return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); case 190: return visitNode(cbNode, node.expression); case 191: - return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); case 217: - return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); case 196: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 197: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 198: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); case 199: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); case 220: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); case 200: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); case 203: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); case 204: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier); case 205: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); case 206: return visitNode(cbNode, node.name); case 207: case 211: return visitNodes(cbNodes, node.elements); case 210: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier); case 208: case 212: - return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); case 209: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); case 169: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); case 173: @@ -8617,69 +3928,40 @@ var ts; ts.forEachChild = forEachChild; function parsingContextErrors(context) { switch (context) { - case 0: - return ts.Diagnostics.Declaration_or_statement_expected; - case 1: - return ts.Diagnostics.Declaration_or_statement_expected; - case 2: - return ts.Diagnostics.Statement_expected; - case 3: - return ts.Diagnostics.case_or_default_expected; - case 4: - return ts.Diagnostics.Statement_expected; - case 5: - return ts.Diagnostics.Property_or_signature_expected; - case 6: - return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; - case 7: - return ts.Diagnostics.Enum_member_expected; - case 8: - return ts.Diagnostics.Type_reference_expected; - case 9: - return ts.Diagnostics.Variable_declaration_expected; - case 10: - return ts.Diagnostics.Property_destructuring_pattern_expected; - case 11: - return ts.Diagnostics.Array_element_destructuring_pattern_expected; - case 12: - return ts.Diagnostics.Argument_expression_expected; - case 13: - return ts.Diagnostics.Property_assignment_expected; - case 14: - return ts.Diagnostics.Expression_or_comma_expected; - case 15: - return ts.Diagnostics.Parameter_declaration_expected; - case 16: - return ts.Diagnostics.Type_parameter_declaration_expected; - case 17: - return ts.Diagnostics.Type_argument_expected; - case 18: - return ts.Diagnostics.Type_expected; - case 19: - return ts.Diagnostics.Unexpected_token_expected; - case 20: - return ts.Diagnostics.Identifier_expected; + case 0: return ts.Diagnostics.Declaration_or_statement_expected; + case 1: return ts.Diagnostics.Declaration_or_statement_expected; + case 2: return ts.Diagnostics.Statement_expected; + case 3: return ts.Diagnostics.case_or_default_expected; + case 4: return ts.Diagnostics.Statement_expected; + case 5: return ts.Diagnostics.Property_or_signature_expected; + case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7: return ts.Diagnostics.Enum_member_expected; + case 8: return ts.Diagnostics.Type_reference_expected; + case 9: return ts.Diagnostics.Variable_declaration_expected; + case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; + case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; + case 12: return ts.Diagnostics.Argument_expression_expected; + case 13: return ts.Diagnostics.Property_assignment_expected; + case 14: return ts.Diagnostics.Expression_or_comma_expected; + case 15: return ts.Diagnostics.Parameter_declaration_expected; + case 16: return ts.Diagnostics.Type_parameter_declaration_expected; + case 17: return ts.Diagnostics.Type_argument_expected; + case 18: return ts.Diagnostics.Type_expected; + case 19: return ts.Diagnostics.Unexpected_token_expected; + case 20: return ts.Diagnostics.Identifier_expected; } } ; function modifierToFlag(token) { switch (token) { - case 109: - return 128; - case 108: - return 16; - case 107: - return 64; - case 106: - return 32; - case 77: - return 1; - case 114: - return 2; - case 69: - return 8192; - case 72: - return 256; + case 109: return 128; + case 108: return 16; + case 107: return 64; + case 106: return 32; + case 77: return 1; + case 114: return 2; + case 69: return 8192; + case 72: return 256; } return 0; } @@ -8912,7 +4194,8 @@ var ts; } ts.updateSourceFile = updateSourceFile; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 64 && (node.text === "eval" || node.text === "arguments"); + return node.kind === 64 && + (node.text === "eval" || node.text === "arguments"); } ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; function isUseStrictPrologueDirective(sourceFile, node) { @@ -9130,7 +4413,9 @@ var ts; var saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; var saveContextFlags = contextFlags; - var result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); + var result = isLookAhead + ? scanner.lookAhead(callback) + : scanner.tryScan(callback); ts.Debug.assert(saveContextFlags === contextFlags); if (!result || isLookAhead) { token = saveToken; @@ -9181,7 +4466,8 @@ var ts; return undefined; } function parseExpectedToken(t, reportAtCurrentPosition, diagnosticMessage, arg0) { - return parseOptionalToken(t) || createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); + return parseOptionalToken(t) || + createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); } function parseTokenNode() { var node = createNode(token); @@ -9258,7 +4544,9 @@ var ts; return createIdentifier(isIdentifierOrKeyword()); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || token === 8 || token === 7; + return isIdentifierOrKeyword() || + token === 8 || + token === 7; } function parsePropertyName() { if (token === 8 || token === 7) { @@ -9311,7 +4599,10 @@ var ts; return canFollowModifier(); } function canFollowModifier() { - return token === 18 || token === 14 || token === 35 || isLiteralPropertyName(); + return token === 18 + || token === 14 + || token === 35 + || isLiteralPropertyName(); } function nextTokenIsClassOrFunction() { nextToken(); @@ -9369,7 +4660,8 @@ var ts; return isIdentifier(); } function isNotHeritageClauseTypeName() { - if (token === 102 || token === 78) { + if (token === 102 || + token === 78) { return lookAhead(nextTokenIsIdentifier); } return false; @@ -9750,7 +5042,9 @@ var ts; var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - if (node.kind === 7 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + if (node.kind === 7 + && sourceText.charCodeAt(tokenPos) === 48 + && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { node.flags |= 16384; } return node; @@ -9789,7 +5083,9 @@ var ts; } function parseParameterType() { if (parseOptional(51)) { - return token === 8 ? parseLiteralNode(true) : parseType(); + return token === 8 + ? parseLiteralNode(true) + : parseType(); } return undefined; } @@ -9947,7 +5243,11 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 || token === 24 || token === 50 || token === 51 || canParseSemicolon(); + return token === 16 || + token === 24 || + token === 50 || + token === 51 || + canParseSemicolon(); } function parseTypeMember() { switch (token) { @@ -9955,7 +5255,9 @@ var ts; case 24: return parseSignatureMember(136); case 18: - return isIndexSignature() ? parseIndexSignatureDeclaration(undefined) : parsePropertyOrMethodSignature(); + return isIndexSignature() + ? parseIndexSignatureDeclaration(undefined) + : parsePropertyOrMethodSignature(); case 87: if (lookAhead(isStartOfConstructSignature)) { return parseSignatureMember(137); @@ -9977,7 +5279,9 @@ var ts; } function parseIndexSignatureWithModifiers() { var modifiers = parseModifiers(); - return isIndexSignature() ? parseIndexSignatureDeclaration(modifiers) : undefined; + return isIndexSignature() + ? parseIndexSignatureDeclaration(modifiers) + : undefined; } function isStartOfConstructSignature() { nextToken(); @@ -10083,9 +5387,7 @@ var ts; function parseUnionTypeOrHigher() { var type = parseArrayTypeOrHigher(); if (token === 44) { - var types = [ - type - ]; + var types = [type]; types.pos = type.pos; while (parseOptional(44)) { types.push(parseArrayTypeOrHigher()); @@ -10110,7 +5412,9 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 51 || token === 23 || token === 50 || token === 52 || isIdentifier() || ts.isModifier(token)) { + if (token === 51 || token === 23 || + token === 50 || token === 52 || + isIdentifier() || ts.isModifier(token)) { return true; } if (token === 17) { @@ -10237,12 +5541,14 @@ var ts; } function nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() { nextToken(); - return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 14 || token === 18); + return !scanner.hasPrecedingLineBreak() && + (isIdentifier() || token === 14 || token === 18); } function parseYieldExpression() { var node = createNode(170); nextToken(); - if (!scanner.hasPrecedingLineBreak() && (token === 35 || isStartOfExpression())) { + if (!scanner.hasPrecedingLineBreak() && + (token === 35 || isStartOfExpression())) { node.asteriskToken = parseOptionalToken(35); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); @@ -10257,9 +5563,7 @@ var ts; var parameter = createNode(128, identifier.pos); parameter.name = identifier; finishNode(parameter); - node.parameters = [ - parameter - ]; + node.parameters = [parameter]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; parseExpected(32); @@ -10271,7 +5575,9 @@ var ts; if (triState === 0) { return undefined; } - var arrowFunction = triState === 1 ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + var arrowFunction = triState === 1 + ? parseParenthesizedArrowFunctionExpressionHead(true) + : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); if (!arrowFunction) { return undefined; } @@ -10493,7 +5799,9 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 90 ? parseSuperExpression() : parseMemberExpressionOrHigher(); + var expression = token === 90 + ? parseSuperExpression() + : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); } function parseMemberExpressionOrHigher() { @@ -10547,7 +5855,9 @@ var ts; if (token === 10 || token === 11) { var tagExpression = createNode(157, expression.pos); tagExpression.tag = expression; - tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); + tagExpression.template = token === 10 + ? parseLiteralNode() + : parseTemplateExpression(); expression = finishNode(tagExpression); continue; } @@ -10593,7 +5903,9 @@ var ts; if (!parseExpected(25)) { return undefined; } - return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; + return typeArguments && canFollowTypeArgumentsInExpression() + ? typeArguments + : undefined; } function canFollowTypeArgumentsInExpression() { switch (token) { @@ -10668,7 +5980,9 @@ var ts; return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 ? parseSpreadElement() : token === 23 ? createNode(172) : parseAssignmentExpressionOrHigher(); + return token === 21 ? parseSpreadElement() : + token === 23 ? createNode(172) : + parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return allowInAnd(parseArgumentOrArrayLiteralElement); @@ -11318,7 +6632,11 @@ var ts; if (isIndexSignature()) { return parseIndexSignatureDeclaration(modifiers); } - if (isIdentifierOrKeyword() || token === 8 || token === 7 || token === 35 || token === 18) { + if (isIdentifierOrKeyword() || + token === 8 || + token === 7 || + token === 35 || + token === 18) { return parsePropertyOrMethodDeclaration(fullStart, modifiers); } ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -11331,7 +6649,9 @@ var ts; node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); if (parseExpected(14)) { - node.members = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); + node.members = inGeneratorParameterContext() + ? doOutsideOfYieldContext(parseClassMembers) + : parseClassMembers(); parseExpected(15); } else { @@ -11341,7 +6661,9 @@ var ts; } function parseHeritageClauses(isClassHeritageClause) { if (isHeritageClause()) { - return isClassHeritageClause && inGeneratorParameterContext() ? doOutsideOfYieldContext(parseHeritageClausesWorker) : parseHeritageClausesWorker(); + return isClassHeritageClause && inGeneratorParameterContext() + ? doOutsideOfYieldContext(parseHeritageClausesWorker) + : parseHeritageClausesWorker(); } return undefined; } @@ -11420,7 +6742,9 @@ var ts; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(20) ? parseInternalModuleTail(getNodePos(), undefined, 1) : parseModuleBlock(); + node.body = parseOptional(20) + ? parseInternalModuleTail(getNodePos(), undefined, 1) + : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { @@ -11432,17 +6756,21 @@ var ts; } function parseModuleDeclaration(fullStart, modifiers) { parseExpected(116); - return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); + return token === 8 + ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) + : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); } function isExternalModuleReference() { - return token === 117 && lookAhead(nextTokenIsOpenParen); + return token === 117 && + lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 16; } function nextTokenIsCommaOrFromKeyword() { nextToken(); - return token === 23 || token === 123; + return token === 23 || + token === 123; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, modifiers) { parseExpected(84); @@ -11462,7 +6790,9 @@ var ts; } var importDeclaration = createNode(204, fullStart); setModifiers(importDeclaration, modifiers); - if (identifier || token === 35 || token === 14) { + if (identifier || + token === 35 || + token === 14) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); parseExpected(123); } @@ -11475,13 +6805,16 @@ var ts; if (identifier) { importClause.name = identifier; } - if (!importClause.name || parseOptional(23)) { + if (!importClause.name || + parseOptional(23)) { importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(207); } return finishNode(importClause); } function parseModuleReference() { - return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); + return isExternalModuleReference() + ? parseExternalModuleReference() + : parseEntityName(false); } function parseExternalModuleReference() { var node = createNode(213); @@ -11611,11 +6944,13 @@ var ts; } function nextTokenCanFollowImportKeyword() { nextToken(); - return isIdentifierOrKeyword() || token === 8 || token === 35 || token === 14; + return isIdentifierOrKeyword() || token === 8 || + token === 35 || token === 14; } function nextTokenCanFollowExportKeyword() { nextToken(); - return token === 52 || token === 35 || token === 14 || token === 72 || isDeclarationStart(); + return token === 52 || token === 35 || + token === 14 || token === 72 || isDeclarationStart(); } function nextTokenIsDeclarationStart() { nextToken(); @@ -11669,7 +7004,9 @@ var ts; return parseSourceElementOrModuleElement(); } function parseSourceElementOrModuleElement() { - return isDeclarationStart() ? parseDeclaration() : parseStatement(); + return isDeclarationStart() + ? parseDeclaration() + : parseStatement(); } function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, sourceText); @@ -11684,10 +7021,7 @@ var ts; if (kind !== 2) { break; } - var range = { - pos: triviaScanner.getTokenPos(), - end: triviaScanner.getTextPos() - }; + var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; var comment = sourceText.substring(range.pos, range.end); var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { @@ -11718,10 +7052,7 @@ var ts; var pathMatchResult = pathRegex.exec(comment); var nameMatchResult = nameRegex.exec(comment); if (pathMatchResult) { - var amdDependency = { - path: pathMatchResult[2], - name: nameMatchResult ? nameMatchResult[2] : undefined - }; + var amdDependency = { path: pathMatchResult[2], name: nameMatchResult ? nameMatchResult[2] : undefined }; amdDependencies.push(amdDependency); } } @@ -11733,7 +7064,13 @@ var ts; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 1 || node.kind === 203 && node.moduleReference.kind === 213 || node.kind === 204 || node.kind === 209 || node.kind === 210 ? node : undefined; + return node.flags & 1 + || node.kind === 203 && node.moduleReference.kind === 213 + || node.kind === 204 + || node.kind === 209 + || node.kind === 210 + ? node + : undefined; }); } } @@ -11896,7 +7233,9 @@ var ts; if (node.name) { node.name.parent = node; } - var message = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = symbol.flags & 2 + ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 + : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); @@ -11942,7 +7281,9 @@ var ts; } else { if (hasExportModifier || isAmbientContext(container)) { - var exportKind = (symbolKind & 107455 ? 1048576 : 0) | (symbolKind & 793056 ? 2097152 : 0) | (symbolKind & 1536 ? 4194304 : 0); + var exportKind = (symbolKind & 107455 ? 1048576 : 0) | + (symbolKind & 793056 ? 2097152 : 0) | + (symbolKind & 1536 ? 4194304 : 0); var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); node.localSymbol = local; @@ -12222,7 +7563,9 @@ var ts; else { bindDeclaration(node, 1, 107455, false); } - if (node.flags & 112 && node.parent.kind === 133 && node.parent.parent.kind === 196) { + if (node.flags & 112 && + node.parent.kind === 133 && + node.parent.parent.kind === 196) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -12256,24 +7599,12 @@ var ts; var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var checker = { - getNodeCount: function () { - return ts.sum(host.getSourceFiles(), "nodeCount"); - }, - getIdentifierCount: function () { - return ts.sum(host.getSourceFiles(), "identifierCount"); - }, - getSymbolCount: function () { - return ts.sum(host.getSourceFiles(), "symbolCount"); - }, - getTypeCount: function () { - return typeCount; - }, - isUndefinedSymbol: function (symbol) { - return symbol === undefinedSymbol; - }, - isArgumentsSymbol: function (symbol) { - return symbol === argumentsSymbol; - }, + getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, + getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, + getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, + getTypeCount: function () { return typeCount; }, + isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, + isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, @@ -12367,7 +7698,9 @@ var ts; return emitResolver; } function error(location, message, arg0, arg1, arg2) { - var diagnostic = location ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); + var diagnostic = location + ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) + : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); diagnostics.add(diagnostic); } function createSymbol(flags, name) { @@ -12453,7 +7786,8 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = target.flags & 2 || source.flags & 2 + ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { error(node.name ? node.name : node, message, symbolToString(source)); }); @@ -12640,18 +7974,18 @@ var ts; } function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert((result.flags & 2) !== 0); - var declaration = ts.forEach(result.declarations, function (d) { - return ts.isBlockOrCatchScoped(d) ? d : undefined; - }); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { var variableDeclaration = ts.getAncestor(declaration, 193); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 175 || variableDeclaration.parent.parent.kind === 181) { + if (variableDeclaration.parent.parent.kind === 175 || + variableDeclaration.parent.parent.kind === 181) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 183 || variableDeclaration.parent.parent.kind === 182) { + else if (variableDeclaration.parent.parent.kind === 183 || + variableDeclaration.parent.parent.kind === 182) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -12672,12 +8006,15 @@ var ts; return false; } function isAliasSymbolDeclaration(node) { - return node.kind === 203 || node.kind === 205 && !!node.name || node.kind === 206 || node.kind === 208 || node.kind === 212 || node.kind === 209; + return node.kind === 203 || + node.kind === 205 && !!node.name || + node.kind === 206 || + node.kind === 208 || + node.kind === 212 || + node.kind === 209; } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { - return isAliasSymbolDeclaration(d) ? d : undefined; - }); + return ts.forEach(symbol.declarations, function (d) { return isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { if (node.moduleReference.kind === 213) { @@ -12718,7 +8055,9 @@ var ts; return getExternalModuleMember(node.parent.parent.parent, node); } function getTargetOfExportSpecifier(node) { - return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); + return node.parent.parent.moduleSpecifier ? + getExternalModuleMember(node.parent.parent, node) : + resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); } function getTargetOfExportAssignment(node) { return resolveEntityName(node.expression, 107455 | 793056 | 1536); @@ -12937,7 +8276,9 @@ var ts; return getMergedSymbol(symbol.parent); } function getExportSymbolOfValueSymbolIfExported(symbol) { - return symbol && (symbol.flags & 1048576) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; + return symbol && (symbol.flags & 1048576) !== 0 + ? getMergedSymbol(symbol.exportSymbol) + : symbol; } function symbolIsValue(symbol) { if (symbol.flags & 16777216) { @@ -12976,7 +8317,10 @@ var ts; return type; } function isReservedMemberName(name) { - return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && name.charCodeAt(2) !== 95 && name.charCodeAt(2) !== 64; + return name.charCodeAt(0) === 95 && + name.charCodeAt(1) === 95 && + name.charCodeAt(2) !== 95 && + name.charCodeAt(2) !== 64; } function getNamedMembers(members) { var result; @@ -13050,28 +8394,24 @@ var ts; } function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { - return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && + canQualifySymbol(symbolFromSymbolTable, meaning); } } if (isAccessible(ts.lookUp(symbols, symbol.name))) { - return [ - symbol - ]; + return [symbol]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608) { - if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [ - symbolFromSymbolTable - ]; + return [symbolFromSymbolTable]; } var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [ - symbolFromSymbolTable - ].concat(accessibleSymbolsFromExports); + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); } } } @@ -13136,9 +8476,7 @@ var ts; errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) }; } - return { - accessibility: 0 - }; + return { accessibility: 0 }; function getExternalModuleContainer(declaration) { for (; declaration; declaration = declaration.parent) { if (hasExternalModuleSymbol(declaration)) { @@ -13148,22 +8486,20 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 200 && declaration.name.kind === 8) || (declaration.kind === 221 && ts.isExternalModule(declaration)); + return (declaration.kind === 200 && declaration.name.kind === 8) || + (declaration.kind === 221 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; - if (ts.forEach(symbol.declarations, function (declaration) { - return !getIsDeclarationVisible(declaration); - })) { + if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { return undefined; } - return { - accessibility: 0, - aliasesToMakeVisible: aliasesToMakeVisible - }; + return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 203 && !(declaration.flags & 1) && isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 203 && + !(declaration.flags & 1) && + isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -13171,9 +8507,7 @@ var ts; } } else { - aliasesToMakeVisible = [ - declaration - ]; + aliasesToMakeVisible = [declaration]; } return true; } @@ -13187,7 +8521,8 @@ var ts; if (entityName.parent.kind === 142) { meaning = 107455 | 1048576; } - else if (entityName.kind === 125 || entityName.parent.kind === 203) { + else if (entityName.kind === 125 || + entityName.parent.kind === 203) { meaning = 1536; } else { @@ -13273,7 +8608,8 @@ var ts; function walkSymbol(symbol, meaning) { if (symbol) { var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); - if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { @@ -13306,7 +8642,8 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { if (type.flags & 1048703) { - writer.writeKeyword(!(globalFlags & 16) && (type.flags & 1) ? "any" : type.intrinsicName); + writer.writeKeyword(!(globalFlags & 16) && + (type.flags & 1) ? "any" : type.intrinsicName); } else if (type.flags & 4096) { writeTypeReference(type, flags); @@ -13399,14 +8736,16 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.flags & 128; - })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 221 || declaration.parent.kind === 201; - })); + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && + ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && + (type.symbol.parent || + ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.parent.kind === 221 || declaration.parent.kind === 201; + })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { - return !!(flags & 2) || (typeStack && ts.contains(typeStack, type)); + return !!(flags & 2) || + (typeStack && ts.contains(typeStack, type)); } } } @@ -13692,7 +9031,8 @@ var ts; case 199: case 203: var _parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 203 && _parent.kind !== 221 && ts.isInAmbientContext(_parent))) { + if (!(ts.getCombinedNodeFlags(node) & 1) && + !(node.kind !== 203 && _parent.kind !== 221 && ts.isInAmbientContext(_parent))) { return isGlobalSourceFile(_parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(_parent); @@ -13747,9 +9087,7 @@ var ts; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); - return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { - return anyType; - })) : classType; + return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; } function getTypeOfPropertyOfType(type, name) { var prop = getPropertyOfType(type, name); @@ -13770,7 +9108,9 @@ var ts; var type; if (pattern.kind === 148) { var _name = declaration.propertyName || declaration.name; - type = getTypeOfPropertyOfType(parentType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); + type = getTypeOfPropertyOfType(parentType, _name.text) || + isNumericLiteralName(_name.text) && getIndexTypeOfType(parentType, 1) || + getIndexTypeOfType(parentType, 0); if (!type) { error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(_name)); return unknownType; @@ -13866,7 +9206,9 @@ var ts; return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 148 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); + return pattern.kind === 148 + ? getTypeFromObjectBindingPattern(pattern) + : getTypeFromArrayBindingPattern(pattern); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -13910,7 +9252,9 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + var diagnostic = symbol.valueDeclaration.type ? + ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : + ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); } } @@ -14044,9 +9388,7 @@ var ts; ts.forEach(declaration.typeParameters, function (node) { var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); if (!result) { - result = [ - tp - ]; + result = [tp]; } else if (!ts.contains(result, tp)) { result.push(tp); @@ -14293,15 +9635,14 @@ var ts; var baseType = classType.baseTypes[0]; var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1); return ts.map(baseSignatures, function (baseSignature) { - var signature = baseType.flags & 4096 ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); + var signature = baseType.flags & 4096 ? + getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); signature.typeParameters = classType.typeParameters; signature.resolvedReturnType = classType; return signature; }); } - return [ - createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false) - ]; + return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; } function createTupleTypeMemberSymbols(memberTypes) { var members = {}; @@ -14330,9 +9671,7 @@ var ts; return true; } function getUnionSignatures(types, kind) { - var signatureLists = ts.map(types, function (t) { - return getSignaturesOfType(t, kind); - }); + var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; for (var _i = 0, _n = signatures.length; _i < _n; _i++) { var signature = signatures[_i]; @@ -14349,9 +9688,7 @@ var ts; for (var i = 0; i < result.length; i++) { var s = result[i]; s.resolvedReturnType = undefined; - s.unionSignatures = ts.map(signatureLists, function (signatures) { - return signatures[i]; - }); + s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); } return result; } @@ -14502,9 +9839,7 @@ var ts; return undefined; } if (!props) { - props = [ - prop - ]; + props = [prop]; } else { props.push(prop); @@ -14604,7 +9939,8 @@ var ts; var links = getNodeLinks(declaration); if (!links.resolvedSignature) { var classType = declaration.kind === 133 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; - var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; + var typeParameters = classType ? classType.typeParameters : + declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; @@ -14736,12 +10072,8 @@ var ts; var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; - type.callSignatures = !isConstructor ? [ - signature - ] : emptyArray; - type.constructSignatures = isConstructor ? [ - signature - ] : emptyArray; + type.callSignatures = !isConstructor ? [signature] : emptyArray; + type.constructSignatures = isConstructor ? [signature] : emptyArray; signature.isolatedSignatureType = type; } return signature.isolatedSignatureType; @@ -14769,7 +10101,9 @@ var ts; } function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); - return declaration ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType : undefined; + return declaration + ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType + : undefined; } function getConstraintOfTypeParameter(type) { if (!type.constraint) { @@ -14825,9 +10159,7 @@ var ts; return links.isIllegalTypeReferenceInConstraint; } var currentNode = typeReferenceNode; - while (!ts.forEach(typeParameterSymbol.declarations, function (d) { - return d.parent === currentNode.parent; - })) { + while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } links.isIllegalTypeReferenceInConstraint = currentNode.kind === 127; @@ -14841,9 +10173,7 @@ var ts; if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); if (symbol && (symbol.flags & 262144)) { - links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { - return d.parent == typeParameter.parent; - }); + links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); } } if (links.isIllegalTypeReferenceInConstraint) { @@ -14942,9 +10272,7 @@ var ts; } function createArrayType(elementType) { var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); - return arrayType !== emptyObjectType ? createTypeReference(arrayType, [ - elementType - ]) : emptyObjectType; + return arrayType !== emptyObjectType ? createTypeReference(arrayType, [elementType]) : emptyObjectType; } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); @@ -15134,21 +10462,15 @@ var ts; return items; } function createUnaryTypeMapper(source, target) { - return function (t) { - return t === source ? target : t; - }; + return function (t) { return t === source ? target : t; }; } function createBinaryTypeMapper(source1, target1, source2, target2) { - return function (t) { - return t === source1 ? target1 : t === source2 ? target2 : t; - }; + return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } function createTypeMapper(sources, targets) { switch (sources.length) { - case 1: - return createUnaryTypeMapper(sources[0], targets[0]); - case 2: - return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); + case 1: return createUnaryTypeMapper(sources[0], targets[0]); + case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); } return function (t) { for (var i = 0; i < sources.length; i++) { @@ -15160,21 +10482,15 @@ var ts; }; } function createUnaryTypeEraser(source) { - return function (t) { - return t === source ? anyType : t; - }; + return function (t) { return t === source ? anyType : t; }; } function createBinaryTypeEraser(source1, source2) { - return function (t) { - return t === source1 || t === source2 ? anyType : t; - }; + return function (t) { return t === source1 || t === source2 ? anyType : t; }; } function createTypeEraser(sources) { switch (sources.length) { - case 1: - return createUnaryTypeEraser(sources[0]); - case 2: - return createBinaryTypeEraser(sources[0], sources[1]); + case 1: return createUnaryTypeEraser(sources[0]); + case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { for (var _i = 0, _n = sources.length; _i < _n; _i++) { @@ -15200,9 +10516,7 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { - return mapper2(mapper1(t)); - }; + return function (t) { return mapper2(mapper1(t)); }; } function instantiateTypeParameter(typeParameter, mapper) { var result = createType(512); @@ -15263,7 +10577,8 @@ var ts; return mapper(type); } if (type.flags & 32768) { - return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? instantiateAnonymousType(type, mapper) : type; + return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? + instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096) { return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); @@ -15288,9 +10603,11 @@ var ts; case 151: return ts.forEach(node.elements, isContextSensitive); case 168: - return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); + return isContextSensitive(node.whenTrue) || + isContextSensitive(node.whenFalse); case 167: - return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); + return node.operatorToken.kind === 49 && + (isContextSensitive(node.left) || isContextSensitive(node.right)); case 218: return isContextSensitive(node.initializer); case 132: @@ -15302,9 +10619,7 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { - return p.type; - }); + return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); } function getTypeWithoutConstructors(type) { if (type.flags & 48128) { @@ -15443,7 +10758,8 @@ var ts; } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (_result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && + (_result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; return _result; } @@ -15904,7 +11220,9 @@ var ts; if (source === target) { return -1; } - if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { + if (source.parameters.length !== target.parameters.length || + source.minArgumentCount !== target.minArgumentCount || + source.hasRestParameter !== target.hasRestParameter) { return 0; } var result = -1; @@ -15948,9 +11266,7 @@ var ts; return true; } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { - return isSupertypeOfEach(t, types) ? t : undefined; - }); + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { var bestSupertype; @@ -16070,7 +11386,9 @@ var ts; diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; case 128: - diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + diagnostic = declaration.dotDotDotToken ? + ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : + ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; case 195: case 132: @@ -16127,10 +11445,7 @@ var ts; var inferences = []; for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { var unused = typeParameters[_i]; - inferences.push({ - primary: undefined, - secondary: undefined - }); + inferences.push({ primary: undefined, secondary: undefined }); } return { typeParameters: typeParameters, @@ -16177,7 +11492,9 @@ var ts; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { var inferences = context.inferences[i]; - var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); + var candidates = inferiority ? + inferences.secondary || (inferences.secondary = []) : + inferences.primary || (inferences.primary = []); if (!ts.contains(candidates, source)) candidates.push(source); break; @@ -16218,7 +11535,8 @@ var ts; inferFromTypes(sourceType, target); } } - else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || + (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -16328,12 +11646,8 @@ var ts; function removeTypesFromUnionType(type, typeKind, isOfTypeKind, allowEmptyUnionResult) { if (type.flags & 16384) { var types = type.types; - if (ts.forEach(types, function (t) { - return !!(t.flags & typeKind) === isOfTypeKind; - })) { - var narrowedType = getUnionType(ts.filter(types, function (t) { - return !(t.flags & typeKind) === isOfTypeKind; - })); + if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { + var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { return narrowedType; } @@ -16427,13 +11741,12 @@ var ts; function resolveLocation(node) { var containerNodes = []; for (var _parent = node.parent; _parent; _parent = _parent.parent) { - if ((ts.isExpression(_parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(_parent)) { + if ((ts.isExpression(_parent) || ts.isObjectLiteralMethod(node)) && + isContextSensitive(_parent)) { containerNodes.unshift(_parent); } } - ts.forEach(containerNodes, function (node) { - getTypeOfNode(node); - }); + ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); } function getSymbolAtLocation(node) { resolveLocation(node); @@ -16562,9 +11875,7 @@ var ts; return targetType; } if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { - return isTypeSubtypeOf(t, targetType); - })); + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); } return type; } @@ -16620,7 +11931,9 @@ var ts; return false; } function checkBlockScopedBindingCapturedInLoop(node, symbol) { - if (languageVersion >= 2 || (symbol.flags & 2) === 0 || symbol.valueDeclaration.parent.kind === 217) { + if (languageVersion >= 2 || + (symbol.flags & 2) === 0 || + symbol.valueDeclaration.parent.kind === 217) { return; } var container = symbol.valueDeclaration; @@ -16728,10 +12041,21 @@ var ts; } if (container && container.parent && container.parent.kind === 196) { if (container.flags & 128) { - canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135; + canUseSuperExpression = + container.kind === 132 || + container.kind === 131 || + container.kind === 134 || + container.kind === 135; } else { - canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135 || container.kind === 130 || container.kind === 129 || container.kind === 133; + canUseSuperExpression = + container.kind === 132 || + container.kind === 131 || + container.kind === 134 || + container.kind === 135 || + container.kind === 130 || + container.kind === 129 || + container.kind === 133; } } } @@ -16778,7 +12102,8 @@ var ts; if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } - if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + if (indexOfParameter === (func.parameters.length - 1) && + funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); } } @@ -16864,10 +12189,7 @@ var ts; mappedType = t; } else if (!mappedTypes) { - mappedTypes = [ - mappedType, - t - ]; + mappedTypes = [mappedType, t]; } else { mappedTypes.push(t); @@ -16883,17 +12205,13 @@ var ts; }); } function getIndexTypeOfContextualType(type, kind) { - return applyToContextualType(type, function (t) { - return getIndexTypeOfObjectOrUnionType(t, kind); - }); + return applyToContextualType(type, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }); } function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } function contextualTypeHasIndexSignature(type, kind) { - return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { - return getIndexTypeOfObjectOrUnionType(t, kind); - }) : getIndexTypeOfObjectOrUnionType(type, kind)); + return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); } function getContextualTypeForObjectLiteralMethod(node) { ts.Debug.assert(ts.isObjectLiteralMethod(node)); @@ -16913,7 +12231,8 @@ var ts; return propertyType; } } - return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || getIndexTypeOfContextualType(type, 0); + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || + getIndexTypeOfContextualType(type, 0); } return undefined; } @@ -16922,7 +12241,9 @@ var ts; var type = getContextualType(arrayLiteral); if (type) { var index = ts.indexOf(arrayLiteral.elements, node); - return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1) || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); + return getTypeOfPropertyOfContextualType(type, "" + index) + || getIndexTypeOfContextualType(type, 1) + || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); } return undefined; } @@ -16986,7 +12307,9 @@ var ts; } function getContextualSignature(node) { ts.Debug.assert(node.kind !== 132 || ts.isObjectLiteralMethod(node)); - var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); + var type = ts.isObjectLiteralMethod(node) + ? getContextualTypeForObjectLiteralMethod(node) + : getContextualType(node); if (!type) { return undefined; } @@ -16997,15 +12320,14 @@ var ts; var types = type.types; for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; - if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { + if (signatureList && + getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; } var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { - signatureList = [ - signature - ]; + signatureList = [signature]; } else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { return undefined; @@ -17103,7 +12425,9 @@ var ts; for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 218 || + memberDecl.kind === 219 || + ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; if (memberDecl.kind === 218) { type = checkPropertyAssignment(memberDecl, contextualMapper); @@ -17113,7 +12437,9 @@ var ts; } else { ts.Debug.assert(memberDecl.kind === 219); - type = memberDecl.name.kind === 126 ? unknownType : checkExpression(memberDecl.name, contextualMapper); + type = memberDecl.name.kind === 126 + ? unknownType + : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -17229,7 +12555,9 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 153 ? node.expression : node.left; + var left = node.kind === 153 + ? node.expression + : node.left; var type = checkExpressionOrQualifiedName(left); if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); @@ -17266,7 +12594,8 @@ var ts; return unknownType; } var isConstEnum = isConstEnumObjectType(objectType); - if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + if (isConstEnum && + (!node.argumentExpression || node.argumentExpression.kind !== 8)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } @@ -17433,7 +12762,8 @@ var ts; callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; } - var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + var hasRightNumberOfTypeArgs = !typeArguments || + (signature.typeParameters && typeArguments.length === signature.typeParameters.length); if (!hasRightNumberOfTypeArgs) { return false; } @@ -17450,7 +12780,8 @@ var ts; function getSingleCallSignature(type) { if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); - if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && + resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { return resolved.callSignatures[0]; } } @@ -17521,7 +12852,9 @@ var ts; var arg = args[i]; if (arg.kind !== 172) { var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); - var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : + arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : + checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { return false; } @@ -17533,9 +12866,7 @@ var ts; var args; if (node.kind === 157) { var template = node.template; - args = [ - template - ]; + args = [template]; if (template.kind === 169) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); @@ -17790,7 +13121,10 @@ var ts; } if (node.kind === 156) { var declaration = signature.declaration; - if (declaration && declaration.kind !== 133 && declaration.kind !== 137 && declaration.kind !== 141) { + if (declaration && + declaration.kind !== 133 && + declaration.kind !== 137 && + declaration.kind !== 141) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -17815,9 +13149,13 @@ var ts; } function getTypeAtPosition(signature, pos) { if (pos >= 0) { - return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + return signature.hasRestParameter ? + pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : + pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; } - return signature.hasRestParameter ? getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : anyArrayType; + return signature.hasRestParameter ? + getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : + anyArrayType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -17966,16 +13304,14 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 64: - { - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; - } - case 153: - { - var _symbol = findSymbol(n); - return !_symbol || _symbol === unknownSymbol || (_symbol.flags & ~8) !== 0; - } + case 64: { + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + } + case 153: { + var _symbol = findSymbol(n); + return !_symbol || _symbol === unknownSymbol || (_symbol.flags & ~8) !== 0; + } case 154: return true; case 159: @@ -17987,22 +13323,20 @@ var ts; function isConstVariableReference(n) { switch (n.kind) { case 64: - case 153: - { - var symbol = findSymbol(n); - return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; - } - case 154: - { - var index = n.argumentExpression; - var _symbol = findSymbol(n.expression); - if (_symbol && index && index.kind === 8) { - var _name = index.text; - var prop = getPropertyOfType(getTypeOfSymbol(_symbol), _name); - return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; - } - return false; + case 153: { + var symbol = findSymbol(n); + return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; + } + case 154: { + var index = n.argumentExpression; + var _symbol = findSymbol(n.expression); + if (_symbol && index && index.kind === 8) { + var _name = index.text; + var prop = getPropertyOfType(getTypeOfSymbol(_symbol), _name); + return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; } + return false; + } case 159: return isConstVariableReference(n.expression); default: @@ -18130,7 +13464,10 @@ var ts; var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var _name = p.name; - var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); + var type = sourceType.flags & 1 ? sourceType : + getTypeOfPropertyOfType(sourceType, _name.text) || + isNumericLiteralName(_name.text) && getIndexTypeOfType(sourceType, 1) || + getIndexTypeOfType(sourceType, 0); if (type) { checkDestructuringAssignment(p.initializer || _name, type); } @@ -18155,7 +13492,9 @@ var ts; if (e.kind !== 172) { if (e.kind !== 171) { var propName = "" + i; - var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); + var type = sourceType.flags & 1 ? sourceType : + isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : + getIndexTypeOfType(sourceType, 1); if (type) { checkDestructuringAssignment(e, type, contextualMapper); } @@ -18236,7 +13575,9 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var suggestedOperator; - if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + if ((leftType.flags & 8) && + (rightType.flags & 8) && + (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { @@ -18298,10 +13639,7 @@ var ts; case 48: return rightType; case 49: - return getUnionType([ - leftType, - rightType - ]); + return getUnionType([leftType, rightType]); case 52: checkAssignmentOperator(rightType); return rightType; @@ -18309,7 +13647,9 @@ var ts; return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : + someConstituentTypeHasKind(rightType, 1048576) ? node.right : + undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); return false; @@ -18355,10 +13695,7 @@ var ts; checkExpression(node.condition); var type1 = checkExpression(node.whenTrue, contextualMapper); var type2 = checkExpression(node.whenFalse, contextualMapper); - return getUnionType([ - type1, - type2 - ]); + return getUnionType([type1, type2]); } function checkTemplateExpression(node) { ts.forEach(node.templateSpans, function (templateSpan) { @@ -18422,7 +13759,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 153 && node.parent.expression === node) || (node.parent.kind === 154 && node.parent.expression === node) || ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 153 && node.parent.expression === node) || + (node.parent.kind === 154 && node.parent.expression === node) || + ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -18532,7 +13871,9 @@ var ts; if (node.kind === 138) { checkGrammarIndexSignature(node); } - else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || node.kind === 136 || node.kind === 133 || node.kind === 137) { + else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || + node.kind === 136 || node.kind === 133 || + node.kind === 137) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -18626,10 +13967,8 @@ var ts; case 160: case 195: case 161: - case 152: - return false; - default: - return ts.forEachChild(n, containsSuperCall); + case 152: return false; + default: return ts.forEachChild(n, containsSuperCall); } } function markThisReferencesAsErrors(n) { @@ -18641,13 +13980,14 @@ var ts; } } function isInstancePropertyWithInitializer(n) { - return n.kind === 130 && !(n.flags & 128) && !!n.initializer; + return n.kind === 130 && + !(n.flags & 128) && + !!n.initializer; } if (ts.getClassBaseTypeNode(node.parent)) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { - return p.flags & (16 | 32 | 64); - }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || + ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); if (superCallShouldBeFirst) { var statements = node.body.statements; if (!statements.length || statements[0].kind !== 177 || !isSuperCallExpression(statements[0].expression)) { @@ -18970,16 +14310,16 @@ var ts; case 197: return 2097152; case 200: - return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; + return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 + ? 4194304 | 1048576 + : 4194304; case 196: case 199: return 2097152 | 1048576; case 203: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { - result |= getDeclarationSpaces(d); - }); + ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); return result; default: return 1048576; @@ -18988,7 +14328,10 @@ var ts; } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); + checkFunctionLikeDeclaration(node) || + checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionName(node.name) || + checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -19043,7 +14386,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 130 || node.kind === 129 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135) { + if (node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 131 || + node.kind === 134 || + node.kind === 135) { return false; } if (ts.isInAmbientContext(node)) { @@ -19111,11 +14459,17 @@ var ts; var symbol = getSymbolOfNode(node); if (symbol.flags & 1) { var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); - if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { + if (localDeclarationSymbol && + localDeclarationSymbol !== symbol && + localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 194); - var container = varDeclList.parent.kind === 175 && varDeclList.parent.parent; - var namesShareScope = container && (container.kind === 174 && ts.isFunctionLike(container.parent) || (container.kind === 201 && container.kind === 200) || container.kind === 221); + var container = varDeclList.parent.kind === 175 && + varDeclList.parent.parent; + var namesShareScope = container && + (container.kind === 174 && ts.isFunctionLike(container.parent) || + (container.kind === 201 && container.kind === 200) || + container.kind === 221); if (!namesShareScope) { var _name = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, _name, _name); @@ -19332,15 +14686,17 @@ var ts; } function checkRightHandSideOfForOf(rhsExpression) { var expressionType = getTypeOfExpression(rhsExpression); - return languageVersion >= 2 ? checkIteratedType(expressionType, rhsExpression) : checkElementTypeOfArrayOrString(expressionType, rhsExpression); + return languageVersion >= 2 + ? checkIteratedType(expressionType, rhsExpression) + : checkElementTypeOfArrayOrString(expressionType, rhsExpression); } function checkIteratedType(iterable, expressionForError) { ts.Debug.assert(languageVersion >= 2); var iteratedType = getIteratedType(iterable, expressionForError); if (expressionForError && iteratedType) { - var completeIterableType = globalIterableType !== emptyObjectType ? createTypeReference(globalIterableType, [ - iteratedType - ]) : emptyObjectType; + var completeIterableType = globalIterableType !== emptyObjectType + ? createTypeReference(globalIterableType, [iteratedType]) + : emptyObjectType; checkTypeAssignableTo(iterable, completeIterableType, expressionForError); } return iteratedType; @@ -19404,7 +14760,9 @@ var ts; } if (!isArrayLikeType(arrayType)) { if (!reportedError) { - var diagnostic = hasStringConstituent ? ts.Diagnostics.Type_0_is_not_an_array_type : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + var diagnostic = hasStringConstituent + ? ts.Diagnostics.Type_0_is_not_an_array_type + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; error(expressionForError, diagnostic, typeToString(arrayType)); } return hasStringConstituent ? stringType : unknownType; @@ -19414,10 +14772,7 @@ var ts; if (arrayElementType.flags & 258) { return stringType; } - return getUnionType([ - arrayElementType, - stringType - ]); + return getUnionType([arrayElementType, stringType]); } return arrayElementType; } @@ -19579,9 +14934,7 @@ var ts; if (stringIndexType && numberIndexType) { errorNode = declaredNumberIndexer || declaredStringIndexer; if (!errorNode && (type.flags & 2048)) { - var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { - return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); - }); + var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); }); errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; } } @@ -19603,13 +14956,13 @@ var ts; _errorNode = indexDeclaration; } else if (containingType.flags & 2048) { - var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { - return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); - }); + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); _errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } if (_errorNode && !isTypeAssignableTo(propertyType, indexType)) { - var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + var errorMessage = indexKind === 0 + ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 + : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; error(_errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); } } @@ -19774,12 +15127,7 @@ var ts; return true; } var seen = {}; - ts.forEach(type.declaredProperties, function (p) { - seen[p.name] = { - prop: p, - containingType: type - }; - }); + ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { var base = _a[_i]; @@ -19787,10 +15135,7 @@ var ts; for (var _b = 0, _c = properties.length; _b < _c; _b++) { var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { - seen[prop.name] = { - prop: prop, - containingType: base - }; + seen[prop.name] = { prop: prop, containingType: base }; } else { var existing = seen[prop.name]; @@ -19893,12 +15238,9 @@ var ts; return undefined; } switch (e.operator) { - case 33: - return value; - case 34: - return -value; - case 47: - return enumIsConst ? ~value : undefined; + case 33: return value; + case 34: return -value; + case 47: return enumIsConst ? ~value : undefined; } return undefined; case 167: @@ -19914,28 +15256,17 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 44: - return left | right; - case 43: - return left & right; - case 41: - return left >> right; - case 42: - return left >>> right; - case 40: - return left << right; - case 45: - return left ^ right; - case 35: - return left * right; - case 36: - return left / right; - case 33: - return left + right; - case 34: - return left - right; - case 37: - return left % right; + case 44: return left | right; + case 43: return left & right; + case 41: return left >> right; + case 42: return left >>> right; + case 40: return left << right; + case 45: return left ^ right; + case 35: return left * right; + case 36: return left / right; + case 33: return left + right; + case 34: return left - right; + case 37: return left % right; } return undefined; case 7: @@ -19958,7 +15289,8 @@ var ts; } else { if (e.kind === 154) { - if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { + if (e.argumentExpression === undefined || + e.argumentExpression.kind !== 8) { return undefined; } _enumType = getTypeOfNode(e.expression); @@ -20054,7 +15386,10 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + if (symbol.flags & 512 + && symbol.declarations.length > 1 + && !ts.isInAmbientContext(node) + && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -20090,7 +15425,9 @@ var ts; } var inAmbientExternalModule = node.parent.kind === 201 && node.parent.parent.name.kind === 8; if (node.parent.kind !== 221 && !inAmbientExternalModule) { - error(moduleName, node.kind === 210 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + error(moduleName, node.kind === 210 ? + ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : + ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { @@ -20103,9 +15440,13 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | + (symbol.flags & 793056 ? 793056 : 0) | + (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 212 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; + var message = node.kind === 212 ? + ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : + ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); } } @@ -20539,7 +15880,9 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 64 && isTypeDeclaration(name.parent) && name.parent.name === name; + return name.kind == 64 && + isTypeDeclaration(name.parent) && + name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { @@ -20633,7 +15976,8 @@ var ts; return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 125 && node.parent.right === node) || (node.parent.kind === 153 && node.parent.name === node); + return (node.parent.kind === 125 && node.parent.right === node) || + (node.parent.kind === 153 && node.parent.name === node); } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { @@ -20688,7 +16032,9 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 64 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 209 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); + return node.parent.kind === 209 + ? getSymbolOfEntityNameOrPropertyAccessExpression(node) + : getSymbolOfPartOfRightHandSideOfImportEquals(node); } switch (node.kind) { case 64: @@ -20707,7 +16053,10 @@ var ts; return undefined; case 8: var moduleName; - if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || ((node.parent.kind === 204 || node.parent.kind === 210) && node.parent.moduleSpecifier === node)) { + if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && + ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || + ((node.parent.kind === 204 || node.parent.kind === 210) && + node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 7: @@ -20793,14 +16142,10 @@ var ts; else if (symbol.flags & 67108864) { var target = getSymbolLinks(symbol).target; if (target) { - return [ - target - ]; + return [target]; } } - return [ - symbol - ]; + return [symbol]; } function isExternalModuleSymbol(symbol) { return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 221; @@ -20882,7 +16227,8 @@ var ts; } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 8 ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + var baseName = expr.kind === 8 ? + ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; assignGeneratedName(node, makeUniqueName(baseName)); } function generateNameForImportDeclaration(node) { @@ -20980,7 +16326,8 @@ var ts; if (ts.nodeIsPresent(node.body)) { var symbol = getSymbolOfNode(node); var signaturesOfSymbol = getSignaturesOfSymbol(symbol); - return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + return signaturesOfSymbol.length > 1 || + (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); } return false; } @@ -21007,7 +16354,9 @@ var ts; } function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { var symbol = getSymbolOfNode(declaration); - var type = symbol && !(symbol.flags & (2048 | 131072)) ? getTypeOfSymbol(symbol) : unknownType; + var type = symbol && !(symbol.flags & (2048 | 131072)) + ? getTypeOfSymbol(symbol) + : unknownType; getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -21016,19 +16365,29 @@ var ts; } function isUnknownIdentifier(location, name) { ts.Debug.assert(!ts.nodeIsSynthesized(location), "isUnknownIdentifier called with a synthesized location"); - return !resolveName(location, name, 107455, undefined, undefined) && !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); + return !resolveName(location, name, 107455, undefined, undefined) && + !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - if (n.parent.kind === 153 && n.parent.name === n) { + if (n.parent.kind === 153 && + n.parent.name === n) { return undefined; } - if (n.parent.kind === 150 && n.parent.propertyName === n) { + if (n.parent.kind === 150 && + n.parent.propertyName === n) { return undefined; } - var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || n.parent.kind === 150 ? getSymbolOfNode(n.parent) : undefined; - var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); - var isLetOrConst = symbol && (symbol.flags & 2) && symbol.valueDeclaration.parent.kind !== 217; + var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || + n.parent.kind === 150 + ? getSymbolOfNode(n.parent) + : undefined; + var symbol = declarationSymbol || + getNodeLinks(n).resolvedSymbol || + resolveName(n, n.text, 107455 | 8388608, undefined, undefined); + var isLetOrConst = symbol && + (symbol.flags & 2) && + symbol.valueDeclaration.parent.kind !== 217; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -21318,7 +16677,8 @@ var ts; } } function checkGrammarTypeArguments(node, typeArguments) { - return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + return checkGrammarForDisallowedTrailingComma(typeArguments) || + checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { @@ -21332,7 +16692,8 @@ var ts; } } function checkGrammarArguments(node, arguments) { - return checkGrammarForDisallowedTrailingComma(arguments) || checkGrammarForOmittedArgument(node, arguments); + return checkGrammarForDisallowedTrailingComma(arguments) || + checkGrammarForOmittedArgument(node, arguments); } function checkGrammarHeritageClause(node) { var types = node.types; @@ -21426,7 +16787,8 @@ var ts; for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var prop = _a[_i]; var _name = prop.name; - if (prop.kind === 172 || _name.kind === 126) { + if (prop.kind === 172 || + _name.kind === 126) { checkGrammarComputedPropertyName(_name); continue; } @@ -21482,16 +16844,22 @@ var ts; var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + var diagnostic = forInOrOfStatement.kind === 182 + ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement + : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var _diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + var _diagnostic = forInOrOfStatement.kind === 182 + ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer + : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, _diagnostic); } if (firstDeclaration.type) { - var _diagnostic_1 = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + var _diagnostic_1 = forInOrOfStatement.kind === 182 + ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation + : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, _diagnostic_1); } } @@ -21545,7 +16913,9 @@ var ts; } } function checkGrammarMethod(node) { - if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarForGenerator(node)) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionLikeDeclaration(node) || + checkGrammarForGenerator(node)) { return true; } if (node.parent.kind === 152) { @@ -21596,7 +16966,8 @@ var ts; switch (current.kind) { case 189: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 184 && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 184 + && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } @@ -21617,11 +16988,15 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + var message = node.kind === 185 + ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement + : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var _message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + var _message = node.kind === 185 + ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement + : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, _message); } } @@ -21658,7 +17033,8 @@ var ts; } } var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); - return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || + checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 64) { @@ -21791,7 +17167,8 @@ var ts; } function checkGrammarProperty(node) { if (node.parent.kind === 196) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || + checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } @@ -21810,7 +17187,12 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 197 || node.kind === 204 || node.kind === 203 || node.kind === 210 || node.kind === 209 || (node.flags & 2)) { + if (node.kind === 197 || + node.kind === 204 || + node.kind === 203 || + node.kind === 210 || + node.kind === 209 || + (node.flags & 2)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -21872,10 +17254,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var indentStrings = [ - "", - " " - ]; + var indentStrings = ["", " "]; function getIndentString(level) { if (indentStrings[level] === undefined) { indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; @@ -21950,34 +17329,21 @@ var ts; writeTextOfNode: writeTextOfNode, writeLiteral: writeLiteral, writeLine: writeLine, - increaseIndent: function () { - return indent++; - }, - decreaseIndent: function () { - return indent--; - }, - getIndent: function () { - return indent; - }, - getTextPos: function () { - return output.length; - }, - getLine: function () { - return lineCount + 1; - }, - getColumn: function () { - return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; - }, - getText: function () { - return output; - } + increaseIndent: function () { return indent++; }, + decreaseIndent: function () { return indent--; }, + getIndent: function () { return indent; }, + getTextPos: function () { return output.length; }, + getLine: function () { return lineCount + 1; }, + getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, + getText: function () { return output; } }; } function getLineOfLocalPosition(currentSourceFile, pos) { return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { - if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && + getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -22006,7 +17372,9 @@ var ts; var lineCount = ts.getLineStarts(currentSourceFile).length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); + var nextLineStart = (currentLine + 1) === lineCount + ? currentSourceFile.text.length + 1 + : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { firstCommentLineIndent = calculateIndent(ts.getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); @@ -22084,7 +17452,8 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 134 || member.kind === 135) && (member.flags & 128) === (accessor.flags & 128)) { + if ((member.kind === 134 || member.kind === 135) + && (member.flags & 128) === (accessor.flags & 128)) { var memberName = ts.getPropertyNameForPropertyNameNode(member.name); var accessorName = ts.getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -22141,8 +17510,7 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { - } : writeJsDocComments; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var aliasDeclarationEmitInfo = []; var referencePathsOutput = ""; @@ -22151,7 +17519,9 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 2048) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { + if (referencedFile && ((referencedFile.flags & 2048) || + shouldEmitToOwnFile(referencedFile, compilerOptions) || + !addedGlobalFileReference)) { writeReferencePath(referencedFile); if (!isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -22168,7 +17538,8 @@ var ts; if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && + !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } @@ -22222,9 +17593,7 @@ var ts; function writeAsychronousImportEqualsDeclarations(importEqualsDeclarations) { var oldWriter = writer; ts.forEach(importEqualsDeclarations, function (aliasToWrite) { - var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { - return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; - }); + var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; }); if (aliasEmitInfo) { createAndSetNewTextWriterWithSymbolWriter(); for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { @@ -22551,8 +17920,15 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 140 || node.parent.kind === 141 || (node.parent.parent && node.parent.parent.kind === 143)) { - ts.Debug.assert(node.parent.kind === 132 || node.parent.kind === 131 || node.parent.kind === 140 || node.parent.kind === 141 || node.parent.kind === 136 || node.parent.kind === 137); + if (node.parent.kind === 140 || + node.parent.kind === 141 || + (node.parent.parent && node.parent.parent.kind === 143)) { + ts.Debug.assert(node.parent.kind === 132 || + node.parent.kind === 131 || + node.parent.kind === 140 || + node.parent.kind === 141 || + node.parent.kind === 136 || + node.parent.kind === 137); emitType(node.constraint); } else { @@ -22615,7 +17991,9 @@ var ts; function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.parent.parent.kind === 196) { - diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + diagnosticMessage = isImplementsList ? + ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : + ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; @@ -22648,9 +18026,7 @@ var ts; emitTypeParameters(node.typeParameters); var baseTypeNode = ts.getClassBaseTypeNode(node); if (baseTypeNode) { - emitHeritageClause([ - baseTypeNode - ], false); + emitHeritageClause([baseTypeNode], false); } emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); write(" {"); @@ -22710,17 +18086,31 @@ var ts; function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.kind === 193) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } else if (node.kind === 130 || node.kind === 129) { if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } return diagnosticMessage !== undefined ? { @@ -22737,9 +18127,7 @@ var ts; } } function emitVariableStatement(node) { - var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { - return resolver.isDeclarationVisible(varDeclaration); - }); + var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); if (hasDeclarationWithEmit) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); @@ -22785,17 +18173,25 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 134 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; + return accessor.kind === 134 + ? accessor.type + : accessor.parameters.length > 0 + ? accessor.parameters[0].type + : undefined; } } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (accessorWithTypeAnnotation.kind === 135) { if (accessorWithTypeAnnotation.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } return { diagnosticMessage: diagnosticMessage, @@ -22805,10 +18201,18 @@ var ts; } else { if (accessorWithTypeAnnotation.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; } return { diagnosticMessage: diagnosticMessage, @@ -22822,7 +18226,8 @@ var ts; if (ts.hasDynamicName(node)) { return; } - if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && + !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); if (node.kind === 195) { emitModuleElementDeclarationFlags(node); @@ -22889,28 +18294,48 @@ var ts; var diagnosticMessage; switch (node.kind) { case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 132: case 131: if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: ts.Debug.fail("This is unknown kind for signature: " + node.kind); @@ -22937,7 +18362,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 140 || node.parent.kind === 141 || node.parent.parent.kind === 143) { + if (node.parent.kind === 140 || + node.parent.kind === 141 || + node.parent.parent.kind === 143) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -22947,28 +18374,50 @@ var ts; var diagnosticMessage; switch (node.parent.kind) { case 133: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; break; case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 132: case 131: if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } else if (node.parent.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); @@ -23020,7 +18469,11 @@ var ts; } } function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 2048 ? referencedFile.fileName : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + var declFileName = referencedFile.flags & 2048 + ? referencedFile.fileName + : shouldEmitToOwnFile(referencedFile, compilerOptions) + ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") + : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencePathsOutput += "/// " + newLine; } @@ -23084,28 +18537,20 @@ var ts; var exportSpecifiers; var exportDefault; var writeEmittedFiles = writeJavaScriptFile; - var emitLeadingComments = compilerOptions.removeComments ? function (node) { - } : emitLeadingDeclarationComments; - var emitTrailingComments = compilerOptions.removeComments ? function (node) { - } : emitTrailingDeclarationComments; - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { - } : emitLeadingCommentsOfLocalPosition; + var emitLeadingComments = compilerOptions.removeComments ? function (node) { } : emitLeadingDeclarationComments; + var emitTrailingComments = compilerOptions.removeComments ? function (node) { } : emitTrailingDeclarationComments; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfLocalPosition; var detachedCommentsInfo; - var emitDetachedComments = compilerOptions.removeComments ? function (node) { - } : emitDetachedCommentsAtPosition; + var emitDetachedComments = compilerOptions.removeComments ? function (node) { } : emitDetachedCommentsAtPosition; var writeComment = writeCommentRange; var emitNodeWithoutSourceMap = compilerOptions.removeComments ? emitNodeWithoutSourceMapWithoutComments : emitNodeWithoutSourceMapWithComments; var emit = emitNodeWithoutSourceMap; var emitWithoutComments = emitNodeWithoutSourceMapWithoutComments; - var emitStart = function (node) { - }; - var emitEnd = function (node) { - }; + var emitStart = function (node) { }; + var emitEnd = function (node) { }; var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { - }; - var scopeEmitEnd = function () { - }; + var scopeEmitStart = function (scopeDeclaration, scopeName) { }; + var scopeEmitEnd = function () { }; var sourceMapData; if (compilerOptions.sourceMap) { initializeEmitterWithSourceMaps(); @@ -23131,10 +18576,7 @@ var ts; var names = currentScopeNames; currentScopeNames = undefined; if (names) { - lastFrame = { - names: names, - previous: lastFrame - }; + lastFrame = { names: names, previous: lastFrame }; return true; } return false; @@ -23154,9 +18596,7 @@ var ts; _name = baseName; } else { - _name = ts.generateUniqueName(baseName, function (n) { - return isExistingName(location, n); - }); + _name = ts.generateUniqueName(baseName, function (n) { return isExistingName(location, n); }); } return recordNameInCurrentScope(_name); } @@ -23256,7 +18696,12 @@ var ts; sourceLinePos.character++; var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine != emittedLine || + lastRecordedSourceMapSpan.emittedColumn != emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { encodeLastRecordedSourceMapSpan(); lastRecordedSourceMapSpan = { emittedLine: emittedLine, @@ -23319,10 +18764,20 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 195 || node.kind === 160 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135 || node.kind === 200 || node.kind === 196 || node.kind === 199) { + else if (node.kind === 195 || + node.kind === 160 || + node.kind === 132 || + node.kind === 131 || + node.kind === 134 || + node.kind === 135 || + node.kind === 200 || + node.kind === 196 || + node.kind === 199) { if (node.name) { var _name = node.name; - scopeName = _name.kind === 126 ? ts.getTextOfNode(_name) : node.name.text; + scopeName = _name.kind === 126 + ? ts.getTextOfNode(_name) + : node.name.text; } recordScopeNameStart(scopeName); } @@ -23669,7 +19124,8 @@ var ts; if (node.template.kind === 169) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 167 && templateSpan.expression.operatorToken.kind === 23; + var needsParens = templateSpan.expression.kind === 167 + && templateSpan.expression.operatorToken.kind === 23; emitParenthesizedIf(templateSpan.expression, needsParens); }); } @@ -23680,7 +19136,8 @@ var ts; ts.forEachChild(node, emit); return; } - var emitOuterParens = ts.isExpression(node.parent) && templateNeedsParens(node, node.parent); + var emitOuterParens = ts.isExpression(node.parent) + && templateNeedsParens(node, node.parent); if (emitOuterParens) { write("("); } @@ -23691,7 +19148,8 @@ var ts; } for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 159 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + var needsParens = templateSpan.expression.kind !== 159 + && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); } @@ -24188,9 +19646,7 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { - return e.kind === 171; - }); + return ts.forEach(elements, function (e) { return e.kind === 171; }); } function skipParentheses(node) { while (node.kind === 159 || node.kind === 158) { @@ -24303,7 +19759,14 @@ var ts; while (operand.kind == 158) { operand = operand.expression; } - if (operand.kind !== 165 && operand.kind !== 164 && operand.kind !== 163 && operand.kind !== 162 && operand.kind !== 166 && operand.kind !== 156 && !(operand.kind === 155 && node.parent.kind === 156) && !(operand.kind === 160 && node.parent.kind === 155)) { + if (operand.kind !== 165 && + operand.kind !== 164 && + operand.kind !== 163 && + operand.kind !== 162 && + operand.kind !== 166 && + operand.kind !== 156 && + !(operand.kind === 155 && node.parent.kind === 156) && + !(operand.kind === 160 && node.parent.kind === 155)) { emit(operand); return; } @@ -24346,7 +19809,8 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operatorToken.kind === 52 && (node.left.kind === 152 || node.left.kind === 151)) { + if (languageVersion < 2 && node.operatorToken.kind === 52 && + (node.left.kind === 152 || node.left.kind === 151)) { emitDestructuring(node, node.parent.kind === 177); } else { @@ -24666,13 +20130,16 @@ var ts; emitToken(15, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function nodeEndPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, node2.end); + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { if (node.kind === 214) { @@ -24966,8 +20433,11 @@ var ts; emitModuleMemberName(node); var initializer = node.initializer; if (!initializer && languageVersion < 2) { - var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); - if (isUninitializedLet && node.parent.parent.kind !== 182 && node.parent.parent.kind !== 183) { + var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && + (getCombinedFlagsForIdentifier(node.name) & 4096); + if (isUninitializedLet && + node.parent.parent.kind !== 182 && + node.parent.parent.kind !== 183) { initializer = createVoidZero(); } } @@ -24990,7 +20460,10 @@ var ts; return ts.getCombinedNodeFlags(node.parent); } function renameNonTopLevelLetAndConst(node) { - if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 64 || (node.parent.kind !== 193 && node.parent.kind !== 150)) { + if (languageVersion >= 2 || + ts.nodeIsSynthesized(node) || + node.kind !== 64 || + (node.parent.kind !== 193 && node.parent.kind !== 150)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); @@ -25002,7 +20475,9 @@ var ts; return; } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var _parent = blockScopeContainer.kind === 221 ? blockScopeContainer : blockScopeContainer.parent; + var _parent = blockScopeContainer.kind === 221 + ? blockScopeContainer + : blockScopeContainer.parent; var generatedName = generateUniqueNameForLocation(_parent, node.text); var variableId = resolver.getBlockScopedVariableId(node); if (!generatedBlockScopeNames) { @@ -25765,7 +21240,8 @@ var ts; emitImportDeclaration(node); return; } - if (resolver.isReferencedAliasDeclaration(node) || (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + if (resolver.isReferencedAliasDeclaration(node) || + (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); if (!(node.flags & 1)) @@ -26287,10 +21763,7 @@ var ts; else { leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); } - emitNewLineBeforeLeadingComments(currentSourceFile, writer, { - pos: pos, - end: pos - }, leadingComments); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitDetachedCommentsAtPosition(node) { @@ -26315,17 +21788,12 @@ var ts; if (nodeLine >= lastCommentLine + 2) { emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { - nodePos: node.pos, - detachedCommentEndPos: detachedComments[detachedComments.length - 1].end - }; + var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); } else { - detachedCommentsInfo = [ - currentDetachedCommentInfo - ]; + detachedCommentsInfo = [currentDetachedCommentInfo]; } } } @@ -26337,7 +21805,10 @@ var ts; if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && + currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { return true; } } @@ -26391,7 +21862,9 @@ var ts; } catch (e) { if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText : e.message); + onError(e.number === unsupportedFileEncodingErrorCode + ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText + : e.message); } text = ""; } @@ -26427,20 +21900,12 @@ var ts; } return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { - return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); - }, + getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, writeFile: writeFile, - getCurrentDirectory: function () { - return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); - }, - useCaseSensitiveFileNames: function () { - return ts.sys.useCaseSensitiveFileNames; - }, + getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, + useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, getCanonicalFileName: getCanonicalFileName, - getNewLine: function () { - return ts.sys.newLine; - } + getNewLine: function () { return ts.sys.newLine; } }; } ts.createCompilerHost = createCompilerHost; @@ -26480,9 +21945,7 @@ var ts; var seenNoDefaultLib = options.noLib; var commonSourceDirectory; host = host || createCompilerHost(options); - ts.forEach(rootNames, function (name) { - return processRootFile(name, false); - }); + ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); if (!seenNoDefaultLib) { processRootFile(host.getDefaultLibFileName(options), true); } @@ -26491,35 +21954,21 @@ var ts; var noDiagnosticsTypeChecker; program = { getSourceFile: getSourceFile, - getSourceFiles: function () { - return files; - }, - getCompilerOptions: function () { - return options; - }, + getSourceFiles: function () { return files; }, + getCompilerOptions: function () { return options; }, getSyntacticDiagnostics: getSyntacticDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, getDeclarationDiagnostics: getDeclarationDiagnostics, getTypeChecker: getTypeChecker, getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, - getCommonSourceDirectory: function () { - return commonSourceDirectory; - }, + getCommonSourceDirectory: function () { return commonSourceDirectory; }, emit: emit, getCurrentDirectory: host.getCurrentDirectory, - getNodeCount: function () { - return getDiagnosticsProducingTypeChecker().getNodeCount(); - }, - getIdentifierCount: function () { - return getDiagnosticsProducingTypeChecker().getIdentifierCount(); - }, - getSymbolCount: function () { - return getDiagnosticsProducingTypeChecker().getSymbolCount(); - }, - getTypeCount: function () { - return getDiagnosticsProducingTypeChecker().getTypeCount(); - } + getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, + getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, + getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, + getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } }; return program; function getEmitHost(writeFileCallback) { @@ -26546,11 +21995,7 @@ var ts; } function emit(sourceFile, writeFileCallback) { if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { - return { - diagnostics: [], - sourceMaps: undefined, - emitSkipped: true - }; + return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); var start = new Date().getTime(); @@ -26716,7 +22161,8 @@ var ts; } else if (node.kind === 200 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportEqualsDeclaration(node) && + ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { @@ -26744,17 +22190,19 @@ var ts; } return; } - var firstExternalModuleSourceFile = ts.forEach(files, function (f) { - return ts.isExternalModule(f) ? f : undefined; - }); + var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (firstExternalModuleSourceFile && !options.module) { var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } - if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModuleSourceFile !== undefined))) { + if (options.outDir || + options.sourceRoot || + (options.mapRoot && + (!options.out || firstExternalModuleSourceFile !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { - if (!(sourceFile.flags & 2048) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { + if (!(sourceFile.flags & 2048) + && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); sourcePathComponents.pop(); if (commonPathComponents) { @@ -26947,11 +22395,7 @@ var ts; { name: "target", shortName: "t", - type: { - "es3": 0, - "es5": 1, - "es6": 2 - }, + type: { "es3": 0, "es5": 1, "es6": 2 }, description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, paramType: ts.Diagnostics.VERSION, error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6 @@ -27131,9 +22575,7 @@ var ts; var files = []; if (ts.hasProperty(json, "files")) { if (json["files"] instanceof Array) { - var files = ts.map(json["files"], function (s) { - return ts.combinePaths(basePath, s); - }); + var files = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } } else { @@ -27160,7 +22602,8 @@ var ts; } var language = matchResult[1]; var territory = matchResult[3]; - if (!trySetLanguageAndTerritory(language, territory, errors) && !trySetLanguageAndTerritory(language, undefined, errors)) { + if (!trySetLanguageAndTerritory(language, territory, errors) && + !trySetLanguageAndTerritory(language, undefined, errors)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_locale_0, locale)); return false; } @@ -27362,9 +22805,7 @@ var ts; } var sourceFile = hostGetSourceFile(fileName, languageVersion, onError); if (sourceFile && compilerOptions.watch) { - sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.fileName, function () { - return sourceFileChanged(sourceFile); - }); + sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.fileName, function () { return sourceFileChanged(sourceFile); }); } return sourceFile; } @@ -27440,10 +22881,7 @@ var ts; reportTimeStatistic("Compile time", compileTime); reportTimeStatistic("Total time", end); } - return { - program: program, - exitStatus: exitStatus - }; + return { program: program, exitStatus: exitStatus }; function compileProgram() { var diagnostics = program.getSyntacticDiagnostics(); reportDiagnostics(diagnostics); @@ -27456,7 +22894,9 @@ var ts; } } if (compilerOptions.noEmit) { - return diagnostics.length ? 1 : 0; + return diagnostics.length + ? 1 + : 0; } var emitOutput = program.emit(); reportDiagnostics(emitOutput.diagnostics); @@ -27487,12 +22927,8 @@ var ts; output += padding + "tsc @args.txt" + ts.sys.newLine; output += ts.sys.newLine; output += getDiagnosticText(ts.Diagnostics.Options_Colon) + ts.sys.newLine; - var optsList = ts.filter(ts.optionDeclarations.slice(), function (v) { - return !v.experimental; - }); - optsList.sort(function (a, b) { - return ts.compareValues(a.name.toLowerCase(), b.name.toLowerCase()); - }); + var optsList = ts.filter(ts.optionDeclarations.slice(), function (v) { return !v.experimental; }); + optsList.sort(function (a, b) { return ts.compareValues(a.name.toLowerCase(), b.name.toLowerCase()); }); var marginLength = 0; var usageColumn = []; var descriptionColumn = []; diff --git a/bin/tsserver.js b/bin/tsserver.js index d44ebe93392..44075b1f778 100644 --- a/bin/tsserver.js +++ b/bin/tsserver.js @@ -253,13 +253,13 @@ var ts; ts.arrayToMap = arrayToMap; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (match, index) { - return args[+index + baseIndex]; - }); + return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); } ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { - return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] ? ts.localizedDiagnosticMessages[message] : message; + return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] + ? ts.localizedDiagnosticMessages[message] + : message; } ts.getLocaleSpecificMessage = getLocaleSpecificMessage; function createFileDiagnostic(file, start, length, message) { @@ -330,7 +330,12 @@ var ts; return diagnostic.file ? diagnostic.file.fileName : undefined; } function compareDiagnostics(d1, d2) { - return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0; + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || + compareValues(d1.start, d2.start) || + compareValues(d1.length, d2.length) || + compareValues(d1.code, d2.code) || + compareMessageText(d1.messageText, d2.messageText) || + 0; } ts.compareDiagnostics = compareDiagnostics; function compareMessageText(text1, text2) { @@ -357,9 +362,7 @@ var ts; if (diagnostics.length < 2) { return diagnostics; } - var newDiagnostics = [ - diagnostics[0] - ]; + var newDiagnostics = [diagnostics[0]]; var previousDiagnostic = diagnostics[0]; for (var i = 1; i < diagnostics.length; i++) { var currentDiagnostic = diagnostics[i]; @@ -436,9 +439,7 @@ var ts; ts.isRootedDiskPath = isRootedDiskPath; function normalizedPathComponents(path, rootLength) { var normalizedParts = getNormalizedParts(path, rootLength); - return [ - path.substr(0, rootLength) - ].concat(normalizedParts); + return [path.substr(0, rootLength)].concat(normalizedParts); } function getNormalizedPathComponents(path, currentDirectory) { path = normalizeSlashes(path); @@ -472,9 +473,7 @@ var ts; } } if (rootLength === urlLength) { - return [ - url - ]; + return [url]; } var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); if (indexOfNextSlash !== -1) { @@ -482,9 +481,7 @@ var ts; return normalizedPathComponents(url, rootLength); } else { - return [ - url + ts.directorySeparator - ]; + return [url + ts.directorySeparator]; } } function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { @@ -546,11 +543,7 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [ - ".d.ts", - ".ts", - ".js" - ]; + var supportedExtensions = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { var ext = supportedExtensions[_i]; @@ -604,15 +597,9 @@ var ts; }; return Node; }, - getSymbolConstructor: function () { - return Symbol; - }, - getTypeConstructor: function () { - return Type; - }, - getSignatureConstructor: function () { - return Signature; - } + getSymbolConstructor: function () { return Symbol; }, + getTypeConstructor: function () { return Type; }, + getSignatureConstructor: function () { return Signature; } }; var Debug; (function (Debug) { @@ -833,14 +820,9 @@ var ts; readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { - _fs.watchFile(fileName, { - persistent: true, - interval: 250 - }, fileChanged); + _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); return { - close: function () { - _fs.unwatchFile(fileName, fileChanged); - } + close: function () { _fs.unwatchFile(fileName, fileChanged); } }; function fileChanged(curr, prev) { if (+curr.mtime <= +prev.mtime) { @@ -896,2431 +878,491 @@ var ts; var ts; (function (ts) { ts.Diagnostics = { - Unterminated_string_literal: { - code: 1002, - category: 1, - key: "Unterminated string literal." - }, - Identifier_expected: { - code: 1003, - category: 1, - key: "Identifier expected." - }, - _0_expected: { - code: 1005, - category: 1, - key: "'{0}' expected." - }, - A_file_cannot_have_a_reference_to_itself: { - code: 1006, - category: 1, - key: "A file cannot have a reference to itself." - }, - Trailing_comma_not_allowed: { - code: 1009, - category: 1, - key: "Trailing comma not allowed." - }, - Asterisk_Slash_expected: { - code: 1010, - category: 1, - key: "'*/' expected." - }, - Unexpected_token: { - code: 1012, - category: 1, - key: "Unexpected token." - }, - A_rest_parameter_must_be_last_in_a_parameter_list: { - code: 1014, - category: 1, - key: "A rest parameter must be last in a parameter list." - }, - Parameter_cannot_have_question_mark_and_initializer: { - code: 1015, - category: 1, - key: "Parameter cannot have question mark and initializer." - }, - A_required_parameter_cannot_follow_an_optional_parameter: { - code: 1016, - category: 1, - key: "A required parameter cannot follow an optional parameter." - }, - An_index_signature_cannot_have_a_rest_parameter: { - code: 1017, - category: 1, - key: "An index signature cannot have a rest parameter." - }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { - code: 1018, - category: 1, - key: "An index signature parameter cannot have an accessibility modifier." - }, - An_index_signature_parameter_cannot_have_a_question_mark: { - code: 1019, - category: 1, - key: "An index signature parameter cannot have a question mark." - }, - An_index_signature_parameter_cannot_have_an_initializer: { - code: 1020, - category: 1, - key: "An index signature parameter cannot have an initializer." - }, - An_index_signature_must_have_a_type_annotation: { - code: 1021, - category: 1, - key: "An index signature must have a type annotation." - }, - An_index_signature_parameter_must_have_a_type_annotation: { - code: 1022, - category: 1, - key: "An index signature parameter must have a type annotation." - }, - An_index_signature_parameter_type_must_be_string_or_number: { - code: 1023, - category: 1, - key: "An index signature parameter type must be 'string' or 'number'." - }, - A_class_or_interface_declaration_can_only_have_one_extends_clause: { - code: 1024, - category: 1, - key: "A class or interface declaration can only have one 'extends' clause." - }, - An_extends_clause_must_precede_an_implements_clause: { - code: 1025, - category: 1, - key: "An 'extends' clause must precede an 'implements' clause." - }, - A_class_can_only_extend_a_single_class: { - code: 1026, - category: 1, - key: "A class can only extend a single class." - }, - A_class_declaration_can_only_have_one_implements_clause: { - code: 1027, - category: 1, - key: "A class declaration can only have one 'implements' clause." - }, - Accessibility_modifier_already_seen: { - code: 1028, - category: 1, - key: "Accessibility modifier already seen." - }, - _0_modifier_must_precede_1_modifier: { - code: 1029, - category: 1, - key: "'{0}' modifier must precede '{1}' modifier." - }, - _0_modifier_already_seen: { - code: 1030, - category: 1, - key: "'{0}' modifier already seen." - }, - _0_modifier_cannot_appear_on_a_class_element: { - code: 1031, - category: 1, - key: "'{0}' modifier cannot appear on a class element." - }, - An_interface_declaration_cannot_have_an_implements_clause: { - code: 1032, - category: 1, - key: "An interface declaration cannot have an 'implements' clause." - }, - super_must_be_followed_by_an_argument_list_or_member_access: { - code: 1034, - category: 1, - key: "'super' must be followed by an argument list or member access." - }, - Only_ambient_modules_can_use_quoted_names: { - code: 1035, - category: 1, - key: "Only ambient modules can use quoted names." - }, - Statements_are_not_allowed_in_ambient_contexts: { - code: 1036, - category: 1, - key: "Statements are not allowed in ambient contexts." - }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { - code: 1038, - category: 1, - key: "A 'declare' modifier cannot be used in an already ambient context." - }, - Initializers_are_not_allowed_in_ambient_contexts: { - code: 1039, - category: 1, - key: "Initializers are not allowed in ambient contexts." - }, - _0_modifier_cannot_appear_on_a_module_element: { - code: 1044, - category: 1, - key: "'{0}' modifier cannot appear on a module element." - }, - A_declare_modifier_cannot_be_used_with_an_interface_declaration: { - code: 1045, - category: 1, - key: "A 'declare' modifier cannot be used with an interface declaration." - }, - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { - code: 1046, - category: 1, - key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." - }, - A_rest_parameter_cannot_be_optional: { - code: 1047, - category: 1, - key: "A rest parameter cannot be optional." - }, - A_rest_parameter_cannot_have_an_initializer: { - code: 1048, - category: 1, - key: "A rest parameter cannot have an initializer." - }, - A_set_accessor_must_have_exactly_one_parameter: { - code: 1049, - category: 1, - key: "A 'set' accessor must have exactly one parameter." - }, - A_set_accessor_cannot_have_an_optional_parameter: { - code: 1051, - category: 1, - key: "A 'set' accessor cannot have an optional parameter." - }, - A_set_accessor_parameter_cannot_have_an_initializer: { - code: 1052, - category: 1, - key: "A 'set' accessor parameter cannot have an initializer." - }, - A_set_accessor_cannot_have_rest_parameter: { - code: 1053, - category: 1, - key: "A 'set' accessor cannot have rest parameter." - }, - A_get_accessor_cannot_have_parameters: { - code: 1054, - category: 1, - key: "A 'get' accessor cannot have parameters." - }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { - code: 1056, - category: 1, - key: "Accessors are only available when targeting ECMAScript 5 and higher." - }, - Enum_member_must_have_initializer: { - code: 1061, - category: 1, - key: "Enum member must have initializer." - }, - An_export_assignment_cannot_be_used_in_an_internal_module: { - code: 1063, - category: 1, - key: "An export assignment cannot be used in an internal module." - }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { - code: 1066, - category: 1, - key: "Ambient enum elements can only have integer literal initializers." - }, - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { - code: 1068, - category: 1, - key: "Unexpected token. A constructor, method, accessor, or property was expected." - }, - A_declare_modifier_cannot_be_used_with_an_import_declaration: { - code: 1079, - category: 1, - key: "A 'declare' modifier cannot be used with an import declaration." - }, - Invalid_reference_directive_syntax: { - code: 1084, - category: 1, - key: "Invalid 'reference' directive syntax." - }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { - code: 1085, - category: 1, - key: "Octal literals are not available when targeting ECMAScript 5 and higher." - }, - An_accessor_cannot_be_declared_in_an_ambient_context: { - code: 1086, - category: 1, - key: "An accessor cannot be declared in an ambient context." - }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { - code: 1089, - category: 1, - key: "'{0}' modifier cannot appear on a constructor declaration." - }, - _0_modifier_cannot_appear_on_a_parameter: { - code: 1090, - category: 1, - key: "'{0}' modifier cannot appear on a parameter." - }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { - code: 1091, - category: 1, - key: "Only a single variable declaration is allowed in a 'for...in' statement." - }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { - code: 1092, - category: 1, - key: "Type parameters cannot appear on a constructor declaration." - }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { - code: 1093, - category: 1, - key: "Type annotation cannot appear on a constructor declaration." - }, - An_accessor_cannot_have_type_parameters: { - code: 1094, - category: 1, - key: "An accessor cannot have type parameters." - }, - A_set_accessor_cannot_have_a_return_type_annotation: { - code: 1095, - category: 1, - key: "A 'set' accessor cannot have a return type annotation." - }, - An_index_signature_must_have_exactly_one_parameter: { - code: 1096, - category: 1, - key: "An index signature must have exactly one parameter." - }, - _0_list_cannot_be_empty: { - code: 1097, - category: 1, - key: "'{0}' list cannot be empty." - }, - Type_parameter_list_cannot_be_empty: { - code: 1098, - category: 1, - key: "Type parameter list cannot be empty." - }, - Type_argument_list_cannot_be_empty: { - code: 1099, - category: 1, - key: "Type argument list cannot be empty." - }, - Invalid_use_of_0_in_strict_mode: { - code: 1100, - category: 1, - key: "Invalid use of '{0}' in strict mode." - }, - with_statements_are_not_allowed_in_strict_mode: { - code: 1101, - category: 1, - key: "'with' statements are not allowed in strict mode." - }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { - code: 1102, - category: 1, - key: "'delete' cannot be called on an identifier in strict mode." - }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { - code: 1104, - category: 1, - key: "A 'continue' statement can only be used within an enclosing iteration statement." - }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { - code: 1105, - category: 1, - key: "A 'break' statement can only be used within an enclosing iteration or switch statement." - }, - Jump_target_cannot_cross_function_boundary: { - code: 1107, - category: 1, - key: "Jump target cannot cross function boundary." - }, - A_return_statement_can_only_be_used_within_a_function_body: { - code: 1108, - category: 1, - key: "A 'return' statement can only be used within a function body." - }, - Expression_expected: { - code: 1109, - category: 1, - key: "Expression expected." - }, - Type_expected: { - code: 1110, - category: 1, - key: "Type expected." - }, - A_class_member_cannot_be_declared_optional: { - code: 1112, - category: 1, - key: "A class member cannot be declared optional." - }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { - code: 1113, - category: 1, - key: "A 'default' clause cannot appear more than once in a 'switch' statement." - }, - Duplicate_label_0: { - code: 1114, - category: 1, - key: "Duplicate label '{0}'" - }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { - code: 1115, - category: 1, - key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." - }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { - code: 1116, - category: 1, - key: "A 'break' statement can only jump to a label of an enclosing statement." - }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { - code: 1117, - category: 1, - key: "An object literal cannot have multiple properties with the same name in strict mode." - }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { - code: 1118, - category: 1, - key: "An object literal cannot have multiple get/set accessors with the same name." - }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { - code: 1119, - category: 1, - key: "An object literal cannot have property and accessor with the same name." - }, - An_export_assignment_cannot_have_modifiers: { - code: 1120, - category: 1, - key: "An export assignment cannot have modifiers." - }, - Octal_literals_are_not_allowed_in_strict_mode: { - code: 1121, - category: 1, - key: "Octal literals are not allowed in strict mode." - }, - A_tuple_type_element_list_cannot_be_empty: { - code: 1122, - category: 1, - key: "A tuple type element list cannot be empty." - }, - Variable_declaration_list_cannot_be_empty: { - code: 1123, - category: 1, - key: "Variable declaration list cannot be empty." - }, - Digit_expected: { - code: 1124, - category: 1, - key: "Digit expected." - }, - Hexadecimal_digit_expected: { - code: 1125, - category: 1, - key: "Hexadecimal digit expected." - }, - Unexpected_end_of_text: { - code: 1126, - category: 1, - key: "Unexpected end of text." - }, - Invalid_character: { - code: 1127, - category: 1, - key: "Invalid character." - }, - Declaration_or_statement_expected: { - code: 1128, - category: 1, - key: "Declaration or statement expected." - }, - Statement_expected: { - code: 1129, - category: 1, - key: "Statement expected." - }, - case_or_default_expected: { - code: 1130, - category: 1, - key: "'case' or 'default' expected." - }, - Property_or_signature_expected: { - code: 1131, - category: 1, - key: "Property or signature expected." - }, - Enum_member_expected: { - code: 1132, - category: 1, - key: "Enum member expected." - }, - Type_reference_expected: { - code: 1133, - category: 1, - key: "Type reference expected." - }, - Variable_declaration_expected: { - code: 1134, - category: 1, - key: "Variable declaration expected." - }, - Argument_expression_expected: { - code: 1135, - category: 1, - key: "Argument expression expected." - }, - Property_assignment_expected: { - code: 1136, - category: 1, - key: "Property assignment expected." - }, - Expression_or_comma_expected: { - code: 1137, - category: 1, - key: "Expression or comma expected." - }, - Parameter_declaration_expected: { - code: 1138, - category: 1, - key: "Parameter declaration expected." - }, - Type_parameter_declaration_expected: { - code: 1139, - category: 1, - key: "Type parameter declaration expected." - }, - Type_argument_expected: { - code: 1140, - category: 1, - key: "Type argument expected." - }, - String_literal_expected: { - code: 1141, - category: 1, - key: "String literal expected." - }, - Line_break_not_permitted_here: { - code: 1142, - category: 1, - key: "Line break not permitted here." - }, - or_expected: { - code: 1144, - category: 1, - key: "'{' or ';' expected." - }, - Modifiers_not_permitted_on_index_signature_members: { - code: 1145, - category: 1, - key: "Modifiers not permitted on index signature members." - }, - Declaration_expected: { - code: 1146, - category: 1, - key: "Declaration expected." - }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { - code: 1147, - category: 1, - key: "Import declarations in an internal module cannot reference an external module." - }, - Cannot_compile_external_modules_unless_the_module_flag_is_provided: { - code: 1148, - category: 1, - key: "Cannot compile external modules unless the '--module' flag is provided." - }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { - code: 1149, - category: 1, - key: "File name '{0}' differs from already included file name '{1}' only in casing" - }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { - code: 1150, - category: 1, - key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." - }, - var_let_or_const_expected: { - code: 1152, - category: 1, - key: "'var', 'let' or 'const' expected." - }, - let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 1153, - category: 1, - key: "'let' declarations are only available when targeting ECMAScript 6 and higher." - }, - const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 1154, - category: 1, - key: "'const' declarations are only available when targeting ECMAScript 6 and higher." - }, - const_declarations_must_be_initialized: { - code: 1155, - category: 1, - key: "'const' declarations must be initialized" - }, - const_declarations_can_only_be_declared_inside_a_block: { - code: 1156, - category: 1, - key: "'const' declarations can only be declared inside a block." - }, - let_declarations_can_only_be_declared_inside_a_block: { - code: 1157, - category: 1, - key: "'let' declarations can only be declared inside a block." - }, - Unterminated_template_literal: { - code: 1160, - category: 1, - key: "Unterminated template literal." - }, - Unterminated_regular_expression_literal: { - code: 1161, - category: 1, - key: "Unterminated regular expression literal." - }, - An_object_member_cannot_be_declared_optional: { - code: 1162, - category: 1, - key: "An object member cannot be declared optional." - }, - yield_expression_must_be_contained_within_a_generator_declaration: { - code: 1163, - category: 1, - key: "'yield' expression must be contained_within a generator declaration." - }, - Computed_property_names_are_not_allowed_in_enums: { - code: 1164, - category: 1, - key: "Computed property names are not allowed in enums." - }, - A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { - code: 1165, - category: 1, - key: "A computed property name in an ambient context must directly refer to a built-in symbol." - }, - A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { - code: 1166, - category: 1, - key: "A computed property name in a class property declaration must directly refer to a built-in symbol." - }, - Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 1167, - category: 1, - key: "Computed property names are only available when targeting ECMAScript 6 and higher." - }, - A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { - code: 1168, - category: 1, - key: "A computed property name in a method overload must directly refer to a built-in symbol." - }, - A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { - code: 1169, - category: 1, - key: "A computed property name in an interface must directly refer to a built-in symbol." - }, - A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { - code: 1170, - category: 1, - key: "A computed property name in a type literal must directly refer to a built-in symbol." - }, - A_comma_expression_is_not_allowed_in_a_computed_property_name: { - code: 1171, - category: 1, - key: "A comma expression is not allowed in a computed property name." - }, - extends_clause_already_seen: { - code: 1172, - category: 1, - key: "'extends' clause already seen." - }, - extends_clause_must_precede_implements_clause: { - code: 1173, - category: 1, - key: "'extends' clause must precede 'implements' clause." - }, - Classes_can_only_extend_a_single_class: { - code: 1174, - category: 1, - key: "Classes can only extend a single class." - }, - implements_clause_already_seen: { - code: 1175, - category: 1, - key: "'implements' clause already seen." - }, - Interface_declaration_cannot_have_implements_clause: { - code: 1176, - category: 1, - key: "Interface declaration cannot have 'implements' clause." - }, - Binary_digit_expected: { - code: 1177, - category: 1, - key: "Binary digit expected." - }, - Octal_digit_expected: { - code: 1178, - category: 1, - key: "Octal digit expected." - }, - Unexpected_token_expected: { - code: 1179, - category: 1, - key: "Unexpected token. '{' expected." - }, - Property_destructuring_pattern_expected: { - code: 1180, - category: 1, - key: "Property destructuring pattern expected." - }, - Array_element_destructuring_pattern_expected: { - code: 1181, - category: 1, - key: "Array element destructuring pattern expected." - }, - A_destructuring_declaration_must_have_an_initializer: { - code: 1182, - category: 1, - key: "A destructuring declaration must have an initializer." - }, - Destructuring_declarations_are_not_allowed_in_ambient_contexts: { - code: 1183, - category: 1, - key: "Destructuring declarations are not allowed in ambient contexts." - }, - An_implementation_cannot_be_declared_in_ambient_contexts: { - code: 1184, - category: 1, - key: "An implementation cannot be declared in ambient contexts." - }, - Modifiers_cannot_appear_here: { - code: 1184, - category: 1, - key: "Modifiers cannot appear here." - }, - Merge_conflict_marker_encountered: { - code: 1185, - category: 1, - key: "Merge conflict marker encountered." - }, - A_rest_element_cannot_have_an_initializer: { - code: 1186, - category: 1, - key: "A rest element cannot have an initializer." - }, - A_parameter_property_may_not_be_a_binding_pattern: { - code: 1187, - category: 1, - key: "A parameter property may not be a binding pattern." - }, - Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { - code: 1188, - category: 1, - key: "Only a single variable declaration is allowed in a 'for...of' statement." - }, - The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { - code: 1189, - category: 1, - key: "The variable declaration of a 'for...in' statement cannot have an initializer." - }, - The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { - code: 1190, - category: 1, - key: "The variable declaration of a 'for...of' statement cannot have an initializer." - }, - An_import_declaration_cannot_have_modifiers: { - code: 1191, - category: 1, - key: "An import declaration cannot have modifiers." - }, - External_module_0_has_no_default_export_or_export_assignment: { - code: 1192, - category: 1, - key: "External module '{0}' has no default export or export assignment." - }, - An_export_declaration_cannot_have_modifiers: { - code: 1193, - category: 1, - key: "An export declaration cannot have modifiers." - }, - Export_declarations_are_not_permitted_in_an_internal_module: { - code: 1194, - category: 1, - key: "Export declarations are not permitted in an internal module." - }, - Catch_clause_variable_name_must_be_an_identifier: { - code: 1195, - category: 1, - key: "Catch clause variable name must be an identifier." - }, - Catch_clause_variable_cannot_have_a_type_annotation: { - code: 1196, - category: 1, - key: "Catch clause variable cannot have a type annotation." - }, - Catch_clause_variable_cannot_have_an_initializer: { - code: 1197, - category: 1, - key: "Catch clause variable cannot have an initializer." - }, - An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { - code: 1198, - category: 1, - key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." - }, - Unterminated_Unicode_escape_sequence: { - code: 1199, - category: 1, - key: "Unterminated Unicode escape sequence." - }, - Duplicate_identifier_0: { - code: 2300, - category: 1, - key: "Duplicate identifier '{0}'." - }, - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { - code: 2301, - category: 1, - key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." - }, - Static_members_cannot_reference_class_type_parameters: { - code: 2302, - category: 1, - key: "Static members cannot reference class type parameters." - }, - Circular_definition_of_import_alias_0: { - code: 2303, - category: 1, - key: "Circular definition of import alias '{0}'." - }, - Cannot_find_name_0: { - code: 2304, - category: 1, - key: "Cannot find name '{0}'." - }, - Module_0_has_no_exported_member_1: { - code: 2305, - category: 1, - key: "Module '{0}' has no exported member '{1}'." - }, - File_0_is_not_an_external_module: { - code: 2306, - category: 1, - key: "File '{0}' is not an external module." - }, - Cannot_find_external_module_0: { - code: 2307, - category: 1, - key: "Cannot find external module '{0}'." - }, - A_module_cannot_have_more_than_one_export_assignment: { - code: 2308, - category: 1, - key: "A module cannot have more than one export assignment." - }, - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { - code: 2309, - category: 1, - key: "An export assignment cannot be used in a module with other exported elements." - }, - Type_0_recursively_references_itself_as_a_base_type: { - code: 2310, - category: 1, - key: "Type '{0}' recursively references itself as a base type." - }, - A_class_may_only_extend_another_class: { - code: 2311, - category: 1, - key: "A class may only extend another class." - }, - An_interface_may_only_extend_a_class_or_another_interface: { - code: 2312, - category: 1, - key: "An interface may only extend a class or another interface." - }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { - code: 2313, - category: 1, - key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." - }, - Generic_type_0_requires_1_type_argument_s: { - code: 2314, - category: 1, - key: "Generic type '{0}' requires {1} type argument(s)." - }, - Type_0_is_not_generic: { - code: 2315, - category: 1, - key: "Type '{0}' is not generic." - }, - Global_type_0_must_be_a_class_or_interface_type: { - code: 2316, - category: 1, - key: "Global type '{0}' must be a class or interface type." - }, - Global_type_0_must_have_1_type_parameter_s: { - code: 2317, - category: 1, - key: "Global type '{0}' must have {1} type parameter(s)." - }, - Cannot_find_global_type_0: { - code: 2318, - category: 1, - key: "Cannot find global type '{0}'." - }, - Named_property_0_of_types_1_and_2_are_not_identical: { - code: 2319, - category: 1, - key: "Named property '{0}' of types '{1}' and '{2}' are not identical." - }, - Interface_0_cannot_simultaneously_extend_types_1_and_2: { - code: 2320, - category: 1, - key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." - }, - Excessive_stack_depth_comparing_types_0_and_1: { - code: 2321, - category: 1, - key: "Excessive stack depth comparing types '{0}' and '{1}'." - }, - Type_0_is_not_assignable_to_type_1: { - code: 2322, - category: 1, - key: "Type '{0}' is not assignable to type '{1}'." - }, - Property_0_is_missing_in_type_1: { - code: 2324, - category: 1, - key: "Property '{0}' is missing in type '{1}'." - }, - Property_0_is_private_in_type_1_but_not_in_type_2: { - code: 2325, - category: 1, - key: "Property '{0}' is private in type '{1}' but not in type '{2}'." - }, - Types_of_property_0_are_incompatible: { - code: 2326, - category: 1, - key: "Types of property '{0}' are incompatible." - }, - Property_0_is_optional_in_type_1_but_required_in_type_2: { - code: 2327, - category: 1, - key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." - }, - Types_of_parameters_0_and_1_are_incompatible: { - code: 2328, - category: 1, - key: "Types of parameters '{0}' and '{1}' are incompatible." - }, - Index_signature_is_missing_in_type_0: { - code: 2329, - category: 1, - key: "Index signature is missing in type '{0}'." - }, - Index_signatures_are_incompatible: { - code: 2330, - category: 1, - key: "Index signatures are incompatible." - }, - this_cannot_be_referenced_in_a_module_body: { - code: 2331, - category: 1, - key: "'this' cannot be referenced in a module body." - }, - this_cannot_be_referenced_in_current_location: { - code: 2332, - category: 1, - key: "'this' cannot be referenced in current location." - }, - this_cannot_be_referenced_in_constructor_arguments: { - code: 2333, - category: 1, - key: "'this' cannot be referenced in constructor arguments." - }, - this_cannot_be_referenced_in_a_static_property_initializer: { - code: 2334, - category: 1, - key: "'this' cannot be referenced in a static property initializer." - }, - super_can_only_be_referenced_in_a_derived_class: { - code: 2335, - category: 1, - key: "'super' can only be referenced in a derived class." - }, - super_cannot_be_referenced_in_constructor_arguments: { - code: 2336, - category: 1, - key: "'super' cannot be referenced in constructor arguments." - }, - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { - code: 2337, - category: 1, - key: "Super calls are not permitted outside constructors or in nested functions inside constructors" - }, - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { - code: 2338, - category: 1, - key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" - }, - Property_0_does_not_exist_on_type_1: { - code: 2339, - category: 1, - key: "Property '{0}' does not exist on type '{1}'." - }, - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { - code: 2340, - category: 1, - key: "Only public and protected methods of the base class are accessible via the 'super' keyword" - }, - Property_0_is_private_and_only_accessible_within_class_1: { - code: 2341, - category: 1, - key: "Property '{0}' is private and only accessible within class '{1}'." - }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { - code: 2342, - category: 1, - key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." - }, - Type_0_does_not_satisfy_the_constraint_1: { - code: 2344, - category: 1, - key: "Type '{0}' does not satisfy the constraint '{1}'." - }, - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { - code: 2345, - category: 1, - key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." - }, - Supplied_parameters_do_not_match_any_signature_of_call_target: { - code: 2346, - category: 1, - key: "Supplied parameters do not match any signature of call target." - }, - Untyped_function_calls_may_not_accept_type_arguments: { - code: 2347, - category: 1, - key: "Untyped function calls may not accept type arguments." - }, - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { - code: 2348, - category: 1, - key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" - }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { - code: 2349, - category: 1, - key: "Cannot invoke an expression whose type lacks a call signature." - }, - Only_a_void_function_can_be_called_with_the_new_keyword: { - code: 2350, - category: 1, - key: "Only a void function can be called with the 'new' keyword." - }, - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { - code: 2351, - category: 1, - key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." - }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { - code: 2352, - category: 1, - key: "Neither type '{0}' nor type '{1}' is assignable to the other." - }, - No_best_common_type_exists_among_return_expressions: { - code: 2354, - category: 1, - key: "No best common type exists among return expressions." - }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { - code: 2355, - category: 1, - key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." - }, - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { - code: 2356, - category: 1, - key: "An arithmetic operand must be of type 'any', 'number' or an enum type." - }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { - code: 2357, - category: 1, - key: "The operand of an increment or decrement operator must be a variable, property or indexer." - }, - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: 2358, - category: 1, - key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." - }, - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { - code: 2359, - category: 1, - key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." - }, - The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { - code: 2360, - category: 1, - key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." - }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: 2361, - category: 1, - key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" - }, - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { - code: 2362, - category: 1, - key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." - }, - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { - code: 2363, - category: 1, - key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." - }, - Invalid_left_hand_side_of_assignment_expression: { - code: 2364, - category: 1, - key: "Invalid left-hand side of assignment expression." - }, - Operator_0_cannot_be_applied_to_types_1_and_2: { - code: 2365, - category: 1, - key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." - }, - Type_parameter_name_cannot_be_0: { - code: 2368, - category: 1, - key: "Type parameter name cannot be '{0}'" - }, - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { - code: 2369, - category: 1, - key: "A parameter property is only allowed in a constructor implementation." - }, - A_rest_parameter_must_be_of_an_array_type: { - code: 2370, - category: 1, - key: "A rest parameter must be of an array type." - }, - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { - code: 2371, - category: 1, - key: "A parameter initializer is only allowed in a function or constructor implementation." - }, - Parameter_0_cannot_be_referenced_in_its_initializer: { - code: 2372, - category: 1, - key: "Parameter '{0}' cannot be referenced in its initializer." - }, - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { - code: 2373, - category: 1, - key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." - }, - Duplicate_string_index_signature: { - code: 2374, - category: 1, - key: "Duplicate string index signature." - }, - Duplicate_number_index_signature: { - code: 2375, - category: 1, - key: "Duplicate number index signature." - }, - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { - code: 2376, - category: 1, - key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." - }, - Constructors_for_derived_classes_must_contain_a_super_call: { - code: 2377, - category: 1, - key: "Constructors for derived classes must contain a 'super' call." - }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { - code: 2378, - category: 1, - key: "A 'get' accessor must return a value or consist of a single 'throw' statement." - }, - Getter_and_setter_accessors_do_not_agree_in_visibility: { - code: 2379, - category: 1, - key: "Getter and setter accessors do not agree in visibility." - }, - get_and_set_accessor_must_have_the_same_type: { - code: 2380, - category: 1, - key: "'get' and 'set' accessor must have the same type." - }, - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { - code: 2381, - category: 1, - key: "A signature with an implementation cannot use a string literal type." - }, - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { - code: 2382, - category: 1, - key: "Specialized overload signature is not assignable to any non-specialized signature." - }, - Overload_signatures_must_all_be_exported_or_not_exported: { - code: 2383, - category: 1, - key: "Overload signatures must all be exported or not exported." - }, - Overload_signatures_must_all_be_ambient_or_non_ambient: { - code: 2384, - category: 1, - key: "Overload signatures must all be ambient or non-ambient." - }, - Overload_signatures_must_all_be_public_private_or_protected: { - code: 2385, - category: 1, - key: "Overload signatures must all be public, private or protected." - }, - Overload_signatures_must_all_be_optional_or_required: { - code: 2386, - category: 1, - key: "Overload signatures must all be optional or required." - }, - Function_overload_must_be_static: { - code: 2387, - category: 1, - key: "Function overload must be static." - }, - Function_overload_must_not_be_static: { - code: 2388, - category: 1, - key: "Function overload must not be static." - }, - Function_implementation_name_must_be_0: { - code: 2389, - category: 1, - key: "Function implementation name must be '{0}'." - }, - Constructor_implementation_is_missing: { - code: 2390, - category: 1, - key: "Constructor implementation is missing." - }, - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { - code: 2391, - category: 1, - key: "Function implementation is missing or not immediately following the declaration." - }, - Multiple_constructor_implementations_are_not_allowed: { - code: 2392, - category: 1, - key: "Multiple constructor implementations are not allowed." - }, - Duplicate_function_implementation: { - code: 2393, - category: 1, - key: "Duplicate function implementation." - }, - Overload_signature_is_not_compatible_with_function_implementation: { - code: 2394, - category: 1, - key: "Overload signature is not compatible with function implementation." - }, - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { - code: 2395, - category: 1, - key: "Individual declarations in merged declaration {0} must be all exported or all local." - }, - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { - code: 2396, - category: 1, - key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." - }, - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { - code: 2399, - category: 1, - key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." - }, - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { - code: 2400, - category: 1, - key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." - }, - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { - code: 2401, - category: 1, - key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." - }, - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { - code: 2402, - category: 1, - key: "Expression resolves to '_super' that compiler uses to capture base class reference." - }, - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { - code: 2403, - category: 1, - key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." - }, - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { - code: 2404, - category: 1, - key: "The left-hand side of a 'for...in' statement cannot use a type annotation." - }, - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { - code: 2405, - category: 1, - key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." - }, - Invalid_left_hand_side_in_for_in_statement: { - code: 2406, - category: 1, - key: "Invalid left-hand side in 'for...in' statement." - }, - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: 2407, - category: 1, - key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." - }, - Setters_cannot_return_a_value: { - code: 2408, - category: 1, - key: "Setters cannot return a value." - }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { - code: 2409, - category: 1, - key: "Return type of constructor signature must be assignable to the instance type of the class" - }, - All_symbols_within_a_with_block_will_be_resolved_to_any: { - code: 2410, - category: 1, - key: "All symbols within a 'with' block will be resolved to 'any'." - }, - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { - code: 2411, - category: 1, - key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." - }, - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { - code: 2412, - category: 1, - key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." - }, - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { - code: 2413, - category: 1, - key: "Numeric index type '{0}' is not assignable to string index type '{1}'." - }, - Class_name_cannot_be_0: { - code: 2414, - category: 1, - key: "Class name cannot be '{0}'" - }, - Class_0_incorrectly_extends_base_class_1: { - code: 2415, - category: 1, - key: "Class '{0}' incorrectly extends base class '{1}'." - }, - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { - code: 2417, - category: 1, - key: "Class static side '{0}' incorrectly extends base class static side '{1}'." - }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { - code: 2419, - category: 1, - key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." - }, - Class_0_incorrectly_implements_interface_1: { - code: 2420, - category: 1, - key: "Class '{0}' incorrectly implements interface '{1}'." - }, - A_class_may_only_implement_another_class_or_interface: { - code: 2422, - category: 1, - key: "A class may only implement another class or interface." - }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { - code: 2423, - category: 1, - key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." - }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { - code: 2424, - category: 1, - key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." - }, - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { - code: 2425, - category: 1, - key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." - }, - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { - code: 2426, - category: 1, - key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." - }, - Interface_name_cannot_be_0: { - code: 2427, - category: 1, - key: "Interface name cannot be '{0}'" - }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { - code: 2428, - category: 1, - key: "All declarations of an interface must have identical type parameters." - }, - Interface_0_incorrectly_extends_interface_1: { - code: 2430, - category: 1, - key: "Interface '{0}' incorrectly extends interface '{1}'." - }, - Enum_name_cannot_be_0: { - code: 2431, - category: 1, - key: "Enum name cannot be '{0}'" - }, - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { - code: 2432, - category: 1, - key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." - }, - A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { - code: 2433, - category: 1, - key: "A module declaration cannot be in a different file from a class or function with which it is merged" - }, - A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { - code: 2434, - category: 1, - key: "A module declaration cannot be located prior to a class or function with which it is merged" - }, - Ambient_external_modules_cannot_be_nested_in_other_modules: { - code: 2435, - category: 1, - key: "Ambient external modules cannot be nested in other modules." - }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { - code: 2436, - category: 1, - key: "Ambient external module declaration cannot specify relative module name." - }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { - code: 2437, - category: 1, - key: "Module '{0}' is hidden by a local declaration with the same name" - }, - Import_name_cannot_be_0: { - code: 2438, - category: 1, - key: "Import name cannot be '{0}'" - }, - Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { - code: 2439, - category: 1, - key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." - }, - Import_declaration_conflicts_with_local_declaration_of_0: { - code: 2440, - category: 1, - key: "Import declaration conflicts with local declaration of '{0}'" - }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { - code: 2441, - category: 1, - key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." - }, - Types_have_separate_declarations_of_a_private_property_0: { - code: 2442, - category: 1, - key: "Types have separate declarations of a private property '{0}'." - }, - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { - code: 2443, - category: 1, - key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." - }, - Property_0_is_protected_in_type_1_but_public_in_type_2: { - code: 2444, - category: 1, - key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." - }, - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { - code: 2445, - category: 1, - key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." - }, - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { - code: 2446, - category: 1, - key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." - }, - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { - code: 2447, - category: 1, - key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." - }, - Block_scoped_variable_0_used_before_its_declaration: { - code: 2448, - category: 1, - key: "Block-scoped variable '{0}' used before its declaration." - }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { - code: 2449, - category: 1, - key: "The operand of an increment or decrement operator cannot be a constant." - }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { - code: 2450, - category: 1, - key: "Left-hand side of assignment expression cannot be a constant." - }, - Cannot_redeclare_block_scoped_variable_0: { - code: 2451, - category: 1, - key: "Cannot redeclare block-scoped variable '{0}'." - }, - An_enum_member_cannot_have_a_numeric_name: { - code: 2452, - category: 1, - key: "An enum member cannot have a numeric name." - }, - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { - code: 2453, - category: 1, - key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." - }, - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { - code: 2455, - category: 1, - key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." - }, - Type_alias_0_circularly_references_itself: { - code: 2456, - category: 1, - key: "Type alias '{0}' circularly references itself." - }, - Type_alias_name_cannot_be_0: { - code: 2457, - category: 1, - key: "Type alias name cannot be '{0}'" - }, - An_AMD_module_cannot_have_multiple_name_assignments: { - code: 2458, - category: 1, - key: "An AMD module cannot have multiple name assignments." - }, - Type_0_has_no_property_1_and_no_string_index_signature: { - code: 2459, - category: 1, - key: "Type '{0}' has no property '{1}' and no string index signature." - }, - Type_0_has_no_property_1: { - code: 2460, - category: 1, - key: "Type '{0}' has no property '{1}'." - }, - Type_0_is_not_an_array_type: { - code: 2461, - category: 1, - key: "Type '{0}' is not an array type." - }, - A_rest_element_must_be_last_in_an_array_destructuring_pattern: { - code: 2462, - category: 1, - key: "A rest element must be last in an array destructuring pattern" - }, - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { - code: 2463, - category: 1, - key: "A binding pattern parameter cannot be optional in an implementation signature." - }, - A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { - code: 2464, - category: 1, - key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." - }, - this_cannot_be_referenced_in_a_computed_property_name: { - code: 2465, - category: 1, - key: "'this' cannot be referenced in a computed property name." - }, - super_cannot_be_referenced_in_a_computed_property_name: { - code: 2466, - category: 1, - key: "'super' cannot be referenced in a computed property name." - }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { - code: 2467, - category: 1, - key: "A computed property name cannot reference a type parameter from its containing type." - }, - Cannot_find_global_value_0: { - code: 2468, - category: 1, - key: "Cannot find global value '{0}'." - }, - The_0_operator_cannot_be_applied_to_type_symbol: { - code: 2469, - category: 1, - key: "The '{0}' operator cannot be applied to type 'symbol'." - }, - Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { - code: 2470, - category: 1, - key: "'Symbol' reference does not refer to the global Symbol constructor object." - }, - A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { - code: 2471, - category: 1, - key: "A computed property name of the form '{0}' must be of type 'symbol'." - }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 2472, - category: 1, - key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." - }, - Enum_declarations_must_all_be_const_or_non_const: { - code: 2473, - category: 1, - key: "Enum declarations must all be const or non-const." - }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { - code: 2474, - category: 1, - key: "In 'const' enum declarations member initializer must be constant expression." - }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { - code: 2475, - category: 1, - key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." - }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { - code: 2476, - category: 1, - key: "A const enum member can only be accessed using a string literal." - }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { - code: 2477, - category: 1, - key: "'const' enum member initializer was evaluated to a non-finite value." - }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { - code: 2478, - category: 1, - key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." - }, - Property_0_does_not_exist_on_const_enum_1: { - code: 2479, - category: 1, - key: "Property '{0}' does not exist on 'const' enum '{1}'." - }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { - code: 2480, - category: 1, - key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." - }, - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { - code: 2481, - category: 1, - key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." - }, - The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { - code: 2483, - category: 1, - key: "The left-hand side of a 'for...of' statement cannot use a type annotation." - }, - Export_declaration_conflicts_with_exported_declaration_of_0: { - code: 2484, - category: 1, - key: "Export declaration conflicts with exported declaration of '{0}'" - }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { - code: 2485, - category: 1, - key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." - }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { - code: 2486, - category: 1, - key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." - }, - Invalid_left_hand_side_in_for_of_statement: { - code: 2487, - category: 1, - key: "Invalid left-hand side in 'for...of' statement." - }, - The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { - code: 2488, - category: 1, - key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." - }, - The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { - code: 2489, - category: 1, - key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." - }, - The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { - code: 2490, - category: 1, - key: "The type returned by the 'next()' method of an iterator must have a 'value' property." - }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { - code: 2491, - category: 1, - key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." - }, - Cannot_redeclare_identifier_0_in_catch_clause: { - code: 2492, - category: 1, - key: "Cannot redeclare identifier '{0}' in catch clause" - }, - Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { - code: 2493, - category: 1, - key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." - }, - Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { - code: 2494, - category: 1, - key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." - }, - Type_0_is_not_an_array_type_or_a_string_type: { - code: 2461, - category: 1, - key: "Type '{0}' is not an array type or a string type." - }, - Import_declaration_0_is_using_private_name_1: { - code: 4000, - category: 1, - key: "Import declaration '{0}' is using private name '{1}'." - }, - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { - code: 4002, - category: 1, - key: "Type parameter '{0}' of exported class has or is using private name '{1}'." - }, - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { - code: 4004, - category: 1, - key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4006, - category: 1, - key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4008, - category: 1, - key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4010, - category: 1, - key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." - }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4012, - category: 1, - key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." - }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { - code: 4014, - category: 1, - key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { - code: 4016, - category: 1, - key: "Type parameter '{0}' of exported function has or is using private name '{1}'." - }, - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { - code: 4019, - category: 1, - key: "Implements clause of exported class '{0}' has or is using private name '{1}'." - }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { - code: 4020, - category: 1, - key: "Extends clause of exported class '{0}' has or is using private name '{1}'." - }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { - code: 4022, - category: 1, - key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." - }, - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4023, - category: 1, - key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." - }, - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { - code: 4024, - category: 1, - key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." - }, - Exported_variable_0_has_or_is_using_private_name_1: { - code: 4025, - category: 1, - key: "Exported variable '{0}' has or is using private name '{1}'." - }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4026, - category: 1, - key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4027, - category: 1, - key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." - }, - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { - code: 4028, - category: 1, - key: "Public static property '{0}' of exported class has or is using private name '{1}'." - }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4029, - category: 1, - key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4030, - category: 1, - key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." - }, - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { - code: 4031, - category: 1, - key: "Public property '{0}' of exported class has or is using private name '{1}'." - }, - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4032, - category: 1, - key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." - }, - Property_0_of_exported_interface_has_or_is_using_private_name_1: { - code: 4033, - category: 1, - key: "Property '{0}' of exported interface has or is using private name '{1}'." - }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4034, - category: 1, - key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { - code: 4035, - category: 1, - key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." - }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4036, - category: 1, - key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { - code: 4037, - category: 1, - key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." - }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4038, - category: 1, - key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4039, - category: 1, - key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { - code: 4040, - category: 1, - key: "Return type of public static property getter from exported class has or is using private name '{0}'." - }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4041, - category: 1, - key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4042, - category: 1, - key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { - code: 4043, - category: 1, - key: "Return type of public property getter from exported class has or is using private name '{0}'." - }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4044, - category: 1, - key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: 4045, - category: 1, - key: "Return type of constructor signature from exported interface has or is using private name '{0}'." - }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4046, - category: 1, - key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: 4047, - category: 1, - key: "Return type of call signature from exported interface has or is using private name '{0}'." - }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4048, - category: 1, - key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: 4049, - category: 1, - key: "Return type of index signature from exported interface has or is using private name '{0}'." - }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4050, - category: 1, - key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4051, - category: 1, - key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { - code: 4052, - category: 1, - key: "Return type of public static method from exported class has or is using private name '{0}'." - }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4053, - category: 1, - key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4054, - category: 1, - key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { - code: 4055, - category: 1, - key: "Return type of public method from exported class has or is using private name '{0}'." - }, - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4056, - category: 1, - key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { - code: 4057, - category: 1, - key: "Return type of method from exported interface has or is using private name '{0}'." - }, - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4058, - category: 1, - key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { - code: 4059, - category: 1, - key: "Return type of exported function has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_exported_function_has_or_is_using_private_name_0: { - code: 4060, - category: 1, - key: "Return type of exported function has or is using private name '{0}'." - }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4061, - category: 1, - key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4062, - category: 1, - key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { - code: 4063, - category: 1, - key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." - }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4064, - category: 1, - key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4065, - category: 1, - key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." - }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4066, - category: 1, - key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4067, - category: 1, - key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." - }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4068, - category: 1, - key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4069, - category: 1, - key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4070, - category: 1, - key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." - }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4071, - category: 1, - key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4072, - category: 1, - key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4073, - category: 1, - key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." - }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4074, - category: 1, - key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { - code: 4075, - category: 1, - key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." - }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4076, - category: 1, - key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { - code: 4077, - category: 1, - key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { - code: 4078, - category: 1, - key: "Parameter '{0}' of exported function has or is using private name '{1}'." - }, - Exported_type_alias_0_has_or_is_using_private_name_1: { - code: 4081, - category: 1, - key: "Exported type alias '{0}' has or is using private name '{1}'." - }, - Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { - code: 4091, - category: 1, - key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." - }, - The_current_host_does_not_support_the_0_option: { - code: 5001, - category: 1, - key: "The current host does not support the '{0}' option." - }, - Cannot_find_the_common_subdirectory_path_for_the_input_files: { - code: 5009, - category: 1, - key: "Cannot find the common subdirectory path for the input files." - }, - Cannot_read_file_0_Colon_1: { - code: 5012, - category: 1, - key: "Cannot read file '{0}': {1}" - }, - Unsupported_file_encoding: { - code: 5013, - category: 1, - key: "Unsupported file encoding." - }, - Unknown_compiler_option_0: { - code: 5023, - category: 1, - key: "Unknown compiler option '{0}'." - }, - Compiler_option_0_requires_a_value_of_type_1: { - code: 5024, - category: 1, - key: "Compiler option '{0}' requires a value of type {1}." - }, - Could_not_write_file_0_Colon_1: { - code: 5033, - category: 1, - key: "Could not write file '{0}': {1}" - }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { - code: 5038, - category: 1, - key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." - }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { - code: 5039, - category: 1, - key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." - }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { - code: 5040, - category: 1, - key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." - }, - Option_noEmit_cannot_be_specified_with_option_declaration: { - code: 5041, - category: 1, - key: "Option 'noEmit' cannot be specified with option 'declaration'." - }, - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { - code: 5042, - category: 1, - key: "Option 'project' cannot be mixed with source files on a command line." - }, - Concatenate_and_emit_output_to_single_file: { - code: 6001, - category: 2, - key: "Concatenate and emit output to single file." - }, - Generates_corresponding_d_ts_file: { - code: 6002, - category: 2, - key: "Generates corresponding '.d.ts' file." - }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { - code: 6003, - category: 2, - key: "Specifies the location where debugger should locate map files instead of generated locations." - }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { - code: 6004, - category: 2, - key: "Specifies the location where debugger should locate TypeScript files instead of source locations." - }, - Watch_input_files: { - code: 6005, - category: 2, - key: "Watch input files." - }, - Redirect_output_structure_to_the_directory: { - code: 6006, - category: 2, - key: "Redirect output structure to the directory." - }, - Do_not_erase_const_enum_declarations_in_generated_code: { - code: 6007, - category: 2, - key: "Do not erase const enum declarations in generated code." - }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { - code: 6008, - category: 2, - key: "Do not emit outputs if any type checking errors were reported." - }, - Do_not_emit_comments_to_output: { - code: 6009, - category: 2, - key: "Do not emit comments to output." - }, - Do_not_emit_outputs: { - code: 6010, - category: 2, - key: "Do not emit outputs." - }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { - code: 6015, - category: 2, - key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" - }, - Specify_module_code_generation_Colon_commonjs_or_amd: { - code: 6016, - category: 2, - key: "Specify module code generation: 'commonjs' or 'amd'" - }, - Print_this_message: { - code: 6017, - category: 2, - key: "Print this message." - }, - Print_the_compiler_s_version: { - code: 6019, - category: 2, - key: "Print the compiler's version." - }, - Compile_the_project_in_the_given_directory: { - code: 6020, - category: 2, - key: "Compile the project in the given directory." - }, - Syntax_Colon_0: { - code: 6023, - category: 2, - key: "Syntax: {0}" - }, - options: { - code: 6024, - category: 2, - key: "options" - }, - file: { - code: 6025, - category: 2, - key: "file" - }, - Examples_Colon_0: { - code: 6026, - category: 2, - key: "Examples: {0}" - }, - Options_Colon: { - code: 6027, - category: 2, - key: "Options:" - }, - Version_0: { - code: 6029, - category: 2, - key: "Version {0}" - }, - Insert_command_line_options_and_files_from_a_file: { - code: 6030, - category: 2, - key: "Insert command line options and files from a file." - }, - File_change_detected_Starting_incremental_compilation: { - code: 6032, - category: 2, - key: "File change detected. Starting incremental compilation..." - }, - KIND: { - code: 6034, - category: 2, - key: "KIND" - }, - FILE: { - code: 6035, - category: 2, - key: "FILE" - }, - VERSION: { - code: 6036, - category: 2, - key: "VERSION" - }, - LOCATION: { - code: 6037, - category: 2, - key: "LOCATION" - }, - DIRECTORY: { - code: 6038, - category: 2, - key: "DIRECTORY" - }, - Compilation_complete_Watching_for_file_changes: { - code: 6042, - category: 2, - key: "Compilation complete. Watching for file changes." - }, - Generates_corresponding_map_file: { - code: 6043, - category: 2, - key: "Generates corresponding '.map' file." - }, - Compiler_option_0_expects_an_argument: { - code: 6044, - category: 1, - key: "Compiler option '{0}' expects an argument." - }, - Unterminated_quoted_string_in_response_file_0: { - code: 6045, - category: 1, - key: "Unterminated quoted string in response file '{0}'." - }, - Argument_for_module_option_must_be_commonjs_or_amd: { - code: 6046, - category: 1, - key: "Argument for '--module' option must be 'commonjs' or 'amd'." - }, - Argument_for_target_option_must_be_es3_es5_or_es6: { - code: 6047, - category: 1, - key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." - }, - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { - code: 6048, - category: 1, - key: "Locale must be of the form or -. For example '{0}' or '{1}'." - }, - Unsupported_locale_0: { - code: 6049, - category: 1, - key: "Unsupported locale '{0}'." - }, - Unable_to_open_file_0: { - code: 6050, - category: 1, - key: "Unable to open file '{0}'." - }, - Corrupted_locale_file_0: { - code: 6051, - category: 1, - key: "Corrupted locale file {0}." - }, - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { - code: 6052, - category: 2, - key: "Raise error on expressions and declarations with an implied 'any' type." - }, - File_0_not_found: { - code: 6053, - category: 1, - key: "File '{0}' not found." - }, - File_0_must_have_extension_ts_or_d_ts: { - code: 6054, - category: 1, - key: "File '{0}' must have extension '.ts' or '.d.ts'." - }, - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { - code: 6055, - category: 2, - key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." - }, - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { - code: 6056, - category: 2, - key: "Do not emit declarations for code that has an '@internal' annotation." - }, - Preserve_new_lines_when_emitting_code: { - code: 6057, - category: 2, - key: "Preserve new-lines when emitting code." - }, - Variable_0_implicitly_has_an_1_type: { - code: 7005, - category: 1, - key: "Variable '{0}' implicitly has an '{1}' type." - }, - Parameter_0_implicitly_has_an_1_type: { - code: 7006, - category: 1, - key: "Parameter '{0}' implicitly has an '{1}' type." - }, - Member_0_implicitly_has_an_1_type: { - code: 7008, - category: 1, - key: "Member '{0}' implicitly has an '{1}' type." - }, - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { - code: 7009, - category: 1, - key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." - }, - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { - code: 7010, - category: 1, - key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." - }, - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { - code: 7011, - category: 1, - key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." - }, - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { - code: 7013, - category: 1, - key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." - }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { - code: 7016, - category: 1, - key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." - }, - Index_signature_of_object_type_implicitly_has_an_any_type: { - code: 7017, - category: 1, - key: "Index signature of object type implicitly has an 'any' type." - }, - Object_literal_s_property_0_implicitly_has_an_1_type: { - code: 7018, - category: 1, - key: "Object literal's property '{0}' implicitly has an '{1}' type." - }, - Rest_parameter_0_implicitly_has_an_any_type: { - code: 7019, - category: 1, - key: "Rest parameter '{0}' implicitly has an 'any[]' type." - }, - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { - code: 7020, - category: 1, - key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." - }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { - code: 7021, - category: 1, - key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." - }, - _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { - code: 7022, - category: 1, - key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." - }, - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { - code: 7023, - category: 1, - key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." - }, - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { - code: 7024, - category: 1, - key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." - }, - You_cannot_rename_this_element: { - code: 8000, - category: 1, - key: "You cannot rename this element." - }, - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { - code: 8001, - category: 1, - key: "You cannot rename elements that are defined in the standard TypeScript library." - }, - yield_expressions_are_not_currently_supported: { - code: 9000, - category: 1, - key: "'yield' expressions are not currently supported." - }, - Generators_are_not_currently_supported: { - code: 9001, - category: 1, - key: "Generators are not currently supported." - }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { - code: 9002, - category: 1, - key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." - } + Unterminated_string_literal: { code: 1002, category: 1, key: "Unterminated string literal." }, + Identifier_expected: { code: 1003, category: 1, key: "Identifier expected." }, + _0_expected: { code: 1005, category: 1, key: "'{0}' expected." }, + A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1, key: "A file cannot have a reference to itself." }, + Trailing_comma_not_allowed: { code: 1009, category: 1, key: "Trailing comma not allowed." }, + Asterisk_Slash_expected: { code: 1010, category: 1, key: "'*/' expected." }, + Unexpected_token: { code: 1012, category: 1, key: "Unexpected token." }, + A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1, key: "A rest parameter must be last in a parameter list." }, + Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1, key: "Parameter cannot have question mark and initializer." }, + A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1, key: "A required parameter cannot follow an optional parameter." }, + An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1, key: "An index signature cannot have a rest parameter." }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1, key: "An index signature parameter cannot have an accessibility modifier." }, + An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1, key: "An index signature parameter cannot have a question mark." }, + An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1, key: "An index signature parameter cannot have an initializer." }, + An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1, key: "An index signature must have a type annotation." }, + An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1, key: "An index signature parameter must have a type annotation." }, + An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1, key: "An index signature parameter type must be 'string' or 'number'." }, + A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1, key: "A class or interface declaration can only have one 'extends' clause." }, + An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1, key: "An 'extends' clause must precede an 'implements' clause." }, + A_class_can_only_extend_a_single_class: { code: 1026, category: 1, key: "A class can only extend a single class." }, + A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1, key: "A class declaration can only have one 'implements' clause." }, + Accessibility_modifier_already_seen: { code: 1028, category: 1, key: "Accessibility modifier already seen." }, + _0_modifier_must_precede_1_modifier: { code: 1029, category: 1, key: "'{0}' modifier must precede '{1}' modifier." }, + _0_modifier_already_seen: { code: 1030, category: 1, key: "'{0}' modifier already seen." }, + _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1, key: "'{0}' modifier cannot appear on a class element." }, + An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1, key: "An interface declaration cannot have an 'implements' clause." }, + super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1, key: "'super' must be followed by an argument list or member access." }, + Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1, key: "Only ambient modules can use quoted names." }, + Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1, key: "Statements are not allowed in ambient contexts." }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1, key: "A 'declare' modifier cannot be used in an already ambient context." }, + Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1, key: "Initializers are not allowed in ambient contexts." }, + _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1, key: "'{0}' modifier cannot appear on a module element." }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1, key: "A 'declare' modifier cannot be used with an interface declaration." }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, + A_rest_parameter_cannot_be_optional: { code: 1047, category: 1, key: "A rest parameter cannot be optional." }, + A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1, key: "A rest parameter cannot have an initializer." }, + A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1, key: "A 'set' accessor must have exactly one parameter." }, + A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1, key: "A 'set' accessor cannot have an optional parameter." }, + A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1, key: "A 'set' accessor parameter cannot have an initializer." }, + A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1, key: "A 'set' accessor cannot have rest parameter." }, + A_get_accessor_cannot_have_parameters: { code: 1054, category: 1, key: "A 'get' accessor cannot have parameters." }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, + Enum_member_must_have_initializer: { code: 1061, category: 1, key: "Enum member must have initializer." }, + An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1, key: "An export assignment cannot be used in an internal module." }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1, key: "Ambient enum elements can only have integer literal initializers." }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1, key: "A 'declare' modifier cannot be used with an import declaration." }, + Invalid_reference_directive_syntax: { code: 1084, category: 1, key: "Invalid 'reference' directive syntax." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1, key: "An accessor cannot be declared in an ambient context." }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1, key: "'{0}' modifier cannot appear on a constructor declaration." }, + _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1, key: "'{0}' modifier cannot appear on a parameter." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1, key: "Type parameters cannot appear on a constructor declaration." }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1, key: "Type annotation cannot appear on a constructor declaration." }, + An_accessor_cannot_have_type_parameters: { code: 1094, category: 1, key: "An accessor cannot have type parameters." }, + A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1, key: "A 'set' accessor cannot have a return type annotation." }, + An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1, key: "An index signature must have exactly one parameter." }, + _0_list_cannot_be_empty: { code: 1097, category: 1, key: "'{0}' list cannot be empty." }, + Type_parameter_list_cannot_be_empty: { code: 1098, category: 1, key: "Type parameter list cannot be empty." }, + Type_argument_list_cannot_be_empty: { code: 1099, category: 1, key: "Type argument list cannot be empty." }, + Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1, key: "Invalid use of '{0}' in strict mode." }, + with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1, key: "'with' statements are not allowed in strict mode." }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1, key: "'delete' cannot be called on an identifier in strict mode." }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, + Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1, key: "Jump target cannot cross function boundary." }, + A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1, key: "A 'return' statement can only be used within a function body." }, + Expression_expected: { code: 1109, category: 1, key: "Expression expected." }, + Type_expected: { code: 1110, category: 1, key: "Type expected." }, + A_class_member_cannot_be_declared_optional: { code: 1112, category: 1, key: "A class member cannot be declared optional." }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, + Duplicate_label_0: { code: 1114, category: 1, key: "Duplicate label '{0}'" }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1, key: "A 'break' statement can only jump to a label of an enclosing statement." }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1, key: "An object literal cannot have multiple properties with the same name in strict mode." }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1, key: "An object literal cannot have multiple get/set accessors with the same name." }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1, key: "An object literal cannot have property and accessor with the same name." }, + An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1, key: "An export assignment cannot have modifiers." }, + Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1, key: "A tuple type element list cannot be empty." }, + Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1, key: "Variable declaration list cannot be empty." }, + Digit_expected: { code: 1124, category: 1, key: "Digit expected." }, + Hexadecimal_digit_expected: { code: 1125, category: 1, key: "Hexadecimal digit expected." }, + Unexpected_end_of_text: { code: 1126, category: 1, key: "Unexpected end of text." }, + Invalid_character: { code: 1127, category: 1, key: "Invalid character." }, + Declaration_or_statement_expected: { code: 1128, category: 1, key: "Declaration or statement expected." }, + Statement_expected: { code: 1129, category: 1, key: "Statement expected." }, + case_or_default_expected: { code: 1130, category: 1, key: "'case' or 'default' expected." }, + Property_or_signature_expected: { code: 1131, category: 1, key: "Property or signature expected." }, + Enum_member_expected: { code: 1132, category: 1, key: "Enum member expected." }, + Type_reference_expected: { code: 1133, category: 1, key: "Type reference expected." }, + Variable_declaration_expected: { code: 1134, category: 1, key: "Variable declaration expected." }, + Argument_expression_expected: { code: 1135, category: 1, key: "Argument expression expected." }, + Property_assignment_expected: { code: 1136, category: 1, key: "Property assignment expected." }, + Expression_or_comma_expected: { code: 1137, category: 1, key: "Expression or comma expected." }, + Parameter_declaration_expected: { code: 1138, category: 1, key: "Parameter declaration expected." }, + Type_parameter_declaration_expected: { code: 1139, category: 1, key: "Type parameter declaration expected." }, + Type_argument_expected: { code: 1140, category: 1, key: "Type argument expected." }, + String_literal_expected: { code: 1141, category: 1, key: "String literal expected." }, + Line_break_not_permitted_here: { code: 1142, category: 1, key: "Line break not permitted here." }, + or_expected: { code: 1144, category: 1, key: "'{' or ';' expected." }, + Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1, key: "Modifiers not permitted on index signature members." }, + Declaration_expected: { code: 1146, category: 1, key: "Declaration expected." }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1, key: "Import declarations in an internal module cannot reference an external module." }, + Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1, key: "Cannot compile external modules unless the '--module' flag is provided." }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: 1, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, + var_let_or_const_expected: { code: 1152, category: 1, key: "'var', 'let' or 'const' expected." }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_must_be_initialized: { code: 1155, category: 1, key: "'const' declarations must be initialized" }, + const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1, key: "'const' declarations can only be declared inside a block." }, + let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1, key: "'let' declarations can only be declared inside a block." }, + Unterminated_template_literal: { code: 1160, category: 1, key: "Unterminated template literal." }, + Unterminated_regular_expression_literal: { code: 1161, category: 1, key: "Unterminated regular expression literal." }, + An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, + yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, + Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, + Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, + A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, + extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, + extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, + Classes_can_only_extend_a_single_class: { code: 1174, category: 1, key: "Classes can only extend a single class." }, + implements_clause_already_seen: { code: 1175, category: 1, key: "'implements' clause already seen." }, + Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1, key: "Interface declaration cannot have 'implements' clause." }, + Binary_digit_expected: { code: 1177, category: 1, key: "Binary digit expected." }, + Octal_digit_expected: { code: 1178, category: 1, key: "Octal digit expected." }, + Unexpected_token_expected: { code: 1179, category: 1, key: "Unexpected token. '{' expected." }, + Property_destructuring_pattern_expected: { code: 1180, category: 1, key: "Property destructuring pattern expected." }, + Array_element_destructuring_pattern_expected: { code: 1181, category: 1, key: "Array element destructuring pattern expected." }, + A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: 1, key: "A destructuring declaration must have an initializer." }, + Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: 1, key: "Destructuring declarations are not allowed in ambient contexts." }, + An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: 1, key: "An implementation cannot be declared in ambient contexts." }, + Modifiers_cannot_appear_here: { code: 1184, category: 1, key: "Modifiers cannot appear here." }, + Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, + A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, + A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, + An_import_declaration_cannot_have_modifiers: { code: 1191, category: 1, key: "An import declaration cannot have modifiers." }, + External_module_0_has_no_default_export_or_export_assignment: { code: 1192, category: 1, key: "External module '{0}' has no default export or export assignment." }, + An_export_declaration_cannot_have_modifiers: { code: 1193, category: 1, key: "An export declaration cannot have modifiers." }, + Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: 1, key: "Export declarations are not permitted in an internal module." }, + Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: 1, key: "Catch clause variable name must be an identifier." }, + Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: 1, key: "Catch clause variable cannot have a type annotation." }, + Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: 1, key: "Catch clause variable cannot have an initializer." }, + An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: 1, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, + Unterminated_Unicode_escape_sequence: { code: 1199, category: 1, key: "Unterminated Unicode escape sequence." }, + Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, + Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1, key: "Static members cannot reference class type parameters." }, + Circular_definition_of_import_alias_0: { code: 2303, category: 1, key: "Circular definition of import alias '{0}'." }, + Cannot_find_name_0: { code: 2304, category: 1, key: "Cannot find name '{0}'." }, + Module_0_has_no_exported_member_1: { code: 2305, category: 1, key: "Module '{0}' has no exported member '{1}'." }, + File_0_is_not_an_external_module: { code: 2306, category: 1, key: "File '{0}' is not an external module." }, + Cannot_find_external_module_0: { code: 2307, category: 1, key: "Cannot find external module '{0}'." }, + A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1, key: "A module cannot have more than one export assignment." }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1, key: "An export assignment cannot be used in a module with other exported elements." }, + Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1, key: "Type '{0}' recursively references itself as a base type." }, + A_class_may_only_extend_another_class: { code: 2311, category: 1, key: "A class may only extend another class." }, + An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1, key: "An interface may only extend a class or another interface." }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, + Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1, key: "Generic type '{0}' requires {1} type argument(s)." }, + Type_0_is_not_generic: { code: 2315, category: 1, key: "Type '{0}' is not generic." }, + Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, + Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, + Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, + Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, + Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, + Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, + Property_0_is_missing_in_type_1: { code: 2324, category: 1, key: "Property '{0}' is missing in type '{1}'." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, + Types_of_property_0_are_incompatible: { code: 2326, category: 1, key: "Types of property '{0}' are incompatible." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, + Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1, key: "Types of parameters '{0}' and '{1}' are incompatible." }, + Index_signature_is_missing_in_type_0: { code: 2329, category: 1, key: "Index signature is missing in type '{0}'." }, + Index_signatures_are_incompatible: { code: 2330, category: 1, key: "Index signatures are incompatible." }, + this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1, key: "'this' cannot be referenced in a module body." }, + this_cannot_be_referenced_in_current_location: { code: 2332, category: 1, key: "'this' cannot be referenced in current location." }, + this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1, key: "'this' cannot be referenced in constructor arguments." }, + this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1, key: "'this' cannot be referenced in a static property initializer." }, + super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1, key: "'super' can only be referenced in a derived class." }, + super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1, key: "'super' cannot be referenced in constructor arguments." }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, + Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, + Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, + Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1, key: "Untyped function calls may not accept type arguments." }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1, key: "Cannot invoke an expression whose type lacks a call signature." }, + Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1, key: "Only a void function can be called with the 'new' keyword." }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1, key: "No best common type exists among return expressions." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1, key: "Invalid left-hand side of assignment expression." }, + Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Type_parameter_name_cannot_be_0: { code: 2368, category: 1, key: "Type parameter name cannot be '{0}'" }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1, key: "A parameter property is only allowed in a constructor implementation." }, + A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1, key: "A rest parameter must be of an array type." }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1, key: "A parameter initializer is only allowed in a function or constructor implementation." }, + Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1, key: "Parameter '{0}' cannot be referenced in its initializer." }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, + Duplicate_string_index_signature: { code: 2374, category: 1, key: "Duplicate string index signature." }, + Duplicate_number_index_signature: { code: 2375, category: 1, key: "Duplicate number index signature." }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, + Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1, key: "Constructors for derived classes must contain a 'super' call." }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1, key: "Getter and setter accessors do not agree in visibility." }, + get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1, key: "'get' and 'set' accessor must have the same type." }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1, key: "A signature with an implementation cannot use a string literal type." }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1, key: "Specialized overload signature is not assignable to any non-specialized signature." }, + Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1, key: "Overload signatures must all be exported or not exported." }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1, key: "Overload signatures must all be ambient or non-ambient." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1, key: "Overload signatures must all be public, private or protected." }, + Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1, key: "Overload signatures must all be optional or required." }, + Function_overload_must_be_static: { code: 2387, category: 1, key: "Function overload must be static." }, + Function_overload_must_not_be_static: { code: 2388, category: 1, key: "Function overload must not be static." }, + Function_implementation_name_must_be_0: { code: 2389, category: 1, key: "Function implementation name must be '{0}'." }, + Constructor_implementation_is_missing: { code: 2390, category: 1, key: "Constructor implementation is missing." }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1, key: "Function implementation is missing or not immediately following the declaration." }, + Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1, key: "Multiple constructor implementations are not allowed." }, + Duplicate_function_implementation: { code: 2393, category: 1, key: "Duplicate function implementation." }, + Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1, key: "Overload signature is not compatible with function implementation." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, + Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1, key: "Invalid left-hand side in 'for...in' statement." }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, + Setters_cannot_return_a_value: { code: 2408, category: 1, key: "Setters cannot return a value." }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1, key: "Return type of constructor signature must be assignable to the instance type of the class" }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1, key: "All symbols within a 'with' block will be resolved to 'any'." }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, + Class_name_cannot_be_0: { code: 2414, category: 1, key: "Class name cannot be '{0}'" }, + Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1, key: "Class '{0}' incorrectly extends base class '{1}'." }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, + Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1, key: "Class '{0}' incorrectly implements interface '{1}'." }, + A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1, key: "A class may only implement another class or interface." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, + Interface_name_cannot_be_0: { code: 2427, category: 1, key: "Interface name cannot be '{0}'" }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1, key: "All declarations of an interface must have identical type parameters." }, + Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1, key: "Interface '{0}' incorrectly extends interface '{1}'." }, + Enum_name_cannot_be_0: { code: 2431, category: 1, key: "Enum name cannot be '{0}'" }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1, key: "Ambient external modules cannot be nested in other modules." }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1, key: "Ambient external module declaration cannot specify relative module name." }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1, key: "Module '{0}' is hidden by a local declaration with the same name" }, + Import_name_cannot_be_0: { code: 2438, category: 1, key: "Import name cannot be '{0}'" }, + Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1, key: "Import declaration conflicts with local declaration of '{0}'" }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1, key: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, + Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1, key: "Block-scoped variable '{0}' used before its declaration." }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1, key: "The operand of an increment or decrement operator cannot be a constant." }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1, key: "Left-hand side of assignment expression cannot be a constant." }, + Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1, key: "Cannot redeclare block-scoped variable '{0}'." }, + An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1, key: "An enum member cannot have a numeric name." }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, + Type_alias_0_circularly_references_itself: { code: 2456, category: 1, key: "Type alias '{0}' circularly references itself." }, + Type_alias_name_cannot_be_0: { code: 2457, category: 1, key: "Type alias name cannot be '{0}'" }, + An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1, key: "An AMD module cannot have multiple name assignments." }, + Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: 1, key: "Type '{0}' has no property '{1}' and no string index signature." }, + Type_0_has_no_property_1: { code: 2460, category: 1, key: "Type '{0}' has no property '{1}'." }, + Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, + A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, + this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, + super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, + Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, + The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, + Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: 1, key: "Export declaration conflicts with exported declaration of '{0}'" }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: 1, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, + Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: 1, key: "Invalid left-hand side in 'for...of' statement." }, + The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: 1, key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." }, + The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { code: 2489, category: 1, key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." }, + The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: 1, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, + Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: 1, key: "Cannot redeclare identifier '{0}' in catch clause" }, + Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: 1, key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: 1, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, + Type_0_is_not_an_array_type_or_a_string_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type or a string type." }, + Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, + Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1, key: "Exported variable '{0}' has or is using private name '{1}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1, key: "Return type of public static method from exported class has or is using private name '{0}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1, key: "Return type of public method from exported class has or is using private name '{0}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1, key: "Return type of method from exported interface has or is using private name '{0}'." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1, key: "Return type of exported function has or is using private name '{0}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, + Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, + Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { code: 4091, category: 1, key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." }, + The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, + Unsupported_file_encoding: { code: 5013, category: 1, key: "Unsupported file encoding." }, + Unknown_compiler_option_0: { code: 5023, category: 1, key: "Unknown compiler option '{0}'." }, + Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1, key: "Compiler option '{0}' requires a value of type {1}." }, + Could_not_write_file_0_Colon_1: { code: 5033, category: 1, key: "Could not write file '{0}': {1}" }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, + Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: 1, key: "Option 'project' cannot be mixed with source files on a command line." }, + Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2, key: "Concatenate and emit output to single file." }, + Generates_corresponding_d_ts_file: { code: 6002, category: 2, key: "Generates corresponding '.d.ts' file." }, + Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2, key: "Specifies the location where debugger should locate map files instead of generated locations." }, + Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + Watch_input_files: { code: 6005, category: 2, key: "Watch input files." }, + Redirect_output_structure_to_the_directory: { code: 6006, category: 2, key: "Redirect output structure to the directory." }, + Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2, key: "Do not erase const enum declarations in generated code." }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_comments_to_output: { code: 6009, category: 2, key: "Do not emit comments to output." }, + Do_not_emit_outputs: { code: 6010, category: 2, key: "Do not emit outputs." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, + Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2, key: "Specify module code generation: 'commonjs' or 'amd'" }, + Print_this_message: { code: 6017, category: 2, key: "Print this message." }, + Print_the_compiler_s_version: { code: 6019, category: 2, key: "Print the compiler's version." }, + Compile_the_project_in_the_given_directory: { code: 6020, category: 2, key: "Compile the project in the given directory." }, + Syntax_Colon_0: { code: 6023, category: 2, key: "Syntax: {0}" }, + options: { code: 6024, category: 2, key: "options" }, + file: { code: 6025, category: 2, key: "file" }, + Examples_Colon_0: { code: 6026, category: 2, key: "Examples: {0}" }, + Options_Colon: { code: 6027, category: 2, key: "Options:" }, + Version_0: { code: 6029, category: 2, key: "Version {0}" }, + Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2, key: "Insert command line options and files from a file." }, + File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2, key: "File change detected. Starting incremental compilation..." }, + KIND: { code: 6034, category: 2, key: "KIND" }, + FILE: { code: 6035, category: 2, key: "FILE" }, + VERSION: { code: 6036, category: 2, key: "VERSION" }, + LOCATION: { code: 6037, category: 2, key: "LOCATION" }, + DIRECTORY: { code: 6038, category: 2, key: "DIRECTORY" }, + Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2, key: "Compilation complete. Watching for file changes." }, + Generates_corresponding_map_file: { code: 6043, category: 2, key: "Generates corresponding '.map' file." }, + Compiler_option_0_expects_an_argument: { code: 6044, category: 1, key: "Compiler option '{0}' expects an argument." }, + Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1, key: "Unterminated quoted string in response file '{0}'." }, + Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, + Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, + Unsupported_locale_0: { code: 6049, category: 1, key: "Unsupported locale '{0}'." }, + Unable_to_open_file_0: { code: 6050, category: 1, key: "Unable to open file '{0}'." }, + Corrupted_locale_file_0: { code: 6051, category: 1, key: "Corrupted locale file {0}." }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2, key: "Raise error on expressions and declarations with an implied 'any' type." }, + File_0_not_found: { code: 6053, category: 1, key: "File '{0}' not found." }, + File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: 2, key: "Do not emit declarations for code that has an '@internal' annotation." }, + Preserve_new_lines_when_emitting_code: { code: 6057, category: 2, key: "Preserve new-lines when emitting code." }, + Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1, key: "Variable '{0}' implicitly has an '{1}' type." }, + Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1, key: "Parameter '{0}' implicitly has an '{1}' type." }, + Member_0_implicitly_has_an_1_type: { code: 7008, category: 1, key: "Member '{0}' implicitly has an '{1}' type." }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, + Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1, key: "Index signature of object type implicitly has an 'any' type." }, + Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, + Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + You_cannot_rename_this_element: { code: 8000, category: 1, key: "You cannot rename this element." }, + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, + yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, + Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." }, + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." } }; })(ts || (ts = {})); var ts; @@ -3437,2806 +1479,10 @@ var ts; "|=": 62, "^=": 63 }; - var unicodeES3IdentifierStart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 543, - 546, - 563, - 592, - 685, - 688, - 696, - 699, - 705, - 720, - 721, - 736, - 740, - 750, - 750, - 890, - 890, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 974, - 976, - 983, - 986, - 1011, - 1024, - 1153, - 1164, - 1220, - 1223, - 1224, - 1227, - 1228, - 1232, - 1269, - 1272, - 1273, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1488, - 1514, - 1520, - 1522, - 1569, - 1594, - 1600, - 1610, - 1649, - 1747, - 1749, - 1749, - 1765, - 1766, - 1786, - 1788, - 1808, - 1808, - 1810, - 1836, - 1920, - 1957, - 2309, - 2361, - 2365, - 2365, - 2384, - 2384, - 2392, - 2401, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2524, - 2525, - 2527, - 2529, - 2544, - 2545, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2649, - 2652, - 2654, - 2654, - 2674, - 2676, - 2693, - 2699, - 2701, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2749, - 2749, - 2768, - 2768, - 2784, - 2784, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2870, - 2873, - 2877, - 2877, - 2908, - 2909, - 2911, - 2913, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 2997, - 2999, - 3001, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3168, - 3169, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3294, - 3294, - 3296, - 3297, - 3333, - 3340, - 3342, - 3344, - 3346, - 3368, - 3370, - 3385, - 3424, - 3425, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3585, - 3632, - 3634, - 3635, - 3648, - 3654, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3760, - 3762, - 3763, - 3773, - 3773, - 3776, - 3780, - 3782, - 3782, - 3804, - 3805, - 3840, - 3840, - 3904, - 3911, - 3913, - 3946, - 3976, - 3979, - 4096, - 4129, - 4131, - 4135, - 4137, - 4138, - 4176, - 4181, - 4256, - 4293, - 4304, - 4342, - 4352, - 4441, - 4447, - 4514, - 4520, - 4601, - 4608, - 4614, - 4616, - 4678, - 4680, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4742, - 4744, - 4744, - 4746, - 4749, - 4752, - 4782, - 4784, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4814, - 4816, - 4822, - 4824, - 4846, - 4848, - 4878, - 4880, - 4880, - 4882, - 4885, - 4888, - 4894, - 4896, - 4934, - 4936, - 4954, - 5024, - 5108, - 5121, - 5740, - 5743, - 5750, - 5761, - 5786, - 5792, - 5866, - 6016, - 6067, - 6176, - 6263, - 6272, - 6312, - 7680, - 7835, - 7840, - 7929, - 7936, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8319, - 8319, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8497, - 8499, - 8505, - 8544, - 8579, - 12293, - 12295, - 12321, - 12329, - 12337, - 12341, - 12344, - 12346, - 12353, - 12436, - 12445, - 12446, - 12449, - 12538, - 12540, - 12542, - 12549, - 12588, - 12593, - 12686, - 12704, - 12727, - 13312, - 19893, - 19968, - 40869, - 40960, - 42124, - 44032, - 55203, - 63744, - 64045, - 64256, - 64262, - 64275, - 64279, - 64285, - 64285, - 64287, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65136, - 65138, - 65140, - 65140, - 65142, - 65276, - 65313, - 65338, - 65345, - 65370, - 65382, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; - var unicodeES3IdentifierPart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 543, - 546, - 563, - 592, - 685, - 688, - 696, - 699, - 705, - 720, - 721, - 736, - 740, - 750, - 750, - 768, - 846, - 864, - 866, - 890, - 890, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 974, - 976, - 983, - 986, - 1011, - 1024, - 1153, - 1155, - 1158, - 1164, - 1220, - 1223, - 1224, - 1227, - 1228, - 1232, - 1269, - 1272, - 1273, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1425, - 1441, - 1443, - 1465, - 1467, - 1469, - 1471, - 1471, - 1473, - 1474, - 1476, - 1476, - 1488, - 1514, - 1520, - 1522, - 1569, - 1594, - 1600, - 1621, - 1632, - 1641, - 1648, - 1747, - 1749, - 1756, - 1759, - 1768, - 1770, - 1773, - 1776, - 1788, - 1808, - 1836, - 1840, - 1866, - 1920, - 1968, - 2305, - 2307, - 2309, - 2361, - 2364, - 2381, - 2384, - 2388, - 2392, - 2403, - 2406, - 2415, - 2433, - 2435, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2492, - 2492, - 2494, - 2500, - 2503, - 2504, - 2507, - 2509, - 2519, - 2519, - 2524, - 2525, - 2527, - 2531, - 2534, - 2545, - 2562, - 2562, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2620, - 2620, - 2622, - 2626, - 2631, - 2632, - 2635, - 2637, - 2649, - 2652, - 2654, - 2654, - 2662, - 2676, - 2689, - 2691, - 2693, - 2699, - 2701, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2748, - 2757, - 2759, - 2761, - 2763, - 2765, - 2768, - 2768, - 2784, - 2784, - 2790, - 2799, - 2817, - 2819, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2870, - 2873, - 2876, - 2883, - 2887, - 2888, - 2891, - 2893, - 2902, - 2903, - 2908, - 2909, - 2911, - 2913, - 2918, - 2927, - 2946, - 2947, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 2997, - 2999, - 3001, - 3006, - 3010, - 3014, - 3016, - 3018, - 3021, - 3031, - 3031, - 3047, - 3055, - 3073, - 3075, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3134, - 3140, - 3142, - 3144, - 3146, - 3149, - 3157, - 3158, - 3168, - 3169, - 3174, - 3183, - 3202, - 3203, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3262, - 3268, - 3270, - 3272, - 3274, - 3277, - 3285, - 3286, - 3294, - 3294, - 3296, - 3297, - 3302, - 3311, - 3330, - 3331, - 3333, - 3340, - 3342, - 3344, - 3346, - 3368, - 3370, - 3385, - 3390, - 3395, - 3398, - 3400, - 3402, - 3405, - 3415, - 3415, - 3424, - 3425, - 3430, - 3439, - 3458, - 3459, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3530, - 3530, - 3535, - 3540, - 3542, - 3542, - 3544, - 3551, - 3570, - 3571, - 3585, - 3642, - 3648, - 3662, - 3664, - 3673, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3769, - 3771, - 3773, - 3776, - 3780, - 3782, - 3782, - 3784, - 3789, - 3792, - 3801, - 3804, - 3805, - 3840, - 3840, - 3864, - 3865, - 3872, - 3881, - 3893, - 3893, - 3895, - 3895, - 3897, - 3897, - 3902, - 3911, - 3913, - 3946, - 3953, - 3972, - 3974, - 3979, - 3984, - 3991, - 3993, - 4028, - 4038, - 4038, - 4096, - 4129, - 4131, - 4135, - 4137, - 4138, - 4140, - 4146, - 4150, - 4153, - 4160, - 4169, - 4176, - 4185, - 4256, - 4293, - 4304, - 4342, - 4352, - 4441, - 4447, - 4514, - 4520, - 4601, - 4608, - 4614, - 4616, - 4678, - 4680, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4742, - 4744, - 4744, - 4746, - 4749, - 4752, - 4782, - 4784, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4814, - 4816, - 4822, - 4824, - 4846, - 4848, - 4878, - 4880, - 4880, - 4882, - 4885, - 4888, - 4894, - 4896, - 4934, - 4936, - 4954, - 4969, - 4977, - 5024, - 5108, - 5121, - 5740, - 5743, - 5750, - 5761, - 5786, - 5792, - 5866, - 6016, - 6099, - 6112, - 6121, - 6160, - 6169, - 6176, - 6263, - 6272, - 6313, - 7680, - 7835, - 7840, - 7929, - 7936, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8255, - 8256, - 8319, - 8319, - 8400, - 8412, - 8417, - 8417, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8497, - 8499, - 8505, - 8544, - 8579, - 12293, - 12295, - 12321, - 12335, - 12337, - 12341, - 12344, - 12346, - 12353, - 12436, - 12441, - 12442, - 12445, - 12446, - 12449, - 12542, - 12549, - 12588, - 12593, - 12686, - 12704, - 12727, - 13312, - 19893, - 19968, - 40869, - 40960, - 42124, - 44032, - 55203, - 63744, - 64045, - 64256, - 64262, - 64275, - 64279, - 64285, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65056, - 65059, - 65075, - 65076, - 65101, - 65103, - 65136, - 65138, - 65140, - 65140, - 65142, - 65276, - 65296, - 65305, - 65313, - 65338, - 65343, - 65343, - 65345, - 65370, - 65381, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; - var unicodeES5IdentifierStart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 705, - 710, - 721, - 736, - 740, - 748, - 748, - 750, - 750, - 880, - 884, - 886, - 887, - 890, - 893, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 1013, - 1015, - 1153, - 1162, - 1319, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1488, - 1514, - 1520, - 1522, - 1568, - 1610, - 1646, - 1647, - 1649, - 1747, - 1749, - 1749, - 1765, - 1766, - 1774, - 1775, - 1786, - 1788, - 1791, - 1791, - 1808, - 1808, - 1810, - 1839, - 1869, - 1957, - 1969, - 1969, - 1994, - 2026, - 2036, - 2037, - 2042, - 2042, - 2048, - 2069, - 2074, - 2074, - 2084, - 2084, - 2088, - 2088, - 2112, - 2136, - 2208, - 2208, - 2210, - 2220, - 2308, - 2361, - 2365, - 2365, - 2384, - 2384, - 2392, - 2401, - 2417, - 2423, - 2425, - 2431, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2493, - 2493, - 2510, - 2510, - 2524, - 2525, - 2527, - 2529, - 2544, - 2545, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2649, - 2652, - 2654, - 2654, - 2674, - 2676, - 2693, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2749, - 2749, - 2768, - 2768, - 2784, - 2785, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2869, - 2873, - 2877, - 2877, - 2908, - 2909, - 2911, - 2913, - 2929, - 2929, - 2947, - 2947, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 3001, - 3024, - 3024, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3133, - 3133, - 3160, - 3161, - 3168, - 3169, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3261, - 3261, - 3294, - 3294, - 3296, - 3297, - 3313, - 3314, - 3333, - 3340, - 3342, - 3344, - 3346, - 3386, - 3389, - 3389, - 3406, - 3406, - 3424, - 3425, - 3450, - 3455, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3585, - 3632, - 3634, - 3635, - 3648, - 3654, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3760, - 3762, - 3763, - 3773, - 3773, - 3776, - 3780, - 3782, - 3782, - 3804, - 3807, - 3840, - 3840, - 3904, - 3911, - 3913, - 3948, - 3976, - 3980, - 4096, - 4138, - 4159, - 4159, - 4176, - 4181, - 4186, - 4189, - 4193, - 4193, - 4197, - 4198, - 4206, - 4208, - 4213, - 4225, - 4238, - 4238, - 4256, - 4293, - 4295, - 4295, - 4301, - 4301, - 4304, - 4346, - 4348, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4744, - 4746, - 4749, - 4752, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4822, - 4824, - 4880, - 4882, - 4885, - 4888, - 4954, - 4992, - 5007, - 5024, - 5108, - 5121, - 5740, - 5743, - 5759, - 5761, - 5786, - 5792, - 5866, - 5870, - 5872, - 5888, - 5900, - 5902, - 5905, - 5920, - 5937, - 5952, - 5969, - 5984, - 5996, - 5998, - 6000, - 6016, - 6067, - 6103, - 6103, - 6108, - 6108, - 6176, - 6263, - 6272, - 6312, - 6314, - 6314, - 6320, - 6389, - 6400, - 6428, - 6480, - 6509, - 6512, - 6516, - 6528, - 6571, - 6593, - 6599, - 6656, - 6678, - 6688, - 6740, - 6823, - 6823, - 6917, - 6963, - 6981, - 6987, - 7043, - 7072, - 7086, - 7087, - 7098, - 7141, - 7168, - 7203, - 7245, - 7247, - 7258, - 7293, - 7401, - 7404, - 7406, - 7409, - 7413, - 7414, - 7424, - 7615, - 7680, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8305, - 8305, - 8319, - 8319, - 8336, - 8348, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8505, - 8508, - 8511, - 8517, - 8521, - 8526, - 8526, - 8544, - 8584, - 11264, - 11310, - 11312, - 11358, - 11360, - 11492, - 11499, - 11502, - 11506, - 11507, - 11520, - 11557, - 11559, - 11559, - 11565, - 11565, - 11568, - 11623, - 11631, - 11631, - 11648, - 11670, - 11680, - 11686, - 11688, - 11694, - 11696, - 11702, - 11704, - 11710, - 11712, - 11718, - 11720, - 11726, - 11728, - 11734, - 11736, - 11742, - 11823, - 11823, - 12293, - 12295, - 12321, - 12329, - 12337, - 12341, - 12344, - 12348, - 12353, - 12438, - 12445, - 12447, - 12449, - 12538, - 12540, - 12543, - 12549, - 12589, - 12593, - 12686, - 12704, - 12730, - 12784, - 12799, - 13312, - 19893, - 19968, - 40908, - 40960, - 42124, - 42192, - 42237, - 42240, - 42508, - 42512, - 42527, - 42538, - 42539, - 42560, - 42606, - 42623, - 42647, - 42656, - 42735, - 42775, - 42783, - 42786, - 42888, - 42891, - 42894, - 42896, - 42899, - 42912, - 42922, - 43000, - 43009, - 43011, - 43013, - 43015, - 43018, - 43020, - 43042, - 43072, - 43123, - 43138, - 43187, - 43250, - 43255, - 43259, - 43259, - 43274, - 43301, - 43312, - 43334, - 43360, - 43388, - 43396, - 43442, - 43471, - 43471, - 43520, - 43560, - 43584, - 43586, - 43588, - 43595, - 43616, - 43638, - 43642, - 43642, - 43648, - 43695, - 43697, - 43697, - 43701, - 43702, - 43705, - 43709, - 43712, - 43712, - 43714, - 43714, - 43739, - 43741, - 43744, - 43754, - 43762, - 43764, - 43777, - 43782, - 43785, - 43790, - 43793, - 43798, - 43808, - 43814, - 43816, - 43822, - 43968, - 44002, - 44032, - 55203, - 55216, - 55238, - 55243, - 55291, - 63744, - 64109, - 64112, - 64217, - 64256, - 64262, - 64275, - 64279, - 64285, - 64285, - 64287, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65136, - 65140, - 65142, - 65276, - 65313, - 65338, - 65345, - 65370, - 65382, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; - var unicodeES5IdentifierPart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 705, - 710, - 721, - 736, - 740, - 748, - 748, - 750, - 750, - 768, - 884, - 886, - 887, - 890, - 893, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 1013, - 1015, - 1153, - 1155, - 1159, - 1162, - 1319, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1425, - 1469, - 1471, - 1471, - 1473, - 1474, - 1476, - 1477, - 1479, - 1479, - 1488, - 1514, - 1520, - 1522, - 1552, - 1562, - 1568, - 1641, - 1646, - 1747, - 1749, - 1756, - 1759, - 1768, - 1770, - 1788, - 1791, - 1791, - 1808, - 1866, - 1869, - 1969, - 1984, - 2037, - 2042, - 2042, - 2048, - 2093, - 2112, - 2139, - 2208, - 2208, - 2210, - 2220, - 2276, - 2302, - 2304, - 2403, - 2406, - 2415, - 2417, - 2423, - 2425, - 2431, - 2433, - 2435, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2492, - 2500, - 2503, - 2504, - 2507, - 2510, - 2519, - 2519, - 2524, - 2525, - 2527, - 2531, - 2534, - 2545, - 2561, - 2563, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2620, - 2620, - 2622, - 2626, - 2631, - 2632, - 2635, - 2637, - 2641, - 2641, - 2649, - 2652, - 2654, - 2654, - 2662, - 2677, - 2689, - 2691, - 2693, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2748, - 2757, - 2759, - 2761, - 2763, - 2765, - 2768, - 2768, - 2784, - 2787, - 2790, - 2799, - 2817, - 2819, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2869, - 2873, - 2876, - 2884, - 2887, - 2888, - 2891, - 2893, - 2902, - 2903, - 2908, - 2909, - 2911, - 2915, - 2918, - 2927, - 2929, - 2929, - 2946, - 2947, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 3001, - 3006, - 3010, - 3014, - 3016, - 3018, - 3021, - 3024, - 3024, - 3031, - 3031, - 3046, - 3055, - 3073, - 3075, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3133, - 3140, - 3142, - 3144, - 3146, - 3149, - 3157, - 3158, - 3160, - 3161, - 3168, - 3171, - 3174, - 3183, - 3202, - 3203, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3260, - 3268, - 3270, - 3272, - 3274, - 3277, - 3285, - 3286, - 3294, - 3294, - 3296, - 3299, - 3302, - 3311, - 3313, - 3314, - 3330, - 3331, - 3333, - 3340, - 3342, - 3344, - 3346, - 3386, - 3389, - 3396, - 3398, - 3400, - 3402, - 3406, - 3415, - 3415, - 3424, - 3427, - 3430, - 3439, - 3450, - 3455, - 3458, - 3459, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3530, - 3530, - 3535, - 3540, - 3542, - 3542, - 3544, - 3551, - 3570, - 3571, - 3585, - 3642, - 3648, - 3662, - 3664, - 3673, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3769, - 3771, - 3773, - 3776, - 3780, - 3782, - 3782, - 3784, - 3789, - 3792, - 3801, - 3804, - 3807, - 3840, - 3840, - 3864, - 3865, - 3872, - 3881, - 3893, - 3893, - 3895, - 3895, - 3897, - 3897, - 3902, - 3911, - 3913, - 3948, - 3953, - 3972, - 3974, - 3991, - 3993, - 4028, - 4038, - 4038, - 4096, - 4169, - 4176, - 4253, - 4256, - 4293, - 4295, - 4295, - 4301, - 4301, - 4304, - 4346, - 4348, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4744, - 4746, - 4749, - 4752, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4822, - 4824, - 4880, - 4882, - 4885, - 4888, - 4954, - 4957, - 4959, - 4992, - 5007, - 5024, - 5108, - 5121, - 5740, - 5743, - 5759, - 5761, - 5786, - 5792, - 5866, - 5870, - 5872, - 5888, - 5900, - 5902, - 5908, - 5920, - 5940, - 5952, - 5971, - 5984, - 5996, - 5998, - 6000, - 6002, - 6003, - 6016, - 6099, - 6103, - 6103, - 6108, - 6109, - 6112, - 6121, - 6155, - 6157, - 6160, - 6169, - 6176, - 6263, - 6272, - 6314, - 6320, - 6389, - 6400, - 6428, - 6432, - 6443, - 6448, - 6459, - 6470, - 6509, - 6512, - 6516, - 6528, - 6571, - 6576, - 6601, - 6608, - 6617, - 6656, - 6683, - 6688, - 6750, - 6752, - 6780, - 6783, - 6793, - 6800, - 6809, - 6823, - 6823, - 6912, - 6987, - 6992, - 7001, - 7019, - 7027, - 7040, - 7155, - 7168, - 7223, - 7232, - 7241, - 7245, - 7293, - 7376, - 7378, - 7380, - 7414, - 7424, - 7654, - 7676, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8204, - 8205, - 8255, - 8256, - 8276, - 8276, - 8305, - 8305, - 8319, - 8319, - 8336, - 8348, - 8400, - 8412, - 8417, - 8417, - 8421, - 8432, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8505, - 8508, - 8511, - 8517, - 8521, - 8526, - 8526, - 8544, - 8584, - 11264, - 11310, - 11312, - 11358, - 11360, - 11492, - 11499, - 11507, - 11520, - 11557, - 11559, - 11559, - 11565, - 11565, - 11568, - 11623, - 11631, - 11631, - 11647, - 11670, - 11680, - 11686, - 11688, - 11694, - 11696, - 11702, - 11704, - 11710, - 11712, - 11718, - 11720, - 11726, - 11728, - 11734, - 11736, - 11742, - 11744, - 11775, - 11823, - 11823, - 12293, - 12295, - 12321, - 12335, - 12337, - 12341, - 12344, - 12348, - 12353, - 12438, - 12441, - 12442, - 12445, - 12447, - 12449, - 12538, - 12540, - 12543, - 12549, - 12589, - 12593, - 12686, - 12704, - 12730, - 12784, - 12799, - 13312, - 19893, - 19968, - 40908, - 40960, - 42124, - 42192, - 42237, - 42240, - 42508, - 42512, - 42539, - 42560, - 42607, - 42612, - 42621, - 42623, - 42647, - 42655, - 42737, - 42775, - 42783, - 42786, - 42888, - 42891, - 42894, - 42896, - 42899, - 42912, - 42922, - 43000, - 43047, - 43072, - 43123, - 43136, - 43204, - 43216, - 43225, - 43232, - 43255, - 43259, - 43259, - 43264, - 43309, - 43312, - 43347, - 43360, - 43388, - 43392, - 43456, - 43471, - 43481, - 43520, - 43574, - 43584, - 43597, - 43600, - 43609, - 43616, - 43638, - 43642, - 43643, - 43648, - 43714, - 43739, - 43741, - 43744, - 43759, - 43762, - 43766, - 43777, - 43782, - 43785, - 43790, - 43793, - 43798, - 43808, - 43814, - 43816, - 43822, - 43968, - 44010, - 44012, - 44013, - 44016, - 44025, - 44032, - 55203, - 55216, - 55238, - 55243, - 55291, - 63744, - 64109, - 64112, - 64217, - 64256, - 64262, - 64275, - 64279, - 64285, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65024, - 65039, - 65056, - 65062, - 65075, - 65076, - 65101, - 65103, - 65136, - 65140, - 65142, - 65276, - 65296, - 65305, - 65313, - 65338, - 65343, - 65343, - 65345, - 65370, - 65382, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; + var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; function lookupInUnicodeMap(code, map) { if (code < map[0]) { return false; @@ -6260,11 +1506,15 @@ var ts; return false; } function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); + return languageVersion >= 1 ? + lookupInUnicodeMap(code, unicodeES5IdentifierStart) : + lookupInUnicodeMap(code, unicodeES3IdentifierStart); } ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); + return languageVersion >= 1 ? + lookupInUnicodeMap(code, unicodeES5IdentifierPart) : + lookupInUnicodeMap(code, unicodeES3IdentifierPart); } function makeReverseMap(source) { var result = []; @@ -6337,7 +1587,9 @@ var ts; ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { - return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || + ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || + ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { @@ -6424,7 +1676,8 @@ var ts; return false; } } - return ch === 61 || text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + return ch === 61 || + text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } return false; @@ -6504,11 +1757,7 @@ var ts; if (collecting) { if (!result) result = []; - result.push({ - pos: startPos, - end: pos, - hasTrailingNewLine: hasTrailingNewLine - }); + result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); } continue; } @@ -6535,11 +1784,15 @@ var ts; } ts.getTrailingCommentRanges = getTrailingCommentRanges; function isIdentifierStart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } ts.isIdentifierStart = isIdentifierStart; function isIdentifierPart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; function createScanner(languageVersion, skipTrivia, text, onError) { @@ -6558,10 +1811,14 @@ var ts; } } function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } function isIdentifierPart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } function scanNumber() { var start = pos; @@ -7284,39 +2541,17 @@ var ts; } setText(text); return { - getStartPos: function () { - return startPos; - }, - getTextPos: function () { - return pos; - }, - getToken: function () { - return token; - }, - getTokenPos: function () { - return tokenPos; - }, - getTokenText: function () { - return text.substring(tokenPos, pos); - }, - getTokenValue: function () { - return tokenValue; - }, - hasExtendedUnicodeEscape: function () { - return hasExtendedUnicodeEscape; - }, - hasPrecedingLineBreak: function () { - return precedingLineBreak; - }, - isIdentifier: function () { - return token === 64 || token > 100; - }, - isReservedWord: function () { - return token >= 65 && token <= 100; - }, - isUnterminated: function () { - return tokenIsUnterminated; - }, + getStartPos: function () { return startPos; }, + getTextPos: function () { return pos; }, + getToken: function () { return token; }, + getTokenPos: function () { return tokenPos; }, + getTokenText: function () { return text.substring(tokenPos, pos); }, + getTokenValue: function () { return tokenValue; }, + hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, + hasPrecedingLineBreak: function () { return precedingLineBreak; }, + isIdentifier: function () { return token === 64 || token > 100; }, + isReservedWord: function () { return token >= 65 && token <= 100; }, + isUnterminated: function () { return tokenIsUnterminated; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, @@ -7482,11 +2717,7 @@ var ts; { name: "target", shortName: "t", - type: { - "es3": 0, - "es5": 1, - "es6": 2 - }, + type: { "es3": 0, "es5": 1, "es6": 2 }, description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, paramType: ts.Diagnostics.VERSION, error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6 @@ -7666,9 +2897,7 @@ var ts; var files = []; if (ts.hasProperty(json, "files")) { if (json["files"] instanceof Array) { - var files = ts.map(json["files"], function (s) { - return ts.combinePaths(basePath, s); - }); + var files = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } } else { @@ -7702,13 +2931,9 @@ var ts; function getSingleLineStringWriter() { if (stringWriters.length == 0) { var str = ""; - var writeText = function (text) { - return str += text; - }; + var writeText = function (text) { return str += text; }; return { - string: function () { - return str; - }, + string: function () { return str; }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -7716,18 +2941,11 @@ var ts; writeStringLiteral: writeText, writeParameter: writeText, writeSymbol: writeText, - writeLine: function () { - return str += " "; - }, - increaseIndent: function () { - }, - decreaseIndent: function () { - }, - clear: function () { - return str = ""; - }, - trackSymbol: function () { - } + writeLine: function () { return str += " "; }, + increaseIndent: function () { }, + decreaseIndent: function () { }, + clear: function () { return str = ""; }, + trackSymbol: function () { } }; } return stringWriters.pop(); @@ -7749,7 +2967,8 @@ var ts; ts.containsParseError = containsParseError; function aggregateChildData(node) { if (!(node.parserContextFlags & 64)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || ts.forEachChild(node, containsParseError); + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || + ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { node.parserContextFlags |= 32; } @@ -7828,7 +3047,8 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 12288) !== 0 || isCatchClauseVariableDeclaration(declaration); + return (getCombinedNodeFlags(declaration) & 12288) !== 0 || + isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function getEnclosingBlockScopeContainer(node) { @@ -7856,7 +3076,10 @@ var ts; } ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { - return declaration && declaration.kind === 193 && declaration.parent && declaration.parent.kind === 217; + return declaration && + declaration.kind === 193 && + declaration.parent && + declaration.parent.kind === 217; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -7908,7 +3131,9 @@ var ts; if (errorNode === undefined) { return getSpanOfTokenAtPosition(sourceFile, node.pos); } - var pos = nodeIsMissing(errorNode) ? errorNode.pos : ts.skipTrivia(sourceFile.text, errorNode.pos); + var pos = nodeIsMissing(errorNode) + ? errorNode.pos + : ts.skipTrivia(sourceFile.text, errorNode.pos); return createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; @@ -7971,7 +3196,9 @@ var ts; function getJsDocComments(node, sourceFileOfNode) { return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); function isJsDocComment(comment) { - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; + return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; } } ts.getJsDocComments = getJsDocComments; @@ -8197,11 +3424,14 @@ var ts; return _parent.expression === node; case 181: var forStatement = _parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || forStatement.condition === node || forStatement.iterator === node; + return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || + forStatement.condition === node || + forStatement.iterator === node; case 182: case 183: var forInStatement = _parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || forInStatement.expression === node; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || + forInStatement.expression === node; case 158: return node === _parent.expression; case 173: @@ -8219,7 +3449,8 @@ var ts; ts.isExpression = isExpression; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 || (preserveConstEnums && moduleState === 2); + return moduleState === 1 || + (preserveConstEnums && moduleState === 2); } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { @@ -8467,7 +3698,9 @@ var ts; } ts.isTrivia = isTrivia; function hasDynamicName(declaration) { - return declaration.name && declaration.name.kind === 126 && !isWellKnownSymbolSyntactically(declaration.name.expression); + return declaration.name && + declaration.name.kind === 126 && + !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { @@ -8571,10 +3804,7 @@ var ts; if (length < 0) { throw new Error("length < 0"); } - return { - start: start, - length: length - }; + return { start: start, length: length }; } ts.createTextSpan = createTextSpan; function createTextSpanFromBounds(start, end) { @@ -8593,10 +3823,7 @@ var ts; if (newLength < 0) { throw new Error("newLength < 0"); } - return { - span: span, - newLength: newLength - }; + return { span: span, newLength: newLength }; } ts.createTextChangeRange = createTextChangeRange; ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); @@ -8757,9 +3984,9 @@ var ts; } var nonAsciiCharacters = /[^\u0000-\u007F]/g; function escapeNonAsciiCharacters(s) { - return nonAsciiCharacters.test(s) ? s.replace(nonAsciiCharacters, function (c) { - return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - }) : s; + return nonAsciiCharacters.test(s) ? + s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) : + s; } ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters; })(ts || (ts = {})); @@ -8804,9 +4031,12 @@ var ts; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { case 125: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); case 127: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.expression); case 128: case 130: case 129: @@ -8814,13 +4044,22 @@ var ts; case 219: case 193: case 150: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); case 140: case 141: case 136: case 137: case 138: - return visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); case 132: case 131: case 133: @@ -8829,9 +4068,17 @@ var ts; case 160: case 195: case 161: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); case 139: - return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); + return visitNode(cbNode, node.typeName) || + visitNodes(cbNodes, node.typeArguments); case 142: return visitNode(cbNode, node.exprName); case 143: @@ -8852,16 +4099,23 @@ var ts; case 152: return visitNodes(cbNodes, node.properties); case 153: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.dotToken) || + visitNode(cbNode, node.name); case 154: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.argumentExpression); case 155: case 156: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments) || + visitNodes(cbNodes, node.arguments); case 157: - return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.template); case 158: - return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); case 159: return visitNode(cbNode, node.expression); case 162: @@ -8873,91 +4127,142 @@ var ts; case 165: return visitNode(cbNode, node.operand); case 170: - return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); case 166: return visitNode(cbNode, node.operand); case 167: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); case 168: - return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); case 171: return visitNode(cbNode, node.expression); case 174: case 201: return visitNodes(cbNodes, node.statements); case 221: - return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); + return visitNodes(cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); case 175: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); case 194: return visitNodes(cbNodes, node.declarations); case 177: return visitNode(cbNode, node.expression); case 178: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); case 179: - return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); case 180: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 181: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.iterator) || + visitNode(cbNode, node.statement); case 182: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 183: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 184: case 185: return visitNode(cbNode, node.label); case 186: return visitNode(cbNode, node.expression); case 187: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 188: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); case 202: return visitNodes(cbNodes, node.clauses); case 214: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); case 215: return visitNodes(cbNodes, node.statements); case 189: - return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); case 190: return visitNode(cbNode, node.expression); case 191: - return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); case 217: - return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); case 196: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 197: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 198: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); case 199: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); case 220: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); case 200: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); case 203: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); case 204: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier); case 205: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); case 206: return visitNode(cbNode, node.name); case 207: case 211: return visitNodes(cbNodes, node.elements); case 210: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier); case 208: case 212: - return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); case 209: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); case 169: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); case 173: @@ -8973,69 +4278,40 @@ var ts; ts.forEachChild = forEachChild; function parsingContextErrors(context) { switch (context) { - case 0: - return ts.Diagnostics.Declaration_or_statement_expected; - case 1: - return ts.Diagnostics.Declaration_or_statement_expected; - case 2: - return ts.Diagnostics.Statement_expected; - case 3: - return ts.Diagnostics.case_or_default_expected; - case 4: - return ts.Diagnostics.Statement_expected; - case 5: - return ts.Diagnostics.Property_or_signature_expected; - case 6: - return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; - case 7: - return ts.Diagnostics.Enum_member_expected; - case 8: - return ts.Diagnostics.Type_reference_expected; - case 9: - return ts.Diagnostics.Variable_declaration_expected; - case 10: - return ts.Diagnostics.Property_destructuring_pattern_expected; - case 11: - return ts.Diagnostics.Array_element_destructuring_pattern_expected; - case 12: - return ts.Diagnostics.Argument_expression_expected; - case 13: - return ts.Diagnostics.Property_assignment_expected; - case 14: - return ts.Diagnostics.Expression_or_comma_expected; - case 15: - return ts.Diagnostics.Parameter_declaration_expected; - case 16: - return ts.Diagnostics.Type_parameter_declaration_expected; - case 17: - return ts.Diagnostics.Type_argument_expected; - case 18: - return ts.Diagnostics.Type_expected; - case 19: - return ts.Diagnostics.Unexpected_token_expected; - case 20: - return ts.Diagnostics.Identifier_expected; + case 0: return ts.Diagnostics.Declaration_or_statement_expected; + case 1: return ts.Diagnostics.Declaration_or_statement_expected; + case 2: return ts.Diagnostics.Statement_expected; + case 3: return ts.Diagnostics.case_or_default_expected; + case 4: return ts.Diagnostics.Statement_expected; + case 5: return ts.Diagnostics.Property_or_signature_expected; + case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7: return ts.Diagnostics.Enum_member_expected; + case 8: return ts.Diagnostics.Type_reference_expected; + case 9: return ts.Diagnostics.Variable_declaration_expected; + case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; + case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; + case 12: return ts.Diagnostics.Argument_expression_expected; + case 13: return ts.Diagnostics.Property_assignment_expected; + case 14: return ts.Diagnostics.Expression_or_comma_expected; + case 15: return ts.Diagnostics.Parameter_declaration_expected; + case 16: return ts.Diagnostics.Type_parameter_declaration_expected; + case 17: return ts.Diagnostics.Type_argument_expected; + case 18: return ts.Diagnostics.Type_expected; + case 19: return ts.Diagnostics.Unexpected_token_expected; + case 20: return ts.Diagnostics.Identifier_expected; } } ; function modifierToFlag(token) { switch (token) { - case 109: - return 128; - case 108: - return 16; - case 107: - return 64; - case 106: - return 32; - case 77: - return 1; - case 114: - return 2; - case 69: - return 8192; - case 72: - return 256; + case 109: return 128; + case 108: return 16; + case 107: return 64; + case 106: return 32; + case 77: return 1; + case 114: return 2; + case 69: return 8192; + case 72: return 256; } return 0; } @@ -9268,7 +4544,8 @@ var ts; } ts.updateSourceFile = updateSourceFile; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 64 && (node.text === "eval" || node.text === "arguments"); + return node.kind === 64 && + (node.text === "eval" || node.text === "arguments"); } ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; function isUseStrictPrologueDirective(sourceFile, node) { @@ -9486,7 +4763,9 @@ var ts; var saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; var saveContextFlags = contextFlags; - var result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); + var result = isLookAhead + ? scanner.lookAhead(callback) + : scanner.tryScan(callback); ts.Debug.assert(saveContextFlags === contextFlags); if (!result || isLookAhead) { token = saveToken; @@ -9537,7 +4816,8 @@ var ts; return undefined; } function parseExpectedToken(t, reportAtCurrentPosition, diagnosticMessage, arg0) { - return parseOptionalToken(t) || createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); + return parseOptionalToken(t) || + createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); } function parseTokenNode() { var node = createNode(token); @@ -9614,7 +4894,9 @@ var ts; return createIdentifier(isIdentifierOrKeyword()); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || token === 8 || token === 7; + return isIdentifierOrKeyword() || + token === 8 || + token === 7; } function parsePropertyName() { if (token === 8 || token === 7) { @@ -9667,7 +4949,10 @@ var ts; return canFollowModifier(); } function canFollowModifier() { - return token === 18 || token === 14 || token === 35 || isLiteralPropertyName(); + return token === 18 + || token === 14 + || token === 35 + || isLiteralPropertyName(); } function nextTokenIsClassOrFunction() { nextToken(); @@ -9725,7 +5010,8 @@ var ts; return isIdentifier(); } function isNotHeritageClauseTypeName() { - if (token === 102 || token === 78) { + if (token === 102 || + token === 78) { return lookAhead(nextTokenIsIdentifier); } return false; @@ -10106,7 +5392,9 @@ var ts; var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - if (node.kind === 7 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + if (node.kind === 7 + && sourceText.charCodeAt(tokenPos) === 48 + && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { node.flags |= 16384; } return node; @@ -10145,7 +5433,9 @@ var ts; } function parseParameterType() { if (parseOptional(51)) { - return token === 8 ? parseLiteralNode(true) : parseType(); + return token === 8 + ? parseLiteralNode(true) + : parseType(); } return undefined; } @@ -10303,7 +5593,11 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 || token === 24 || token === 50 || token === 51 || canParseSemicolon(); + return token === 16 || + token === 24 || + token === 50 || + token === 51 || + canParseSemicolon(); } function parseTypeMember() { switch (token) { @@ -10311,7 +5605,9 @@ var ts; case 24: return parseSignatureMember(136); case 18: - return isIndexSignature() ? parseIndexSignatureDeclaration(undefined) : parsePropertyOrMethodSignature(); + return isIndexSignature() + ? parseIndexSignatureDeclaration(undefined) + : parsePropertyOrMethodSignature(); case 87: if (lookAhead(isStartOfConstructSignature)) { return parseSignatureMember(137); @@ -10333,7 +5629,9 @@ var ts; } function parseIndexSignatureWithModifiers() { var modifiers = parseModifiers(); - return isIndexSignature() ? parseIndexSignatureDeclaration(modifiers) : undefined; + return isIndexSignature() + ? parseIndexSignatureDeclaration(modifiers) + : undefined; } function isStartOfConstructSignature() { nextToken(); @@ -10439,9 +5737,7 @@ var ts; function parseUnionTypeOrHigher() { var type = parseArrayTypeOrHigher(); if (token === 44) { - var types = [ - type - ]; + var types = [type]; types.pos = type.pos; while (parseOptional(44)) { types.push(parseArrayTypeOrHigher()); @@ -10466,7 +5762,9 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 51 || token === 23 || token === 50 || token === 52 || isIdentifier() || ts.isModifier(token)) { + if (token === 51 || token === 23 || + token === 50 || token === 52 || + isIdentifier() || ts.isModifier(token)) { return true; } if (token === 17) { @@ -10593,12 +5891,14 @@ var ts; } function nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() { nextToken(); - return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 14 || token === 18); + return !scanner.hasPrecedingLineBreak() && + (isIdentifier() || token === 14 || token === 18); } function parseYieldExpression() { var node = createNode(170); nextToken(); - if (!scanner.hasPrecedingLineBreak() && (token === 35 || isStartOfExpression())) { + if (!scanner.hasPrecedingLineBreak() && + (token === 35 || isStartOfExpression())) { node.asteriskToken = parseOptionalToken(35); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); @@ -10613,9 +5913,7 @@ var ts; var parameter = createNode(128, identifier.pos); parameter.name = identifier; finishNode(parameter); - node.parameters = [ - parameter - ]; + node.parameters = [parameter]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; parseExpected(32); @@ -10627,7 +5925,9 @@ var ts; if (triState === 0) { return undefined; } - var arrowFunction = triState === 1 ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + var arrowFunction = triState === 1 + ? parseParenthesizedArrowFunctionExpressionHead(true) + : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); if (!arrowFunction) { return undefined; } @@ -10849,7 +6149,9 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 90 ? parseSuperExpression() : parseMemberExpressionOrHigher(); + var expression = token === 90 + ? parseSuperExpression() + : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); } function parseMemberExpressionOrHigher() { @@ -10903,7 +6205,9 @@ var ts; if (token === 10 || token === 11) { var tagExpression = createNode(157, expression.pos); tagExpression.tag = expression; - tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); + tagExpression.template = token === 10 + ? parseLiteralNode() + : parseTemplateExpression(); expression = finishNode(tagExpression); continue; } @@ -10949,7 +6253,9 @@ var ts; if (!parseExpected(25)) { return undefined; } - return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; + return typeArguments && canFollowTypeArgumentsInExpression() + ? typeArguments + : undefined; } function canFollowTypeArgumentsInExpression() { switch (token) { @@ -11024,7 +6330,9 @@ var ts; return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 ? parseSpreadElement() : token === 23 ? createNode(172) : parseAssignmentExpressionOrHigher(); + return token === 21 ? parseSpreadElement() : + token === 23 ? createNode(172) : + parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return allowInAnd(parseArgumentOrArrayLiteralElement); @@ -11674,7 +6982,11 @@ var ts; if (isIndexSignature()) { return parseIndexSignatureDeclaration(modifiers); } - if (isIdentifierOrKeyword() || token === 8 || token === 7 || token === 35 || token === 18) { + if (isIdentifierOrKeyword() || + token === 8 || + token === 7 || + token === 35 || + token === 18) { return parsePropertyOrMethodDeclaration(fullStart, modifiers); } ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -11687,7 +6999,9 @@ var ts; node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); if (parseExpected(14)) { - node.members = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); + node.members = inGeneratorParameterContext() + ? doOutsideOfYieldContext(parseClassMembers) + : parseClassMembers(); parseExpected(15); } else { @@ -11697,7 +7011,9 @@ var ts; } function parseHeritageClauses(isClassHeritageClause) { if (isHeritageClause()) { - return isClassHeritageClause && inGeneratorParameterContext() ? doOutsideOfYieldContext(parseHeritageClausesWorker) : parseHeritageClausesWorker(); + return isClassHeritageClause && inGeneratorParameterContext() + ? doOutsideOfYieldContext(parseHeritageClausesWorker) + : parseHeritageClausesWorker(); } return undefined; } @@ -11776,7 +7092,9 @@ var ts; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(20) ? parseInternalModuleTail(getNodePos(), undefined, 1) : parseModuleBlock(); + node.body = parseOptional(20) + ? parseInternalModuleTail(getNodePos(), undefined, 1) + : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { @@ -11788,17 +7106,21 @@ var ts; } function parseModuleDeclaration(fullStart, modifiers) { parseExpected(116); - return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); + return token === 8 + ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) + : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); } function isExternalModuleReference() { - return token === 117 && lookAhead(nextTokenIsOpenParen); + return token === 117 && + lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 16; } function nextTokenIsCommaOrFromKeyword() { nextToken(); - return token === 23 || token === 123; + return token === 23 || + token === 123; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, modifiers) { parseExpected(84); @@ -11818,7 +7140,9 @@ var ts; } var importDeclaration = createNode(204, fullStart); setModifiers(importDeclaration, modifiers); - if (identifier || token === 35 || token === 14) { + if (identifier || + token === 35 || + token === 14) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); parseExpected(123); } @@ -11831,13 +7155,16 @@ var ts; if (identifier) { importClause.name = identifier; } - if (!importClause.name || parseOptional(23)) { + if (!importClause.name || + parseOptional(23)) { importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(207); } return finishNode(importClause); } function parseModuleReference() { - return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); + return isExternalModuleReference() + ? parseExternalModuleReference() + : parseEntityName(false); } function parseExternalModuleReference() { var node = createNode(213); @@ -11967,11 +7294,13 @@ var ts; } function nextTokenCanFollowImportKeyword() { nextToken(); - return isIdentifierOrKeyword() || token === 8 || token === 35 || token === 14; + return isIdentifierOrKeyword() || token === 8 || + token === 35 || token === 14; } function nextTokenCanFollowExportKeyword() { nextToken(); - return token === 52 || token === 35 || token === 14 || token === 72 || isDeclarationStart(); + return token === 52 || token === 35 || + token === 14 || token === 72 || isDeclarationStart(); } function nextTokenIsDeclarationStart() { nextToken(); @@ -12025,7 +7354,9 @@ var ts; return parseSourceElementOrModuleElement(); } function parseSourceElementOrModuleElement() { - return isDeclarationStart() ? parseDeclaration() : parseStatement(); + return isDeclarationStart() + ? parseDeclaration() + : parseStatement(); } function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, sourceText); @@ -12040,10 +7371,7 @@ var ts; if (kind !== 2) { break; } - var range = { - pos: triviaScanner.getTokenPos(), - end: triviaScanner.getTextPos() - }; + var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; var comment = sourceText.substring(range.pos, range.end); var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { @@ -12074,10 +7402,7 @@ var ts; var pathMatchResult = pathRegex.exec(comment); var nameMatchResult = nameRegex.exec(comment); if (pathMatchResult) { - var amdDependency = { - path: pathMatchResult[2], - name: nameMatchResult ? nameMatchResult[2] : undefined - }; + var amdDependency = { path: pathMatchResult[2], name: nameMatchResult ? nameMatchResult[2] : undefined }; amdDependencies.push(amdDependency); } } @@ -12089,7 +7414,13 @@ var ts; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 1 || node.kind === 203 && node.moduleReference.kind === 213 || node.kind === 204 || node.kind === 209 || node.kind === 210 ? node : undefined; + return node.flags & 1 + || node.kind === 203 && node.moduleReference.kind === 213 + || node.kind === 204 + || node.kind === 209 + || node.kind === 210 + ? node + : undefined; }); } } @@ -12252,7 +7583,9 @@ var ts; if (node.name) { node.name.parent = node; } - var message = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = symbol.flags & 2 + ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 + : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); @@ -12298,7 +7631,9 @@ var ts; } else { if (hasExportModifier || isAmbientContext(container)) { - var exportKind = (symbolKind & 107455 ? 1048576 : 0) | (symbolKind & 793056 ? 2097152 : 0) | (symbolKind & 1536 ? 4194304 : 0); + var exportKind = (symbolKind & 107455 ? 1048576 : 0) | + (symbolKind & 793056 ? 2097152 : 0) | + (symbolKind & 1536 ? 4194304 : 0); var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); node.localSymbol = local; @@ -12578,7 +7913,9 @@ var ts; else { bindDeclaration(node, 1, 107455, false); } - if (node.flags & 112 && node.parent.kind === 133 && node.parent.parent.kind === 196) { + if (node.flags & 112 && + node.parent.kind === 133 && + node.parent.parent.kind === 196) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -12612,24 +7949,12 @@ var ts; var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var checker = { - getNodeCount: function () { - return ts.sum(host.getSourceFiles(), "nodeCount"); - }, - getIdentifierCount: function () { - return ts.sum(host.getSourceFiles(), "identifierCount"); - }, - getSymbolCount: function () { - return ts.sum(host.getSourceFiles(), "symbolCount"); - }, - getTypeCount: function () { - return typeCount; - }, - isUndefinedSymbol: function (symbol) { - return symbol === undefinedSymbol; - }, - isArgumentsSymbol: function (symbol) { - return symbol === argumentsSymbol; - }, + getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, + getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, + getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, + getTypeCount: function () { return typeCount; }, + isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, + isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, @@ -12723,7 +8048,9 @@ var ts; return emitResolver; } function error(location, message, arg0, arg1, arg2) { - var diagnostic = location ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); + var diagnostic = location + ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) + : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); diagnostics.add(diagnostic); } function createSymbol(flags, name) { @@ -12809,7 +8136,8 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = target.flags & 2 || source.flags & 2 + ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { error(node.name ? node.name : node, message, symbolToString(source)); }); @@ -12996,18 +8324,18 @@ var ts; } function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert((result.flags & 2) !== 0); - var declaration = ts.forEach(result.declarations, function (d) { - return ts.isBlockOrCatchScoped(d) ? d : undefined; - }); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { var variableDeclaration = ts.getAncestor(declaration, 193); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 175 || variableDeclaration.parent.parent.kind === 181) { + if (variableDeclaration.parent.parent.kind === 175 || + variableDeclaration.parent.parent.kind === 181) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 183 || variableDeclaration.parent.parent.kind === 182) { + else if (variableDeclaration.parent.parent.kind === 183 || + variableDeclaration.parent.parent.kind === 182) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -13028,12 +8356,15 @@ var ts; return false; } function isAliasSymbolDeclaration(node) { - return node.kind === 203 || node.kind === 205 && !!node.name || node.kind === 206 || node.kind === 208 || node.kind === 212 || node.kind === 209; + return node.kind === 203 || + node.kind === 205 && !!node.name || + node.kind === 206 || + node.kind === 208 || + node.kind === 212 || + node.kind === 209; } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { - return isAliasSymbolDeclaration(d) ? d : undefined; - }); + return ts.forEach(symbol.declarations, function (d) { return isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { if (node.moduleReference.kind === 213) { @@ -13074,7 +8405,9 @@ var ts; return getExternalModuleMember(node.parent.parent.parent, node); } function getTargetOfExportSpecifier(node) { - return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); + return node.parent.parent.moduleSpecifier ? + getExternalModuleMember(node.parent.parent, node) : + resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); } function getTargetOfExportAssignment(node) { return resolveEntityName(node.expression, 107455 | 793056 | 1536); @@ -13293,7 +8626,9 @@ var ts; return getMergedSymbol(symbol.parent); } function getExportSymbolOfValueSymbolIfExported(symbol) { - return symbol && (symbol.flags & 1048576) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; + return symbol && (symbol.flags & 1048576) !== 0 + ? getMergedSymbol(symbol.exportSymbol) + : symbol; } function symbolIsValue(symbol) { if (symbol.flags & 16777216) { @@ -13332,7 +8667,10 @@ var ts; return type; } function isReservedMemberName(name) { - return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && name.charCodeAt(2) !== 95 && name.charCodeAt(2) !== 64; + return name.charCodeAt(0) === 95 && + name.charCodeAt(1) === 95 && + name.charCodeAt(2) !== 95 && + name.charCodeAt(2) !== 64; } function getNamedMembers(members) { var result; @@ -13406,28 +8744,24 @@ var ts; } function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { - return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && + canQualifySymbol(symbolFromSymbolTable, meaning); } } if (isAccessible(ts.lookUp(symbols, symbol.name))) { - return [ - symbol - ]; + return [symbol]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608) { - if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [ - symbolFromSymbolTable - ]; + return [symbolFromSymbolTable]; } var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [ - symbolFromSymbolTable - ].concat(accessibleSymbolsFromExports); + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); } } } @@ -13492,9 +8826,7 @@ var ts; errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) }; } - return { - accessibility: 0 - }; + return { accessibility: 0 }; function getExternalModuleContainer(declaration) { for (; declaration; declaration = declaration.parent) { if (hasExternalModuleSymbol(declaration)) { @@ -13504,22 +8836,20 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 200 && declaration.name.kind === 8) || (declaration.kind === 221 && ts.isExternalModule(declaration)); + return (declaration.kind === 200 && declaration.name.kind === 8) || + (declaration.kind === 221 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; - if (ts.forEach(symbol.declarations, function (declaration) { - return !getIsDeclarationVisible(declaration); - })) { + if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { return undefined; } - return { - accessibility: 0, - aliasesToMakeVisible: aliasesToMakeVisible - }; + return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 203 && !(declaration.flags & 1) && isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 203 && + !(declaration.flags & 1) && + isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -13527,9 +8857,7 @@ var ts; } } else { - aliasesToMakeVisible = [ - declaration - ]; + aliasesToMakeVisible = [declaration]; } return true; } @@ -13543,7 +8871,8 @@ var ts; if (entityName.parent.kind === 142) { meaning = 107455 | 1048576; } - else if (entityName.kind === 125 || entityName.parent.kind === 203) { + else if (entityName.kind === 125 || + entityName.parent.kind === 203) { meaning = 1536; } else { @@ -13629,7 +8958,8 @@ var ts; function walkSymbol(symbol, meaning) { if (symbol) { var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); - if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { @@ -13662,7 +8992,8 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { if (type.flags & 1048703) { - writer.writeKeyword(!(globalFlags & 16) && (type.flags & 1) ? "any" : type.intrinsicName); + writer.writeKeyword(!(globalFlags & 16) && + (type.flags & 1) ? "any" : type.intrinsicName); } else if (type.flags & 4096) { writeTypeReference(type, flags); @@ -13755,14 +9086,16 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.flags & 128; - })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 221 || declaration.parent.kind === 201; - })); + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && + ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && + (type.symbol.parent || + ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.parent.kind === 221 || declaration.parent.kind === 201; + })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { - return !!(flags & 2) || (typeStack && ts.contains(typeStack, type)); + return !!(flags & 2) || + (typeStack && ts.contains(typeStack, type)); } } } @@ -14048,7 +9381,8 @@ var ts; case 199: case 203: var _parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 203 && _parent.kind !== 221 && ts.isInAmbientContext(_parent))) { + if (!(ts.getCombinedNodeFlags(node) & 1) && + !(node.kind !== 203 && _parent.kind !== 221 && ts.isInAmbientContext(_parent))) { return isGlobalSourceFile(_parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(_parent); @@ -14103,9 +9437,7 @@ var ts; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); - return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { - return anyType; - })) : classType; + return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; } function getTypeOfPropertyOfType(type, name) { var prop = getPropertyOfType(type, name); @@ -14126,7 +9458,9 @@ var ts; var type; if (pattern.kind === 148) { var _name = declaration.propertyName || declaration.name; - type = getTypeOfPropertyOfType(parentType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); + type = getTypeOfPropertyOfType(parentType, _name.text) || + isNumericLiteralName(_name.text) && getIndexTypeOfType(parentType, 1) || + getIndexTypeOfType(parentType, 0); if (!type) { error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(_name)); return unknownType; @@ -14222,7 +9556,9 @@ var ts; return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 148 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); + return pattern.kind === 148 + ? getTypeFromObjectBindingPattern(pattern) + : getTypeFromArrayBindingPattern(pattern); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -14266,7 +9602,9 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + var diagnostic = symbol.valueDeclaration.type ? + ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : + ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); } } @@ -14400,9 +9738,7 @@ var ts; ts.forEach(declaration.typeParameters, function (node) { var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); if (!result) { - result = [ - tp - ]; + result = [tp]; } else if (!ts.contains(result, tp)) { result.push(tp); @@ -14649,15 +9985,14 @@ var ts; var baseType = classType.baseTypes[0]; var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1); return ts.map(baseSignatures, function (baseSignature) { - var signature = baseType.flags & 4096 ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); + var signature = baseType.flags & 4096 ? + getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); signature.typeParameters = classType.typeParameters; signature.resolvedReturnType = classType; return signature; }); } - return [ - createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false) - ]; + return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; } function createTupleTypeMemberSymbols(memberTypes) { var members = {}; @@ -14686,9 +10021,7 @@ var ts; return true; } function getUnionSignatures(types, kind) { - var signatureLists = ts.map(types, function (t) { - return getSignaturesOfType(t, kind); - }); + var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; for (var _i = 0, _n = signatures.length; _i < _n; _i++) { var signature = signatures[_i]; @@ -14705,9 +10038,7 @@ var ts; for (var i = 0; i < result.length; i++) { var s = result[i]; s.resolvedReturnType = undefined; - s.unionSignatures = ts.map(signatureLists, function (signatures) { - return signatures[i]; - }); + s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); } return result; } @@ -14858,9 +10189,7 @@ var ts; return undefined; } if (!props) { - props = [ - prop - ]; + props = [prop]; } else { props.push(prop); @@ -14960,7 +10289,8 @@ var ts; var links = getNodeLinks(declaration); if (!links.resolvedSignature) { var classType = declaration.kind === 133 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; - var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; + var typeParameters = classType ? classType.typeParameters : + declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; @@ -15092,12 +10422,8 @@ var ts; var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; - type.callSignatures = !isConstructor ? [ - signature - ] : emptyArray; - type.constructSignatures = isConstructor ? [ - signature - ] : emptyArray; + type.callSignatures = !isConstructor ? [signature] : emptyArray; + type.constructSignatures = isConstructor ? [signature] : emptyArray; signature.isolatedSignatureType = type; } return signature.isolatedSignatureType; @@ -15125,7 +10451,9 @@ var ts; } function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); - return declaration ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType : undefined; + return declaration + ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType + : undefined; } function getConstraintOfTypeParameter(type) { if (!type.constraint) { @@ -15181,9 +10509,7 @@ var ts; return links.isIllegalTypeReferenceInConstraint; } var currentNode = typeReferenceNode; - while (!ts.forEach(typeParameterSymbol.declarations, function (d) { - return d.parent === currentNode.parent; - })) { + while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } links.isIllegalTypeReferenceInConstraint = currentNode.kind === 127; @@ -15197,9 +10523,7 @@ var ts; if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); if (symbol && (symbol.flags & 262144)) { - links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { - return d.parent == typeParameter.parent; - }); + links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); } } if (links.isIllegalTypeReferenceInConstraint) { @@ -15298,9 +10622,7 @@ var ts; } function createArrayType(elementType) { var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); - return arrayType !== emptyObjectType ? createTypeReference(arrayType, [ - elementType - ]) : emptyObjectType; + return arrayType !== emptyObjectType ? createTypeReference(arrayType, [elementType]) : emptyObjectType; } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); @@ -15490,21 +10812,15 @@ var ts; return items; } function createUnaryTypeMapper(source, target) { - return function (t) { - return t === source ? target : t; - }; + return function (t) { return t === source ? target : t; }; } function createBinaryTypeMapper(source1, target1, source2, target2) { - return function (t) { - return t === source1 ? target1 : t === source2 ? target2 : t; - }; + return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } function createTypeMapper(sources, targets) { switch (sources.length) { - case 1: - return createUnaryTypeMapper(sources[0], targets[0]); - case 2: - return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); + case 1: return createUnaryTypeMapper(sources[0], targets[0]); + case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); } return function (t) { for (var i = 0; i < sources.length; i++) { @@ -15516,21 +10832,15 @@ var ts; }; } function createUnaryTypeEraser(source) { - return function (t) { - return t === source ? anyType : t; - }; + return function (t) { return t === source ? anyType : t; }; } function createBinaryTypeEraser(source1, source2) { - return function (t) { - return t === source1 || t === source2 ? anyType : t; - }; + return function (t) { return t === source1 || t === source2 ? anyType : t; }; } function createTypeEraser(sources) { switch (sources.length) { - case 1: - return createUnaryTypeEraser(sources[0]); - case 2: - return createBinaryTypeEraser(sources[0], sources[1]); + case 1: return createUnaryTypeEraser(sources[0]); + case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { for (var _i = 0, _n = sources.length; _i < _n; _i++) { @@ -15556,9 +10866,7 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { - return mapper2(mapper1(t)); - }; + return function (t) { return mapper2(mapper1(t)); }; } function instantiateTypeParameter(typeParameter, mapper) { var result = createType(512); @@ -15619,7 +10927,8 @@ var ts; return mapper(type); } if (type.flags & 32768) { - return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? instantiateAnonymousType(type, mapper) : type; + return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? + instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096) { return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); @@ -15644,9 +10953,11 @@ var ts; case 151: return ts.forEach(node.elements, isContextSensitive); case 168: - return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); + return isContextSensitive(node.whenTrue) || + isContextSensitive(node.whenFalse); case 167: - return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); + return node.operatorToken.kind === 49 && + (isContextSensitive(node.left) || isContextSensitive(node.right)); case 218: return isContextSensitive(node.initializer); case 132: @@ -15658,9 +10969,7 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { - return p.type; - }); + return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); } function getTypeWithoutConstructors(type) { if (type.flags & 48128) { @@ -15799,7 +11108,8 @@ var ts; } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (_result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && + (_result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; return _result; } @@ -16260,7 +11570,9 @@ var ts; if (source === target) { return -1; } - if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { + if (source.parameters.length !== target.parameters.length || + source.minArgumentCount !== target.minArgumentCount || + source.hasRestParameter !== target.hasRestParameter) { return 0; } var result = -1; @@ -16304,9 +11616,7 @@ var ts; return true; } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { - return isSupertypeOfEach(t, types) ? t : undefined; - }); + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { var bestSupertype; @@ -16426,7 +11736,9 @@ var ts; diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; case 128: - diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + diagnostic = declaration.dotDotDotToken ? + ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : + ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; case 195: case 132: @@ -16483,10 +11795,7 @@ var ts; var inferences = []; for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { var unused = typeParameters[_i]; - inferences.push({ - primary: undefined, - secondary: undefined - }); + inferences.push({ primary: undefined, secondary: undefined }); } return { typeParameters: typeParameters, @@ -16533,7 +11842,9 @@ var ts; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { var inferences = context.inferences[i]; - var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); + var candidates = inferiority ? + inferences.secondary || (inferences.secondary = []) : + inferences.primary || (inferences.primary = []); if (!ts.contains(candidates, source)) candidates.push(source); break; @@ -16574,7 +11885,8 @@ var ts; inferFromTypes(sourceType, target); } } - else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || + (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -16684,12 +11996,8 @@ var ts; function removeTypesFromUnionType(type, typeKind, isOfTypeKind, allowEmptyUnionResult) { if (type.flags & 16384) { var types = type.types; - if (ts.forEach(types, function (t) { - return !!(t.flags & typeKind) === isOfTypeKind; - })) { - var narrowedType = getUnionType(ts.filter(types, function (t) { - return !(t.flags & typeKind) === isOfTypeKind; - })); + if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { + var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { return narrowedType; } @@ -16783,13 +12091,12 @@ var ts; function resolveLocation(node) { var containerNodes = []; for (var _parent = node.parent; _parent; _parent = _parent.parent) { - if ((ts.isExpression(_parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(_parent)) { + if ((ts.isExpression(_parent) || ts.isObjectLiteralMethod(node)) && + isContextSensitive(_parent)) { containerNodes.unshift(_parent); } } - ts.forEach(containerNodes, function (node) { - getTypeOfNode(node); - }); + ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); } function getSymbolAtLocation(node) { resolveLocation(node); @@ -16918,9 +12225,7 @@ var ts; return targetType; } if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { - return isTypeSubtypeOf(t, targetType); - })); + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); } return type; } @@ -16976,7 +12281,9 @@ var ts; return false; } function checkBlockScopedBindingCapturedInLoop(node, symbol) { - if (languageVersion >= 2 || (symbol.flags & 2) === 0 || symbol.valueDeclaration.parent.kind === 217) { + if (languageVersion >= 2 || + (symbol.flags & 2) === 0 || + symbol.valueDeclaration.parent.kind === 217) { return; } var container = symbol.valueDeclaration; @@ -17084,10 +12391,21 @@ var ts; } if (container && container.parent && container.parent.kind === 196) { if (container.flags & 128) { - canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135; + canUseSuperExpression = + container.kind === 132 || + container.kind === 131 || + container.kind === 134 || + container.kind === 135; } else { - canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135 || container.kind === 130 || container.kind === 129 || container.kind === 133; + canUseSuperExpression = + container.kind === 132 || + container.kind === 131 || + container.kind === 134 || + container.kind === 135 || + container.kind === 130 || + container.kind === 129 || + container.kind === 133; } } } @@ -17134,7 +12452,8 @@ var ts; if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } - if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + if (indexOfParameter === (func.parameters.length - 1) && + funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); } } @@ -17220,10 +12539,7 @@ var ts; mappedType = t; } else if (!mappedTypes) { - mappedTypes = [ - mappedType, - t - ]; + mappedTypes = [mappedType, t]; } else { mappedTypes.push(t); @@ -17239,17 +12555,13 @@ var ts; }); } function getIndexTypeOfContextualType(type, kind) { - return applyToContextualType(type, function (t) { - return getIndexTypeOfObjectOrUnionType(t, kind); - }); + return applyToContextualType(type, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }); } function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } function contextualTypeHasIndexSignature(type, kind) { - return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { - return getIndexTypeOfObjectOrUnionType(t, kind); - }) : getIndexTypeOfObjectOrUnionType(type, kind)); + return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); } function getContextualTypeForObjectLiteralMethod(node) { ts.Debug.assert(ts.isObjectLiteralMethod(node)); @@ -17269,7 +12581,8 @@ var ts; return propertyType; } } - return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || getIndexTypeOfContextualType(type, 0); + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || + getIndexTypeOfContextualType(type, 0); } return undefined; } @@ -17278,7 +12591,9 @@ var ts; var type = getContextualType(arrayLiteral); if (type) { var index = ts.indexOf(arrayLiteral.elements, node); - return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1) || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); + return getTypeOfPropertyOfContextualType(type, "" + index) + || getIndexTypeOfContextualType(type, 1) + || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); } return undefined; } @@ -17342,7 +12657,9 @@ var ts; } function getContextualSignature(node) { ts.Debug.assert(node.kind !== 132 || ts.isObjectLiteralMethod(node)); - var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); + var type = ts.isObjectLiteralMethod(node) + ? getContextualTypeForObjectLiteralMethod(node) + : getContextualType(node); if (!type) { return undefined; } @@ -17353,15 +12670,14 @@ var ts; var types = type.types; for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; - if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { + if (signatureList && + getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; } var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { - signatureList = [ - signature - ]; + signatureList = [signature]; } else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { return undefined; @@ -17459,7 +12775,9 @@ var ts; for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 218 || + memberDecl.kind === 219 || + ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; if (memberDecl.kind === 218) { type = checkPropertyAssignment(memberDecl, contextualMapper); @@ -17469,7 +12787,9 @@ var ts; } else { ts.Debug.assert(memberDecl.kind === 219); - type = memberDecl.name.kind === 126 ? unknownType : checkExpression(memberDecl.name, contextualMapper); + type = memberDecl.name.kind === 126 + ? unknownType + : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -17585,7 +12905,9 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 153 ? node.expression : node.left; + var left = node.kind === 153 + ? node.expression + : node.left; var type = checkExpressionOrQualifiedName(left); if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); @@ -17622,7 +12944,8 @@ var ts; return unknownType; } var isConstEnum = isConstEnumObjectType(objectType); - if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + if (isConstEnum && + (!node.argumentExpression || node.argumentExpression.kind !== 8)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } @@ -17789,7 +13112,8 @@ var ts; callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; } - var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + var hasRightNumberOfTypeArgs = !typeArguments || + (signature.typeParameters && typeArguments.length === signature.typeParameters.length); if (!hasRightNumberOfTypeArgs) { return false; } @@ -17806,7 +13130,8 @@ var ts; function getSingleCallSignature(type) { if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); - if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && + resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { return resolved.callSignatures[0]; } } @@ -17877,7 +13202,9 @@ var ts; var arg = args[i]; if (arg.kind !== 172) { var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); - var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : + arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : + checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { return false; } @@ -17889,9 +13216,7 @@ var ts; var args; if (node.kind === 157) { var template = node.template; - args = [ - template - ]; + args = [template]; if (template.kind === 169) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); @@ -18146,7 +13471,10 @@ var ts; } if (node.kind === 156) { var declaration = signature.declaration; - if (declaration && declaration.kind !== 133 && declaration.kind !== 137 && declaration.kind !== 141) { + if (declaration && + declaration.kind !== 133 && + declaration.kind !== 137 && + declaration.kind !== 141) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -18171,9 +13499,13 @@ var ts; } function getTypeAtPosition(signature, pos) { if (pos >= 0) { - return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + return signature.hasRestParameter ? + pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : + pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; } - return signature.hasRestParameter ? getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : anyArrayType; + return signature.hasRestParameter ? + getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : + anyArrayType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -18322,16 +13654,14 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 64: - { - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; - } - case 153: - { - var _symbol = findSymbol(n); - return !_symbol || _symbol === unknownSymbol || (_symbol.flags & ~8) !== 0; - } + case 64: { + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + } + case 153: { + var _symbol = findSymbol(n); + return !_symbol || _symbol === unknownSymbol || (_symbol.flags & ~8) !== 0; + } case 154: return true; case 159: @@ -18343,22 +13673,20 @@ var ts; function isConstVariableReference(n) { switch (n.kind) { case 64: - case 153: - { - var symbol = findSymbol(n); - return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; - } - case 154: - { - var index = n.argumentExpression; - var _symbol = findSymbol(n.expression); - if (_symbol && index && index.kind === 8) { - var _name = index.text; - var prop = getPropertyOfType(getTypeOfSymbol(_symbol), _name); - return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; - } - return false; + case 153: { + var symbol = findSymbol(n); + return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; + } + case 154: { + var index = n.argumentExpression; + var _symbol = findSymbol(n.expression); + if (_symbol && index && index.kind === 8) { + var _name = index.text; + var prop = getPropertyOfType(getTypeOfSymbol(_symbol), _name); + return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; } + return false; + } case 159: return isConstVariableReference(n.expression); default: @@ -18486,7 +13814,10 @@ var ts; var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var _name = p.name; - var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); + var type = sourceType.flags & 1 ? sourceType : + getTypeOfPropertyOfType(sourceType, _name.text) || + isNumericLiteralName(_name.text) && getIndexTypeOfType(sourceType, 1) || + getIndexTypeOfType(sourceType, 0); if (type) { checkDestructuringAssignment(p.initializer || _name, type); } @@ -18511,7 +13842,9 @@ var ts; if (e.kind !== 172) { if (e.kind !== 171) { var propName = "" + i; - var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); + var type = sourceType.flags & 1 ? sourceType : + isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : + getIndexTypeOfType(sourceType, 1); if (type) { checkDestructuringAssignment(e, type, contextualMapper); } @@ -18592,7 +13925,9 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var suggestedOperator; - if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + if ((leftType.flags & 8) && + (rightType.flags & 8) && + (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { @@ -18654,10 +13989,7 @@ var ts; case 48: return rightType; case 49: - return getUnionType([ - leftType, - rightType - ]); + return getUnionType([leftType, rightType]); case 52: checkAssignmentOperator(rightType); return rightType; @@ -18665,7 +13997,9 @@ var ts; return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : + someConstituentTypeHasKind(rightType, 1048576) ? node.right : + undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); return false; @@ -18711,10 +14045,7 @@ var ts; checkExpression(node.condition); var type1 = checkExpression(node.whenTrue, contextualMapper); var type2 = checkExpression(node.whenFalse, contextualMapper); - return getUnionType([ - type1, - type2 - ]); + return getUnionType([type1, type2]); } function checkTemplateExpression(node) { ts.forEach(node.templateSpans, function (templateSpan) { @@ -18778,7 +14109,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 153 && node.parent.expression === node) || (node.parent.kind === 154 && node.parent.expression === node) || ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 153 && node.parent.expression === node) || + (node.parent.kind === 154 && node.parent.expression === node) || + ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -18888,7 +14221,9 @@ var ts; if (node.kind === 138) { checkGrammarIndexSignature(node); } - else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || node.kind === 136 || node.kind === 133 || node.kind === 137) { + else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || + node.kind === 136 || node.kind === 133 || + node.kind === 137) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -18982,10 +14317,8 @@ var ts; case 160: case 195: case 161: - case 152: - return false; - default: - return ts.forEachChild(n, containsSuperCall); + case 152: return false; + default: return ts.forEachChild(n, containsSuperCall); } } function markThisReferencesAsErrors(n) { @@ -18997,13 +14330,14 @@ var ts; } } function isInstancePropertyWithInitializer(n) { - return n.kind === 130 && !(n.flags & 128) && !!n.initializer; + return n.kind === 130 && + !(n.flags & 128) && + !!n.initializer; } if (ts.getClassBaseTypeNode(node.parent)) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { - return p.flags & (16 | 32 | 64); - }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || + ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); if (superCallShouldBeFirst) { var statements = node.body.statements; if (!statements.length || statements[0].kind !== 177 || !isSuperCallExpression(statements[0].expression)) { @@ -19326,16 +14660,16 @@ var ts; case 197: return 2097152; case 200: - return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; + return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 + ? 4194304 | 1048576 + : 4194304; case 196: case 199: return 2097152 | 1048576; case 203: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { - result |= getDeclarationSpaces(d); - }); + ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); return result; default: return 1048576; @@ -19344,7 +14678,10 @@ var ts; } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); + checkFunctionLikeDeclaration(node) || + checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionName(node.name) || + checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -19399,7 +14736,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 130 || node.kind === 129 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135) { + if (node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 131 || + node.kind === 134 || + node.kind === 135) { return false; } if (ts.isInAmbientContext(node)) { @@ -19467,11 +14809,17 @@ var ts; var symbol = getSymbolOfNode(node); if (symbol.flags & 1) { var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); - if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { + if (localDeclarationSymbol && + localDeclarationSymbol !== symbol && + localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 194); - var container = varDeclList.parent.kind === 175 && varDeclList.parent.parent; - var namesShareScope = container && (container.kind === 174 && ts.isFunctionLike(container.parent) || (container.kind === 201 && container.kind === 200) || container.kind === 221); + var container = varDeclList.parent.kind === 175 && + varDeclList.parent.parent; + var namesShareScope = container && + (container.kind === 174 && ts.isFunctionLike(container.parent) || + (container.kind === 201 && container.kind === 200) || + container.kind === 221); if (!namesShareScope) { var _name = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, _name, _name); @@ -19688,15 +15036,17 @@ var ts; } function checkRightHandSideOfForOf(rhsExpression) { var expressionType = getTypeOfExpression(rhsExpression); - return languageVersion >= 2 ? checkIteratedType(expressionType, rhsExpression) : checkElementTypeOfArrayOrString(expressionType, rhsExpression); + return languageVersion >= 2 + ? checkIteratedType(expressionType, rhsExpression) + : checkElementTypeOfArrayOrString(expressionType, rhsExpression); } function checkIteratedType(iterable, expressionForError) { ts.Debug.assert(languageVersion >= 2); var iteratedType = getIteratedType(iterable, expressionForError); if (expressionForError && iteratedType) { - var completeIterableType = globalIterableType !== emptyObjectType ? createTypeReference(globalIterableType, [ - iteratedType - ]) : emptyObjectType; + var completeIterableType = globalIterableType !== emptyObjectType + ? createTypeReference(globalIterableType, [iteratedType]) + : emptyObjectType; checkTypeAssignableTo(iterable, completeIterableType, expressionForError); } return iteratedType; @@ -19760,7 +15110,9 @@ var ts; } if (!isArrayLikeType(arrayType)) { if (!reportedError) { - var diagnostic = hasStringConstituent ? ts.Diagnostics.Type_0_is_not_an_array_type : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + var diagnostic = hasStringConstituent + ? ts.Diagnostics.Type_0_is_not_an_array_type + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; error(expressionForError, diagnostic, typeToString(arrayType)); } return hasStringConstituent ? stringType : unknownType; @@ -19770,10 +15122,7 @@ var ts; if (arrayElementType.flags & 258) { return stringType; } - return getUnionType([ - arrayElementType, - stringType - ]); + return getUnionType([arrayElementType, stringType]); } return arrayElementType; } @@ -19935,9 +15284,7 @@ var ts; if (stringIndexType && numberIndexType) { errorNode = declaredNumberIndexer || declaredStringIndexer; if (!errorNode && (type.flags & 2048)) { - var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { - return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); - }); + var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); }); errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; } } @@ -19959,13 +15306,13 @@ var ts; _errorNode = indexDeclaration; } else if (containingType.flags & 2048) { - var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { - return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); - }); + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); _errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } if (_errorNode && !isTypeAssignableTo(propertyType, indexType)) { - var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + var errorMessage = indexKind === 0 + ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 + : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; error(_errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); } } @@ -20130,12 +15477,7 @@ var ts; return true; } var seen = {}; - ts.forEach(type.declaredProperties, function (p) { - seen[p.name] = { - prop: p, - containingType: type - }; - }); + ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { var base = _a[_i]; @@ -20143,10 +15485,7 @@ var ts; for (var _b = 0, _c = properties.length; _b < _c; _b++) { var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { - seen[prop.name] = { - prop: prop, - containingType: base - }; + seen[prop.name] = { prop: prop, containingType: base }; } else { var existing = seen[prop.name]; @@ -20249,12 +15588,9 @@ var ts; return undefined; } switch (e.operator) { - case 33: - return value; - case 34: - return -value; - case 47: - return enumIsConst ? ~value : undefined; + case 33: return value; + case 34: return -value; + case 47: return enumIsConst ? ~value : undefined; } return undefined; case 167: @@ -20270,28 +15606,17 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 44: - return left | right; - case 43: - return left & right; - case 41: - return left >> right; - case 42: - return left >>> right; - case 40: - return left << right; - case 45: - return left ^ right; - case 35: - return left * right; - case 36: - return left / right; - case 33: - return left + right; - case 34: - return left - right; - case 37: - return left % right; + case 44: return left | right; + case 43: return left & right; + case 41: return left >> right; + case 42: return left >>> right; + case 40: return left << right; + case 45: return left ^ right; + case 35: return left * right; + case 36: return left / right; + case 33: return left + right; + case 34: return left - right; + case 37: return left % right; } return undefined; case 7: @@ -20314,7 +15639,8 @@ var ts; } else { if (e.kind === 154) { - if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { + if (e.argumentExpression === undefined || + e.argumentExpression.kind !== 8) { return undefined; } _enumType = getTypeOfNode(e.expression); @@ -20410,7 +15736,10 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + if (symbol.flags & 512 + && symbol.declarations.length > 1 + && !ts.isInAmbientContext(node) + && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -20446,7 +15775,9 @@ var ts; } var inAmbientExternalModule = node.parent.kind === 201 && node.parent.parent.name.kind === 8; if (node.parent.kind !== 221 && !inAmbientExternalModule) { - error(moduleName, node.kind === 210 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + error(moduleName, node.kind === 210 ? + ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : + ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { @@ -20459,9 +15790,13 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | + (symbol.flags & 793056 ? 793056 : 0) | + (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 212 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; + var message = node.kind === 212 ? + ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : + ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); } } @@ -20895,7 +16230,9 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 64 && isTypeDeclaration(name.parent) && name.parent.name === name; + return name.kind == 64 && + isTypeDeclaration(name.parent) && + name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { @@ -20989,7 +16326,8 @@ var ts; return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 125 && node.parent.right === node) || (node.parent.kind === 153 && node.parent.name === node); + return (node.parent.kind === 125 && node.parent.right === node) || + (node.parent.kind === 153 && node.parent.name === node); } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { @@ -21044,7 +16382,9 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 64 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 209 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); + return node.parent.kind === 209 + ? getSymbolOfEntityNameOrPropertyAccessExpression(node) + : getSymbolOfPartOfRightHandSideOfImportEquals(node); } switch (node.kind) { case 64: @@ -21063,7 +16403,10 @@ var ts; return undefined; case 8: var moduleName; - if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || ((node.parent.kind === 204 || node.parent.kind === 210) && node.parent.moduleSpecifier === node)) { + if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && + ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || + ((node.parent.kind === 204 || node.parent.kind === 210) && + node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 7: @@ -21149,14 +16492,10 @@ var ts; else if (symbol.flags & 67108864) { var target = getSymbolLinks(symbol).target; if (target) { - return [ - target - ]; + return [target]; } } - return [ - symbol - ]; + return [symbol]; } function isExternalModuleSymbol(symbol) { return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 221; @@ -21238,7 +16577,8 @@ var ts; } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 8 ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + var baseName = expr.kind === 8 ? + ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; assignGeneratedName(node, makeUniqueName(baseName)); } function generateNameForImportDeclaration(node) { @@ -21336,7 +16676,8 @@ var ts; if (ts.nodeIsPresent(node.body)) { var symbol = getSymbolOfNode(node); var signaturesOfSymbol = getSignaturesOfSymbol(symbol); - return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + return signaturesOfSymbol.length > 1 || + (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); } return false; } @@ -21363,7 +16704,9 @@ var ts; } function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { var symbol = getSymbolOfNode(declaration); - var type = symbol && !(symbol.flags & (2048 | 131072)) ? getTypeOfSymbol(symbol) : unknownType; + var type = symbol && !(symbol.flags & (2048 | 131072)) + ? getTypeOfSymbol(symbol) + : unknownType; getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -21372,19 +16715,29 @@ var ts; } function isUnknownIdentifier(location, name) { ts.Debug.assert(!ts.nodeIsSynthesized(location), "isUnknownIdentifier called with a synthesized location"); - return !resolveName(location, name, 107455, undefined, undefined) && !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); + return !resolveName(location, name, 107455, undefined, undefined) && + !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - if (n.parent.kind === 153 && n.parent.name === n) { + if (n.parent.kind === 153 && + n.parent.name === n) { return undefined; } - if (n.parent.kind === 150 && n.parent.propertyName === n) { + if (n.parent.kind === 150 && + n.parent.propertyName === n) { return undefined; } - var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || n.parent.kind === 150 ? getSymbolOfNode(n.parent) : undefined; - var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); - var isLetOrConst = symbol && (symbol.flags & 2) && symbol.valueDeclaration.parent.kind !== 217; + var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || + n.parent.kind === 150 + ? getSymbolOfNode(n.parent) + : undefined; + var symbol = declarationSymbol || + getNodeLinks(n).resolvedSymbol || + resolveName(n, n.text, 107455 | 8388608, undefined, undefined); + var isLetOrConst = symbol && + (symbol.flags & 2) && + symbol.valueDeclaration.parent.kind !== 217; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -21674,7 +17027,8 @@ var ts; } } function checkGrammarTypeArguments(node, typeArguments) { - return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + return checkGrammarForDisallowedTrailingComma(typeArguments) || + checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { @@ -21688,7 +17042,8 @@ var ts; } } function checkGrammarArguments(node, arguments) { - return checkGrammarForDisallowedTrailingComma(arguments) || checkGrammarForOmittedArgument(node, arguments); + return checkGrammarForDisallowedTrailingComma(arguments) || + checkGrammarForOmittedArgument(node, arguments); } function checkGrammarHeritageClause(node) { var types = node.types; @@ -21782,7 +17137,8 @@ var ts; for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var prop = _a[_i]; var _name = prop.name; - if (prop.kind === 172 || _name.kind === 126) { + if (prop.kind === 172 || + _name.kind === 126) { checkGrammarComputedPropertyName(_name); continue; } @@ -21838,16 +17194,22 @@ var ts; var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + var diagnostic = forInOrOfStatement.kind === 182 + ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement + : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var _diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + var _diagnostic = forInOrOfStatement.kind === 182 + ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer + : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, _diagnostic); } if (firstDeclaration.type) { - var _diagnostic_1 = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + var _diagnostic_1 = forInOrOfStatement.kind === 182 + ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation + : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, _diagnostic_1); } } @@ -21901,7 +17263,9 @@ var ts; } } function checkGrammarMethod(node) { - if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarForGenerator(node)) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionLikeDeclaration(node) || + checkGrammarForGenerator(node)) { return true; } if (node.parent.kind === 152) { @@ -21952,7 +17316,8 @@ var ts; switch (current.kind) { case 189: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 184 && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 184 + && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } @@ -21973,11 +17338,15 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + var message = node.kind === 185 + ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement + : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var _message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + var _message = node.kind === 185 + ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement + : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, _message); } } @@ -22014,7 +17383,8 @@ var ts; } } var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); - return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || + checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 64) { @@ -22147,7 +17517,8 @@ var ts; } function checkGrammarProperty(node) { if (node.parent.kind === 196) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || + checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } @@ -22166,7 +17537,12 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 197 || node.kind === 204 || node.kind === 203 || node.kind === 210 || node.kind === 209 || (node.flags & 2)) { + if (node.kind === 197 || + node.kind === 204 || + node.kind === 203 || + node.kind === 210 || + node.kind === 209 || + (node.flags & 2)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -22228,10 +17604,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var indentStrings = [ - "", - " " - ]; + var indentStrings = ["", " "]; function getIndentString(level) { if (indentStrings[level] === undefined) { indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; @@ -22306,34 +17679,21 @@ var ts; writeTextOfNode: writeTextOfNode, writeLiteral: writeLiteral, writeLine: writeLine, - increaseIndent: function () { - return indent++; - }, - decreaseIndent: function () { - return indent--; - }, - getIndent: function () { - return indent; - }, - getTextPos: function () { - return output.length; - }, - getLine: function () { - return lineCount + 1; - }, - getColumn: function () { - return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; - }, - getText: function () { - return output; - } + increaseIndent: function () { return indent++; }, + decreaseIndent: function () { return indent--; }, + getIndent: function () { return indent; }, + getTextPos: function () { return output.length; }, + getLine: function () { return lineCount + 1; }, + getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, + getText: function () { return output; } }; } function getLineOfLocalPosition(currentSourceFile, pos) { return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { - if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && + getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -22362,7 +17722,9 @@ var ts; var lineCount = ts.getLineStarts(currentSourceFile).length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); + var nextLineStart = (currentLine + 1) === lineCount + ? currentSourceFile.text.length + 1 + : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { firstCommentLineIndent = calculateIndent(ts.getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); @@ -22440,7 +17802,8 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 134 || member.kind === 135) && (member.flags & 128) === (accessor.flags & 128)) { + if ((member.kind === 134 || member.kind === 135) + && (member.flags & 128) === (accessor.flags & 128)) { var memberName = ts.getPropertyNameForPropertyNameNode(member.name); var accessorName = ts.getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -22497,8 +17860,7 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { - } : writeJsDocComments; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var aliasDeclarationEmitInfo = []; var referencePathsOutput = ""; @@ -22507,7 +17869,9 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 2048) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { + if (referencedFile && ((referencedFile.flags & 2048) || + shouldEmitToOwnFile(referencedFile, compilerOptions) || + !addedGlobalFileReference)) { writeReferencePath(referencedFile); if (!isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -22524,7 +17888,8 @@ var ts; if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && + !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } @@ -22578,9 +17943,7 @@ var ts; function writeAsychronousImportEqualsDeclarations(importEqualsDeclarations) { var oldWriter = writer; ts.forEach(importEqualsDeclarations, function (aliasToWrite) { - var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { - return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; - }); + var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; }); if (aliasEmitInfo) { createAndSetNewTextWriterWithSymbolWriter(); for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { @@ -22907,8 +18270,15 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 140 || node.parent.kind === 141 || (node.parent.parent && node.parent.parent.kind === 143)) { - ts.Debug.assert(node.parent.kind === 132 || node.parent.kind === 131 || node.parent.kind === 140 || node.parent.kind === 141 || node.parent.kind === 136 || node.parent.kind === 137); + if (node.parent.kind === 140 || + node.parent.kind === 141 || + (node.parent.parent && node.parent.parent.kind === 143)) { + ts.Debug.assert(node.parent.kind === 132 || + node.parent.kind === 131 || + node.parent.kind === 140 || + node.parent.kind === 141 || + node.parent.kind === 136 || + node.parent.kind === 137); emitType(node.constraint); } else { @@ -22971,7 +18341,9 @@ var ts; function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.parent.parent.kind === 196) { - diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + diagnosticMessage = isImplementsList ? + ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : + ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; @@ -23004,9 +18376,7 @@ var ts; emitTypeParameters(node.typeParameters); var baseTypeNode = ts.getClassBaseTypeNode(node); if (baseTypeNode) { - emitHeritageClause([ - baseTypeNode - ], false); + emitHeritageClause([baseTypeNode], false); } emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); write(" {"); @@ -23066,17 +18436,31 @@ var ts; function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.kind === 193) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } else if (node.kind === 130 || node.kind === 129) { if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } return diagnosticMessage !== undefined ? { @@ -23093,9 +18477,7 @@ var ts; } } function emitVariableStatement(node) { - var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { - return resolver.isDeclarationVisible(varDeclaration); - }); + var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); if (hasDeclarationWithEmit) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); @@ -23141,17 +18523,25 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 134 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; + return accessor.kind === 134 + ? accessor.type + : accessor.parameters.length > 0 + ? accessor.parameters[0].type + : undefined; } } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (accessorWithTypeAnnotation.kind === 135) { if (accessorWithTypeAnnotation.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } return { diagnosticMessage: diagnosticMessage, @@ -23161,10 +18551,18 @@ var ts; } else { if (accessorWithTypeAnnotation.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; } return { diagnosticMessage: diagnosticMessage, @@ -23178,7 +18576,8 @@ var ts; if (ts.hasDynamicName(node)) { return; } - if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && + !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); if (node.kind === 195) { emitModuleElementDeclarationFlags(node); @@ -23245,28 +18644,48 @@ var ts; var diagnosticMessage; switch (node.kind) { case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 132: case 131: if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: ts.Debug.fail("This is unknown kind for signature: " + node.kind); @@ -23293,7 +18712,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 140 || node.parent.kind === 141 || node.parent.parent.kind === 143) { + if (node.parent.kind === 140 || + node.parent.kind === 141 || + node.parent.parent.kind === 143) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -23303,28 +18724,50 @@ var ts; var diagnosticMessage; switch (node.parent.kind) { case 133: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; break; case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 132: case 131: if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } else if (node.parent.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); @@ -23376,7 +18819,11 @@ var ts; } } function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 2048 ? referencedFile.fileName : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + var declFileName = referencedFile.flags & 2048 + ? referencedFile.fileName + : shouldEmitToOwnFile(referencedFile, compilerOptions) + ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") + : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencePathsOutput += "/// " + newLine; } @@ -23440,28 +18887,20 @@ var ts; var exportSpecifiers; var exportDefault; var writeEmittedFiles = writeJavaScriptFile; - var emitLeadingComments = compilerOptions.removeComments ? function (node) { - } : emitLeadingDeclarationComments; - var emitTrailingComments = compilerOptions.removeComments ? function (node) { - } : emitTrailingDeclarationComments; - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { - } : emitLeadingCommentsOfLocalPosition; + var emitLeadingComments = compilerOptions.removeComments ? function (node) { } : emitLeadingDeclarationComments; + var emitTrailingComments = compilerOptions.removeComments ? function (node) { } : emitTrailingDeclarationComments; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfLocalPosition; var detachedCommentsInfo; - var emitDetachedComments = compilerOptions.removeComments ? function (node) { - } : emitDetachedCommentsAtPosition; + var emitDetachedComments = compilerOptions.removeComments ? function (node) { } : emitDetachedCommentsAtPosition; var writeComment = writeCommentRange; var emitNodeWithoutSourceMap = compilerOptions.removeComments ? emitNodeWithoutSourceMapWithoutComments : emitNodeWithoutSourceMapWithComments; var emit = emitNodeWithoutSourceMap; var emitWithoutComments = emitNodeWithoutSourceMapWithoutComments; - var emitStart = function (node) { - }; - var emitEnd = function (node) { - }; + var emitStart = function (node) { }; + var emitEnd = function (node) { }; var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { - }; - var scopeEmitEnd = function () { - }; + var scopeEmitStart = function (scopeDeclaration, scopeName) { }; + var scopeEmitEnd = function () { }; var sourceMapData; if (compilerOptions.sourceMap) { initializeEmitterWithSourceMaps(); @@ -23487,10 +18926,7 @@ var ts; var names = currentScopeNames; currentScopeNames = undefined; if (names) { - lastFrame = { - names: names, - previous: lastFrame - }; + lastFrame = { names: names, previous: lastFrame }; return true; } return false; @@ -23510,9 +18946,7 @@ var ts; _name = baseName; } else { - _name = ts.generateUniqueName(baseName, function (n) { - return isExistingName(location, n); - }); + _name = ts.generateUniqueName(baseName, function (n) { return isExistingName(location, n); }); } return recordNameInCurrentScope(_name); } @@ -23612,7 +19046,12 @@ var ts; sourceLinePos.character++; var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine != emittedLine || + lastRecordedSourceMapSpan.emittedColumn != emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { encodeLastRecordedSourceMapSpan(); lastRecordedSourceMapSpan = { emittedLine: emittedLine, @@ -23675,10 +19114,20 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 195 || node.kind === 160 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135 || node.kind === 200 || node.kind === 196 || node.kind === 199) { + else if (node.kind === 195 || + node.kind === 160 || + node.kind === 132 || + node.kind === 131 || + node.kind === 134 || + node.kind === 135 || + node.kind === 200 || + node.kind === 196 || + node.kind === 199) { if (node.name) { var _name = node.name; - scopeName = _name.kind === 126 ? ts.getTextOfNode(_name) : node.name.text; + scopeName = _name.kind === 126 + ? ts.getTextOfNode(_name) + : node.name.text; } recordScopeNameStart(scopeName); } @@ -24025,7 +19474,8 @@ var ts; if (node.template.kind === 169) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 167 && templateSpan.expression.operatorToken.kind === 23; + var needsParens = templateSpan.expression.kind === 167 + && templateSpan.expression.operatorToken.kind === 23; emitParenthesizedIf(templateSpan.expression, needsParens); }); } @@ -24036,7 +19486,8 @@ var ts; ts.forEachChild(node, emit); return; } - var emitOuterParens = ts.isExpression(node.parent) && templateNeedsParens(node, node.parent); + var emitOuterParens = ts.isExpression(node.parent) + && templateNeedsParens(node, node.parent); if (emitOuterParens) { write("("); } @@ -24047,7 +19498,8 @@ var ts; } for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 159 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + var needsParens = templateSpan.expression.kind !== 159 + && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); } @@ -24544,9 +19996,7 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { - return e.kind === 171; - }); + return ts.forEach(elements, function (e) { return e.kind === 171; }); } function skipParentheses(node) { while (node.kind === 159 || node.kind === 158) { @@ -24659,7 +20109,14 @@ var ts; while (operand.kind == 158) { operand = operand.expression; } - if (operand.kind !== 165 && operand.kind !== 164 && operand.kind !== 163 && operand.kind !== 162 && operand.kind !== 166 && operand.kind !== 156 && !(operand.kind === 155 && node.parent.kind === 156) && !(operand.kind === 160 && node.parent.kind === 155)) { + if (operand.kind !== 165 && + operand.kind !== 164 && + operand.kind !== 163 && + operand.kind !== 162 && + operand.kind !== 166 && + operand.kind !== 156 && + !(operand.kind === 155 && node.parent.kind === 156) && + !(operand.kind === 160 && node.parent.kind === 155)) { emit(operand); return; } @@ -24702,7 +20159,8 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operatorToken.kind === 52 && (node.left.kind === 152 || node.left.kind === 151)) { + if (languageVersion < 2 && node.operatorToken.kind === 52 && + (node.left.kind === 152 || node.left.kind === 151)) { emitDestructuring(node, node.parent.kind === 177); } else { @@ -25022,13 +20480,16 @@ var ts; emitToken(15, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function nodeEndPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, node2.end); + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { if (node.kind === 214) { @@ -25322,8 +20783,11 @@ var ts; emitModuleMemberName(node); var initializer = node.initializer; if (!initializer && languageVersion < 2) { - var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); - if (isUninitializedLet && node.parent.parent.kind !== 182 && node.parent.parent.kind !== 183) { + var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && + (getCombinedFlagsForIdentifier(node.name) & 4096); + if (isUninitializedLet && + node.parent.parent.kind !== 182 && + node.parent.parent.kind !== 183) { initializer = createVoidZero(); } } @@ -25346,7 +20810,10 @@ var ts; return ts.getCombinedNodeFlags(node.parent); } function renameNonTopLevelLetAndConst(node) { - if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 64 || (node.parent.kind !== 193 && node.parent.kind !== 150)) { + if (languageVersion >= 2 || + ts.nodeIsSynthesized(node) || + node.kind !== 64 || + (node.parent.kind !== 193 && node.parent.kind !== 150)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); @@ -25358,7 +20825,9 @@ var ts; return; } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var _parent = blockScopeContainer.kind === 221 ? blockScopeContainer : blockScopeContainer.parent; + var _parent = blockScopeContainer.kind === 221 + ? blockScopeContainer + : blockScopeContainer.parent; var generatedName = generateUniqueNameForLocation(_parent, node.text); var variableId = resolver.getBlockScopedVariableId(node); if (!generatedBlockScopeNames) { @@ -26121,7 +21590,8 @@ var ts; emitImportDeclaration(node); return; } - if (resolver.isReferencedAliasDeclaration(node) || (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + if (resolver.isReferencedAliasDeclaration(node) || + (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); if (!(node.flags & 1)) @@ -26643,10 +22113,7 @@ var ts; else { leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); } - emitNewLineBeforeLeadingComments(currentSourceFile, writer, { - pos: pos, - end: pos - }, leadingComments); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitDetachedCommentsAtPosition(node) { @@ -26671,17 +22138,12 @@ var ts; if (nodeLine >= lastCommentLine + 2) { emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { - nodePos: node.pos, - detachedCommentEndPos: detachedComments[detachedComments.length - 1].end - }; + var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); } else { - detachedCommentsInfo = [ - currentDetachedCommentInfo - ]; + detachedCommentsInfo = [currentDetachedCommentInfo]; } } } @@ -26693,7 +22155,10 @@ var ts; if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && + currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { return true; } } @@ -26747,7 +22212,9 @@ var ts; } catch (e) { if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText : e.message); + onError(e.number === unsupportedFileEncodingErrorCode + ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText + : e.message); } text = ""; } @@ -26783,20 +22250,12 @@ var ts; } return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { - return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); - }, + getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, writeFile: writeFile, - getCurrentDirectory: function () { - return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); - }, - useCaseSensitiveFileNames: function () { - return ts.sys.useCaseSensitiveFileNames; - }, + getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, + useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, getCanonicalFileName: getCanonicalFileName, - getNewLine: function () { - return ts.sys.newLine; - } + getNewLine: function () { return ts.sys.newLine; } }; } ts.createCompilerHost = createCompilerHost; @@ -26836,9 +22295,7 @@ var ts; var seenNoDefaultLib = options.noLib; var commonSourceDirectory; host = host || createCompilerHost(options); - ts.forEach(rootNames, function (name) { - return processRootFile(name, false); - }); + ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); if (!seenNoDefaultLib) { processRootFile(host.getDefaultLibFileName(options), true); } @@ -26847,35 +22304,21 @@ var ts; var noDiagnosticsTypeChecker; program = { getSourceFile: getSourceFile, - getSourceFiles: function () { - return files; - }, - getCompilerOptions: function () { - return options; - }, + getSourceFiles: function () { return files; }, + getCompilerOptions: function () { return options; }, getSyntacticDiagnostics: getSyntacticDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, getDeclarationDiagnostics: getDeclarationDiagnostics, getTypeChecker: getTypeChecker, getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, - getCommonSourceDirectory: function () { - return commonSourceDirectory; - }, + getCommonSourceDirectory: function () { return commonSourceDirectory; }, emit: emit, getCurrentDirectory: host.getCurrentDirectory, - getNodeCount: function () { - return getDiagnosticsProducingTypeChecker().getNodeCount(); - }, - getIdentifierCount: function () { - return getDiagnosticsProducingTypeChecker().getIdentifierCount(); - }, - getSymbolCount: function () { - return getDiagnosticsProducingTypeChecker().getSymbolCount(); - }, - getTypeCount: function () { - return getDiagnosticsProducingTypeChecker().getTypeCount(); - } + getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, + getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, + getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, + getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } }; return program; function getEmitHost(writeFileCallback) { @@ -26902,11 +22345,7 @@ var ts; } function emit(sourceFile, writeFileCallback) { if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { - return { - diagnostics: [], - sourceMaps: undefined, - emitSkipped: true - }; + return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); var start = new Date().getTime(); @@ -27072,7 +22511,8 @@ var ts; } else if (node.kind === 200 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportEqualsDeclaration(node) && + ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { @@ -27100,17 +22540,19 @@ var ts; } return; } - var firstExternalModuleSourceFile = ts.forEach(files, function (f) { - return ts.isExternalModule(f) ? f : undefined; - }); + var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (firstExternalModuleSourceFile && !options.module) { var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } - if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModuleSourceFile !== undefined))) { + if (options.outDir || + options.sourceRoot || + (options.mapRoot && + (!options.out || firstExternalModuleSourceFile !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { - if (!(sourceFile.flags & 2048) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { + if (!(sourceFile.flags & 2048) + && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); sourcePathComponents.pop(); if (commonPathComponents) { @@ -27319,12 +22761,17 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 182 || variableDeclaration.parent.parent.kind === 183) { + if (variableDeclaration.parent.parent.kind === 182 || + variableDeclaration.parent.parent.kind === 183) { return spanInNode(variableDeclaration.parent.parent); } var isParentVariableStatement = variableDeclaration.parent.parent.kind === 175; var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 181 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); - var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement ? variableDeclaration.parent.parent.initializer.declarations : undefined; + var declarations = isParentVariableStatement + ? variableDeclaration.parent.parent.declarationList.declarations + : isDeclarationOfForStatement + ? variableDeclaration.parent.parent.initializer.declarations + : undefined; if (variableDeclaration.initializer || (variableDeclaration.flags & 1)) { if (declarations && declarations[0] === variableDeclaration) { if (isParentVariableStatement) { @@ -27345,7 +22792,8 @@ var ts; } } function canHaveSpanInParameterDeclaration(parameter) { - return !!parameter.initializer || parameter.dotDotDotToken !== undefined || !!(parameter.flags & 16) || !!(parameter.flags & 32); + return !!parameter.initializer || parameter.dotDotDotToken !== undefined || + !!(parameter.flags & 16) || !!(parameter.flags & 32); } function spanInParameterDeclaration(parameter) { if (canHaveSpanInParameterDeclaration(parameter)) { @@ -27363,7 +22811,8 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 1) || (functionDeclaration.parent.kind === 196 && functionDeclaration.kind !== 133); + return !!(functionDeclaration.flags & 1) || + (functionDeclaration.parent.kind === 196 && functionDeclaration.kind !== 133); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -27537,7 +22986,14 @@ var ts; var _parent = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (_parent.kind === 179 || _parent.kind === 182 || _parent.kind === 183 || _parent.kind === 181 || _parent.kind === 178 || _parent.kind === 180 || _parent.kind === 187 || _parent.kind === 217) { + if (_parent.kind === 179 || + _parent.kind === 182 || + _parent.kind === 183 || + _parent.kind === 181 || + _parent.kind === 178 || + _parent.kind === 180 || + _parent.kind === 187 || + _parent.kind === 217) { addOutliningSpan(_parent, openBrace, closeBrace, autoCollapse(n)); break; } @@ -27564,24 +23020,22 @@ var ts; }); break; } - case 201: - { - var _openBrace = ts.findChildOfKind(n, 14, sourceFile); - var _closeBrace = ts.findChildOfKind(n, 15, sourceFile); - addOutliningSpan(n.parent, _openBrace, _closeBrace, autoCollapse(n)); - break; - } + case 201: { + var _openBrace = ts.findChildOfKind(n, 14, sourceFile); + var _closeBrace = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n.parent, _openBrace, _closeBrace, autoCollapse(n)); + break; + } case 196: case 197: case 199: case 152: - case 202: - { - var _openBrace_1 = ts.findChildOfKind(n, 14, sourceFile); - var _closeBrace_1 = ts.findChildOfKind(n, 15, sourceFile); - addOutliningSpan(n, _openBrace_1, _closeBrace_1, autoCollapse(n)); - break; - } + case 202: { + var _openBrace_1 = ts.findChildOfKind(n, 14, sourceFile); + var _closeBrace_1 = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n, _openBrace_1, _closeBrace_1, autoCollapse(n)); + break; + } case 151: var openBracket = ts.findChildOfKind(n, 18, sourceFile); var closeBracket = ts.findChildOfKind(n, 19, sourceFile); @@ -27628,13 +23082,7 @@ var ts; } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ - name: name, - fileName: fileName, - matchKind: matchKind, - isCaseSensitive: allMatchesAreCaseSensitive(matches), - declaration: declaration - }); + rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } }); @@ -27669,7 +23117,9 @@ var ts; return undefined; } function getTextOfIdentifierOrLiteral(node) { - if (node.kind === 64 || node.kind === 8 || node.kind === 7) { + if (node.kind === 64 || + node.kind === 8 || + node.kind === 7) { return node.text; } return undefined; @@ -27734,11 +23184,11 @@ var ts; } return _bestMatchKind; } - var baseSensitivity = { - sensitivity: "base" - }; + var baseSensitivity = { sensitivity: "base" }; function compareNavigateToItems(i1, i2) { - return i1.matchKind - i2.matchKind || i1.name.localeCompare(i2.name, undefined, baseSensitivity) || i1.name.localeCompare(i2.name); + return i1.matchKind - i2.matchKind || + i1.name.localeCompare(i2.name, undefined, baseSensitivity) || + i1.name.localeCompare(i2.name); } function createNavigateToItem(rawItem) { var declaration = rawItem.declaration; @@ -27888,9 +23338,7 @@ var ts; function isTopLevelFunctionDeclaration(functionDeclaration) { if (functionDeclaration.kind === 195) { if (functionDeclaration.body && functionDeclaration.body.kind === 174) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { - return s.kind === 195 && !isEmpty(s.name.text); - })) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 195 && !isEmpty(s.name.text); })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -28008,9 +23456,7 @@ var ts; } return undefined; function createItem(node, name, scriptElementKind) { - return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ]); + return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)]); } } function isEmpty(text) { @@ -28064,16 +23510,12 @@ var ts; function createModuleItem(node) { var moduleName = getModuleName(node); var childItems = getItemsWorker(getChildNodes(getInnermostModule(node).body.statements), createChildItem); - return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ], childItems, getIndent(node)); + return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { if (node.name && node.body && node.body.kind === 174) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } return undefined; } @@ -28083,10 +23525,10 @@ var ts; return undefined; } hasGlobalNode = true; - var rootName = ts.isExternalModule(node) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(node.fileName)))) + "\"" : ""; - return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [ - getNodeSpan(node) - ], childItems); + var rootName = ts.isExternalModule(node) + ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(node.fileName)))) + "\"" + : ""; + return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [getNodeSpan(node)], childItems); } function createClassItem(node) { if (!node.name) { @@ -28099,38 +23541,26 @@ var ts; }); var nodes = removeDynamicallyNamedProperties(node); if (constructor) { - nodes.push.apply(nodes, ts.filter(constructor.parameters, function (p) { - return !ts.isBindingPattern(p.name); - })); + nodes.push.apply(nodes, ts.filter(constructor.parameters, function (p) { return !ts.isBindingPattern(p.name); })); } childItems = getItemsWorker(sortNodes(nodes), createChildItem); } - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createEnumItem(node) { var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createIterfaceItem(node) { var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { - return member.name === undefined || member.name.kind !== 126; - }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 126; }); } function removeDynamicallyNamedProperties(node) { - return ts.filter(node.members, function (member) { - return !ts.hasDynamicName(member); - }); + return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { while (node.body.kind === 200) { @@ -28139,7 +23569,9 @@ var ts; return node; } function getNodeSpan(node) { - return node.kind === 221 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + return node.kind === 221 + ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) + : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } function getTextOfNode(node) { return ts.getTextOfNodeFromSourceText(sourceFile.text, node); @@ -28169,9 +23601,7 @@ var ts; var stringToWordSpans = {}; pattern = pattern.trim(); var fullPatternSegment = createSegment(pattern); - var dotSeparatedSegments = pattern.split(".").map(function (p) { - return createSegment(p.trim()); - }); + var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); return { getMatches: getMatches, @@ -28279,9 +23709,7 @@ var ts; if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { var match = matchTextChunk(candidate, segment.totalTextChunk, false); if (match) { - return [ - match - ]; + return [match]; } } var subWordTextChunks = segment.subWordTextChunks; @@ -28348,7 +23776,8 @@ var ts; for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; if (gotOneMatchThisCandidate) { - if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { break; } } @@ -28369,7 +23798,10 @@ var ts; } ts.createPatternMatcher = createPatternMatcher; function patternMatchCompareTo(match1, match2) { - return compareType(match1, match2) || compareCamelCase(match1, match2) || compareCase(match1, match2) || comparePunctuation(match1, match2); + return compareType(match1, match2) || + compareCamelCase(match1, match2) || + compareCase(match1, match2) || + comparePunctuation(match1, match2); } function comparePunctuation(result1, result2) { if (result1.punctuationStripped !== result2.punctuationStripped) { @@ -28518,7 +23950,11 @@ var ts; var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); - if (charIsPunctuation(identifier.charCodeAt(i - 1)) || charIsPunctuation(identifier.charCodeAt(i)) || lastIsDigit != currentIsDigit || hasTransitionFromLowerToUpper || hasTransitionFromUpperToLower) { + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || + charIsPunctuation(identifier.charCodeAt(i)) || + lastIsDigit != currentIsDigit || + hasTransitionFromLowerToUpper || + hasTransitionFromUpperToLower) { if (!isAllPunctuation(identifier, wordStart, i)) { result.push(ts.createTextSpan(wordStart, i - wordStart)); } @@ -28570,7 +24006,8 @@ var ts; } function transitionFromUpperToLower(identifier, word, index, wordStart) { if (word) { - if (index != wordStart && index + 1 < identifier.length) { + if (index != wordStart && + index + 1 < identifier.length) { var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); if (currentIsUpper && nextIsLower) { @@ -28588,7 +24025,9 @@ var ts; function transitionFromLowerToUpper(identifier, word, index) { var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); - var transition = word ? (currentIsUpper && !lastIsUpper) : currentIsUpper; + var transition = word + ? (currentIsUpper && !lastIsUpper) + : currentIsUpper; return transition; } })(ts || (ts = {})); @@ -28618,7 +24057,8 @@ var ts; function getImmediatelyContainingArgumentInfo(node) { if (node.parent.kind === 155 || node.parent.kind === 156) { var callExpression = node.parent; - if (node.kind === 24 || node.kind === 16) { + if (node.kind === 24 || + node.kind === 16) { var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; ts.Debug.assert(list !== undefined); @@ -28688,9 +24128,7 @@ var ts; } function getArgumentCount(argumentsList) { var listChildren = argumentsList.getChildren(); - var argumentCount = ts.countWhere(listChildren, function (arg) { - return arg.kind !== 23; - }); + var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 23; }); if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 23) { argumentCount++; } @@ -28707,7 +24145,9 @@ var ts; return spanIndex + 1; } function getArgumentListInfoForTemplate(tagExpression, argumentIndex) { - var argumentCount = tagExpression.template.kind === 10 ? 1 : tagExpression.template.templateSpans.length + 1; + var argumentCount = tagExpression.template.kind === 10 + ? 1 + : tagExpression.template.templateSpans.length + 1; ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); return { kind: 2, @@ -28812,10 +24252,7 @@ var ts; isVariadic: candidateSignature.hasRestParameter, prefixDisplayParts: prefixDisplayParts, suffixDisplayParts: suffixDisplayParts, - separatorDisplayParts: [ - ts.punctuationPart(23), - ts.spacePart() - ], + separatorDisplayParts: [ts.punctuationPart(23), ts.spacePart()], parameters: signatureHelpParameters, documentation: candidateSignature.getDocumentationComment() }; @@ -28924,9 +24361,7 @@ var ts; } ts.findListItemInfo = findListItemInfo; function findChildOfKind(n, kind, sourceFile) { - return ts.forEach(n.getChildren(sourceFile), function (c) { - return c.kind === kind && c; - }); + return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; }); } ts.findChildOfKind = findChildOfKind; function findContainingList(node) { @@ -28940,15 +24375,11 @@ var ts; } ts.findContainingList = findContainingList; function getTouchingWord(sourceFile, position) { - return getTouchingToken(sourceFile, position, function (n) { - return isWord(n.kind); - }); + return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }); } ts.getTouchingWord = getTouchingWord; function getTouchingPropertyName(sourceFile, position) { - return getTouchingToken(sourceFile, position, function (n) { - return isPropertyName(n.kind); - }); + return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }); } ts.getTouchingPropertyName = getTouchingPropertyName; function getTouchingToken(sourceFile, position, includeItemAtEndPosition) { @@ -29002,7 +24433,8 @@ var ts; var children = n.getChildren(); for (var _i = 0, _n = children.length; _i < _n; _i++) { var child = children[_i]; - var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); + var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || + (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { return find(child); } @@ -29105,7 +24537,8 @@ var ts; } ts.isPunctuation = isPunctuation; function isInsideTemplateLiteral(node, position) { - return ts.isTemplateLiteralKind(node.kind) && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); + return ts.isTemplateLiteralKind(node.kind) + && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); } ts.isInsideTemplateLiteral = isInsideTemplateLiteral; function compareDataObjects(dst, src) { @@ -29138,38 +24571,19 @@ var ts; var indent; resetWriter(); return { - displayParts: function () { - return displayParts; - }, - writeKeyword: function (text) { - return writeKind(text, 5); - }, - writeOperator: function (text) { - return writeKind(text, 12); - }, - writePunctuation: function (text) { - return writeKind(text, 15); - }, - writeSpace: function (text) { - return writeKind(text, 16); - }, - writeStringLiteral: function (text) { - return writeKind(text, 8); - }, - writeParameter: function (text) { - return writeKind(text, 13); - }, + displayParts: function () { return displayParts; }, + writeKeyword: function (text) { return writeKind(text, 5); }, + writeOperator: function (text) { return writeKind(text, 12); }, + writePunctuation: function (text) { return writeKind(text, 15); }, + writeSpace: function (text) { return writeKind(text, 16); }, + writeStringLiteral: function (text) { return writeKind(text, 8); }, + writeParameter: function (text) { return writeKind(text, 13); }, writeSymbol: writeSymbol, writeLine: writeLine, - increaseIndent: function () { - indent++; - }, - decreaseIndent: function () { - indent--; - }, + increaseIndent: function () { indent++; }, + decreaseIndent: function () { indent--; }, clear: resetWriter, - trackSymbol: function () { - } + trackSymbol: function () { } }; function writeIndent() { if (lineStart) { @@ -29323,9 +24737,7 @@ var ts; advance: advance, readTokenInfo: readTokenInfo, isOnToken: isOnToken, - lastTrailingTriviaWasNewLine: function () { - return wasNewLine; - }, + lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, close: function () { lastTokenInfo = undefined; scanner.setText(undefined); @@ -29386,7 +24798,8 @@ var ts; return container.kind === 9; } function shouldRescanTemplateToken(container) { - return container.kind === 12 || container.kind === 13; + return container.kind === 12 || + container.kind === 13; } function startsWithSlashToken(t) { return t === 36 || t === 56; @@ -29399,7 +24812,13 @@ var ts; token: undefined }; } - var expectedScanAction = shouldRescanGreaterThanToken(n) ? 1 : shouldRescanSlashToken(n) ? 2 : shouldRescanTemplateToken(n) ? 3 : 0; + var expectedScanAction = shouldRescanGreaterThanToken(n) + ? 1 + : shouldRescanSlashToken(n) + ? 2 + : shouldRescanTemplateToken(n) + ? 3 + : 0; if (lastTokenInfo && expectedScanAction === lastScanAction) { return fixTokenKind(lastTokenInfo, n); } @@ -29566,7 +24985,9 @@ var ts; this.Flag = Flag; } Rule.prototype.toString = function () { - return "[desc=" + this.Descriptor + "," + "operation=" + this.Operation + "," + "flag=" + this.Flag + "]"; + return "[desc=" + this.Descriptor + "," + + "operation=" + this.Operation + "," + + "flag=" + this.Flag + "]"; }; return Rule; })(); @@ -29584,7 +25005,8 @@ var ts; this.RightTokenRange = RightTokenRange; } RuleDescriptor.prototype.toString = function () { - return "[leftRange=" + this.LeftTokenRange + "," + "rightRange=" + this.RightTokenRange + "]"; + return "[leftRange=" + this.LeftTokenRange + "," + + "rightRange=" + this.RightTokenRange + "]"; }; RuleDescriptor.create1 = function (left, right) { return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right)); @@ -29614,7 +25036,8 @@ var ts; this.Action = null; } RuleOperation.prototype.toString = function () { - return "[context=" + this.Context + "," + "action=" + this.Action + "]"; + return "[context=" + this.Context + "," + + "action=" + this.Action + "]"; }; RuleOperation.create1 = function (action) { return RuleOperation.create2(formatting.RuleOperationContext.Any, action); @@ -29681,12 +25104,7 @@ var ts; this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(15, 75), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(15, 99), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.FromTokens([ - 17, - 19, - 23, - 22 - ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.FromTokens([17, 19, 23, 22])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); @@ -29695,19 +25113,9 @@ var ts; this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([ - 64, - 3 - ]); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([64, 3]); this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([ - 17, - 3, - 74, - 95, - 80, - 75 - ]); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([17, 3, 74, 95, 80, 75]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(14, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); @@ -29726,151 +25134,79 @@ var ts; this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(34, 34), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(34, 39), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ - 97, - 93, - 87, - 73, - 89, - 96 - ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ - 104, - 69 - ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([97, 93, 87, 73, 89, 96]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([104, 69]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(82, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(98, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2)); this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(89, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ - 17, - 74, - 75, - 66 - ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ - 95, - 80 - ]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ - 115, - 119 - ]), 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([17, 74, 75, 66]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([95, 80]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([115, 119]), 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(113, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ - 116, - 117 - ]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ - 68, - 114, - 76, - 77, - 78, - 115, - 102, - 84, - 103, - 116, - 106, - 108, - 119, - 109 - ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([ - 78, - 102 - ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([116, 117]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([68, 114, 76, 77, 78, 115, 102, 84, 103, 116, 106, 108, 119, 109]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([78, 102])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(8, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(32, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(21, 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.FromTokens([ - 17, - 23 - ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.FromTokens([17, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(17, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.TypeNames), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); - this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([ - 16, - 18, - 25, - 23 - ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([16, 18, 25, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8)); - this.HighPriorityCommonRules = [ - this.IgnoreBeforeComment, - this.IgnoreAfterLineComment, - this.NoSpaceBeforeColon, - this.SpaceAfterColon, - this.NoSpaceBeforeQuestionMark, - this.SpaceAfterQuestionMarkInConditionalOperator, - this.NoSpaceAfterQuestionMark, - this.NoSpaceBeforeDot, - this.NoSpaceAfterDot, - this.NoSpaceAfterUnaryPrefixOperator, - this.NoSpaceAfterUnaryPreincrementOperator, - this.NoSpaceAfterUnaryPredecrementOperator, - this.NoSpaceBeforeUnaryPostincrementOperator, - this.NoSpaceBeforeUnaryPostdecrementOperator, - this.SpaceAfterPostincrementWhenFollowedByAdd, - this.SpaceAfterAddWhenFollowedByUnaryPlus, - this.SpaceAfterAddWhenFollowedByPreincrement, - this.SpaceAfterPostdecrementWhenFollowedBySubtract, - this.SpaceAfterSubtractWhenFollowedByUnaryMinus, - this.SpaceAfterSubtractWhenFollowedByPredecrement, - this.NoSpaceAfterCloseBrace, - this.SpaceAfterOpenBrace, - this.SpaceBeforeCloseBrace, - this.NewLineBeforeCloseBraceInBlockContext, - this.SpaceAfterCloseBrace, - this.SpaceBetweenCloseBraceAndElse, - this.SpaceBetweenCloseBraceAndWhile, - this.NoSpaceBetweenEmptyBraceBrackets, - this.SpaceAfterFunctionInFuncDecl, - this.NewLineAfterOpenBraceInBlockContext, - this.SpaceAfterGetSetInMember, - this.NoSpaceBetweenReturnAndSemicolon, - this.SpaceAfterCertainKeywords, - this.SpaceAfterLetConstInVariableDeclaration, - this.NoSpaceBeforeOpenParenInFuncCall, - this.SpaceBeforeBinaryKeywordOperator, - this.SpaceAfterBinaryKeywordOperator, - this.SpaceAfterVoidOperator, - this.NoSpaceAfterConstructor, - this.NoSpaceAfterModuleImport, - this.SpaceAfterCertainTypeScriptKeywords, - this.SpaceBeforeCertainTypeScriptKeywords, - this.SpaceAfterModuleName, - this.SpaceAfterArrow, - this.NoSpaceAfterEllipsis, - this.NoSpaceAfterOptionalParameters, - this.NoSpaceBetweenEmptyInterfaceBraceBrackets, - this.NoSpaceBeforeOpenAngularBracket, - this.NoSpaceBetweenCloseParenAndAngularBracket, - this.NoSpaceAfterOpenAngularBracket, - this.NoSpaceBeforeCloseAngularBracket, - this.NoSpaceAfterCloseAngularBracket - ]; - this.LowPriorityCommonRules = [ - this.NoSpaceBeforeSemicolon, - this.SpaceBeforeOpenBraceInControl, - this.SpaceBeforeOpenBraceInFunction, - this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, - this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, - this.NoSpaceAfterOpenBracket, - this.NoSpaceBeforeCloseBracket, - this.NoSpaceAfterCloseBracket, - this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, - this.SpaceBetweenStatements, - this.SpaceAfterTryFinally - ]; + this.HighPriorityCommonRules = + [ + this.IgnoreBeforeComment, this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, + this.NoSpaceAfterQuestionMark, + this.NoSpaceBeforeDot, this.NoSpaceAfterDot, + this.NoSpaceAfterUnaryPrefixOperator, + this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, + this.SpaceAfterPostincrementWhenFollowedByAdd, + this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterPostdecrementWhenFollowedBySubtract, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.NoSpaceAfterCloseBrace, + this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, + this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, + this.NoSpaceBetweenReturnAndSemicolon, + this.SpaceAfterCertainKeywords, + this.SpaceAfterLetConstInVariableDeclaration, + this.NoSpaceBeforeOpenParenInFuncCall, + this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, + this.SpaceAfterVoidOperator, + this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, + this.SpaceAfterModuleName, + this.SpaceAfterArrow, + this.NoSpaceAfterEllipsis, + this.NoSpaceAfterOptionalParameters, + this.NoSpaceBetweenEmptyInterfaceBraceBrackets, + this.NoSpaceBeforeOpenAngularBracket, + this.NoSpaceBetweenCloseParenAndAngularBracket, + this.NoSpaceAfterOpenAngularBracket, + this.NoSpaceBeforeCloseAngularBracket, + this.NoSpaceAfterCloseAngularBracket + ]; + this.LowPriorityCommonRules = + [ + this.NoSpaceBeforeSemicolon, + this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.NoSpaceBeforeComma, + this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket, + this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket, + this.SpaceAfterSemicolon, + this.NoSpaceBeforeOpenParenInFuncDecl, + this.SpaceBetweenStatements, this.SpaceAfterTryFinally + ]; this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); @@ -30044,7 +25380,8 @@ var ts; return context.TokensAreOnSameLine(); }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 194 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; + return context.currentTokenParent.kind === 194 && + context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind != 2; @@ -30078,7 +25415,8 @@ var ts; } }; Rules.IsTypeArgumentOrParameterContext = function (context) { - return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); + return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || + Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsVoidOpContext = function (context) { return context.currentTokenSpan.kind === 98 && context.currentTokenParent.kind === 164; @@ -30121,7 +25459,8 @@ var ts; }; RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) { var _this = this; - var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; + var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && + rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) { rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) { var rulesBucketIndex = _this.GetRuleBucketIndex(left, right); @@ -30196,13 +25535,19 @@ var ts; RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) { var position; if (rule.Operation.Action == 1) { - position = specificTokens ? 0 : RulesPosition.IgnoreRulesAny; + position = specificTokens ? + 0 : + RulesPosition.IgnoreRulesAny; } else if (!rule.Operation.Context.IsAny()) { - position = specificTokens ? RulesPosition.ContextRulesSpecific : RulesPosition.ContextRulesAny; + position = specificTokens ? + RulesPosition.ContextRulesSpecific : + RulesPosition.ContextRulesAny; } else { - position = specificTokens ? RulesPosition.NoContextRulesSpecific : RulesPosition.NoContextRulesAny; + position = specificTokens ? + RulesPosition.NoContextRulesSpecific : + RulesPosition.NoContextRulesAny; } var state = constructionState[rulesBucketIndex]; if (state === undefined) { @@ -30259,9 +25604,7 @@ var ts; this.token = token; } TokenSingleValueAccess.prototype.GetTokens = function () { - return [ - this.token - ]; + return [this.token]; }; TokenSingleValueAccess.prototype.Contains = function (tokenValue) { return tokenValue == this.token; @@ -30315,68 +25658,18 @@ var ts; return this.tokenAccess.toString(); }; TokenRange.Any = TokenRange.AllTokens(); - TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([ - 3 - ])); + TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); TokenRange.Keywords = TokenRange.FromRange(65, 124); TokenRange.BinaryOperators = TokenRange.FromRange(24, 63); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([ - 85, - 86, - 124 - ]); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([ - 38, - 39, - 47, - 46 - ]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([ - 7, - 64, - 16, - 18, - 14, - 92, - 87 - ]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([ - 64, - 16, - 92, - 87 - ]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([ - 64, - 17, - 19, - 87 - ]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([ - 64, - 16, - 92, - 87 - ]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([ - 64, - 17, - 19, - 87 - ]); - TokenRange.Comments = TokenRange.FromTokens([ - 2, - 3 - ]); - TokenRange.TypeNames = TokenRange.FromTokens([ - 64, - 118, - 120, - 112, - 121, - 98, - 111 - ]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([85, 86, 124]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([38, 39, 47, 46]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7, 64, 16, 18, 14, 92, 87]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); + TokenRange.Comments = TokenRange.FromTokens([2, 3]); + TokenRange.TypeNames = TokenRange.FromTokens([64, 118, 120, 112, 121, 98, 111]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -30521,11 +25814,16 @@ var ts; } function findOutermostParent(position, expectedTokenKind, sourceFile) { var precedingToken = ts.findPrecedingToken(position, sourceFile); - if (!precedingToken || precedingToken.kind !== expectedTokenKind || position !== precedingToken.getEnd()) { + if (!precedingToken || + precedingToken.kind !== expectedTokenKind || + position !== precedingToken.getEnd()) { return undefined; } var current = precedingToken; - while (current && current.parent && current.parent.end === precedingToken.end && !isListElement(current.parent, current)) { + while (current && + current.parent && + current.parent.end === precedingToken.end && + !isListElement(current.parent, current)) { current = current.parent; } return current; @@ -30550,9 +25848,7 @@ var ts; function findEnclosingNode(range, sourceFile) { return find(sourceFile); function find(n) { - var candidate = ts.forEachChild(n, function (c) { - return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; - }); + var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; }); if (candidate) { var result = find(candidate); if (result) { @@ -30566,11 +25862,9 @@ var ts; if (!errors.length) { return rangeHasNoErrors; } - var sorted = errors.filter(function (d) { - return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); - }).sort(function (e1, e2) { - return e1.start - e2.start; - }); + var sorted = errors + .filter(function (d) { return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); }) + .sort(function (e1, e2) { return e1.start - e2.start; }); if (!sorted.length) { return rangeHasNoErrors; } @@ -30664,7 +25958,10 @@ var ts; var indentation = inheritedIndentation; if (indentation === -1) { if (isSomeBlock(node.kind)) { - if (isSomeBlock(parent.kind) || parent.kind === 221 || parent.kind === 214 || parent.kind === 215) { + if (isSomeBlock(parent.kind) || + parent.kind === 221 || + parent.kind === 214 || + parent.kind === 215) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -30713,12 +26010,8 @@ var ts; return nodeStartLine !== line ? indentation + delta : indentation; } }, - getIndentation: function () { - return indentation; - }, - getDelta: function () { - return delta; - }, + getIndentation: function () { return indentation; }, + getDelta: function () { return delta; }, recomputeIndentation: function (lineAdded) { if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent.kind, node.kind)) { if (lineAdded) { @@ -30912,7 +26205,8 @@ var ts; trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { - lineAdded = processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); + lineAdded = + processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); } } previousRange = range; @@ -30940,7 +26234,9 @@ var ts; dynamicIndentation.recomputeIndentation(true); } } - trimTrailingWhitespaces = (rule.Operation.Action & (4 | 2)) && rule.Flag !== 1; + trimTrailingWhitespaces = + (rule.Operation.Action & (4 | 2)) && + rule.Flag !== 1; } else { trimTrailingWhitespaces = true; @@ -30978,16 +26274,10 @@ var ts; var startPos = commentRange.pos; for (var line = _startLine; line < endLine; ++line) { var endOfLine = ts.getEndLinePosition(line, sourceFile); - parts.push({ - pos: startPos, - end: endOfLine - }); + parts.push({ pos: startPos, end: endOfLine }); startPos = ts.getStartPositionOfLine(line + 1, sourceFile); } - parts.push({ - pos: startPos, - end: commentRange.end - }); + parts.push({ pos: startPos, end: commentRange.end }); } var startLinePos = ts.getStartPositionOfLine(_startLine, sourceFile); var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options); @@ -31002,7 +26292,9 @@ var ts; var _delta = indentation - nonWhitespaceColumnInFirstPart.column; for (var i = startIndex, len = parts.length; i < len; ++i, ++_startLine) { var _startLinePos = ts.getStartPositionOfLine(_startLine, sourceFile); - var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); + var nonWhitespaceCharacterAndColumn = i === 0 + ? nonWhitespaceColumnInFirstPart + : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); var newIndentation = nonWhitespaceCharacterAndColumn.column + _delta; if (newIndentation > 0) { var indentationString = getIndentationString(newIndentation, options); @@ -31031,10 +26323,7 @@ var ts; } } function newTextChange(start, len, newText) { - return { - span: ts.createTextSpan(start, len), - newText: newText - }; + return { span: ts.createTextSpan(start, len), newText: newText }; } function recordDelete(start, len) { if (len) { @@ -31184,7 +26473,12 @@ var ts; if (!precedingToken) { return 0; } - var precedingTokenIsLiteral = precedingToken.kind === 8 || precedingToken.kind === 9 || precedingToken.kind === 10 || precedingToken.kind === 11 || precedingToken.kind === 12 || precedingToken.kind === 13; + var precedingTokenIsLiteral = precedingToken.kind === 8 || + precedingToken.kind === 9 || + precedingToken.kind === 10 || + precedingToken.kind === 11 || + precedingToken.kind === 12 || + precedingToken.kind === 13; if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } @@ -31244,7 +26538,8 @@ var ts; } } parentStart = getParentStart(_parent, current, sourceFile); - var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(_parent, current, currentStart.line, sourceFile); + var parentAndChildShareLine = parentStart.line === currentStart.line || + childStartsOnTheSameLineWithElseInIfStatement(_parent, current, currentStart.line, sourceFile); if (useActualIndentation) { var _actualIndentation = getActualIndentationForNode(current, _parent, currentStart, parentAndChildShareLine, sourceFile, options); if (_actualIndentation !== -1) { @@ -31277,7 +26572,8 @@ var ts; } } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { - var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && (parent.kind === 221 || !parentAndChildShareLine); + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && + (parent.kind === 221 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -31317,7 +26613,8 @@ var ts; if (node.parent) { switch (node.parent.kind) { case 139: - if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; @@ -31331,29 +26628,30 @@ var ts; case 132: case 131: case 136: - case 137: - { - var start = node.getStart(sourceFile); - if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { - return node.parent.typeParameters; - } - if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { - return node.parent.parameters; - } - break; + case 137: { + var start = node.getStart(sourceFile); + if (node.parent.typeParameters && + ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { + return node.parent.typeParameters; } + if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { + return node.parent.parameters; + } + break; + } case 156: - case 155: - { - var _start = node.getStart(sourceFile); - if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, _start, node.getEnd())) { - return node.parent.typeArguments; - } - if (node.parent.arguments && ts.rangeContainsStartEnd(node.parent.arguments, _start, node.getEnd())) { - return node.parent.arguments; - } - break; + case 155: { + var _start = node.getStart(sourceFile); + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, _start, node.getEnd())) { + return node.parent.typeArguments; } + if (node.parent.arguments && + ts.rangeContainsStartEnd(node.parent.arguments, _start, node.getEnd())) { + return node.parent.arguments; + } + break; + } } } return undefined; @@ -31402,10 +26700,7 @@ var ts; } character++; } - return { - column: column, - character: character - }; + return { column: column, character: character }; } SmartIndenter.findFirstNonWhitespaceCharacterAndColumn = findFirstNonWhitespaceCharacterAndColumn; function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { @@ -31789,7 +27084,10 @@ var ts; return pos; } function isName(pos, end, sourceFile, name) { - return pos + name.length < end && sourceFile.text.substr(pos, name.length) === name && (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); + return pos + name.length < end && + sourceFile.text.substr(pos, name.length) === name && + (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || + ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); } function isParamTag(pos, end, sourceFile) { return isName(pos, end, sourceFile, paramTag); @@ -32005,9 +27303,7 @@ var ts; }; SignatureObject.prototype.getDocumentationComment = function () { if (this.documentationComment === undefined) { - this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([ - this.declaration - ], undefined, false) : []; + this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration], undefined, false) : []; } return this.documentationComment; }; @@ -32041,7 +27337,9 @@ var ts; case 131: var functionDeclaration = node; if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) { - var lastDeclaration = namedDeclarations.length > 0 ? namedDeclarations[namedDeclarations.length - 1] : undefined; + var lastDeclaration = namedDeclarations.length > 0 ? + namedDeclarations[namedDeclarations.length - 1] : + undefined; if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) { if (functionDeclaration.body && !lastDeclaration.body) { namedDeclarations[namedDeclarations.length - 1] = functionDeclaration; @@ -32239,9 +27537,7 @@ var ts; ts.ClassificationTypeNames = ClassificationTypeNames; function displayPartsToString(displayParts) { if (displayParts) { - return ts.map(displayParts, function (displayPart) { - return displayPart.text; - }).join(""); + return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(""); } return ""; } @@ -32419,9 +27715,7 @@ var ts; return bucket; } function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { - return name && name.charAt(0) === '_'; - }).map(function (name) { + var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === '_'; }).map(function (name) { var entries = ts.lookUp(buckets, name); var sourceFiles = []; for (var i in entries) { @@ -32432,9 +27726,7 @@ var ts; references: entry.owners.slice(0) }); } - sourceFiles.sort(function (x, y) { - return y.refCount - x.refCount; - }); + sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); return { bucket: name, sourceFiles: sourceFiles @@ -32623,11 +27915,7 @@ var ts; processImport(); } processTripleSlashDirectives(); - return { - referencedFiles: referencedFiles, - importedFiles: importedFiles, - isLibFile: isNoDefaultLib - }; + return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib }; } ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { @@ -32640,10 +27928,14 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 64 && (node.parent.kind === 185 || node.parent.kind === 184) && node.parent.label === node; + return node.kind === 64 && + (node.parent.kind === 185 || node.parent.kind === 184) && + node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 64 && node.parent.kind === 189 && node.parent.label === node; + return node.kind === 64 && + node.parent.kind === 189 && + node.parent.label === node; } function isLabeledBy(node, labelName) { for (var owner = node.parent; owner.kind === 189; owner = owner.parent) { @@ -32678,10 +27970,12 @@ var ts; return node.parent.kind === 200 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 64 && ts.isFunctionLike(node.parent) && node.parent.name === node; + return node.kind === 64 && + ts.isFunctionLike(node.parent) && node.parent.name === node; } function isNameOfPropertyAssignment(node) { - return (node.kind === 64 || node.kind === 8 || node.kind === 7) && (node.parent.kind === 218 || node.parent.kind === 219) && node.parent.name === node; + return (node.kind === 64 || node.kind === 8 || node.kind === 7) && + (node.parent.kind === 218 || node.parent.kind === 219) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 || node.kind === 7) { @@ -32704,12 +27998,15 @@ var ts; } function isNameOfExternalModuleImportOrDeclaration(node) { if (node.kind === 8) { - return isNameOfModuleDeclaration(node) || (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); + return isNameOfModuleDeclaration(node) || + (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); } return false; } function isInsideComment(sourceFile, token, position) { - return position <= token.getStart(sourceFile) && (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); + return position <= token.getStart(sourceFile) && + (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || + isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); function isInsideCommentRange(comments) { return ts.forEach(comments, function (comment) { if (comment.pos < position && position < comment.end) { @@ -32722,7 +28019,8 @@ var ts; return true; } else { - return !(text.charCodeAt(comment.end - 1) === 47 && text.charCodeAt(comment.end - 2) === 42); + return !(text.charCodeAt(comment.end - 1) === 47 && + text.charCodeAt(comment.end - 2) === 42); } } return false; @@ -32762,44 +28060,33 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 200: - return ScriptElementKind.moduleElement; - case 196: - return ScriptElementKind.classElement; - case 197: - return ScriptElementKind.interfaceElement; - case 198: - return ScriptElementKind.typeElement; - case 199: - return ScriptElementKind.enumElement; + case 200: return ScriptElementKind.moduleElement; + case 196: return ScriptElementKind.classElement; + case 197: return ScriptElementKind.interfaceElement; + case 198: return ScriptElementKind.typeElement; + case 199: return ScriptElementKind.enumElement; case 193: - return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 195: - return ScriptElementKind.functionElement; - case 134: - return ScriptElementKind.memberGetAccessorElement; - case 135: - return ScriptElementKind.memberSetAccessorElement; + return ts.isConst(node) + ? ScriptElementKind.constElement + : ts.isLet(node) + ? ScriptElementKind.letElement + : ScriptElementKind.variableElement; + case 195: return ScriptElementKind.functionElement; + case 134: return ScriptElementKind.memberGetAccessorElement; + case 135: return ScriptElementKind.memberSetAccessorElement; case 132: case 131: return ScriptElementKind.memberFunctionElement; case 130: case 129: return ScriptElementKind.memberVariableElement; - case 138: - return ScriptElementKind.indexSignatureElement; - case 137: - return ScriptElementKind.constructSignatureElement; - case 136: - return ScriptElementKind.callSignatureElement; - case 133: - return ScriptElementKind.constructorImplementationElement; - case 127: - return ScriptElementKind.typeParameterElement; - case 220: - return ScriptElementKind.variableElement; - case 128: - return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 138: return ScriptElementKind.indexSignatureElement; + case 137: return ScriptElementKind.constructSignatureElement; + case 136: return ScriptElementKind.callSignatureElement; + case 133: return ScriptElementKind.constructorImplementationElement; + case 127: return ScriptElementKind.typeParameterElement; + case 220: return ScriptElementKind.variableElement; + case 128: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; case 203: case 208: case 205: @@ -32855,26 +28142,13 @@ var ts; var changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { getSourceFile: getOrCreateSourceFile, - getCancellationToken: function () { - return cancellationToken; - }, - getCanonicalFileName: function (fileName) { - return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); - }, - useCaseSensitiveFileNames: function () { - return useCaseSensitivefileNames; - }, - getNewLine: function () { - return host.getNewLine ? host.getNewLine() : "\r\n"; - }, - getDefaultLibFileName: function (options) { - return host.getDefaultLibFileName(options); - }, - writeFile: function (fileName, data, writeByteOrderMark) { - }, - getCurrentDirectory: function () { - return host.getCurrentDirectory(); - } + getCancellationToken: function () { return cancellationToken; }, + getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); }, + useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, + getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, + getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, + writeFile: function (fileName, data, writeByteOrderMark) { }, + getCurrentDirectory: function () { return host.getCurrentDirectory(); } }); if (program) { var oldSourceFiles = program.getSourceFiles(); @@ -32963,7 +28237,8 @@ var ts; if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { return undefined; } - if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && (firstCharCode === 39 || firstCharCode === 34)) { + if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && + (firstCharCode === 39 || firstCharCode === 34)) { displayName = displayName.substring(1, displayName.length - 1); } var isValid = ts.isIdentifierStart(displayName.charCodeAt(0), target); @@ -33126,7 +28401,9 @@ var ts; } function isCompletionListBlocker(previousToken) { var _start_1 = new Date().getTime(); - var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); + var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || + isIdentifierDefinitionLocation(previousToken) || + isRightOfIllegalDot(previousToken); log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - _start_1)); return result; } @@ -33143,9 +28420,16 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 155 || containingNodeKind === 133 || containingNodeKind === 156 || containingNodeKind === 151 || containingNodeKind === 167; + return containingNodeKind === 155 + || containingNodeKind === 133 + || containingNodeKind === 156 + || containingNodeKind === 151 + || containingNodeKind === 167; case 16: - return containingNodeKind === 155 || containingNodeKind === 133 || containingNodeKind === 156 || containingNodeKind === 159; + return containingNodeKind === 155 + || containingNodeKind === 133 + || containingNodeKind === 156 + || containingNodeKind === 159; case 18: return containingNodeKind === 151; case 116: @@ -33155,7 +28439,8 @@ var ts; case 14: return containingNodeKind === 196; case 52: - return containingNodeKind === 193 || containingNodeKind === 167; + return containingNodeKind === 193 + || containingNodeKind === 167; case 11: return containingNodeKind === 169; case 12: @@ -33175,7 +28460,9 @@ var ts; return false; } function isInStringOrRegularExpressionOrTemplateLiteral(previousToken) { - if (previousToken.kind === 8 || previousToken.kind === 9 || ts.isTemplateLiteralKind(previousToken.kind)) { + if (previousToken.kind === 8 + || previousToken.kind === 9 + || ts.isTemplateLiteralKind(previousToken.kind)) { var _start_1 = previousToken.getStart(); var end = previousToken.getEnd(); if (_start_1 < position && position < end) { @@ -33222,23 +28509,43 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 193 || containingNodeKind === 194 || containingNodeKind === 175 || containingNodeKind === 199 || isFunction(containingNodeKind) || containingNodeKind === 196 || containingNodeKind === 195 || containingNodeKind === 197 || containingNodeKind === 149 || containingNodeKind === 148; + return containingNodeKind === 193 || + containingNodeKind === 194 || + containingNodeKind === 175 || + containingNodeKind === 199 || + isFunction(containingNodeKind) || + containingNodeKind === 196 || + containingNodeKind === 195 || + containingNodeKind === 197 || + containingNodeKind === 149 || + containingNodeKind === 148; case 20: return containingNodeKind === 149; case 18: return containingNodeKind === 149; case 16: - return containingNodeKind === 217 || isFunction(containingNodeKind); + return containingNodeKind === 217 || + isFunction(containingNodeKind); case 14: - return containingNodeKind === 199 || containingNodeKind === 197 || containingNodeKind === 143 || containingNodeKind === 148; + return containingNodeKind === 199 || + containingNodeKind === 197 || + containingNodeKind === 143 || + containingNodeKind === 148; case 22: - return containingNodeKind === 129 && (previousToken.parent.parent.kind === 197 || previousToken.parent.parent.kind === 143); + return containingNodeKind === 129 && + (previousToken.parent.parent.kind === 197 || + previousToken.parent.parent.kind === 143); case 24: - return containingNodeKind === 196 || containingNodeKind === 195 || containingNodeKind === 197 || isFunction(containingNodeKind); + return containingNodeKind === 196 || + containingNodeKind === 195 || + containingNodeKind === 197 || + isFunction(containingNodeKind); case 109: return containingNodeKind === 130; case 21: - return containingNodeKind === 128 || containingNodeKind === 133 || (previousToken.parent.parent.kind === 149); + return containingNodeKind === 128 || + containingNodeKind === 133 || + (previousToken.parent.parent.kind === 149); case 108: case 106: case 107: @@ -33283,7 +28590,8 @@ var ts; if (!importDeclaration.importClause) { return exports; } - if (importDeclaration.importClause.namedBindings && importDeclaration.importClause.namedBindings.kind === 207) { + if (importDeclaration.importClause.namedBindings && + importDeclaration.importClause.namedBindings.kind === 207) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { var _name = el.propertyName || el.name; exisingImports[_name.text] = true; @@ -33292,9 +28600,7 @@ var ts; if (ts.isEmpty(exisingImports)) { return exports; } - return ts.filter(exports, function (e) { - return !ts.lookUp(exisingImports, e.name); - }); + return ts.filter(exports, function (e) { return !ts.lookUp(exisingImports, e.name); }); } function filterContextualMembersList(contextualMemberSymbols, existingMembers) { if (!existingMembers || existingMembers.length === 0) { @@ -33344,9 +28650,7 @@ var ts; name: entryName, kind: ScriptElementKind.keyword, kindModifiers: ScriptElementKindModifier.none, - displayParts: [ - ts.displayPart(entryName, 5) - ], + displayParts: [ts.displayPart(entryName, 5)], documentation: undefined }; } @@ -33444,7 +28748,9 @@ var ts; return ScriptElementKind.unknown; } function getSymbolModifiers(symbol) { - return symbol && symbol.declarations && symbol.declarations.length > 0 ? ts.getNodeModifiers(symbol.declarations[0]) : ScriptElementKindModifier.none; + return symbol && symbol.declarations && symbol.declarations.length > 0 + ? ts.getNodeModifiers(symbol.declarations[0]) + : ScriptElementKindModifier.none; } function getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, enclosingDeclaration, typeResolver, location, semanticMeaning) { if (semanticMeaning === void 0) { semanticMeaning = getMeaningFromLocation(location); } @@ -33529,7 +28835,8 @@ var ts; hasAddedSymbolInfo = true; } } - else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || (location.kind === 113 && location.parent.kind === 133)) { + else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || + (location.kind === 113 && location.parent.kind === 133)) { var functionDeclaration = location.parent; var _allSignatures = functionDeclaration.kind === 133 ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeResolver.isImplementationOfOverload(functionDeclaration)) { @@ -33543,7 +28850,8 @@ var ts; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 136 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 136 && + !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, _allSignatures); hasAddedSymbolInfo = true; @@ -33663,7 +28971,9 @@ var ts; if (symbolKind !== ScriptElementKind.unknown) { if (type) { addPrefixForAnyFunctionOrVar(symbol, symbolKind); - if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 || symbolKind === ScriptElementKind.localVariableElement) { + if (symbolKind === ScriptElementKind.memberVariableElement || + symbolFlags & 3 || + symbolKind === ScriptElementKind.localVariableElement) { displayParts.push(ts.punctuationPart(51)); displayParts.push(ts.spacePart()); if (type.symbol && type.symbol.flags & 262144) { @@ -33676,7 +28986,12 @@ var ts; displayParts.push.apply(displayParts, ts.typeToDisplayParts(typeResolver, type, enclosingDeclaration)); } } - else if (symbolFlags & 16 || symbolFlags & 8192 || symbolFlags & 16384 || symbolFlags & 131072 || symbolFlags & 98304 || symbolKind === ScriptElementKind.memberFunctionElement) { + else if (symbolFlags & 16 || + symbolFlags & 8192 || + symbolFlags & 16384 || + symbolFlags & 131072 || + symbolFlags & 98304 || + symbolKind === ScriptElementKind.memberFunctionElement) { var _allSignatures_1 = type.getCallSignatures(); addSignatureDisplayParts(_allSignatures_1[0], _allSignatures_1); } @@ -33689,11 +29004,7 @@ var ts; if (!documentation) { documentation = symbol.getDocumentationComment(); } - return { - displayParts: displayParts, - documentation: documentation, - symbolKind: symbolKind - }; + return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; function addNewLineIfDisplayPartsExist() { if (displayParts.length) { displayParts.push(ts.lineBreakPart()); @@ -33780,26 +29091,20 @@ var ts; if (isJumpStatementTarget(node)) { var labelName = node.text; var label = getTargetLabel(node.parent, node.text); - return label ? [ - getDefinitionInfo(label, ScriptElementKind.label, labelName, undefined) - ] : undefined; + return label ? [getDefinitionInfo(label, ScriptElementKind.label, labelName, undefined)] : undefined; } - var comment = ts.forEach(sourceFile.referencedFiles, function (r) { - return (r.pos <= position && position < r.end) ? r : undefined; - }); + var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); if (comment) { var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); if (referenceFile) { - return [ - { + return [{ fileName: referenceFile.fileName, textSpan: ts.createTextSpanFromBounds(0, 0), kind: ScriptElementKind.scriptElement, name: comment.fileName, containerName: undefined, containerKind: undefined - } - ]; + }]; } return undefined; } @@ -33830,7 +29135,8 @@ var ts; var symbolKind = getSymbolKind(symbol, typeInfoResolver, node); var containerSymbol = symbol.parent; var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : ""; - if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { + if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && + !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { ts.forEach(declarations, function (declaration) { result.push(getDefinitionInfo(declaration, symbolKind, symbolName, containerName)); }); @@ -33850,7 +29156,8 @@ var ts; var _declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 133) || (!selectConstructors && (d.kind === 195 || d.kind === 132 || d.kind === 131))) { + if ((selectConstructors && d.kind === 133) || + (!selectConstructors && (d.kind === 195 || d.kind === 132 || d.kind === 131))) { _declarations.push(d); if (d.body) definition = d; @@ -33890,10 +29197,9 @@ var ts; if (!node) { return undefined; } - if (node.kind === 64 || node.kind === 92 || node.kind === 90 || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { - return getReferencesForNode(node, [ - sourceFile - ], true, false, false); + if (node.kind === 64 || node.kind === 92 || node.kind === 90 || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + return getReferencesForNode(node, [sourceFile], true, false, false); } switch (node.kind) { case 83: @@ -33941,7 +29247,9 @@ var ts; } break; case 81: - if (hasKind(node.parent, 181) || hasKind(node.parent, 182) || hasKind(node.parent, 183)) { + if (hasKind(node.parent, 181) || + hasKind(node.parent, 182) || + hasKind(node.parent, 183)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -33962,7 +29270,8 @@ var ts; return getGetAndSetOccurrences(node.parent); } default: - if (ts.isModifier(node.kind) && node.parent && (ts.isDeclaration(node.parent) || node.parent.kind === 175)) { + if (ts.isModifier(node.kind) && node.parent && + (ts.isDeclaration(node.parent) || node.parent.kind === 175)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -34207,16 +29516,15 @@ var ts; function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { - return pushKeywordIf(keywords, child, 115, 119); - }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 115, 119); }); } } } function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (declaration.flags & 112) { - if (!(container.kind === 196 || (declaration.kind === 128 && hasKind(container, 133)))) { + if (!(container.kind === 196 || + (declaration.kind === 128 && hasKind(container, 133)))) { return undefined; } } @@ -34260,9 +29568,7 @@ var ts; } ts.forEach(nodes, function (node) { if (node.modifiers && node.flags & modifierFlag) { - ts.forEach(node.modifiers, function (child) { - return pushKeywordIf(keywords, child, modifier); - }); + ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); } }); return ts.map(keywords, getReferenceEntryFromNode); @@ -34316,7 +29622,9 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 64 && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { + if (node.kind !== 64 && + !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && + !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } ts.Debug.assert(node.kind === 64 || node.kind === 7 || node.kind === 8); @@ -34326,9 +29634,7 @@ var ts; if (isLabelName(node)) { if (isJumpStatementTarget(node)) { var labelDefinition = getTargetLabel(node.parent, node.text); - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [ - getReferenceEntryFromNode(node) - ]; + return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [getReferenceEntryFromNode(node)]; } else { return getLabelReferencesInNode(node.parent, node); @@ -34342,9 +29648,7 @@ var ts; } var symbol = typeInfoResolver.getSymbolAtLocation(node); if (!symbol) { - return [ - getReferenceEntryFromNode(node) - ]; + return [getReferenceEntryFromNode(node)]; } var declarations = symbol.declarations; if (!declarations || !declarations.length) { @@ -34378,7 +29682,9 @@ var ts; } return result; function isImportOrExportSpecifierName(location) { - return location.parent && (location.parent.kind === 208 || location.parent.kind === 212) && location.parent.propertyName === location; + return location.parent && + (location.parent.kind === 208 || location.parent.kind === 212) && + location.parent.propertyName === location; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { @@ -34386,9 +29692,7 @@ var ts; }); } function getDeclaredName(symbol, location) { - var functionExpression = ts.forEach(symbol.declarations, function (d) { - return d.kind === 160 ? d : undefined; - }); + var functionExpression = ts.forEach(symbol.declarations, function (d) { return d.kind === 160 ? d : undefined; }); var _name; if (functionExpression && functionExpression.name) { _name = functionExpression.name.text; @@ -34403,10 +29707,10 @@ var ts; if (isImportOrExportSpecifierName(location)) { return location.getText(); } - var functionExpression = ts.forEach(declarations, function (d) { - return d.kind === 160 ? d : undefined; - }); - var _name = functionExpression && functionExpression.name ? functionExpression.name.text : symbol.name; + var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 160 ? d : undefined; }); + var _name = functionExpression && functionExpression.name + ? functionExpression.name.text + : symbol.name; return stripQuotes(_name); } function stripQuotes(name) { @@ -34419,9 +29723,7 @@ var ts; } function getSymbolScope(symbol) { if (symbol.flags & (4 | 8192)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { - return (d.flags & 32) ? d : undefined; - }); + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); if (privateDeclaration) { return ts.getAncestor(privateDeclaration, 196); } @@ -34466,7 +29768,8 @@ var ts; if (position > end) break; var endPosition = position + symbolNameLength; - if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && + (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { positions.push(position); } position = text.indexOf(symbolName, position + symbolNameLength + 1); @@ -34484,7 +29787,8 @@ var ts; if (!_node || _node.getWidth() !== labelName.length) { return; } - if (_node === targetLabel || (isJumpStatementTarget(_node) && getTargetLabel(_node, labelName) === targetLabel)) { + if (_node === targetLabel || + (isJumpStatementTarget(_node) && getTargetLabel(_node, labelName) === targetLabel)) { _result.push(getReferenceEntryFromNode(_node)); } }); @@ -34496,7 +29800,8 @@ var ts; case 64: return node.getWidth() === searchSymbolName.length; case 8: - if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + isNameOfExternalModuleImportOrDeclaration(node)) { return node.getWidth() === searchSymbolName.length + 2; } break; @@ -34519,7 +29824,8 @@ var ts; cancellationToken.throwIfCancellationRequested(); var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); if (!isValidReferencePosition(referenceLocation, searchText)) { - if ((findInStrings && isInString(position)) || (findInComments && isInComment(position))) { + if ((findInStrings && isInString(position)) || + (findInComments && isInComment(position))) { result.push({ fileName: sourceFile.fileName, textSpan: ts.createTextSpan(position, searchText.length), @@ -34677,9 +29983,7 @@ var ts; } } function populateSearchSymbolSet(symbol, location) { - var _result = [ - symbol - ]; + var _result = [symbol]; if (isImportOrExportSpecifierImportSymbol(symbol)) { _result.push(typeInfoResolver.getAliasedSymbol(symbol)); } @@ -34732,14 +30036,13 @@ var ts; if (searchSymbols.indexOf(referenceSymbol) >= 0) { return true; } - if (isImportOrExportSpecifierImportSymbol(referenceSymbol) && searchSymbols.indexOf(typeInfoResolver.getAliasedSymbol(referenceSymbol)) >= 0) { + if (isImportOrExportSpecifierImportSymbol(referenceSymbol) && + searchSymbols.indexOf(typeInfoResolver.getAliasedSymbol(referenceSymbol)) >= 0) { return true; } if (isNameOfPropertyAssignment(referenceLocation)) { return ts.forEach(getPropertySymbolsFromContextualType(referenceLocation), function (contextualSymbol) { - return ts.forEach(typeInfoResolver.getRootSymbols(contextualSymbol), function (s) { - return searchSymbols.indexOf(s) >= 0; - }); + return ts.forEach(typeInfoResolver.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0; }); }); } return ts.forEach(typeInfoResolver.getRootSymbols(referenceSymbol), function (rootSymbol) { @@ -34749,9 +30052,7 @@ var ts; if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { var _result = []; getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), _result); - return ts.forEach(_result, function (s) { - return searchSymbols.indexOf(s) >= 0; - }); + return ts.forEach(_result, function (s) { return searchSymbols.indexOf(s) >= 0; }); } return false; }); @@ -34765,9 +30066,7 @@ var ts; if (contextualType.flags & 16384) { var unionProperty = contextualType.getProperty(_name); if (unionProperty) { - return [ - unionProperty - ]; + return [unionProperty]; } else { var _result = []; @@ -34783,9 +30082,7 @@ var ts; else { var _symbol = contextualType.getProperty(_name); if (_symbol) { - return [ - _symbol - ]; + return [_symbol]; } } } @@ -34843,9 +30140,7 @@ var ts; return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); } function containErrors(diagnostics) { - return ts.forEach(diagnostics, function (diagnostic) { - return diagnostic.category === 1; - }); + return ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1; }); } function getEmitOutput(fileName) { synchronizeHostData(); @@ -34939,7 +30234,9 @@ var ts; } function getMeaningFromRightHandSideOfImportEquals(node) { ts.Debug.assert(node.kind === 64); - if (node.parent.kind === 125 && node.parent.right === node && node.parent.parent.kind === 203) { + if (node.parent.kind === 125 && + node.parent.right === node && + node.parent.parent.kind === 203) { return 1 | 2 | 4; } return 4; @@ -34998,7 +30295,8 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 200 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + if (nodeForStartPos.parent.parent.kind === 200 && + nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } else { @@ -35045,7 +30343,8 @@ var ts; } } else if (flags & 1536) { - if (meaningAtPosition & 4 || (meaningAtPosition & 1 && hasValueSideModule(symbol))) { + if (meaningAtPosition & 4 || + (meaningAtPosition & 1 && hasValueSideModule(symbol))) { return ClassificationTypeNames.moduleName; } } @@ -35170,11 +30469,16 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 52) { - if (token.parent.kind === 193 || token.parent.kind === 130 || token.parent.kind === 128) { + if (token.parent.kind === 193 || + token.parent.kind === 130 || + token.parent.kind === 128) { return ClassificationTypeNames.operator; } } - if (token.parent.kind === 167 || token.parent.kind === 165 || token.parent.kind === 166 || token.parent.kind === 168) { + if (token.parent.kind === 167 || + token.parent.kind === 165 || + token.parent.kind === 166 || + token.parent.kind === 168) { return ClassificationTypeNames.operator; } } @@ -35272,22 +30576,14 @@ var ts; return result; function getMatchingTokenKind(token) { switch (token.kind) { - case 14: - return 15; - case 16: - return 17; - case 18: - return 19; - case 24: - return 25; - case 15: - return 14; - case 17: - return 16; - case 19: - return 18; - case 25: - return 24; + case 14: return 15; + case 16: return 17; + case 18: return 19; + case 24: return 25; + case 15: return 14; + case 17: return 16; + case 19: return 18; + case 25: return 24; } return undefined; } @@ -35368,9 +30664,7 @@ var ts; var multiLineCommentStart = /(?:\/\*+\s*)/.source; var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; var _preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; - var literals = "(?:" + ts.map(descriptors, function (d) { - return "(" + escapeRegExp(d.text) + ")"; - }).join("|") + ")"; + var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; var messageRemainder = /(?:.*?)/.source; var messagePortion = "(" + literals + messageRemainder + ")"; @@ -35378,7 +30672,9 @@ var ts; return new RegExp(regExpString, "gim"); } function isLetterOrDigit(char) { - return (char >= 97 && char <= 122) || (char >= 65 && char <= 90) || (char >= 48 && char <= 57); + return (char >= 97 && char <= 122) || + (char >= 65 && char <= 90) || + (char >= 48 && char <= 57); } } function getRenameInfo(fileName, position) { @@ -35480,7 +30776,9 @@ var ts; break; case 8: case 7: - if (ts.isDeclarationName(node) || node.parent.kind === 213 || isArgumentOfElementAccessExpression(node)) { + if (ts.isDeclarationName(node) || + node.parent.kind === 213 || + isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } break; @@ -35490,7 +30788,10 @@ var ts; } } function isArgumentOfElementAccessExpression(node) { - return node && node.parent && node.parent.kind === 154 && node.parent.argumentExpression === node; + return node && + node.parent && + node.parent.kind === 154 && + node.parent.argumentExpression === node; } function createClassifier() { var _scanner = ts.createScanner(2, false); @@ -35519,7 +30820,10 @@ var ts; } function canFollow(keyword1, keyword2) { if (isAccessibilityModifier(keyword1)) { - if (keyword2 === 115 || keyword2 === 119 || keyword2 === 113 || keyword2 === 109) { + if (keyword2 === 115 || + keyword2 === 119 || + keyword2 === 113 || + keyword2 === 109) { return true; } return false; @@ -35577,13 +30881,18 @@ var ts; else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { token = 64; } - else if (lastNonTriviaToken === 64 && token === 24) { + else if (lastNonTriviaToken === 64 && + token === 24) { angleBracketStack++; } else if (token === 25 && angleBracketStack > 0) { angleBracketStack--; } - else if (token === 111 || token === 120 || token === 118 || token === 112 || token === 121) { + else if (token === 111 || + token === 120 || + token === 118 || + token === 112 || + token === 121) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { token = 64; } @@ -35634,7 +30943,9 @@ var ts; } if (numBackslashes & 1) { var quoteChar = tokenText.charCodeAt(0); - result.finalLexState = quoteChar === 34 ? 3 : 2; + result.finalLexState = quoteChar === 34 + ? 3 + : 2; } } } @@ -35666,10 +30977,7 @@ var ts; if (result.entries.length === 0) { length -= offset; } - result.entries.push({ - length: length, - classification: classification - }); + result.entries.push({ length: length, classification: classification }); } } } @@ -35764,9 +31072,7 @@ var ts; return 5; } } - return { - getClassificationsForLine: getClassificationsForLine - }; + return { getClassificationsForLine: getClassificationsForLine }; } ts.createClassifier = createClassifier; function getDefaultLibFilePath(options) { @@ -35790,15 +31096,9 @@ var ts; Node.prototype = proto; return Node; }, - getSymbolConstructor: function () { - return SymbolObject; - }, - getTypeConstructor: function () { - return TypeObject; - }, - getSignatureConstructor: function () { - return SignatureObject; - } + getSymbolConstructor: function () { return SymbolObject; }, + getTypeConstructor: function () { return TypeObject; }, + getSignatureConstructor: function () { return SignatureObject; } }; } initializeServices(); @@ -35879,9 +31179,7 @@ var ts; return this.compilationSettings; }; LSHost.prototype.getScriptFileNames = function () { - return this.roots.map(function (root) { - return root.fileName; - }); + return this.roots.map(function (root) { return root.fileName; }); }; LSHost.prototype.getScriptVersion = function (filename) { return this.getScriptInfo(filename).svc.latestVersion().toString(); @@ -35974,10 +31272,7 @@ var ts; var script = this.filenameToScript[filename]; var index = script.snap().index; var lineCol = index.charOffsetToLineNumberAndPos(position); - return { - line: lineCol.line, - col: lineCol.col + 1 - }; + return { line: lineCol.line, col: lineCol.col + 1 }; }; return LSHost; })(); @@ -36055,9 +31350,7 @@ var ts; }; Project.prototype.filesToString = function () { var strBuilder = ""; - ts.forEachValue(this.filenameToSourceFile, function (sourceFile) { - strBuilder += sourceFile.fileName + "\n"; - }); + ts.forEachValue(this.filenameToSourceFile, function (sourceFile) { strBuilder += sourceFile.fileName + "\n"; }); return strBuilder; }; Project.prototype.setProjectOptions = function (projectOptions) { @@ -36154,7 +31447,8 @@ var ts; for (var i = 0, len = this.openFileRoots.length; i < len; i++) { var r = this.openFileRoots[i]; if (info.defaultProject.getSourceFile(r)) { - this.inferredProjects = copyListRemovingItem(r.defaultProject, this.inferredProjects); + this.inferredProjects = + copyListRemovingItem(r.defaultProject, this.inferredProjects); this.openFilesReferenced.push(r); r.defaultProject = info.defaultProject; } @@ -36276,9 +31570,7 @@ var ts; info = new ScriptInfo(this.host, fileName, content, openedByClient); this.filenameToScriptInfo[fileName] = info; if (!info.isOpen) { - info.fileWatcher = this.host.watchFile(fileName, function (_) { - _this.watchedFileChanged(fileName); - }); + info.fileWatcher = this.host.watchFile(fileName, function (_) { _this.watchedFileChanged(fileName); }); } } } @@ -36360,16 +31652,12 @@ var ts; var dirPath = ts.getDirectoryPath(configFilename); var rawConfig = ts.readConfigFile(configFilename); if (!rawConfig) { - return { - errorMsg: "tsconfig syntax error" - }; + return { errorMsg: "tsconfig syntax error" }; } else { var parsedCommandLine = ts.parseConfigFile(rawConfig); if (parsedCommandLine.errors) { - return { - errorMsg: "tsconfig option errors" - }; + return { errorMsg: "tsconfig option errors" }; } else if (parsedCommandLine.fileNames) { var proj = this.createProject(configFilename); @@ -36382,9 +31670,7 @@ var ts; proj.addRoot(info); } else { - return { - errorMsg: "specified file " + rootFilename + " not found" - }; + return { errorMsg: "specified file " + rootFilename + " not found" }; } } var projectOptions = { @@ -36395,15 +31681,10 @@ var ts; projectOptions.formatCodeOptions = rawConfig.formatCodeOptions; } proj.setProjectOptions(projectOptions); - return { - success: true, - project: proj - }; + return { success: true, project: proj }; } else { - return { - errorMsg: "no files found" - }; + return { errorMsg: "no files found" }; } } }; @@ -36480,12 +31761,8 @@ var ts; this.trailingText = ""; this.suppressTrailingText = false; this.lineIndex.root = new LineNode(); - this.startPath = [ - this.lineIndex.root - ]; - this.stack = [ - this.lineIndex.root - ]; + this.startPath = [this.lineIndex.root]; + this.stack = [this.lineIndex.root]; } EditWalker.prototype.insertLines = function (insertedText) { if (this.suppressTrailingText) { @@ -36677,7 +31954,9 @@ var ts; } ScriptVersionCache.prototype.edit = function (pos, deleteLen, insertedText) { this.changes[this.changes.length] = new TextChange(pos, deleteLen, insertedText); - if ((this.changes.length > ScriptVersionCache.changeNumberThreshold) || (deleteLen > ScriptVersionCache.changeLengthThreshold) || (insertedText && (insertedText.length > ScriptVersionCache.changeLengthThreshold))) { + if ((this.changes.length > ScriptVersionCache.changeNumberThreshold) || + (deleteLen > ScriptVersionCache.changeLengthThreshold) || + (insertedText && (insertedText.length > ScriptVersionCache.changeLengthThreshold))) { this.getSnapshot(); } }; @@ -36782,9 +32061,7 @@ var ts; return this.index.root.charCount(); }; LineIndexSnapshot.prototype.getLineStartPositions = function () { - var starts = [ - -1 - ]; + var starts = [-1]; var count = 1; var pos = 0; this.index.every(function (ll, s, len) { @@ -36963,10 +32240,7 @@ var ts; LineIndex.linesFromText = function (text) { var lineStarts = ts.computeLineStarts(text); if (lineStarts.length == 0) { - return { - lines: [], - lineMap: lineStarts - }; + return { lines: [], lineMap: lineStarts }; } var lines = new Array(lineStarts.length); var lc = lineStarts.length - 1; @@ -36980,10 +32254,7 @@ var ts; else { lines.length--; } - return { - lines: lines, - lineMap: lineStarts - }; + return { lines: lines, lineMap: lineStarts }; }; return LineIndex; })(); @@ -37097,10 +32368,7 @@ var ts; } else { var lineInfo = this.lineNumberToInfo(this.lineCount(), 0); - return { - line: this.lineCount(), - col: lineInfo.leaf.charCount() - }; + return { line: this.lineCount(), col: lineInfo.leaf.charCount() }; } }; LineNode.prototype.lineNumberToInfo = function (lineNumber, charOffset) { @@ -37287,12 +32555,7 @@ var ts; (function (ts) { var server; (function (server) { - var spaceCache = [ - " ", - " ", - " ", - " " - ]; + var spaceCache = [" ", " ", " ", " "]; function generateSpaces(n) { if (!spaceCache[n]) { var strBuilder = ""; @@ -37378,22 +32641,16 @@ var ts; this.fileHash = {}; this.nextFileId = 1; this.changeSeq = 0; - this.projectService = new server.ProjectService(host, logger, function (eventName, project, fileName) { - _this.handleEvent(eventName, project, fileName); - }); + this.projectService = + new server.ProjectService(host, logger, function (eventName, project, fileName) { + _this.handleEvent(eventName, project, fileName); + }); } Session.prototype.handleEvent = function (eventName, project, fileName) { var _this = this; if (eventName == "context") { this.projectService.log("got context event, updating diagnostics for" + fileName, "Info"); - this.updateErrorCheck([ - { - fileName: fileName, - project: project - } - ], this.changeSeq, function (n) { - return n == _this.changeSeq; - }, 100); + this.updateErrorCheck([{ fileName: fileName, project: project }], this.changeSeq, function (n) { return n == _this.changeSeq; }, 100); } }; Session.prototype.logError = function (err, cmd) { @@ -37415,7 +32672,8 @@ var ts; if (this.logger.isVerbose()) { this.logger.info(msg.type + ": " + json); } - this.sendLineToClient('Content-Length: ' + (1 + Buffer.byteLength(json, 'utf8')) + '\r\n\r\n' + json); + this.sendLineToClient('Content-Length: ' + (1 + Buffer.byteLength(json, 'utf8')) + + '\r\n\r\n' + json); }; Session.prototype.event = function (info, eventName) { var ev = { @@ -37451,13 +32709,8 @@ var ts; try { var diags = project.compilerService.languageService.getSemanticDiagnostics(file); if (diags) { - var bakedDiags = diags.map(function (diag) { - return formatDiag(file, project, diag); - }); - this.event({ - file: file, - diagnostics: bakedDiags - }, "semanticDiag"); + var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); }); + this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag"); } } catch (err) { @@ -37468,13 +32721,8 @@ var ts; try { var diags = project.compilerService.languageService.getSyntacticDiagnostics(file); if (diags) { - var bakedDiags = diags.map(function (diag) { - return formatDiag(file, project, diag); - }); - this.event({ - file: file, - diagnostics: bakedDiags - }, "syntaxDiag"); + var bakedDiags = diags.map(function (diag) { return formatDiag(file, project, diag); }); + this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag"); } } catch (err) { @@ -37543,13 +32791,11 @@ var ts; if (!definitions) { return undefined; } - return definitions.map(function (def) { - return ({ - file: def.fileName, - start: compilerService.host.positionToLineCol(def.fileName, def.textSpan.start), - end: compilerService.host.positionToLineCol(def.fileName, ts.textSpanEnd(def.textSpan)) - }); - }); + return definitions.map(function (def) { return ({ + file: def.fileName, + start: compilerService.host.positionToLineCol(def.fileName, def.textSpan.start), + end: compilerService.host.positionToLineCol(def.fileName, ts.textSpanEnd(def.textSpan)) + }); }); }; Session.prototype.getRenameLocations = function (line, col, fileName, findInComments, findInStrings) { var file = ts.normalizePath(fileName); @@ -37573,13 +32819,11 @@ var ts; if (!renameLocations) { return undefined; } - var bakedRenameLocs = renameLocations.map(function (location) { - return ({ - file: location.fileName, - start: compilerService.host.positionToLineCol(location.fileName, location.textSpan.start), - end: compilerService.host.positionToLineCol(location.fileName, ts.textSpanEnd(location.textSpan)) - }); - }).sort(function (a, b) { + var bakedRenameLocs = renameLocations.map(function (location) { return ({ + file: location.fileName, + start: compilerService.host.positionToLineCol(location.fileName, location.textSpan.start), + end: compilerService.host.positionToLineCol(location.fileName, ts.textSpanEnd(location.textSpan)) + }); }).sort(function (a, b) { if (a.file < b.file) { return -1; } @@ -37606,22 +32850,13 @@ var ts; } } if (!curFileAccum) { - curFileAccum = { - file: cur.file, - locs: [] - }; + curFileAccum = { file: cur.file, locs: [] }; accum.push(curFileAccum); } - curFileAccum.locs.push({ - start: cur.start, - end: cur.end - }); + curFileAccum.locs.push({ start: cur.start, end: cur.end }); return accum; }, []); - return { - info: renameInfo, - locs: bakedRenameLocs - }; + return { info: renameInfo, locs: bakedRenameLocs }; }; Session.prototype.getReferences = function (line, col, fileName) { var file = ts.normalizePath(fileName); @@ -37744,10 +32979,7 @@ var ts; } if (indentPosition > 0) { var spaces = generateSpaces(indentPosition); - edits.push({ - span: ts.createTextSpanFromBounds(position, position), - newText: spaces - }); + edits.push({ span: ts.createTextSpanFromBounds(position, position), newText: spaces }); } else if (indentPosition < 0) { edits.push({ @@ -37814,17 +33046,12 @@ var ts; fileName = ts.normalizePath(fileName); var project = _this.projectService.getProjectForFile(fileName); if (project) { - accum.push({ - fileName: fileName, - project: project - }); + accum.push({ fileName: fileName, project: project }); } return accum; }, []); if (checkList.length > 0) { - this.updateErrorCheck(checkList, this.changeSeq, function (n) { - return n == _this.changeSeq; - }, delay); + this.updateErrorCheck(checkList, this.changeSeq, function (n) { return n == _this.changeSeq; }, delay); } }; Session.prototype.change = function (line, col, endLine, endCol, insertString, fileName) { @@ -37839,9 +33066,7 @@ var ts; compilerService.host.editScript(file, start, end, insertString); this.changeSeq++; } - this.updateProjectStructure(this.changeSeq, function (n) { - return n == _this.changeSeq; - }); + this.updateProjectStructure(this.changeSeq, function (n) { return n == _this.changeSeq; }); } }; Session.prototype.reload = function (fileName, tempFileName, reqSeq) { @@ -37875,20 +33100,16 @@ var ts; return undefined; } var compilerService = project.compilerService; - return items.map(function (item) { - return ({ - text: item.text, - kind: item.kind, - kindModifiers: item.kindModifiers, - spans: item.spans.map(function (span) { - return ({ - start: compilerService.host.positionToLineCol(fileName, span.start), - end: compilerService.host.positionToLineCol(fileName, ts.textSpanEnd(span)) - }); - }), - childItems: _this.decorateNavigationBarItem(project, fileName, item.childItems) - }); - }); + return items.map(function (item) { return ({ + text: item.text, + kind: item.kind, + kindModifiers: item.kindModifiers, + spans: item.spans.map(function (span) { return ({ + start: compilerService.host.positionToLineCol(fileName, span.start), + end: compilerService.host.positionToLineCol(fileName, ts.textSpanEnd(span)) + }); }), + childItems: _this.decorateNavigationBarItem(project, fileName, item.childItems) + }); }); }; Session.prototype.getNavigationBarItems = function (fileName) { var file = ts.normalizePath(fileName); @@ -37951,12 +33172,10 @@ var ts; if (!spans) { return undefined; } - return spans.map(function (span) { - return ({ - start: compilerService.host.positionToLineCol(file, span.start), - end: compilerService.host.positionToLineCol(file, span.start + span.length) - }); - }); + return spans.map(function (span) { return ({ + start: compilerService.host.positionToLineCol(file, span.start), + end: compilerService.host.positionToLineCol(file, span.start + span.length) + }); }); }; Session.prototype.onMessage = function (message) { if (this.logger.isVerbose()) { @@ -37969,119 +33188,101 @@ var ts; var errorMessage; var responseRequired = true; switch (request.command) { - case CommandNames.Definition: - { - var defArgs = request.arguments; - response = this.getDefinition(defArgs.line, defArgs.col, defArgs.file); - break; - } - case CommandNames.References: - { - var refArgs = request.arguments; - response = this.getReferences(refArgs.line, refArgs.col, refArgs.file); - break; - } - case CommandNames.Rename: - { - var renameArgs = request.arguments; - response = this.getRenameLocations(renameArgs.line, renameArgs.col, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings); - break; - } - case CommandNames.Open: - { - var openArgs = request.arguments; - this.openClientFile(openArgs.file); - responseRequired = false; - break; - } - case CommandNames.Quickinfo: - { - var quickinfoArgs = request.arguments; - response = this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.col, quickinfoArgs.file); - break; - } - case CommandNames.Format: - { - var formatArgs = request.arguments; - response = this.getFormattingEditsForRange(formatArgs.line, formatArgs.col, formatArgs.endLine, formatArgs.endCol, formatArgs.file); - break; - } - case CommandNames.Formatonkey: - { - var formatOnKeyArgs = request.arguments; - response = this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.col, formatOnKeyArgs.key, formatOnKeyArgs.file); - break; - } - case CommandNames.Completions: - { - var completionsArgs = request.arguments; - response = this.getCompletions(request.arguments.line, request.arguments.col, completionsArgs.prefix, request.arguments.file); - break; - } - case CommandNames.CompletionDetails: - { - var completionDetailsArgs = request.arguments; - response = this.getCompletionEntryDetails(request.arguments.line, request.arguments.col, completionDetailsArgs.entryNames, request.arguments.file); - break; - } - case CommandNames.Geterr: - { - var geterrArgs = request.arguments; - response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files); - responseRequired = false; - break; - } - case CommandNames.Change: - { - var changeArgs = request.arguments; - this.change(changeArgs.line, changeArgs.col, changeArgs.endLine, changeArgs.endCol, changeArgs.insertString, changeArgs.file); - responseRequired = false; - break; - } - case CommandNames.Reload: - { - var reloadArgs = request.arguments; - this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq); - break; - } - case CommandNames.Saveto: - { - var savetoArgs = request.arguments; - this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); - responseRequired = false; - break; - } - case CommandNames.Close: - { - var closeArgs = request.arguments; - this.closeClientFile(closeArgs.file); - responseRequired = false; - break; - } - case CommandNames.Navto: - { - var navtoArgs = request.arguments; - response = this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount); - break; - } - case CommandNames.Brace: - { - var braceArguments = request.arguments; - response = this.getBraceMatching(braceArguments.line, braceArguments.col, braceArguments.file); - break; - } - case CommandNames.NavBar: - { - var navBarArgs = request.arguments; - response = this.getNavigationBarItems(navBarArgs.file); - break; - } - default: - { - this.projectService.log("Unrecognized JSON command: " + message); - this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command); - break; - } + case CommandNames.Definition: { + var defArgs = request.arguments; + response = this.getDefinition(defArgs.line, defArgs.col, defArgs.file); + break; + } + case CommandNames.References: { + var refArgs = request.arguments; + response = this.getReferences(refArgs.line, refArgs.col, refArgs.file); + break; + } + case CommandNames.Rename: { + var renameArgs = request.arguments; + response = this.getRenameLocations(renameArgs.line, renameArgs.col, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings); + break; + } + case CommandNames.Open: { + var openArgs = request.arguments; + this.openClientFile(openArgs.file); + responseRequired = false; + break; + } + case CommandNames.Quickinfo: { + var quickinfoArgs = request.arguments; + response = this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.col, quickinfoArgs.file); + break; + } + case CommandNames.Format: { + var formatArgs = request.arguments; + response = this.getFormattingEditsForRange(formatArgs.line, formatArgs.col, formatArgs.endLine, formatArgs.endCol, formatArgs.file); + break; + } + case CommandNames.Formatonkey: { + var formatOnKeyArgs = request.arguments; + response = this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.col, formatOnKeyArgs.key, formatOnKeyArgs.file); + break; + } + case CommandNames.Completions: { + var completionsArgs = request.arguments; + response = this.getCompletions(request.arguments.line, request.arguments.col, completionsArgs.prefix, request.arguments.file); + break; + } + case CommandNames.CompletionDetails: { + var completionDetailsArgs = request.arguments; + response = this.getCompletionEntryDetails(request.arguments.line, request.arguments.col, completionDetailsArgs.entryNames, request.arguments.file); + break; + } + case CommandNames.Geterr: { + var geterrArgs = request.arguments; + response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files); + responseRequired = false; + break; + } + case CommandNames.Change: { + var changeArgs = request.arguments; + this.change(changeArgs.line, changeArgs.col, changeArgs.endLine, changeArgs.endCol, changeArgs.insertString, changeArgs.file); + responseRequired = false; + break; + } + case CommandNames.Reload: { + var reloadArgs = request.arguments; + this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq); + break; + } + case CommandNames.Saveto: { + var savetoArgs = request.arguments; + this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); + responseRequired = false; + break; + } + case CommandNames.Close: { + var closeArgs = request.arguments; + this.closeClientFile(closeArgs.file); + responseRequired = false; + break; + } + case CommandNames.Navto: { + var navtoArgs = request.arguments; + response = this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount); + break; + } + case CommandNames.Brace: { + var braceArguments = request.arguments; + response = this.getBraceMatching(braceArguments.line, braceArguments.col, braceArguments.file); + break; + } + case CommandNames.NavBar: { + var navBarArgs = request.arguments; + response = this.getNavigationBarItems(navBarArgs.file); + break; + } + default: { + this.projectService.log("Unrecognized JSON command: " + message); + this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command); + break; + } } if (this.logger.isVerbose()) { var elapsed = process.hrtime(start); @@ -38322,9 +33523,7 @@ var ts; ts.sys.watchFile = function (fileName, callback) { var watchedFile = watchedFileSet.addFile(fileName, callback); return { - close: function () { - return watchedFileSet.removeFile(watchedFile); - } + close: function () { return watchedFileSet.removeFile(watchedFile); } }; }; var ioSession = new IOSession(ts.sys, logger); diff --git a/bin/typescript.d.ts b/bin/typescript.d.ts index e6f4bf572d7..8f71dc4ee08 100644 --- a/bin/typescript.d.ts +++ b/bin/typescript.d.ts @@ -1200,9 +1200,6 @@ declare module "typescript" { target?: ScriptTarget; version?: boolean; watch?: boolean; - stripInternal?: boolean; - preserveNewLines?: boolean; - cacheDownlevelForOfLength?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/bin/typescript.js b/bin/typescript.js index 1cefda2a274..9e939631006 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -834,13 +834,13 @@ var ts; ts.arrayToMap = arrayToMap; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (match, index) { - return args[+index + baseIndex]; - }); + return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); } ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { - return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] ? ts.localizedDiagnosticMessages[message] : message; + return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] + ? ts.localizedDiagnosticMessages[message] + : message; } ts.getLocaleSpecificMessage = getLocaleSpecificMessage; function createFileDiagnostic(file, start, length, message) { @@ -911,7 +911,12 @@ var ts; return diagnostic.file ? diagnostic.file.fileName : undefined; } function compareDiagnostics(d1, d2) { - return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0; + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || + compareValues(d1.start, d2.start) || + compareValues(d1.length, d2.length) || + compareValues(d1.code, d2.code) || + compareMessageText(d1.messageText, d2.messageText) || + 0; } ts.compareDiagnostics = compareDiagnostics; function compareMessageText(text1, text2) { @@ -938,9 +943,7 @@ var ts; if (diagnostics.length < 2) { return diagnostics; } - var newDiagnostics = [ - diagnostics[0] - ]; + var newDiagnostics = [diagnostics[0]]; var previousDiagnostic = diagnostics[0]; for (var i = 1; i < diagnostics.length; i++) { var currentDiagnostic = diagnostics[i]; @@ -1017,9 +1020,7 @@ var ts; ts.isRootedDiskPath = isRootedDiskPath; function normalizedPathComponents(path, rootLength) { var normalizedParts = getNormalizedParts(path, rootLength); - return [ - path.substr(0, rootLength) - ].concat(normalizedParts); + return [path.substr(0, rootLength)].concat(normalizedParts); } function getNormalizedPathComponents(path, currentDirectory) { path = normalizeSlashes(path); @@ -1053,9 +1054,7 @@ var ts; } } if (rootLength === urlLength) { - return [ - url - ]; + return [url]; } var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); if (indexOfNextSlash !== -1) { @@ -1063,9 +1062,7 @@ var ts; return normalizedPathComponents(url, rootLength); } else { - return [ - url + ts.directorySeparator - ]; + return [url + ts.directorySeparator]; } } function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { @@ -1127,11 +1124,7 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [ - ".d.ts", - ".ts", - ".js" - ]; + var supportedExtensions = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { var ext = supportedExtensions[_i]; @@ -1185,15 +1178,9 @@ var ts; }; return Node; }, - getSymbolConstructor: function () { - return Symbol; - }, - getTypeConstructor: function () { - return Type; - }, - getSignatureConstructor: function () { - return Signature; - } + getSymbolConstructor: function () { return Symbol; }, + getTypeConstructor: function () { return Type; }, + getSignatureConstructor: function () { return Signature; } }; (function (AssertionLevel) { AssertionLevel[AssertionLevel["None"] = 0] = "None"; @@ -1421,14 +1408,9 @@ var ts; readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { - _fs.watchFile(fileName, { - persistent: true, - interval: 250 - }, fileChanged); + _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); return { - close: function () { - _fs.unwatchFile(fileName, fileChanged); - } + close: function () { _fs.unwatchFile(fileName, fileChanged); } }; function fileChanged(curr, prev) { if (+curr.mtime <= +prev.mtime) { @@ -1484,2431 +1466,491 @@ var ts; var ts; (function (ts) { ts.Diagnostics = { - Unterminated_string_literal: { - code: 1002, - category: 1, - key: "Unterminated string literal." - }, - Identifier_expected: { - code: 1003, - category: 1, - key: "Identifier expected." - }, - _0_expected: { - code: 1005, - category: 1, - key: "'{0}' expected." - }, - A_file_cannot_have_a_reference_to_itself: { - code: 1006, - category: 1, - key: "A file cannot have a reference to itself." - }, - Trailing_comma_not_allowed: { - code: 1009, - category: 1, - key: "Trailing comma not allowed." - }, - Asterisk_Slash_expected: { - code: 1010, - category: 1, - key: "'*/' expected." - }, - Unexpected_token: { - code: 1012, - category: 1, - key: "Unexpected token." - }, - A_rest_parameter_must_be_last_in_a_parameter_list: { - code: 1014, - category: 1, - key: "A rest parameter must be last in a parameter list." - }, - Parameter_cannot_have_question_mark_and_initializer: { - code: 1015, - category: 1, - key: "Parameter cannot have question mark and initializer." - }, - A_required_parameter_cannot_follow_an_optional_parameter: { - code: 1016, - category: 1, - key: "A required parameter cannot follow an optional parameter." - }, - An_index_signature_cannot_have_a_rest_parameter: { - code: 1017, - category: 1, - key: "An index signature cannot have a rest parameter." - }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { - code: 1018, - category: 1, - key: "An index signature parameter cannot have an accessibility modifier." - }, - An_index_signature_parameter_cannot_have_a_question_mark: { - code: 1019, - category: 1, - key: "An index signature parameter cannot have a question mark." - }, - An_index_signature_parameter_cannot_have_an_initializer: { - code: 1020, - category: 1, - key: "An index signature parameter cannot have an initializer." - }, - An_index_signature_must_have_a_type_annotation: { - code: 1021, - category: 1, - key: "An index signature must have a type annotation." - }, - An_index_signature_parameter_must_have_a_type_annotation: { - code: 1022, - category: 1, - key: "An index signature parameter must have a type annotation." - }, - An_index_signature_parameter_type_must_be_string_or_number: { - code: 1023, - category: 1, - key: "An index signature parameter type must be 'string' or 'number'." - }, - A_class_or_interface_declaration_can_only_have_one_extends_clause: { - code: 1024, - category: 1, - key: "A class or interface declaration can only have one 'extends' clause." - }, - An_extends_clause_must_precede_an_implements_clause: { - code: 1025, - category: 1, - key: "An 'extends' clause must precede an 'implements' clause." - }, - A_class_can_only_extend_a_single_class: { - code: 1026, - category: 1, - key: "A class can only extend a single class." - }, - A_class_declaration_can_only_have_one_implements_clause: { - code: 1027, - category: 1, - key: "A class declaration can only have one 'implements' clause." - }, - Accessibility_modifier_already_seen: { - code: 1028, - category: 1, - key: "Accessibility modifier already seen." - }, - _0_modifier_must_precede_1_modifier: { - code: 1029, - category: 1, - key: "'{0}' modifier must precede '{1}' modifier." - }, - _0_modifier_already_seen: { - code: 1030, - category: 1, - key: "'{0}' modifier already seen." - }, - _0_modifier_cannot_appear_on_a_class_element: { - code: 1031, - category: 1, - key: "'{0}' modifier cannot appear on a class element." - }, - An_interface_declaration_cannot_have_an_implements_clause: { - code: 1032, - category: 1, - key: "An interface declaration cannot have an 'implements' clause." - }, - super_must_be_followed_by_an_argument_list_or_member_access: { - code: 1034, - category: 1, - key: "'super' must be followed by an argument list or member access." - }, - Only_ambient_modules_can_use_quoted_names: { - code: 1035, - category: 1, - key: "Only ambient modules can use quoted names." - }, - Statements_are_not_allowed_in_ambient_contexts: { - code: 1036, - category: 1, - key: "Statements are not allowed in ambient contexts." - }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { - code: 1038, - category: 1, - key: "A 'declare' modifier cannot be used in an already ambient context." - }, - Initializers_are_not_allowed_in_ambient_contexts: { - code: 1039, - category: 1, - key: "Initializers are not allowed in ambient contexts." - }, - _0_modifier_cannot_appear_on_a_module_element: { - code: 1044, - category: 1, - key: "'{0}' modifier cannot appear on a module element." - }, - A_declare_modifier_cannot_be_used_with_an_interface_declaration: { - code: 1045, - category: 1, - key: "A 'declare' modifier cannot be used with an interface declaration." - }, - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { - code: 1046, - category: 1, - key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." - }, - A_rest_parameter_cannot_be_optional: { - code: 1047, - category: 1, - key: "A rest parameter cannot be optional." - }, - A_rest_parameter_cannot_have_an_initializer: { - code: 1048, - category: 1, - key: "A rest parameter cannot have an initializer." - }, - A_set_accessor_must_have_exactly_one_parameter: { - code: 1049, - category: 1, - key: "A 'set' accessor must have exactly one parameter." - }, - A_set_accessor_cannot_have_an_optional_parameter: { - code: 1051, - category: 1, - key: "A 'set' accessor cannot have an optional parameter." - }, - A_set_accessor_parameter_cannot_have_an_initializer: { - code: 1052, - category: 1, - key: "A 'set' accessor parameter cannot have an initializer." - }, - A_set_accessor_cannot_have_rest_parameter: { - code: 1053, - category: 1, - key: "A 'set' accessor cannot have rest parameter." - }, - A_get_accessor_cannot_have_parameters: { - code: 1054, - category: 1, - key: "A 'get' accessor cannot have parameters." - }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { - code: 1056, - category: 1, - key: "Accessors are only available when targeting ECMAScript 5 and higher." - }, - Enum_member_must_have_initializer: { - code: 1061, - category: 1, - key: "Enum member must have initializer." - }, - An_export_assignment_cannot_be_used_in_an_internal_module: { - code: 1063, - category: 1, - key: "An export assignment cannot be used in an internal module." - }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { - code: 1066, - category: 1, - key: "Ambient enum elements can only have integer literal initializers." - }, - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { - code: 1068, - category: 1, - key: "Unexpected token. A constructor, method, accessor, or property was expected." - }, - A_declare_modifier_cannot_be_used_with_an_import_declaration: { - code: 1079, - category: 1, - key: "A 'declare' modifier cannot be used with an import declaration." - }, - Invalid_reference_directive_syntax: { - code: 1084, - category: 1, - key: "Invalid 'reference' directive syntax." - }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { - code: 1085, - category: 1, - key: "Octal literals are not available when targeting ECMAScript 5 and higher." - }, - An_accessor_cannot_be_declared_in_an_ambient_context: { - code: 1086, - category: 1, - key: "An accessor cannot be declared in an ambient context." - }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { - code: 1089, - category: 1, - key: "'{0}' modifier cannot appear on a constructor declaration." - }, - _0_modifier_cannot_appear_on_a_parameter: { - code: 1090, - category: 1, - key: "'{0}' modifier cannot appear on a parameter." - }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { - code: 1091, - category: 1, - key: "Only a single variable declaration is allowed in a 'for...in' statement." - }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { - code: 1092, - category: 1, - key: "Type parameters cannot appear on a constructor declaration." - }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { - code: 1093, - category: 1, - key: "Type annotation cannot appear on a constructor declaration." - }, - An_accessor_cannot_have_type_parameters: { - code: 1094, - category: 1, - key: "An accessor cannot have type parameters." - }, - A_set_accessor_cannot_have_a_return_type_annotation: { - code: 1095, - category: 1, - key: "A 'set' accessor cannot have a return type annotation." - }, - An_index_signature_must_have_exactly_one_parameter: { - code: 1096, - category: 1, - key: "An index signature must have exactly one parameter." - }, - _0_list_cannot_be_empty: { - code: 1097, - category: 1, - key: "'{0}' list cannot be empty." - }, - Type_parameter_list_cannot_be_empty: { - code: 1098, - category: 1, - key: "Type parameter list cannot be empty." - }, - Type_argument_list_cannot_be_empty: { - code: 1099, - category: 1, - key: "Type argument list cannot be empty." - }, - Invalid_use_of_0_in_strict_mode: { - code: 1100, - category: 1, - key: "Invalid use of '{0}' in strict mode." - }, - with_statements_are_not_allowed_in_strict_mode: { - code: 1101, - category: 1, - key: "'with' statements are not allowed in strict mode." - }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { - code: 1102, - category: 1, - key: "'delete' cannot be called on an identifier in strict mode." - }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { - code: 1104, - category: 1, - key: "A 'continue' statement can only be used within an enclosing iteration statement." - }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { - code: 1105, - category: 1, - key: "A 'break' statement can only be used within an enclosing iteration or switch statement." - }, - Jump_target_cannot_cross_function_boundary: { - code: 1107, - category: 1, - key: "Jump target cannot cross function boundary." - }, - A_return_statement_can_only_be_used_within_a_function_body: { - code: 1108, - category: 1, - key: "A 'return' statement can only be used within a function body." - }, - Expression_expected: { - code: 1109, - category: 1, - key: "Expression expected." - }, - Type_expected: { - code: 1110, - category: 1, - key: "Type expected." - }, - A_class_member_cannot_be_declared_optional: { - code: 1112, - category: 1, - key: "A class member cannot be declared optional." - }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { - code: 1113, - category: 1, - key: "A 'default' clause cannot appear more than once in a 'switch' statement." - }, - Duplicate_label_0: { - code: 1114, - category: 1, - key: "Duplicate label '{0}'" - }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { - code: 1115, - category: 1, - key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." - }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { - code: 1116, - category: 1, - key: "A 'break' statement can only jump to a label of an enclosing statement." - }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { - code: 1117, - category: 1, - key: "An object literal cannot have multiple properties with the same name in strict mode." - }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { - code: 1118, - category: 1, - key: "An object literal cannot have multiple get/set accessors with the same name." - }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { - code: 1119, - category: 1, - key: "An object literal cannot have property and accessor with the same name." - }, - An_export_assignment_cannot_have_modifiers: { - code: 1120, - category: 1, - key: "An export assignment cannot have modifiers." - }, - Octal_literals_are_not_allowed_in_strict_mode: { - code: 1121, - category: 1, - key: "Octal literals are not allowed in strict mode." - }, - A_tuple_type_element_list_cannot_be_empty: { - code: 1122, - category: 1, - key: "A tuple type element list cannot be empty." - }, - Variable_declaration_list_cannot_be_empty: { - code: 1123, - category: 1, - key: "Variable declaration list cannot be empty." - }, - Digit_expected: { - code: 1124, - category: 1, - key: "Digit expected." - }, - Hexadecimal_digit_expected: { - code: 1125, - category: 1, - key: "Hexadecimal digit expected." - }, - Unexpected_end_of_text: { - code: 1126, - category: 1, - key: "Unexpected end of text." - }, - Invalid_character: { - code: 1127, - category: 1, - key: "Invalid character." - }, - Declaration_or_statement_expected: { - code: 1128, - category: 1, - key: "Declaration or statement expected." - }, - Statement_expected: { - code: 1129, - category: 1, - key: "Statement expected." - }, - case_or_default_expected: { - code: 1130, - category: 1, - key: "'case' or 'default' expected." - }, - Property_or_signature_expected: { - code: 1131, - category: 1, - key: "Property or signature expected." - }, - Enum_member_expected: { - code: 1132, - category: 1, - key: "Enum member expected." - }, - Type_reference_expected: { - code: 1133, - category: 1, - key: "Type reference expected." - }, - Variable_declaration_expected: { - code: 1134, - category: 1, - key: "Variable declaration expected." - }, - Argument_expression_expected: { - code: 1135, - category: 1, - key: "Argument expression expected." - }, - Property_assignment_expected: { - code: 1136, - category: 1, - key: "Property assignment expected." - }, - Expression_or_comma_expected: { - code: 1137, - category: 1, - key: "Expression or comma expected." - }, - Parameter_declaration_expected: { - code: 1138, - category: 1, - key: "Parameter declaration expected." - }, - Type_parameter_declaration_expected: { - code: 1139, - category: 1, - key: "Type parameter declaration expected." - }, - Type_argument_expected: { - code: 1140, - category: 1, - key: "Type argument expected." - }, - String_literal_expected: { - code: 1141, - category: 1, - key: "String literal expected." - }, - Line_break_not_permitted_here: { - code: 1142, - category: 1, - key: "Line break not permitted here." - }, - or_expected: { - code: 1144, - category: 1, - key: "'{' or ';' expected." - }, - Modifiers_not_permitted_on_index_signature_members: { - code: 1145, - category: 1, - key: "Modifiers not permitted on index signature members." - }, - Declaration_expected: { - code: 1146, - category: 1, - key: "Declaration expected." - }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { - code: 1147, - category: 1, - key: "Import declarations in an internal module cannot reference an external module." - }, - Cannot_compile_external_modules_unless_the_module_flag_is_provided: { - code: 1148, - category: 1, - key: "Cannot compile external modules unless the '--module' flag is provided." - }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { - code: 1149, - category: 1, - key: "File name '{0}' differs from already included file name '{1}' only in casing" - }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { - code: 1150, - category: 1, - key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." - }, - var_let_or_const_expected: { - code: 1152, - category: 1, - key: "'var', 'let' or 'const' expected." - }, - let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 1153, - category: 1, - key: "'let' declarations are only available when targeting ECMAScript 6 and higher." - }, - const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 1154, - category: 1, - key: "'const' declarations are only available when targeting ECMAScript 6 and higher." - }, - const_declarations_must_be_initialized: { - code: 1155, - category: 1, - key: "'const' declarations must be initialized" - }, - const_declarations_can_only_be_declared_inside_a_block: { - code: 1156, - category: 1, - key: "'const' declarations can only be declared inside a block." - }, - let_declarations_can_only_be_declared_inside_a_block: { - code: 1157, - category: 1, - key: "'let' declarations can only be declared inside a block." - }, - Unterminated_template_literal: { - code: 1160, - category: 1, - key: "Unterminated template literal." - }, - Unterminated_regular_expression_literal: { - code: 1161, - category: 1, - key: "Unterminated regular expression literal." - }, - An_object_member_cannot_be_declared_optional: { - code: 1162, - category: 1, - key: "An object member cannot be declared optional." - }, - yield_expression_must_be_contained_within_a_generator_declaration: { - code: 1163, - category: 1, - key: "'yield' expression must be contained_within a generator declaration." - }, - Computed_property_names_are_not_allowed_in_enums: { - code: 1164, - category: 1, - key: "Computed property names are not allowed in enums." - }, - A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { - code: 1165, - category: 1, - key: "A computed property name in an ambient context must directly refer to a built-in symbol." - }, - A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { - code: 1166, - category: 1, - key: "A computed property name in a class property declaration must directly refer to a built-in symbol." - }, - Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 1167, - category: 1, - key: "Computed property names are only available when targeting ECMAScript 6 and higher." - }, - A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { - code: 1168, - category: 1, - key: "A computed property name in a method overload must directly refer to a built-in symbol." - }, - A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { - code: 1169, - category: 1, - key: "A computed property name in an interface must directly refer to a built-in symbol." - }, - A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { - code: 1170, - category: 1, - key: "A computed property name in a type literal must directly refer to a built-in symbol." - }, - A_comma_expression_is_not_allowed_in_a_computed_property_name: { - code: 1171, - category: 1, - key: "A comma expression is not allowed in a computed property name." - }, - extends_clause_already_seen: { - code: 1172, - category: 1, - key: "'extends' clause already seen." - }, - extends_clause_must_precede_implements_clause: { - code: 1173, - category: 1, - key: "'extends' clause must precede 'implements' clause." - }, - Classes_can_only_extend_a_single_class: { - code: 1174, - category: 1, - key: "Classes can only extend a single class." - }, - implements_clause_already_seen: { - code: 1175, - category: 1, - key: "'implements' clause already seen." - }, - Interface_declaration_cannot_have_implements_clause: { - code: 1176, - category: 1, - key: "Interface declaration cannot have 'implements' clause." - }, - Binary_digit_expected: { - code: 1177, - category: 1, - key: "Binary digit expected." - }, - Octal_digit_expected: { - code: 1178, - category: 1, - key: "Octal digit expected." - }, - Unexpected_token_expected: { - code: 1179, - category: 1, - key: "Unexpected token. '{' expected." - }, - Property_destructuring_pattern_expected: { - code: 1180, - category: 1, - key: "Property destructuring pattern expected." - }, - Array_element_destructuring_pattern_expected: { - code: 1181, - category: 1, - key: "Array element destructuring pattern expected." - }, - A_destructuring_declaration_must_have_an_initializer: { - code: 1182, - category: 1, - key: "A destructuring declaration must have an initializer." - }, - Destructuring_declarations_are_not_allowed_in_ambient_contexts: { - code: 1183, - category: 1, - key: "Destructuring declarations are not allowed in ambient contexts." - }, - An_implementation_cannot_be_declared_in_ambient_contexts: { - code: 1184, - category: 1, - key: "An implementation cannot be declared in ambient contexts." - }, - Modifiers_cannot_appear_here: { - code: 1184, - category: 1, - key: "Modifiers cannot appear here." - }, - Merge_conflict_marker_encountered: { - code: 1185, - category: 1, - key: "Merge conflict marker encountered." - }, - A_rest_element_cannot_have_an_initializer: { - code: 1186, - category: 1, - key: "A rest element cannot have an initializer." - }, - A_parameter_property_may_not_be_a_binding_pattern: { - code: 1187, - category: 1, - key: "A parameter property may not be a binding pattern." - }, - Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { - code: 1188, - category: 1, - key: "Only a single variable declaration is allowed in a 'for...of' statement." - }, - The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { - code: 1189, - category: 1, - key: "The variable declaration of a 'for...in' statement cannot have an initializer." - }, - The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { - code: 1190, - category: 1, - key: "The variable declaration of a 'for...of' statement cannot have an initializer." - }, - An_import_declaration_cannot_have_modifiers: { - code: 1191, - category: 1, - key: "An import declaration cannot have modifiers." - }, - External_module_0_has_no_default_export_or_export_assignment: { - code: 1192, - category: 1, - key: "External module '{0}' has no default export or export assignment." - }, - An_export_declaration_cannot_have_modifiers: { - code: 1193, - category: 1, - key: "An export declaration cannot have modifiers." - }, - Export_declarations_are_not_permitted_in_an_internal_module: { - code: 1194, - category: 1, - key: "Export declarations are not permitted in an internal module." - }, - Catch_clause_variable_name_must_be_an_identifier: { - code: 1195, - category: 1, - key: "Catch clause variable name must be an identifier." - }, - Catch_clause_variable_cannot_have_a_type_annotation: { - code: 1196, - category: 1, - key: "Catch clause variable cannot have a type annotation." - }, - Catch_clause_variable_cannot_have_an_initializer: { - code: 1197, - category: 1, - key: "Catch clause variable cannot have an initializer." - }, - An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { - code: 1198, - category: 1, - key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." - }, - Unterminated_Unicode_escape_sequence: { - code: 1199, - category: 1, - key: "Unterminated Unicode escape sequence." - }, - Duplicate_identifier_0: { - code: 2300, - category: 1, - key: "Duplicate identifier '{0}'." - }, - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { - code: 2301, - category: 1, - key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." - }, - Static_members_cannot_reference_class_type_parameters: { - code: 2302, - category: 1, - key: "Static members cannot reference class type parameters." - }, - Circular_definition_of_import_alias_0: { - code: 2303, - category: 1, - key: "Circular definition of import alias '{0}'." - }, - Cannot_find_name_0: { - code: 2304, - category: 1, - key: "Cannot find name '{0}'." - }, - Module_0_has_no_exported_member_1: { - code: 2305, - category: 1, - key: "Module '{0}' has no exported member '{1}'." - }, - File_0_is_not_an_external_module: { - code: 2306, - category: 1, - key: "File '{0}' is not an external module." - }, - Cannot_find_external_module_0: { - code: 2307, - category: 1, - key: "Cannot find external module '{0}'." - }, - A_module_cannot_have_more_than_one_export_assignment: { - code: 2308, - category: 1, - key: "A module cannot have more than one export assignment." - }, - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { - code: 2309, - category: 1, - key: "An export assignment cannot be used in a module with other exported elements." - }, - Type_0_recursively_references_itself_as_a_base_type: { - code: 2310, - category: 1, - key: "Type '{0}' recursively references itself as a base type." - }, - A_class_may_only_extend_another_class: { - code: 2311, - category: 1, - key: "A class may only extend another class." - }, - An_interface_may_only_extend_a_class_or_another_interface: { - code: 2312, - category: 1, - key: "An interface may only extend a class or another interface." - }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { - code: 2313, - category: 1, - key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." - }, - Generic_type_0_requires_1_type_argument_s: { - code: 2314, - category: 1, - key: "Generic type '{0}' requires {1} type argument(s)." - }, - Type_0_is_not_generic: { - code: 2315, - category: 1, - key: "Type '{0}' is not generic." - }, - Global_type_0_must_be_a_class_or_interface_type: { - code: 2316, - category: 1, - key: "Global type '{0}' must be a class or interface type." - }, - Global_type_0_must_have_1_type_parameter_s: { - code: 2317, - category: 1, - key: "Global type '{0}' must have {1} type parameter(s)." - }, - Cannot_find_global_type_0: { - code: 2318, - category: 1, - key: "Cannot find global type '{0}'." - }, - Named_property_0_of_types_1_and_2_are_not_identical: { - code: 2319, - category: 1, - key: "Named property '{0}' of types '{1}' and '{2}' are not identical." - }, - Interface_0_cannot_simultaneously_extend_types_1_and_2: { - code: 2320, - category: 1, - key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." - }, - Excessive_stack_depth_comparing_types_0_and_1: { - code: 2321, - category: 1, - key: "Excessive stack depth comparing types '{0}' and '{1}'." - }, - Type_0_is_not_assignable_to_type_1: { - code: 2322, - category: 1, - key: "Type '{0}' is not assignable to type '{1}'." - }, - Property_0_is_missing_in_type_1: { - code: 2324, - category: 1, - key: "Property '{0}' is missing in type '{1}'." - }, - Property_0_is_private_in_type_1_but_not_in_type_2: { - code: 2325, - category: 1, - key: "Property '{0}' is private in type '{1}' but not in type '{2}'." - }, - Types_of_property_0_are_incompatible: { - code: 2326, - category: 1, - key: "Types of property '{0}' are incompatible." - }, - Property_0_is_optional_in_type_1_but_required_in_type_2: { - code: 2327, - category: 1, - key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." - }, - Types_of_parameters_0_and_1_are_incompatible: { - code: 2328, - category: 1, - key: "Types of parameters '{0}' and '{1}' are incompatible." - }, - Index_signature_is_missing_in_type_0: { - code: 2329, - category: 1, - key: "Index signature is missing in type '{0}'." - }, - Index_signatures_are_incompatible: { - code: 2330, - category: 1, - key: "Index signatures are incompatible." - }, - this_cannot_be_referenced_in_a_module_body: { - code: 2331, - category: 1, - key: "'this' cannot be referenced in a module body." - }, - this_cannot_be_referenced_in_current_location: { - code: 2332, - category: 1, - key: "'this' cannot be referenced in current location." - }, - this_cannot_be_referenced_in_constructor_arguments: { - code: 2333, - category: 1, - key: "'this' cannot be referenced in constructor arguments." - }, - this_cannot_be_referenced_in_a_static_property_initializer: { - code: 2334, - category: 1, - key: "'this' cannot be referenced in a static property initializer." - }, - super_can_only_be_referenced_in_a_derived_class: { - code: 2335, - category: 1, - key: "'super' can only be referenced in a derived class." - }, - super_cannot_be_referenced_in_constructor_arguments: { - code: 2336, - category: 1, - key: "'super' cannot be referenced in constructor arguments." - }, - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { - code: 2337, - category: 1, - key: "Super calls are not permitted outside constructors or in nested functions inside constructors" - }, - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { - code: 2338, - category: 1, - key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" - }, - Property_0_does_not_exist_on_type_1: { - code: 2339, - category: 1, - key: "Property '{0}' does not exist on type '{1}'." - }, - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { - code: 2340, - category: 1, - key: "Only public and protected methods of the base class are accessible via the 'super' keyword" - }, - Property_0_is_private_and_only_accessible_within_class_1: { - code: 2341, - category: 1, - key: "Property '{0}' is private and only accessible within class '{1}'." - }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { - code: 2342, - category: 1, - key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." - }, - Type_0_does_not_satisfy_the_constraint_1: { - code: 2344, - category: 1, - key: "Type '{0}' does not satisfy the constraint '{1}'." - }, - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { - code: 2345, - category: 1, - key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." - }, - Supplied_parameters_do_not_match_any_signature_of_call_target: { - code: 2346, - category: 1, - key: "Supplied parameters do not match any signature of call target." - }, - Untyped_function_calls_may_not_accept_type_arguments: { - code: 2347, - category: 1, - key: "Untyped function calls may not accept type arguments." - }, - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { - code: 2348, - category: 1, - key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" - }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { - code: 2349, - category: 1, - key: "Cannot invoke an expression whose type lacks a call signature." - }, - Only_a_void_function_can_be_called_with_the_new_keyword: { - code: 2350, - category: 1, - key: "Only a void function can be called with the 'new' keyword." - }, - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { - code: 2351, - category: 1, - key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." - }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { - code: 2352, - category: 1, - key: "Neither type '{0}' nor type '{1}' is assignable to the other." - }, - No_best_common_type_exists_among_return_expressions: { - code: 2354, - category: 1, - key: "No best common type exists among return expressions." - }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { - code: 2355, - category: 1, - key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." - }, - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { - code: 2356, - category: 1, - key: "An arithmetic operand must be of type 'any', 'number' or an enum type." - }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { - code: 2357, - category: 1, - key: "The operand of an increment or decrement operator must be a variable, property or indexer." - }, - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: 2358, - category: 1, - key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." - }, - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { - code: 2359, - category: 1, - key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." - }, - The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { - code: 2360, - category: 1, - key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." - }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: 2361, - category: 1, - key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" - }, - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { - code: 2362, - category: 1, - key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." - }, - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { - code: 2363, - category: 1, - key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." - }, - Invalid_left_hand_side_of_assignment_expression: { - code: 2364, - category: 1, - key: "Invalid left-hand side of assignment expression." - }, - Operator_0_cannot_be_applied_to_types_1_and_2: { - code: 2365, - category: 1, - key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." - }, - Type_parameter_name_cannot_be_0: { - code: 2368, - category: 1, - key: "Type parameter name cannot be '{0}'" - }, - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { - code: 2369, - category: 1, - key: "A parameter property is only allowed in a constructor implementation." - }, - A_rest_parameter_must_be_of_an_array_type: { - code: 2370, - category: 1, - key: "A rest parameter must be of an array type." - }, - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { - code: 2371, - category: 1, - key: "A parameter initializer is only allowed in a function or constructor implementation." - }, - Parameter_0_cannot_be_referenced_in_its_initializer: { - code: 2372, - category: 1, - key: "Parameter '{0}' cannot be referenced in its initializer." - }, - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { - code: 2373, - category: 1, - key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." - }, - Duplicate_string_index_signature: { - code: 2374, - category: 1, - key: "Duplicate string index signature." - }, - Duplicate_number_index_signature: { - code: 2375, - category: 1, - key: "Duplicate number index signature." - }, - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { - code: 2376, - category: 1, - key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." - }, - Constructors_for_derived_classes_must_contain_a_super_call: { - code: 2377, - category: 1, - key: "Constructors for derived classes must contain a 'super' call." - }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { - code: 2378, - category: 1, - key: "A 'get' accessor must return a value or consist of a single 'throw' statement." - }, - Getter_and_setter_accessors_do_not_agree_in_visibility: { - code: 2379, - category: 1, - key: "Getter and setter accessors do not agree in visibility." - }, - get_and_set_accessor_must_have_the_same_type: { - code: 2380, - category: 1, - key: "'get' and 'set' accessor must have the same type." - }, - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { - code: 2381, - category: 1, - key: "A signature with an implementation cannot use a string literal type." - }, - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { - code: 2382, - category: 1, - key: "Specialized overload signature is not assignable to any non-specialized signature." - }, - Overload_signatures_must_all_be_exported_or_not_exported: { - code: 2383, - category: 1, - key: "Overload signatures must all be exported or not exported." - }, - Overload_signatures_must_all_be_ambient_or_non_ambient: { - code: 2384, - category: 1, - key: "Overload signatures must all be ambient or non-ambient." - }, - Overload_signatures_must_all_be_public_private_or_protected: { - code: 2385, - category: 1, - key: "Overload signatures must all be public, private or protected." - }, - Overload_signatures_must_all_be_optional_or_required: { - code: 2386, - category: 1, - key: "Overload signatures must all be optional or required." - }, - Function_overload_must_be_static: { - code: 2387, - category: 1, - key: "Function overload must be static." - }, - Function_overload_must_not_be_static: { - code: 2388, - category: 1, - key: "Function overload must not be static." - }, - Function_implementation_name_must_be_0: { - code: 2389, - category: 1, - key: "Function implementation name must be '{0}'." - }, - Constructor_implementation_is_missing: { - code: 2390, - category: 1, - key: "Constructor implementation is missing." - }, - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { - code: 2391, - category: 1, - key: "Function implementation is missing or not immediately following the declaration." - }, - Multiple_constructor_implementations_are_not_allowed: { - code: 2392, - category: 1, - key: "Multiple constructor implementations are not allowed." - }, - Duplicate_function_implementation: { - code: 2393, - category: 1, - key: "Duplicate function implementation." - }, - Overload_signature_is_not_compatible_with_function_implementation: { - code: 2394, - category: 1, - key: "Overload signature is not compatible with function implementation." - }, - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { - code: 2395, - category: 1, - key: "Individual declarations in merged declaration {0} must be all exported or all local." - }, - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { - code: 2396, - category: 1, - key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." - }, - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { - code: 2399, - category: 1, - key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." - }, - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { - code: 2400, - category: 1, - key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." - }, - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { - code: 2401, - category: 1, - key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." - }, - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { - code: 2402, - category: 1, - key: "Expression resolves to '_super' that compiler uses to capture base class reference." - }, - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { - code: 2403, - category: 1, - key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." - }, - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { - code: 2404, - category: 1, - key: "The left-hand side of a 'for...in' statement cannot use a type annotation." - }, - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { - code: 2405, - category: 1, - key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." - }, - Invalid_left_hand_side_in_for_in_statement: { - code: 2406, - category: 1, - key: "Invalid left-hand side in 'for...in' statement." - }, - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: 2407, - category: 1, - key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." - }, - Setters_cannot_return_a_value: { - code: 2408, - category: 1, - key: "Setters cannot return a value." - }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { - code: 2409, - category: 1, - key: "Return type of constructor signature must be assignable to the instance type of the class" - }, - All_symbols_within_a_with_block_will_be_resolved_to_any: { - code: 2410, - category: 1, - key: "All symbols within a 'with' block will be resolved to 'any'." - }, - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { - code: 2411, - category: 1, - key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." - }, - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { - code: 2412, - category: 1, - key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." - }, - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { - code: 2413, - category: 1, - key: "Numeric index type '{0}' is not assignable to string index type '{1}'." - }, - Class_name_cannot_be_0: { - code: 2414, - category: 1, - key: "Class name cannot be '{0}'" - }, - Class_0_incorrectly_extends_base_class_1: { - code: 2415, - category: 1, - key: "Class '{0}' incorrectly extends base class '{1}'." - }, - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { - code: 2417, - category: 1, - key: "Class static side '{0}' incorrectly extends base class static side '{1}'." - }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { - code: 2419, - category: 1, - key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." - }, - Class_0_incorrectly_implements_interface_1: { - code: 2420, - category: 1, - key: "Class '{0}' incorrectly implements interface '{1}'." - }, - A_class_may_only_implement_another_class_or_interface: { - code: 2422, - category: 1, - key: "A class may only implement another class or interface." - }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { - code: 2423, - category: 1, - key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." - }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { - code: 2424, - category: 1, - key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." - }, - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { - code: 2425, - category: 1, - key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." - }, - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { - code: 2426, - category: 1, - key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." - }, - Interface_name_cannot_be_0: { - code: 2427, - category: 1, - key: "Interface name cannot be '{0}'" - }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { - code: 2428, - category: 1, - key: "All declarations of an interface must have identical type parameters." - }, - Interface_0_incorrectly_extends_interface_1: { - code: 2430, - category: 1, - key: "Interface '{0}' incorrectly extends interface '{1}'." - }, - Enum_name_cannot_be_0: { - code: 2431, - category: 1, - key: "Enum name cannot be '{0}'" - }, - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { - code: 2432, - category: 1, - key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." - }, - A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { - code: 2433, - category: 1, - key: "A module declaration cannot be in a different file from a class or function with which it is merged" - }, - A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { - code: 2434, - category: 1, - key: "A module declaration cannot be located prior to a class or function with which it is merged" - }, - Ambient_external_modules_cannot_be_nested_in_other_modules: { - code: 2435, - category: 1, - key: "Ambient external modules cannot be nested in other modules." - }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { - code: 2436, - category: 1, - key: "Ambient external module declaration cannot specify relative module name." - }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { - code: 2437, - category: 1, - key: "Module '{0}' is hidden by a local declaration with the same name" - }, - Import_name_cannot_be_0: { - code: 2438, - category: 1, - key: "Import name cannot be '{0}'" - }, - Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { - code: 2439, - category: 1, - key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." - }, - Import_declaration_conflicts_with_local_declaration_of_0: { - code: 2440, - category: 1, - key: "Import declaration conflicts with local declaration of '{0}'" - }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { - code: 2441, - category: 1, - key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." - }, - Types_have_separate_declarations_of_a_private_property_0: { - code: 2442, - category: 1, - key: "Types have separate declarations of a private property '{0}'." - }, - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { - code: 2443, - category: 1, - key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." - }, - Property_0_is_protected_in_type_1_but_public_in_type_2: { - code: 2444, - category: 1, - key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." - }, - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { - code: 2445, - category: 1, - key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." - }, - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { - code: 2446, - category: 1, - key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." - }, - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { - code: 2447, - category: 1, - key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." - }, - Block_scoped_variable_0_used_before_its_declaration: { - code: 2448, - category: 1, - key: "Block-scoped variable '{0}' used before its declaration." - }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { - code: 2449, - category: 1, - key: "The operand of an increment or decrement operator cannot be a constant." - }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { - code: 2450, - category: 1, - key: "Left-hand side of assignment expression cannot be a constant." - }, - Cannot_redeclare_block_scoped_variable_0: { - code: 2451, - category: 1, - key: "Cannot redeclare block-scoped variable '{0}'." - }, - An_enum_member_cannot_have_a_numeric_name: { - code: 2452, - category: 1, - key: "An enum member cannot have a numeric name." - }, - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { - code: 2453, - category: 1, - key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." - }, - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { - code: 2455, - category: 1, - key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." - }, - Type_alias_0_circularly_references_itself: { - code: 2456, - category: 1, - key: "Type alias '{0}' circularly references itself." - }, - Type_alias_name_cannot_be_0: { - code: 2457, - category: 1, - key: "Type alias name cannot be '{0}'" - }, - An_AMD_module_cannot_have_multiple_name_assignments: { - code: 2458, - category: 1, - key: "An AMD module cannot have multiple name assignments." - }, - Type_0_has_no_property_1_and_no_string_index_signature: { - code: 2459, - category: 1, - key: "Type '{0}' has no property '{1}' and no string index signature." - }, - Type_0_has_no_property_1: { - code: 2460, - category: 1, - key: "Type '{0}' has no property '{1}'." - }, - Type_0_is_not_an_array_type: { - code: 2461, - category: 1, - key: "Type '{0}' is not an array type." - }, - A_rest_element_must_be_last_in_an_array_destructuring_pattern: { - code: 2462, - category: 1, - key: "A rest element must be last in an array destructuring pattern" - }, - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { - code: 2463, - category: 1, - key: "A binding pattern parameter cannot be optional in an implementation signature." - }, - A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { - code: 2464, - category: 1, - key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." - }, - this_cannot_be_referenced_in_a_computed_property_name: { - code: 2465, - category: 1, - key: "'this' cannot be referenced in a computed property name." - }, - super_cannot_be_referenced_in_a_computed_property_name: { - code: 2466, - category: 1, - key: "'super' cannot be referenced in a computed property name." - }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { - code: 2467, - category: 1, - key: "A computed property name cannot reference a type parameter from its containing type." - }, - Cannot_find_global_value_0: { - code: 2468, - category: 1, - key: "Cannot find global value '{0}'." - }, - The_0_operator_cannot_be_applied_to_type_symbol: { - code: 2469, - category: 1, - key: "The '{0}' operator cannot be applied to type 'symbol'." - }, - Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { - code: 2470, - category: 1, - key: "'Symbol' reference does not refer to the global Symbol constructor object." - }, - A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { - code: 2471, - category: 1, - key: "A computed property name of the form '{0}' must be of type 'symbol'." - }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 2472, - category: 1, - key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." - }, - Enum_declarations_must_all_be_const_or_non_const: { - code: 2473, - category: 1, - key: "Enum declarations must all be const or non-const." - }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { - code: 2474, - category: 1, - key: "In 'const' enum declarations member initializer must be constant expression." - }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { - code: 2475, - category: 1, - key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." - }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { - code: 2476, - category: 1, - key: "A const enum member can only be accessed using a string literal." - }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { - code: 2477, - category: 1, - key: "'const' enum member initializer was evaluated to a non-finite value." - }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { - code: 2478, - category: 1, - key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." - }, - Property_0_does_not_exist_on_const_enum_1: { - code: 2479, - category: 1, - key: "Property '{0}' does not exist on 'const' enum '{1}'." - }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { - code: 2480, - category: 1, - key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." - }, - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { - code: 2481, - category: 1, - key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." - }, - The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { - code: 2483, - category: 1, - key: "The left-hand side of a 'for...of' statement cannot use a type annotation." - }, - Export_declaration_conflicts_with_exported_declaration_of_0: { - code: 2484, - category: 1, - key: "Export declaration conflicts with exported declaration of '{0}'" - }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { - code: 2485, - category: 1, - key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." - }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { - code: 2486, - category: 1, - key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." - }, - Invalid_left_hand_side_in_for_of_statement: { - code: 2487, - category: 1, - key: "Invalid left-hand side in 'for...of' statement." - }, - The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { - code: 2488, - category: 1, - key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." - }, - The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { - code: 2489, - category: 1, - key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." - }, - The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { - code: 2490, - category: 1, - key: "The type returned by the 'next()' method of an iterator must have a 'value' property." - }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { - code: 2491, - category: 1, - key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." - }, - Cannot_redeclare_identifier_0_in_catch_clause: { - code: 2492, - category: 1, - key: "Cannot redeclare identifier '{0}' in catch clause" - }, - Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { - code: 2493, - category: 1, - key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." - }, - Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { - code: 2494, - category: 1, - key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." - }, - Type_0_is_not_an_array_type_or_a_string_type: { - code: 2461, - category: 1, - key: "Type '{0}' is not an array type or a string type." - }, - Import_declaration_0_is_using_private_name_1: { - code: 4000, - category: 1, - key: "Import declaration '{0}' is using private name '{1}'." - }, - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { - code: 4002, - category: 1, - key: "Type parameter '{0}' of exported class has or is using private name '{1}'." - }, - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { - code: 4004, - category: 1, - key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4006, - category: 1, - key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4008, - category: 1, - key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4010, - category: 1, - key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." - }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4012, - category: 1, - key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." - }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { - code: 4014, - category: 1, - key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { - code: 4016, - category: 1, - key: "Type parameter '{0}' of exported function has or is using private name '{1}'." - }, - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { - code: 4019, - category: 1, - key: "Implements clause of exported class '{0}' has or is using private name '{1}'." - }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { - code: 4020, - category: 1, - key: "Extends clause of exported class '{0}' has or is using private name '{1}'." - }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { - code: 4022, - category: 1, - key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." - }, - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4023, - category: 1, - key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." - }, - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { - code: 4024, - category: 1, - key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." - }, - Exported_variable_0_has_or_is_using_private_name_1: { - code: 4025, - category: 1, - key: "Exported variable '{0}' has or is using private name '{1}'." - }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4026, - category: 1, - key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4027, - category: 1, - key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." - }, - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { - code: 4028, - category: 1, - key: "Public static property '{0}' of exported class has or is using private name '{1}'." - }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4029, - category: 1, - key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4030, - category: 1, - key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." - }, - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { - code: 4031, - category: 1, - key: "Public property '{0}' of exported class has or is using private name '{1}'." - }, - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4032, - category: 1, - key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." - }, - Property_0_of_exported_interface_has_or_is_using_private_name_1: { - code: 4033, - category: 1, - key: "Property '{0}' of exported interface has or is using private name '{1}'." - }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4034, - category: 1, - key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { - code: 4035, - category: 1, - key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." - }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4036, - category: 1, - key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { - code: 4037, - category: 1, - key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." - }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4038, - category: 1, - key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4039, - category: 1, - key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { - code: 4040, - category: 1, - key: "Return type of public static property getter from exported class has or is using private name '{0}'." - }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4041, - category: 1, - key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4042, - category: 1, - key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { - code: 4043, - category: 1, - key: "Return type of public property getter from exported class has or is using private name '{0}'." - }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4044, - category: 1, - key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: 4045, - category: 1, - key: "Return type of constructor signature from exported interface has or is using private name '{0}'." - }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4046, - category: 1, - key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: 4047, - category: 1, - key: "Return type of call signature from exported interface has or is using private name '{0}'." - }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4048, - category: 1, - key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: 4049, - category: 1, - key: "Return type of index signature from exported interface has or is using private name '{0}'." - }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4050, - category: 1, - key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4051, - category: 1, - key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { - code: 4052, - category: 1, - key: "Return type of public static method from exported class has or is using private name '{0}'." - }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4053, - category: 1, - key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4054, - category: 1, - key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { - code: 4055, - category: 1, - key: "Return type of public method from exported class has or is using private name '{0}'." - }, - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4056, - category: 1, - key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { - code: 4057, - category: 1, - key: "Return type of method from exported interface has or is using private name '{0}'." - }, - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4058, - category: 1, - key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { - code: 4059, - category: 1, - key: "Return type of exported function has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_exported_function_has_or_is_using_private_name_0: { - code: 4060, - category: 1, - key: "Return type of exported function has or is using private name '{0}'." - }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4061, - category: 1, - key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4062, - category: 1, - key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { - code: 4063, - category: 1, - key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." - }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4064, - category: 1, - key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4065, - category: 1, - key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." - }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4066, - category: 1, - key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4067, - category: 1, - key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." - }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4068, - category: 1, - key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4069, - category: 1, - key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4070, - category: 1, - key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." - }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4071, - category: 1, - key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4072, - category: 1, - key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4073, - category: 1, - key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." - }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4074, - category: 1, - key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { - code: 4075, - category: 1, - key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." - }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4076, - category: 1, - key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { - code: 4077, - category: 1, - key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { - code: 4078, - category: 1, - key: "Parameter '{0}' of exported function has or is using private name '{1}'." - }, - Exported_type_alias_0_has_or_is_using_private_name_1: { - code: 4081, - category: 1, - key: "Exported type alias '{0}' has or is using private name '{1}'." - }, - Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { - code: 4091, - category: 1, - key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." - }, - The_current_host_does_not_support_the_0_option: { - code: 5001, - category: 1, - key: "The current host does not support the '{0}' option." - }, - Cannot_find_the_common_subdirectory_path_for_the_input_files: { - code: 5009, - category: 1, - key: "Cannot find the common subdirectory path for the input files." - }, - Cannot_read_file_0_Colon_1: { - code: 5012, - category: 1, - key: "Cannot read file '{0}': {1}" - }, - Unsupported_file_encoding: { - code: 5013, - category: 1, - key: "Unsupported file encoding." - }, - Unknown_compiler_option_0: { - code: 5023, - category: 1, - key: "Unknown compiler option '{0}'." - }, - Compiler_option_0_requires_a_value_of_type_1: { - code: 5024, - category: 1, - key: "Compiler option '{0}' requires a value of type {1}." - }, - Could_not_write_file_0_Colon_1: { - code: 5033, - category: 1, - key: "Could not write file '{0}': {1}" - }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { - code: 5038, - category: 1, - key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." - }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { - code: 5039, - category: 1, - key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." - }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { - code: 5040, - category: 1, - key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." - }, - Option_noEmit_cannot_be_specified_with_option_declaration: { - code: 5041, - category: 1, - key: "Option 'noEmit' cannot be specified with option 'declaration'." - }, - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { - code: 5042, - category: 1, - key: "Option 'project' cannot be mixed with source files on a command line." - }, - Concatenate_and_emit_output_to_single_file: { - code: 6001, - category: 2, - key: "Concatenate and emit output to single file." - }, - Generates_corresponding_d_ts_file: { - code: 6002, - category: 2, - key: "Generates corresponding '.d.ts' file." - }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { - code: 6003, - category: 2, - key: "Specifies the location where debugger should locate map files instead of generated locations." - }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { - code: 6004, - category: 2, - key: "Specifies the location where debugger should locate TypeScript files instead of source locations." - }, - Watch_input_files: { - code: 6005, - category: 2, - key: "Watch input files." - }, - Redirect_output_structure_to_the_directory: { - code: 6006, - category: 2, - key: "Redirect output structure to the directory." - }, - Do_not_erase_const_enum_declarations_in_generated_code: { - code: 6007, - category: 2, - key: "Do not erase const enum declarations in generated code." - }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { - code: 6008, - category: 2, - key: "Do not emit outputs if any type checking errors were reported." - }, - Do_not_emit_comments_to_output: { - code: 6009, - category: 2, - key: "Do not emit comments to output." - }, - Do_not_emit_outputs: { - code: 6010, - category: 2, - key: "Do not emit outputs." - }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { - code: 6015, - category: 2, - key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" - }, - Specify_module_code_generation_Colon_commonjs_or_amd: { - code: 6016, - category: 2, - key: "Specify module code generation: 'commonjs' or 'amd'" - }, - Print_this_message: { - code: 6017, - category: 2, - key: "Print this message." - }, - Print_the_compiler_s_version: { - code: 6019, - category: 2, - key: "Print the compiler's version." - }, - Compile_the_project_in_the_given_directory: { - code: 6020, - category: 2, - key: "Compile the project in the given directory." - }, - Syntax_Colon_0: { - code: 6023, - category: 2, - key: "Syntax: {0}" - }, - options: { - code: 6024, - category: 2, - key: "options" - }, - file: { - code: 6025, - category: 2, - key: "file" - }, - Examples_Colon_0: { - code: 6026, - category: 2, - key: "Examples: {0}" - }, - Options_Colon: { - code: 6027, - category: 2, - key: "Options:" - }, - Version_0: { - code: 6029, - category: 2, - key: "Version {0}" - }, - Insert_command_line_options_and_files_from_a_file: { - code: 6030, - category: 2, - key: "Insert command line options and files from a file." - }, - File_change_detected_Starting_incremental_compilation: { - code: 6032, - category: 2, - key: "File change detected. Starting incremental compilation..." - }, - KIND: { - code: 6034, - category: 2, - key: "KIND" - }, - FILE: { - code: 6035, - category: 2, - key: "FILE" - }, - VERSION: { - code: 6036, - category: 2, - key: "VERSION" - }, - LOCATION: { - code: 6037, - category: 2, - key: "LOCATION" - }, - DIRECTORY: { - code: 6038, - category: 2, - key: "DIRECTORY" - }, - Compilation_complete_Watching_for_file_changes: { - code: 6042, - category: 2, - key: "Compilation complete. Watching for file changes." - }, - Generates_corresponding_map_file: { - code: 6043, - category: 2, - key: "Generates corresponding '.map' file." - }, - Compiler_option_0_expects_an_argument: { - code: 6044, - category: 1, - key: "Compiler option '{0}' expects an argument." - }, - Unterminated_quoted_string_in_response_file_0: { - code: 6045, - category: 1, - key: "Unterminated quoted string in response file '{0}'." - }, - Argument_for_module_option_must_be_commonjs_or_amd: { - code: 6046, - category: 1, - key: "Argument for '--module' option must be 'commonjs' or 'amd'." - }, - Argument_for_target_option_must_be_es3_es5_or_es6: { - code: 6047, - category: 1, - key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." - }, - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { - code: 6048, - category: 1, - key: "Locale must be of the form or -. For example '{0}' or '{1}'." - }, - Unsupported_locale_0: { - code: 6049, - category: 1, - key: "Unsupported locale '{0}'." - }, - Unable_to_open_file_0: { - code: 6050, - category: 1, - key: "Unable to open file '{0}'." - }, - Corrupted_locale_file_0: { - code: 6051, - category: 1, - key: "Corrupted locale file {0}." - }, - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { - code: 6052, - category: 2, - key: "Raise error on expressions and declarations with an implied 'any' type." - }, - File_0_not_found: { - code: 6053, - category: 1, - key: "File '{0}' not found." - }, - File_0_must_have_extension_ts_or_d_ts: { - code: 6054, - category: 1, - key: "File '{0}' must have extension '.ts' or '.d.ts'." - }, - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { - code: 6055, - category: 2, - key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." - }, - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { - code: 6056, - category: 2, - key: "Do not emit declarations for code that has an '@internal' annotation." - }, - Preserve_new_lines_when_emitting_code: { - code: 6057, - category: 2, - key: "Preserve new-lines when emitting code." - }, - Variable_0_implicitly_has_an_1_type: { - code: 7005, - category: 1, - key: "Variable '{0}' implicitly has an '{1}' type." - }, - Parameter_0_implicitly_has_an_1_type: { - code: 7006, - category: 1, - key: "Parameter '{0}' implicitly has an '{1}' type." - }, - Member_0_implicitly_has_an_1_type: { - code: 7008, - category: 1, - key: "Member '{0}' implicitly has an '{1}' type." - }, - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { - code: 7009, - category: 1, - key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." - }, - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { - code: 7010, - category: 1, - key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." - }, - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { - code: 7011, - category: 1, - key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." - }, - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { - code: 7013, - category: 1, - key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." - }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { - code: 7016, - category: 1, - key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." - }, - Index_signature_of_object_type_implicitly_has_an_any_type: { - code: 7017, - category: 1, - key: "Index signature of object type implicitly has an 'any' type." - }, - Object_literal_s_property_0_implicitly_has_an_1_type: { - code: 7018, - category: 1, - key: "Object literal's property '{0}' implicitly has an '{1}' type." - }, - Rest_parameter_0_implicitly_has_an_any_type: { - code: 7019, - category: 1, - key: "Rest parameter '{0}' implicitly has an 'any[]' type." - }, - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { - code: 7020, - category: 1, - key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." - }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { - code: 7021, - category: 1, - key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." - }, - _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { - code: 7022, - category: 1, - key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." - }, - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { - code: 7023, - category: 1, - key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." - }, - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { - code: 7024, - category: 1, - key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." - }, - You_cannot_rename_this_element: { - code: 8000, - category: 1, - key: "You cannot rename this element." - }, - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { - code: 8001, - category: 1, - key: "You cannot rename elements that are defined in the standard TypeScript library." - }, - yield_expressions_are_not_currently_supported: { - code: 9000, - category: 1, - key: "'yield' expressions are not currently supported." - }, - Generators_are_not_currently_supported: { - code: 9001, - category: 1, - key: "Generators are not currently supported." - }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { - code: 9002, - category: 1, - key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." - } + Unterminated_string_literal: { code: 1002, category: 1, key: "Unterminated string literal." }, + Identifier_expected: { code: 1003, category: 1, key: "Identifier expected." }, + _0_expected: { code: 1005, category: 1, key: "'{0}' expected." }, + A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1, key: "A file cannot have a reference to itself." }, + Trailing_comma_not_allowed: { code: 1009, category: 1, key: "Trailing comma not allowed." }, + Asterisk_Slash_expected: { code: 1010, category: 1, key: "'*/' expected." }, + Unexpected_token: { code: 1012, category: 1, key: "Unexpected token." }, + A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1, key: "A rest parameter must be last in a parameter list." }, + Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1, key: "Parameter cannot have question mark and initializer." }, + A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1, key: "A required parameter cannot follow an optional parameter." }, + An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1, key: "An index signature cannot have a rest parameter." }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1, key: "An index signature parameter cannot have an accessibility modifier." }, + An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1, key: "An index signature parameter cannot have a question mark." }, + An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1, key: "An index signature parameter cannot have an initializer." }, + An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1, key: "An index signature must have a type annotation." }, + An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1, key: "An index signature parameter must have a type annotation." }, + An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1, key: "An index signature parameter type must be 'string' or 'number'." }, + A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1, key: "A class or interface declaration can only have one 'extends' clause." }, + An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1, key: "An 'extends' clause must precede an 'implements' clause." }, + A_class_can_only_extend_a_single_class: { code: 1026, category: 1, key: "A class can only extend a single class." }, + A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1, key: "A class declaration can only have one 'implements' clause." }, + Accessibility_modifier_already_seen: { code: 1028, category: 1, key: "Accessibility modifier already seen." }, + _0_modifier_must_precede_1_modifier: { code: 1029, category: 1, key: "'{0}' modifier must precede '{1}' modifier." }, + _0_modifier_already_seen: { code: 1030, category: 1, key: "'{0}' modifier already seen." }, + _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1, key: "'{0}' modifier cannot appear on a class element." }, + An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1, key: "An interface declaration cannot have an 'implements' clause." }, + super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1, key: "'super' must be followed by an argument list or member access." }, + Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1, key: "Only ambient modules can use quoted names." }, + Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1, key: "Statements are not allowed in ambient contexts." }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1, key: "A 'declare' modifier cannot be used in an already ambient context." }, + Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1, key: "Initializers are not allowed in ambient contexts." }, + _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1, key: "'{0}' modifier cannot appear on a module element." }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1, key: "A 'declare' modifier cannot be used with an interface declaration." }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, + A_rest_parameter_cannot_be_optional: { code: 1047, category: 1, key: "A rest parameter cannot be optional." }, + A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1, key: "A rest parameter cannot have an initializer." }, + A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1, key: "A 'set' accessor must have exactly one parameter." }, + A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1, key: "A 'set' accessor cannot have an optional parameter." }, + A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1, key: "A 'set' accessor parameter cannot have an initializer." }, + A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1, key: "A 'set' accessor cannot have rest parameter." }, + A_get_accessor_cannot_have_parameters: { code: 1054, category: 1, key: "A 'get' accessor cannot have parameters." }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, + Enum_member_must_have_initializer: { code: 1061, category: 1, key: "Enum member must have initializer." }, + An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1, key: "An export assignment cannot be used in an internal module." }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1, key: "Ambient enum elements can only have integer literal initializers." }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1, key: "A 'declare' modifier cannot be used with an import declaration." }, + Invalid_reference_directive_syntax: { code: 1084, category: 1, key: "Invalid 'reference' directive syntax." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1, key: "An accessor cannot be declared in an ambient context." }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1, key: "'{0}' modifier cannot appear on a constructor declaration." }, + _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1, key: "'{0}' modifier cannot appear on a parameter." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1, key: "Type parameters cannot appear on a constructor declaration." }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1, key: "Type annotation cannot appear on a constructor declaration." }, + An_accessor_cannot_have_type_parameters: { code: 1094, category: 1, key: "An accessor cannot have type parameters." }, + A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1, key: "A 'set' accessor cannot have a return type annotation." }, + An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1, key: "An index signature must have exactly one parameter." }, + _0_list_cannot_be_empty: { code: 1097, category: 1, key: "'{0}' list cannot be empty." }, + Type_parameter_list_cannot_be_empty: { code: 1098, category: 1, key: "Type parameter list cannot be empty." }, + Type_argument_list_cannot_be_empty: { code: 1099, category: 1, key: "Type argument list cannot be empty." }, + Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1, key: "Invalid use of '{0}' in strict mode." }, + with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1, key: "'with' statements are not allowed in strict mode." }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1, key: "'delete' cannot be called on an identifier in strict mode." }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, + Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1, key: "Jump target cannot cross function boundary." }, + A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1, key: "A 'return' statement can only be used within a function body." }, + Expression_expected: { code: 1109, category: 1, key: "Expression expected." }, + Type_expected: { code: 1110, category: 1, key: "Type expected." }, + A_class_member_cannot_be_declared_optional: { code: 1112, category: 1, key: "A class member cannot be declared optional." }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, + Duplicate_label_0: { code: 1114, category: 1, key: "Duplicate label '{0}'" }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1, key: "A 'break' statement can only jump to a label of an enclosing statement." }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1, key: "An object literal cannot have multiple properties with the same name in strict mode." }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1, key: "An object literal cannot have multiple get/set accessors with the same name." }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1, key: "An object literal cannot have property and accessor with the same name." }, + An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1, key: "An export assignment cannot have modifiers." }, + Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1, key: "A tuple type element list cannot be empty." }, + Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1, key: "Variable declaration list cannot be empty." }, + Digit_expected: { code: 1124, category: 1, key: "Digit expected." }, + Hexadecimal_digit_expected: { code: 1125, category: 1, key: "Hexadecimal digit expected." }, + Unexpected_end_of_text: { code: 1126, category: 1, key: "Unexpected end of text." }, + Invalid_character: { code: 1127, category: 1, key: "Invalid character." }, + Declaration_or_statement_expected: { code: 1128, category: 1, key: "Declaration or statement expected." }, + Statement_expected: { code: 1129, category: 1, key: "Statement expected." }, + case_or_default_expected: { code: 1130, category: 1, key: "'case' or 'default' expected." }, + Property_or_signature_expected: { code: 1131, category: 1, key: "Property or signature expected." }, + Enum_member_expected: { code: 1132, category: 1, key: "Enum member expected." }, + Type_reference_expected: { code: 1133, category: 1, key: "Type reference expected." }, + Variable_declaration_expected: { code: 1134, category: 1, key: "Variable declaration expected." }, + Argument_expression_expected: { code: 1135, category: 1, key: "Argument expression expected." }, + Property_assignment_expected: { code: 1136, category: 1, key: "Property assignment expected." }, + Expression_or_comma_expected: { code: 1137, category: 1, key: "Expression or comma expected." }, + Parameter_declaration_expected: { code: 1138, category: 1, key: "Parameter declaration expected." }, + Type_parameter_declaration_expected: { code: 1139, category: 1, key: "Type parameter declaration expected." }, + Type_argument_expected: { code: 1140, category: 1, key: "Type argument expected." }, + String_literal_expected: { code: 1141, category: 1, key: "String literal expected." }, + Line_break_not_permitted_here: { code: 1142, category: 1, key: "Line break not permitted here." }, + or_expected: { code: 1144, category: 1, key: "'{' or ';' expected." }, + Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1, key: "Modifiers not permitted on index signature members." }, + Declaration_expected: { code: 1146, category: 1, key: "Declaration expected." }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1, key: "Import declarations in an internal module cannot reference an external module." }, + Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1, key: "Cannot compile external modules unless the '--module' flag is provided." }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: 1, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, + var_let_or_const_expected: { code: 1152, category: 1, key: "'var', 'let' or 'const' expected." }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_must_be_initialized: { code: 1155, category: 1, key: "'const' declarations must be initialized" }, + const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1, key: "'const' declarations can only be declared inside a block." }, + let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1, key: "'let' declarations can only be declared inside a block." }, + Unterminated_template_literal: { code: 1160, category: 1, key: "Unterminated template literal." }, + Unterminated_regular_expression_literal: { code: 1161, category: 1, key: "Unterminated regular expression literal." }, + An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, + yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, + Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, + Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, + A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, + extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, + extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, + Classes_can_only_extend_a_single_class: { code: 1174, category: 1, key: "Classes can only extend a single class." }, + implements_clause_already_seen: { code: 1175, category: 1, key: "'implements' clause already seen." }, + Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1, key: "Interface declaration cannot have 'implements' clause." }, + Binary_digit_expected: { code: 1177, category: 1, key: "Binary digit expected." }, + Octal_digit_expected: { code: 1178, category: 1, key: "Octal digit expected." }, + Unexpected_token_expected: { code: 1179, category: 1, key: "Unexpected token. '{' expected." }, + Property_destructuring_pattern_expected: { code: 1180, category: 1, key: "Property destructuring pattern expected." }, + Array_element_destructuring_pattern_expected: { code: 1181, category: 1, key: "Array element destructuring pattern expected." }, + A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: 1, key: "A destructuring declaration must have an initializer." }, + Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: 1, key: "Destructuring declarations are not allowed in ambient contexts." }, + An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: 1, key: "An implementation cannot be declared in ambient contexts." }, + Modifiers_cannot_appear_here: { code: 1184, category: 1, key: "Modifiers cannot appear here." }, + Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, + A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, + A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, + An_import_declaration_cannot_have_modifiers: { code: 1191, category: 1, key: "An import declaration cannot have modifiers." }, + External_module_0_has_no_default_export_or_export_assignment: { code: 1192, category: 1, key: "External module '{0}' has no default export or export assignment." }, + An_export_declaration_cannot_have_modifiers: { code: 1193, category: 1, key: "An export declaration cannot have modifiers." }, + Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: 1, key: "Export declarations are not permitted in an internal module." }, + Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: 1, key: "Catch clause variable name must be an identifier." }, + Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: 1, key: "Catch clause variable cannot have a type annotation." }, + Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: 1, key: "Catch clause variable cannot have an initializer." }, + An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: 1, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, + Unterminated_Unicode_escape_sequence: { code: 1199, category: 1, key: "Unterminated Unicode escape sequence." }, + Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, + Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1, key: "Static members cannot reference class type parameters." }, + Circular_definition_of_import_alias_0: { code: 2303, category: 1, key: "Circular definition of import alias '{0}'." }, + Cannot_find_name_0: { code: 2304, category: 1, key: "Cannot find name '{0}'." }, + Module_0_has_no_exported_member_1: { code: 2305, category: 1, key: "Module '{0}' has no exported member '{1}'." }, + File_0_is_not_an_external_module: { code: 2306, category: 1, key: "File '{0}' is not an external module." }, + Cannot_find_external_module_0: { code: 2307, category: 1, key: "Cannot find external module '{0}'." }, + A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1, key: "A module cannot have more than one export assignment." }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1, key: "An export assignment cannot be used in a module with other exported elements." }, + Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1, key: "Type '{0}' recursively references itself as a base type." }, + A_class_may_only_extend_another_class: { code: 2311, category: 1, key: "A class may only extend another class." }, + An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1, key: "An interface may only extend a class or another interface." }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, + Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1, key: "Generic type '{0}' requires {1} type argument(s)." }, + Type_0_is_not_generic: { code: 2315, category: 1, key: "Type '{0}' is not generic." }, + Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, + Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, + Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, + Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, + Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, + Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, + Property_0_is_missing_in_type_1: { code: 2324, category: 1, key: "Property '{0}' is missing in type '{1}'." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, + Types_of_property_0_are_incompatible: { code: 2326, category: 1, key: "Types of property '{0}' are incompatible." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, + Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1, key: "Types of parameters '{0}' and '{1}' are incompatible." }, + Index_signature_is_missing_in_type_0: { code: 2329, category: 1, key: "Index signature is missing in type '{0}'." }, + Index_signatures_are_incompatible: { code: 2330, category: 1, key: "Index signatures are incompatible." }, + this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1, key: "'this' cannot be referenced in a module body." }, + this_cannot_be_referenced_in_current_location: { code: 2332, category: 1, key: "'this' cannot be referenced in current location." }, + this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1, key: "'this' cannot be referenced in constructor arguments." }, + this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1, key: "'this' cannot be referenced in a static property initializer." }, + super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1, key: "'super' can only be referenced in a derived class." }, + super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1, key: "'super' cannot be referenced in constructor arguments." }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, + Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, + Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, + Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1, key: "Untyped function calls may not accept type arguments." }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1, key: "Cannot invoke an expression whose type lacks a call signature." }, + Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1, key: "Only a void function can be called with the 'new' keyword." }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1, key: "No best common type exists among return expressions." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1, key: "Invalid left-hand side of assignment expression." }, + Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Type_parameter_name_cannot_be_0: { code: 2368, category: 1, key: "Type parameter name cannot be '{0}'" }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1, key: "A parameter property is only allowed in a constructor implementation." }, + A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1, key: "A rest parameter must be of an array type." }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1, key: "A parameter initializer is only allowed in a function or constructor implementation." }, + Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1, key: "Parameter '{0}' cannot be referenced in its initializer." }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, + Duplicate_string_index_signature: { code: 2374, category: 1, key: "Duplicate string index signature." }, + Duplicate_number_index_signature: { code: 2375, category: 1, key: "Duplicate number index signature." }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, + Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1, key: "Constructors for derived classes must contain a 'super' call." }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1, key: "Getter and setter accessors do not agree in visibility." }, + get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1, key: "'get' and 'set' accessor must have the same type." }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1, key: "A signature with an implementation cannot use a string literal type." }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1, key: "Specialized overload signature is not assignable to any non-specialized signature." }, + Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1, key: "Overload signatures must all be exported or not exported." }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1, key: "Overload signatures must all be ambient or non-ambient." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1, key: "Overload signatures must all be public, private or protected." }, + Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1, key: "Overload signatures must all be optional or required." }, + Function_overload_must_be_static: { code: 2387, category: 1, key: "Function overload must be static." }, + Function_overload_must_not_be_static: { code: 2388, category: 1, key: "Function overload must not be static." }, + Function_implementation_name_must_be_0: { code: 2389, category: 1, key: "Function implementation name must be '{0}'." }, + Constructor_implementation_is_missing: { code: 2390, category: 1, key: "Constructor implementation is missing." }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1, key: "Function implementation is missing or not immediately following the declaration." }, + Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1, key: "Multiple constructor implementations are not allowed." }, + Duplicate_function_implementation: { code: 2393, category: 1, key: "Duplicate function implementation." }, + Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1, key: "Overload signature is not compatible with function implementation." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, + Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1, key: "Invalid left-hand side in 'for...in' statement." }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, + Setters_cannot_return_a_value: { code: 2408, category: 1, key: "Setters cannot return a value." }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1, key: "Return type of constructor signature must be assignable to the instance type of the class" }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1, key: "All symbols within a 'with' block will be resolved to 'any'." }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, + Class_name_cannot_be_0: { code: 2414, category: 1, key: "Class name cannot be '{0}'" }, + Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1, key: "Class '{0}' incorrectly extends base class '{1}'." }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, + Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1, key: "Class '{0}' incorrectly implements interface '{1}'." }, + A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1, key: "A class may only implement another class or interface." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, + Interface_name_cannot_be_0: { code: 2427, category: 1, key: "Interface name cannot be '{0}'" }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1, key: "All declarations of an interface must have identical type parameters." }, + Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1, key: "Interface '{0}' incorrectly extends interface '{1}'." }, + Enum_name_cannot_be_0: { code: 2431, category: 1, key: "Enum name cannot be '{0}'" }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1, key: "Ambient external modules cannot be nested in other modules." }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1, key: "Ambient external module declaration cannot specify relative module name." }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1, key: "Module '{0}' is hidden by a local declaration with the same name" }, + Import_name_cannot_be_0: { code: 2438, category: 1, key: "Import name cannot be '{0}'" }, + Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1, key: "Import declaration conflicts with local declaration of '{0}'" }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1, key: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, + Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1, key: "Block-scoped variable '{0}' used before its declaration." }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1, key: "The operand of an increment or decrement operator cannot be a constant." }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1, key: "Left-hand side of assignment expression cannot be a constant." }, + Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1, key: "Cannot redeclare block-scoped variable '{0}'." }, + An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1, key: "An enum member cannot have a numeric name." }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, + Type_alias_0_circularly_references_itself: { code: 2456, category: 1, key: "Type alias '{0}' circularly references itself." }, + Type_alias_name_cannot_be_0: { code: 2457, category: 1, key: "Type alias name cannot be '{0}'" }, + An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1, key: "An AMD module cannot have multiple name assignments." }, + Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: 1, key: "Type '{0}' has no property '{1}' and no string index signature." }, + Type_0_has_no_property_1: { code: 2460, category: 1, key: "Type '{0}' has no property '{1}'." }, + Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, + A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, + this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, + super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, + Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, + The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, + Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: 1, key: "Export declaration conflicts with exported declaration of '{0}'" }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: 1, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, + Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: 1, key: "Invalid left-hand side in 'for...of' statement." }, + The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: 1, key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." }, + The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { code: 2489, category: 1, key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." }, + The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: 1, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, + Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: 1, key: "Cannot redeclare identifier '{0}' in catch clause" }, + Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: 1, key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: 1, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, + Type_0_is_not_an_array_type_or_a_string_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type or a string type." }, + Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, + Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1, key: "Exported variable '{0}' has or is using private name '{1}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1, key: "Return type of public static method from exported class has or is using private name '{0}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1, key: "Return type of public method from exported class has or is using private name '{0}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1, key: "Return type of method from exported interface has or is using private name '{0}'." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1, key: "Return type of exported function has or is using private name '{0}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, + Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, + Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { code: 4091, category: 1, key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." }, + The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, + Unsupported_file_encoding: { code: 5013, category: 1, key: "Unsupported file encoding." }, + Unknown_compiler_option_0: { code: 5023, category: 1, key: "Unknown compiler option '{0}'." }, + Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1, key: "Compiler option '{0}' requires a value of type {1}." }, + Could_not_write_file_0_Colon_1: { code: 5033, category: 1, key: "Could not write file '{0}': {1}" }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, + Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: 1, key: "Option 'project' cannot be mixed with source files on a command line." }, + Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2, key: "Concatenate and emit output to single file." }, + Generates_corresponding_d_ts_file: { code: 6002, category: 2, key: "Generates corresponding '.d.ts' file." }, + Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2, key: "Specifies the location where debugger should locate map files instead of generated locations." }, + Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + Watch_input_files: { code: 6005, category: 2, key: "Watch input files." }, + Redirect_output_structure_to_the_directory: { code: 6006, category: 2, key: "Redirect output structure to the directory." }, + Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2, key: "Do not erase const enum declarations in generated code." }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_comments_to_output: { code: 6009, category: 2, key: "Do not emit comments to output." }, + Do_not_emit_outputs: { code: 6010, category: 2, key: "Do not emit outputs." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, + Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2, key: "Specify module code generation: 'commonjs' or 'amd'" }, + Print_this_message: { code: 6017, category: 2, key: "Print this message." }, + Print_the_compiler_s_version: { code: 6019, category: 2, key: "Print the compiler's version." }, + Compile_the_project_in_the_given_directory: { code: 6020, category: 2, key: "Compile the project in the given directory." }, + Syntax_Colon_0: { code: 6023, category: 2, key: "Syntax: {0}" }, + options: { code: 6024, category: 2, key: "options" }, + file: { code: 6025, category: 2, key: "file" }, + Examples_Colon_0: { code: 6026, category: 2, key: "Examples: {0}" }, + Options_Colon: { code: 6027, category: 2, key: "Options:" }, + Version_0: { code: 6029, category: 2, key: "Version {0}" }, + Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2, key: "Insert command line options and files from a file." }, + File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2, key: "File change detected. Starting incremental compilation..." }, + KIND: { code: 6034, category: 2, key: "KIND" }, + FILE: { code: 6035, category: 2, key: "FILE" }, + VERSION: { code: 6036, category: 2, key: "VERSION" }, + LOCATION: { code: 6037, category: 2, key: "LOCATION" }, + DIRECTORY: { code: 6038, category: 2, key: "DIRECTORY" }, + Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2, key: "Compilation complete. Watching for file changes." }, + Generates_corresponding_map_file: { code: 6043, category: 2, key: "Generates corresponding '.map' file." }, + Compiler_option_0_expects_an_argument: { code: 6044, category: 1, key: "Compiler option '{0}' expects an argument." }, + Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1, key: "Unterminated quoted string in response file '{0}'." }, + Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, + Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, + Unsupported_locale_0: { code: 6049, category: 1, key: "Unsupported locale '{0}'." }, + Unable_to_open_file_0: { code: 6050, category: 1, key: "Unable to open file '{0}'." }, + Corrupted_locale_file_0: { code: 6051, category: 1, key: "Corrupted locale file {0}." }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2, key: "Raise error on expressions and declarations with an implied 'any' type." }, + File_0_not_found: { code: 6053, category: 1, key: "File '{0}' not found." }, + File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: 2, key: "Do not emit declarations for code that has an '@internal' annotation." }, + Preserve_new_lines_when_emitting_code: { code: 6057, category: 2, key: "Preserve new-lines when emitting code." }, + Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1, key: "Variable '{0}' implicitly has an '{1}' type." }, + Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1, key: "Parameter '{0}' implicitly has an '{1}' type." }, + Member_0_implicitly_has_an_1_type: { code: 7008, category: 1, key: "Member '{0}' implicitly has an '{1}' type." }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, + Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1, key: "Index signature of object type implicitly has an 'any' type." }, + Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, + Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + You_cannot_rename_this_element: { code: 8000, category: 1, key: "You cannot rename this element." }, + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, + yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, + Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." }, + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." } }; })(ts || (ts = {})); var ts; @@ -4025,2806 +2067,10 @@ var ts; "|=": 62, "^=": 63 }; - var unicodeES3IdentifierStart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 543, - 546, - 563, - 592, - 685, - 688, - 696, - 699, - 705, - 720, - 721, - 736, - 740, - 750, - 750, - 890, - 890, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 974, - 976, - 983, - 986, - 1011, - 1024, - 1153, - 1164, - 1220, - 1223, - 1224, - 1227, - 1228, - 1232, - 1269, - 1272, - 1273, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1488, - 1514, - 1520, - 1522, - 1569, - 1594, - 1600, - 1610, - 1649, - 1747, - 1749, - 1749, - 1765, - 1766, - 1786, - 1788, - 1808, - 1808, - 1810, - 1836, - 1920, - 1957, - 2309, - 2361, - 2365, - 2365, - 2384, - 2384, - 2392, - 2401, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2524, - 2525, - 2527, - 2529, - 2544, - 2545, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2649, - 2652, - 2654, - 2654, - 2674, - 2676, - 2693, - 2699, - 2701, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2749, - 2749, - 2768, - 2768, - 2784, - 2784, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2870, - 2873, - 2877, - 2877, - 2908, - 2909, - 2911, - 2913, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 2997, - 2999, - 3001, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3168, - 3169, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3294, - 3294, - 3296, - 3297, - 3333, - 3340, - 3342, - 3344, - 3346, - 3368, - 3370, - 3385, - 3424, - 3425, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3585, - 3632, - 3634, - 3635, - 3648, - 3654, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3760, - 3762, - 3763, - 3773, - 3773, - 3776, - 3780, - 3782, - 3782, - 3804, - 3805, - 3840, - 3840, - 3904, - 3911, - 3913, - 3946, - 3976, - 3979, - 4096, - 4129, - 4131, - 4135, - 4137, - 4138, - 4176, - 4181, - 4256, - 4293, - 4304, - 4342, - 4352, - 4441, - 4447, - 4514, - 4520, - 4601, - 4608, - 4614, - 4616, - 4678, - 4680, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4742, - 4744, - 4744, - 4746, - 4749, - 4752, - 4782, - 4784, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4814, - 4816, - 4822, - 4824, - 4846, - 4848, - 4878, - 4880, - 4880, - 4882, - 4885, - 4888, - 4894, - 4896, - 4934, - 4936, - 4954, - 5024, - 5108, - 5121, - 5740, - 5743, - 5750, - 5761, - 5786, - 5792, - 5866, - 6016, - 6067, - 6176, - 6263, - 6272, - 6312, - 7680, - 7835, - 7840, - 7929, - 7936, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8319, - 8319, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8497, - 8499, - 8505, - 8544, - 8579, - 12293, - 12295, - 12321, - 12329, - 12337, - 12341, - 12344, - 12346, - 12353, - 12436, - 12445, - 12446, - 12449, - 12538, - 12540, - 12542, - 12549, - 12588, - 12593, - 12686, - 12704, - 12727, - 13312, - 19893, - 19968, - 40869, - 40960, - 42124, - 44032, - 55203, - 63744, - 64045, - 64256, - 64262, - 64275, - 64279, - 64285, - 64285, - 64287, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65136, - 65138, - 65140, - 65140, - 65142, - 65276, - 65313, - 65338, - 65345, - 65370, - 65382, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; - var unicodeES3IdentifierPart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 543, - 546, - 563, - 592, - 685, - 688, - 696, - 699, - 705, - 720, - 721, - 736, - 740, - 750, - 750, - 768, - 846, - 864, - 866, - 890, - 890, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 974, - 976, - 983, - 986, - 1011, - 1024, - 1153, - 1155, - 1158, - 1164, - 1220, - 1223, - 1224, - 1227, - 1228, - 1232, - 1269, - 1272, - 1273, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1425, - 1441, - 1443, - 1465, - 1467, - 1469, - 1471, - 1471, - 1473, - 1474, - 1476, - 1476, - 1488, - 1514, - 1520, - 1522, - 1569, - 1594, - 1600, - 1621, - 1632, - 1641, - 1648, - 1747, - 1749, - 1756, - 1759, - 1768, - 1770, - 1773, - 1776, - 1788, - 1808, - 1836, - 1840, - 1866, - 1920, - 1968, - 2305, - 2307, - 2309, - 2361, - 2364, - 2381, - 2384, - 2388, - 2392, - 2403, - 2406, - 2415, - 2433, - 2435, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2492, - 2492, - 2494, - 2500, - 2503, - 2504, - 2507, - 2509, - 2519, - 2519, - 2524, - 2525, - 2527, - 2531, - 2534, - 2545, - 2562, - 2562, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2620, - 2620, - 2622, - 2626, - 2631, - 2632, - 2635, - 2637, - 2649, - 2652, - 2654, - 2654, - 2662, - 2676, - 2689, - 2691, - 2693, - 2699, - 2701, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2748, - 2757, - 2759, - 2761, - 2763, - 2765, - 2768, - 2768, - 2784, - 2784, - 2790, - 2799, - 2817, - 2819, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2870, - 2873, - 2876, - 2883, - 2887, - 2888, - 2891, - 2893, - 2902, - 2903, - 2908, - 2909, - 2911, - 2913, - 2918, - 2927, - 2946, - 2947, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 2997, - 2999, - 3001, - 3006, - 3010, - 3014, - 3016, - 3018, - 3021, - 3031, - 3031, - 3047, - 3055, - 3073, - 3075, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3134, - 3140, - 3142, - 3144, - 3146, - 3149, - 3157, - 3158, - 3168, - 3169, - 3174, - 3183, - 3202, - 3203, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3262, - 3268, - 3270, - 3272, - 3274, - 3277, - 3285, - 3286, - 3294, - 3294, - 3296, - 3297, - 3302, - 3311, - 3330, - 3331, - 3333, - 3340, - 3342, - 3344, - 3346, - 3368, - 3370, - 3385, - 3390, - 3395, - 3398, - 3400, - 3402, - 3405, - 3415, - 3415, - 3424, - 3425, - 3430, - 3439, - 3458, - 3459, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3530, - 3530, - 3535, - 3540, - 3542, - 3542, - 3544, - 3551, - 3570, - 3571, - 3585, - 3642, - 3648, - 3662, - 3664, - 3673, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3769, - 3771, - 3773, - 3776, - 3780, - 3782, - 3782, - 3784, - 3789, - 3792, - 3801, - 3804, - 3805, - 3840, - 3840, - 3864, - 3865, - 3872, - 3881, - 3893, - 3893, - 3895, - 3895, - 3897, - 3897, - 3902, - 3911, - 3913, - 3946, - 3953, - 3972, - 3974, - 3979, - 3984, - 3991, - 3993, - 4028, - 4038, - 4038, - 4096, - 4129, - 4131, - 4135, - 4137, - 4138, - 4140, - 4146, - 4150, - 4153, - 4160, - 4169, - 4176, - 4185, - 4256, - 4293, - 4304, - 4342, - 4352, - 4441, - 4447, - 4514, - 4520, - 4601, - 4608, - 4614, - 4616, - 4678, - 4680, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4742, - 4744, - 4744, - 4746, - 4749, - 4752, - 4782, - 4784, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4814, - 4816, - 4822, - 4824, - 4846, - 4848, - 4878, - 4880, - 4880, - 4882, - 4885, - 4888, - 4894, - 4896, - 4934, - 4936, - 4954, - 4969, - 4977, - 5024, - 5108, - 5121, - 5740, - 5743, - 5750, - 5761, - 5786, - 5792, - 5866, - 6016, - 6099, - 6112, - 6121, - 6160, - 6169, - 6176, - 6263, - 6272, - 6313, - 7680, - 7835, - 7840, - 7929, - 7936, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8255, - 8256, - 8319, - 8319, - 8400, - 8412, - 8417, - 8417, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8497, - 8499, - 8505, - 8544, - 8579, - 12293, - 12295, - 12321, - 12335, - 12337, - 12341, - 12344, - 12346, - 12353, - 12436, - 12441, - 12442, - 12445, - 12446, - 12449, - 12542, - 12549, - 12588, - 12593, - 12686, - 12704, - 12727, - 13312, - 19893, - 19968, - 40869, - 40960, - 42124, - 44032, - 55203, - 63744, - 64045, - 64256, - 64262, - 64275, - 64279, - 64285, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65056, - 65059, - 65075, - 65076, - 65101, - 65103, - 65136, - 65138, - 65140, - 65140, - 65142, - 65276, - 65296, - 65305, - 65313, - 65338, - 65343, - 65343, - 65345, - 65370, - 65381, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; - var unicodeES5IdentifierStart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 705, - 710, - 721, - 736, - 740, - 748, - 748, - 750, - 750, - 880, - 884, - 886, - 887, - 890, - 893, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 1013, - 1015, - 1153, - 1162, - 1319, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1488, - 1514, - 1520, - 1522, - 1568, - 1610, - 1646, - 1647, - 1649, - 1747, - 1749, - 1749, - 1765, - 1766, - 1774, - 1775, - 1786, - 1788, - 1791, - 1791, - 1808, - 1808, - 1810, - 1839, - 1869, - 1957, - 1969, - 1969, - 1994, - 2026, - 2036, - 2037, - 2042, - 2042, - 2048, - 2069, - 2074, - 2074, - 2084, - 2084, - 2088, - 2088, - 2112, - 2136, - 2208, - 2208, - 2210, - 2220, - 2308, - 2361, - 2365, - 2365, - 2384, - 2384, - 2392, - 2401, - 2417, - 2423, - 2425, - 2431, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2493, - 2493, - 2510, - 2510, - 2524, - 2525, - 2527, - 2529, - 2544, - 2545, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2649, - 2652, - 2654, - 2654, - 2674, - 2676, - 2693, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2749, - 2749, - 2768, - 2768, - 2784, - 2785, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2869, - 2873, - 2877, - 2877, - 2908, - 2909, - 2911, - 2913, - 2929, - 2929, - 2947, - 2947, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 3001, - 3024, - 3024, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3133, - 3133, - 3160, - 3161, - 3168, - 3169, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3261, - 3261, - 3294, - 3294, - 3296, - 3297, - 3313, - 3314, - 3333, - 3340, - 3342, - 3344, - 3346, - 3386, - 3389, - 3389, - 3406, - 3406, - 3424, - 3425, - 3450, - 3455, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3585, - 3632, - 3634, - 3635, - 3648, - 3654, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3760, - 3762, - 3763, - 3773, - 3773, - 3776, - 3780, - 3782, - 3782, - 3804, - 3807, - 3840, - 3840, - 3904, - 3911, - 3913, - 3948, - 3976, - 3980, - 4096, - 4138, - 4159, - 4159, - 4176, - 4181, - 4186, - 4189, - 4193, - 4193, - 4197, - 4198, - 4206, - 4208, - 4213, - 4225, - 4238, - 4238, - 4256, - 4293, - 4295, - 4295, - 4301, - 4301, - 4304, - 4346, - 4348, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4744, - 4746, - 4749, - 4752, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4822, - 4824, - 4880, - 4882, - 4885, - 4888, - 4954, - 4992, - 5007, - 5024, - 5108, - 5121, - 5740, - 5743, - 5759, - 5761, - 5786, - 5792, - 5866, - 5870, - 5872, - 5888, - 5900, - 5902, - 5905, - 5920, - 5937, - 5952, - 5969, - 5984, - 5996, - 5998, - 6000, - 6016, - 6067, - 6103, - 6103, - 6108, - 6108, - 6176, - 6263, - 6272, - 6312, - 6314, - 6314, - 6320, - 6389, - 6400, - 6428, - 6480, - 6509, - 6512, - 6516, - 6528, - 6571, - 6593, - 6599, - 6656, - 6678, - 6688, - 6740, - 6823, - 6823, - 6917, - 6963, - 6981, - 6987, - 7043, - 7072, - 7086, - 7087, - 7098, - 7141, - 7168, - 7203, - 7245, - 7247, - 7258, - 7293, - 7401, - 7404, - 7406, - 7409, - 7413, - 7414, - 7424, - 7615, - 7680, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8305, - 8305, - 8319, - 8319, - 8336, - 8348, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8505, - 8508, - 8511, - 8517, - 8521, - 8526, - 8526, - 8544, - 8584, - 11264, - 11310, - 11312, - 11358, - 11360, - 11492, - 11499, - 11502, - 11506, - 11507, - 11520, - 11557, - 11559, - 11559, - 11565, - 11565, - 11568, - 11623, - 11631, - 11631, - 11648, - 11670, - 11680, - 11686, - 11688, - 11694, - 11696, - 11702, - 11704, - 11710, - 11712, - 11718, - 11720, - 11726, - 11728, - 11734, - 11736, - 11742, - 11823, - 11823, - 12293, - 12295, - 12321, - 12329, - 12337, - 12341, - 12344, - 12348, - 12353, - 12438, - 12445, - 12447, - 12449, - 12538, - 12540, - 12543, - 12549, - 12589, - 12593, - 12686, - 12704, - 12730, - 12784, - 12799, - 13312, - 19893, - 19968, - 40908, - 40960, - 42124, - 42192, - 42237, - 42240, - 42508, - 42512, - 42527, - 42538, - 42539, - 42560, - 42606, - 42623, - 42647, - 42656, - 42735, - 42775, - 42783, - 42786, - 42888, - 42891, - 42894, - 42896, - 42899, - 42912, - 42922, - 43000, - 43009, - 43011, - 43013, - 43015, - 43018, - 43020, - 43042, - 43072, - 43123, - 43138, - 43187, - 43250, - 43255, - 43259, - 43259, - 43274, - 43301, - 43312, - 43334, - 43360, - 43388, - 43396, - 43442, - 43471, - 43471, - 43520, - 43560, - 43584, - 43586, - 43588, - 43595, - 43616, - 43638, - 43642, - 43642, - 43648, - 43695, - 43697, - 43697, - 43701, - 43702, - 43705, - 43709, - 43712, - 43712, - 43714, - 43714, - 43739, - 43741, - 43744, - 43754, - 43762, - 43764, - 43777, - 43782, - 43785, - 43790, - 43793, - 43798, - 43808, - 43814, - 43816, - 43822, - 43968, - 44002, - 44032, - 55203, - 55216, - 55238, - 55243, - 55291, - 63744, - 64109, - 64112, - 64217, - 64256, - 64262, - 64275, - 64279, - 64285, - 64285, - 64287, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65136, - 65140, - 65142, - 65276, - 65313, - 65338, - 65345, - 65370, - 65382, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; - var unicodeES5IdentifierPart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 705, - 710, - 721, - 736, - 740, - 748, - 748, - 750, - 750, - 768, - 884, - 886, - 887, - 890, - 893, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 1013, - 1015, - 1153, - 1155, - 1159, - 1162, - 1319, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1425, - 1469, - 1471, - 1471, - 1473, - 1474, - 1476, - 1477, - 1479, - 1479, - 1488, - 1514, - 1520, - 1522, - 1552, - 1562, - 1568, - 1641, - 1646, - 1747, - 1749, - 1756, - 1759, - 1768, - 1770, - 1788, - 1791, - 1791, - 1808, - 1866, - 1869, - 1969, - 1984, - 2037, - 2042, - 2042, - 2048, - 2093, - 2112, - 2139, - 2208, - 2208, - 2210, - 2220, - 2276, - 2302, - 2304, - 2403, - 2406, - 2415, - 2417, - 2423, - 2425, - 2431, - 2433, - 2435, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2492, - 2500, - 2503, - 2504, - 2507, - 2510, - 2519, - 2519, - 2524, - 2525, - 2527, - 2531, - 2534, - 2545, - 2561, - 2563, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2620, - 2620, - 2622, - 2626, - 2631, - 2632, - 2635, - 2637, - 2641, - 2641, - 2649, - 2652, - 2654, - 2654, - 2662, - 2677, - 2689, - 2691, - 2693, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2748, - 2757, - 2759, - 2761, - 2763, - 2765, - 2768, - 2768, - 2784, - 2787, - 2790, - 2799, - 2817, - 2819, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2869, - 2873, - 2876, - 2884, - 2887, - 2888, - 2891, - 2893, - 2902, - 2903, - 2908, - 2909, - 2911, - 2915, - 2918, - 2927, - 2929, - 2929, - 2946, - 2947, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 3001, - 3006, - 3010, - 3014, - 3016, - 3018, - 3021, - 3024, - 3024, - 3031, - 3031, - 3046, - 3055, - 3073, - 3075, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3133, - 3140, - 3142, - 3144, - 3146, - 3149, - 3157, - 3158, - 3160, - 3161, - 3168, - 3171, - 3174, - 3183, - 3202, - 3203, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3260, - 3268, - 3270, - 3272, - 3274, - 3277, - 3285, - 3286, - 3294, - 3294, - 3296, - 3299, - 3302, - 3311, - 3313, - 3314, - 3330, - 3331, - 3333, - 3340, - 3342, - 3344, - 3346, - 3386, - 3389, - 3396, - 3398, - 3400, - 3402, - 3406, - 3415, - 3415, - 3424, - 3427, - 3430, - 3439, - 3450, - 3455, - 3458, - 3459, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3530, - 3530, - 3535, - 3540, - 3542, - 3542, - 3544, - 3551, - 3570, - 3571, - 3585, - 3642, - 3648, - 3662, - 3664, - 3673, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3769, - 3771, - 3773, - 3776, - 3780, - 3782, - 3782, - 3784, - 3789, - 3792, - 3801, - 3804, - 3807, - 3840, - 3840, - 3864, - 3865, - 3872, - 3881, - 3893, - 3893, - 3895, - 3895, - 3897, - 3897, - 3902, - 3911, - 3913, - 3948, - 3953, - 3972, - 3974, - 3991, - 3993, - 4028, - 4038, - 4038, - 4096, - 4169, - 4176, - 4253, - 4256, - 4293, - 4295, - 4295, - 4301, - 4301, - 4304, - 4346, - 4348, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4744, - 4746, - 4749, - 4752, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4822, - 4824, - 4880, - 4882, - 4885, - 4888, - 4954, - 4957, - 4959, - 4992, - 5007, - 5024, - 5108, - 5121, - 5740, - 5743, - 5759, - 5761, - 5786, - 5792, - 5866, - 5870, - 5872, - 5888, - 5900, - 5902, - 5908, - 5920, - 5940, - 5952, - 5971, - 5984, - 5996, - 5998, - 6000, - 6002, - 6003, - 6016, - 6099, - 6103, - 6103, - 6108, - 6109, - 6112, - 6121, - 6155, - 6157, - 6160, - 6169, - 6176, - 6263, - 6272, - 6314, - 6320, - 6389, - 6400, - 6428, - 6432, - 6443, - 6448, - 6459, - 6470, - 6509, - 6512, - 6516, - 6528, - 6571, - 6576, - 6601, - 6608, - 6617, - 6656, - 6683, - 6688, - 6750, - 6752, - 6780, - 6783, - 6793, - 6800, - 6809, - 6823, - 6823, - 6912, - 6987, - 6992, - 7001, - 7019, - 7027, - 7040, - 7155, - 7168, - 7223, - 7232, - 7241, - 7245, - 7293, - 7376, - 7378, - 7380, - 7414, - 7424, - 7654, - 7676, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8204, - 8205, - 8255, - 8256, - 8276, - 8276, - 8305, - 8305, - 8319, - 8319, - 8336, - 8348, - 8400, - 8412, - 8417, - 8417, - 8421, - 8432, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8505, - 8508, - 8511, - 8517, - 8521, - 8526, - 8526, - 8544, - 8584, - 11264, - 11310, - 11312, - 11358, - 11360, - 11492, - 11499, - 11507, - 11520, - 11557, - 11559, - 11559, - 11565, - 11565, - 11568, - 11623, - 11631, - 11631, - 11647, - 11670, - 11680, - 11686, - 11688, - 11694, - 11696, - 11702, - 11704, - 11710, - 11712, - 11718, - 11720, - 11726, - 11728, - 11734, - 11736, - 11742, - 11744, - 11775, - 11823, - 11823, - 12293, - 12295, - 12321, - 12335, - 12337, - 12341, - 12344, - 12348, - 12353, - 12438, - 12441, - 12442, - 12445, - 12447, - 12449, - 12538, - 12540, - 12543, - 12549, - 12589, - 12593, - 12686, - 12704, - 12730, - 12784, - 12799, - 13312, - 19893, - 19968, - 40908, - 40960, - 42124, - 42192, - 42237, - 42240, - 42508, - 42512, - 42539, - 42560, - 42607, - 42612, - 42621, - 42623, - 42647, - 42655, - 42737, - 42775, - 42783, - 42786, - 42888, - 42891, - 42894, - 42896, - 42899, - 42912, - 42922, - 43000, - 43047, - 43072, - 43123, - 43136, - 43204, - 43216, - 43225, - 43232, - 43255, - 43259, - 43259, - 43264, - 43309, - 43312, - 43347, - 43360, - 43388, - 43392, - 43456, - 43471, - 43481, - 43520, - 43574, - 43584, - 43597, - 43600, - 43609, - 43616, - 43638, - 43642, - 43643, - 43648, - 43714, - 43739, - 43741, - 43744, - 43759, - 43762, - 43766, - 43777, - 43782, - 43785, - 43790, - 43793, - 43798, - 43808, - 43814, - 43816, - 43822, - 43968, - 44010, - 44012, - 44013, - 44016, - 44025, - 44032, - 55203, - 55216, - 55238, - 55243, - 55291, - 63744, - 64109, - 64112, - 64217, - 64256, - 64262, - 64275, - 64279, - 64285, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65024, - 65039, - 65056, - 65062, - 65075, - 65076, - 65101, - 65103, - 65136, - 65140, - 65142, - 65276, - 65296, - 65305, - 65313, - 65338, - 65343, - 65343, - 65345, - 65370, - 65382, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; + var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; function lookupInUnicodeMap(code, map) { if (code < map[0]) { return false; @@ -6848,11 +2094,15 @@ var ts; return false; } function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); + return languageVersion >= 1 ? + lookupInUnicodeMap(code, unicodeES5IdentifierStart) : + lookupInUnicodeMap(code, unicodeES3IdentifierStart); } ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); + return languageVersion >= 1 ? + lookupInUnicodeMap(code, unicodeES5IdentifierPart) : + lookupInUnicodeMap(code, unicodeES3IdentifierPart); } function makeReverseMap(source) { var result = []; @@ -6925,7 +2175,9 @@ var ts; ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { - return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || + ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || + ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { @@ -7012,7 +2264,8 @@ var ts; return false; } } - return ch === 61 || text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + return ch === 61 || + text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } return false; @@ -7092,11 +2345,7 @@ var ts; if (collecting) { if (!result) result = []; - result.push({ - pos: startPos, - end: pos, - hasTrailingNewLine: hasTrailingNewLine - }); + result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); } continue; } @@ -7123,11 +2372,15 @@ var ts; } ts.getTrailingCommentRanges = getTrailingCommentRanges; function isIdentifierStart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } ts.isIdentifierStart = isIdentifierStart; function isIdentifierPart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; function createScanner(languageVersion, skipTrivia, text, onError) { @@ -7146,10 +2399,14 @@ var ts; } } function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } function isIdentifierPart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } function scanNumber() { var start = pos; @@ -7872,39 +3129,17 @@ var ts; } setText(text); return { - getStartPos: function () { - return startPos; - }, - getTextPos: function () { - return pos; - }, - getToken: function () { - return token; - }, - getTokenPos: function () { - return tokenPos; - }, - getTokenText: function () { - return text.substring(tokenPos, pos); - }, - getTokenValue: function () { - return tokenValue; - }, - hasExtendedUnicodeEscape: function () { - return hasExtendedUnicodeEscape; - }, - hasPrecedingLineBreak: function () { - return precedingLineBreak; - }, - isIdentifier: function () { - return token === 64 || token > 100; - }, - isReservedWord: function () { - return token >= 65 && token <= 100; - }, - isUnterminated: function () { - return tokenIsUnterminated; - }, + getStartPos: function () { return startPos; }, + getTextPos: function () { return pos; }, + getToken: function () { return token; }, + getTokenPos: function () { return tokenPos; }, + getTokenText: function () { return text.substring(tokenPos, pos); }, + getTokenValue: function () { return tokenValue; }, + hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, + hasPrecedingLineBreak: function () { return precedingLineBreak; }, + isIdentifier: function () { return token === 64 || token > 100; }, + isReservedWord: function () { return token >= 65 && token <= 100; }, + isUnterminated: function () { return tokenIsUnterminated; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, @@ -7934,13 +3169,9 @@ var ts; function getSingleLineStringWriter() { if (stringWriters.length == 0) { var str = ""; - var writeText = function (text) { - return str += text; - }; + var writeText = function (text) { return str += text; }; return { - string: function () { - return str; - }, + string: function () { return str; }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -7948,18 +3179,11 @@ var ts; writeStringLiteral: writeText, writeParameter: writeText, writeSymbol: writeText, - writeLine: function () { - return str += " "; - }, - increaseIndent: function () { - }, - decreaseIndent: function () { - }, - clear: function () { - return str = ""; - }, - trackSymbol: function () { - } + writeLine: function () { return str += " "; }, + increaseIndent: function () { }, + decreaseIndent: function () { }, + clear: function () { return str = ""; }, + trackSymbol: function () { } }; } return stringWriters.pop(); @@ -7981,7 +3205,8 @@ var ts; ts.containsParseError = containsParseError; function aggregateChildData(node) { if (!(node.parserContextFlags & 64)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || ts.forEachChild(node, containsParseError); + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || + ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { node.parserContextFlags |= 32; } @@ -8060,7 +3285,8 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 12288) !== 0 || isCatchClauseVariableDeclaration(declaration); + return (getCombinedNodeFlags(declaration) & 12288) !== 0 || + isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function getEnclosingBlockScopeContainer(node) { @@ -8088,7 +3314,10 @@ var ts; } ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { - return declaration && declaration.kind === 193 && declaration.parent && declaration.parent.kind === 217; + return declaration && + declaration.kind === 193 && + declaration.parent && + declaration.parent.kind === 217; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -8140,7 +3369,9 @@ var ts; if (errorNode === undefined) { return getSpanOfTokenAtPosition(sourceFile, node.pos); } - var pos = nodeIsMissing(errorNode) ? errorNode.pos : ts.skipTrivia(sourceFile.text, errorNode.pos); + var pos = nodeIsMissing(errorNode) + ? errorNode.pos + : ts.skipTrivia(sourceFile.text, errorNode.pos); return createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; @@ -8203,7 +3434,9 @@ var ts; function getJsDocComments(node, sourceFileOfNode) { return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); function isJsDocComment(comment) { - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; + return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; } } ts.getJsDocComments = getJsDocComments; @@ -8429,11 +3662,14 @@ var ts; return _parent.expression === node; case 181: var forStatement = _parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || forStatement.condition === node || forStatement.iterator === node; + return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || + forStatement.condition === node || + forStatement.iterator === node; case 182: case 183: var forInStatement = _parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || forInStatement.expression === node; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || + forInStatement.expression === node; case 158: return node === _parent.expression; case 173: @@ -8451,7 +3687,8 @@ var ts; ts.isExpression = isExpression; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 || (preserveConstEnums && moduleState === 2); + return moduleState === 1 || + (preserveConstEnums && moduleState === 2); } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { @@ -8699,7 +3936,9 @@ var ts; } ts.isTrivia = isTrivia; function hasDynamicName(declaration) { - return declaration.name && declaration.name.kind === 126 && !isWellKnownSymbolSyntactically(declaration.name.expression); + return declaration.name && + declaration.name.kind === 126 && + !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { @@ -8803,10 +4042,7 @@ var ts; if (length < 0) { throw new Error("length < 0"); } - return { - start: start, - length: length - }; + return { start: start, length: length }; } ts.createTextSpan = createTextSpan; function createTextSpanFromBounds(start, end) { @@ -8825,10 +4061,7 @@ var ts; if (newLength < 0) { throw new Error("newLength < 0"); } - return { - span: span, - newLength: newLength - }; + return { span: span, newLength: newLength }; } ts.createTextChangeRange = createTextChangeRange; ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); @@ -8989,9 +4222,9 @@ var ts; } var nonAsciiCharacters = /[^\u0000-\u007F]/g; function escapeNonAsciiCharacters(s) { - return nonAsciiCharacters.test(s) ? s.replace(nonAsciiCharacters, function (c) { - return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - }) : s; + return nonAsciiCharacters.test(s) ? + s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) : + s; } ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters; })(ts || (ts = {})); @@ -9036,9 +4269,12 @@ var ts; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { case 125: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); case 127: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.expression); case 128: case 130: case 129: @@ -9046,13 +4282,22 @@ var ts; case 219: case 193: case 150: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); case 140: case 141: case 136: case 137: case 138: - return visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); case 132: case 131: case 133: @@ -9061,9 +4306,17 @@ var ts; case 160: case 195: case 161: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); case 139: - return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); + return visitNode(cbNode, node.typeName) || + visitNodes(cbNodes, node.typeArguments); case 142: return visitNode(cbNode, node.exprName); case 143: @@ -9084,16 +4337,23 @@ var ts; case 152: return visitNodes(cbNodes, node.properties); case 153: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.dotToken) || + visitNode(cbNode, node.name); case 154: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.argumentExpression); case 155: case 156: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments) || + visitNodes(cbNodes, node.arguments); case 157: - return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.template); case 158: - return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); case 159: return visitNode(cbNode, node.expression); case 162: @@ -9105,91 +4365,142 @@ var ts; case 165: return visitNode(cbNode, node.operand); case 170: - return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); case 166: return visitNode(cbNode, node.operand); case 167: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); case 168: - return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); case 171: return visitNode(cbNode, node.expression); case 174: case 201: return visitNodes(cbNodes, node.statements); case 221: - return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); + return visitNodes(cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); case 175: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); case 194: return visitNodes(cbNodes, node.declarations); case 177: return visitNode(cbNode, node.expression); case 178: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); case 179: - return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); case 180: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 181: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.iterator) || + visitNode(cbNode, node.statement); case 182: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 183: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 184: case 185: return visitNode(cbNode, node.label); case 186: return visitNode(cbNode, node.expression); case 187: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 188: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); case 202: return visitNodes(cbNodes, node.clauses); case 214: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); case 215: return visitNodes(cbNodes, node.statements); case 189: - return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); case 190: return visitNode(cbNode, node.expression); case 191: - return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); case 217: - return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); case 196: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 197: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 198: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); case 199: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); case 220: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); case 200: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); case 203: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); case 204: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier); case 205: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); case 206: return visitNode(cbNode, node.name); case 207: case 211: return visitNodes(cbNodes, node.elements); case 210: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier); case 208: case 212: - return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); case 209: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); case 169: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); case 173: @@ -9236,69 +4547,40 @@ var ts; })(Tristate || (Tristate = {})); function parsingContextErrors(context) { switch (context) { - case 0: - return ts.Diagnostics.Declaration_or_statement_expected; - case 1: - return ts.Diagnostics.Declaration_or_statement_expected; - case 2: - return ts.Diagnostics.Statement_expected; - case 3: - return ts.Diagnostics.case_or_default_expected; - case 4: - return ts.Diagnostics.Statement_expected; - case 5: - return ts.Diagnostics.Property_or_signature_expected; - case 6: - return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; - case 7: - return ts.Diagnostics.Enum_member_expected; - case 8: - return ts.Diagnostics.Type_reference_expected; - case 9: - return ts.Diagnostics.Variable_declaration_expected; - case 10: - return ts.Diagnostics.Property_destructuring_pattern_expected; - case 11: - return ts.Diagnostics.Array_element_destructuring_pattern_expected; - case 12: - return ts.Diagnostics.Argument_expression_expected; - case 13: - return ts.Diagnostics.Property_assignment_expected; - case 14: - return ts.Diagnostics.Expression_or_comma_expected; - case 15: - return ts.Diagnostics.Parameter_declaration_expected; - case 16: - return ts.Diagnostics.Type_parameter_declaration_expected; - case 17: - return ts.Diagnostics.Type_argument_expected; - case 18: - return ts.Diagnostics.Type_expected; - case 19: - return ts.Diagnostics.Unexpected_token_expected; - case 20: - return ts.Diagnostics.Identifier_expected; + case 0: return ts.Diagnostics.Declaration_or_statement_expected; + case 1: return ts.Diagnostics.Declaration_or_statement_expected; + case 2: return ts.Diagnostics.Statement_expected; + case 3: return ts.Diagnostics.case_or_default_expected; + case 4: return ts.Diagnostics.Statement_expected; + case 5: return ts.Diagnostics.Property_or_signature_expected; + case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7: return ts.Diagnostics.Enum_member_expected; + case 8: return ts.Diagnostics.Type_reference_expected; + case 9: return ts.Diagnostics.Variable_declaration_expected; + case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; + case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; + case 12: return ts.Diagnostics.Argument_expression_expected; + case 13: return ts.Diagnostics.Property_assignment_expected; + case 14: return ts.Diagnostics.Expression_or_comma_expected; + case 15: return ts.Diagnostics.Parameter_declaration_expected; + case 16: return ts.Diagnostics.Type_parameter_declaration_expected; + case 17: return ts.Diagnostics.Type_argument_expected; + case 18: return ts.Diagnostics.Type_expected; + case 19: return ts.Diagnostics.Unexpected_token_expected; + case 20: return ts.Diagnostics.Identifier_expected; } } ; function modifierToFlag(token) { switch (token) { - case 109: - return 128; - case 108: - return 16; - case 107: - return 64; - case 106: - return 32; - case 77: - return 1; - case 114: - return 2; - case 69: - return 8192; - case 72: - return 256; + case 109: return 128; + case 108: return 16; + case 107: return 64; + case 106: return 32; + case 77: return 1; + case 114: return 2; + case 69: return 8192; + case 72: return 256; } return 0; } @@ -9531,7 +4813,8 @@ var ts; } ts.updateSourceFile = updateSourceFile; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 64 && (node.text === "eval" || node.text === "arguments"); + return node.kind === 64 && + (node.text === "eval" || node.text === "arguments"); } ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; function isUseStrictPrologueDirective(sourceFile, node) { @@ -9753,7 +5036,9 @@ var ts; var saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; var saveContextFlags = contextFlags; - var result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); + var result = isLookAhead + ? scanner.lookAhead(callback) + : scanner.tryScan(callback); ts.Debug.assert(saveContextFlags === contextFlags); if (!result || isLookAhead) { token = saveToken; @@ -9804,7 +5089,8 @@ var ts; return undefined; } function parseExpectedToken(t, reportAtCurrentPosition, diagnosticMessage, arg0) { - return parseOptionalToken(t) || createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); + return parseOptionalToken(t) || + createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); } function parseTokenNode() { var node = createNode(token); @@ -9881,7 +5167,9 @@ var ts; return createIdentifier(isIdentifierOrKeyword()); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || token === 8 || token === 7; + return isIdentifierOrKeyword() || + token === 8 || + token === 7; } function parsePropertyName() { if (token === 8 || token === 7) { @@ -9934,7 +5222,10 @@ var ts; return canFollowModifier(); } function canFollowModifier() { - return token === 18 || token === 14 || token === 35 || isLiteralPropertyName(); + return token === 18 + || token === 14 + || token === 35 + || isLiteralPropertyName(); } function nextTokenIsClassOrFunction() { nextToken(); @@ -9992,7 +5283,8 @@ var ts; return isIdentifier(); } function isNotHeritageClauseTypeName() { - if (token === 102 || token === 78) { + if (token === 102 || + token === 78) { return lookAhead(nextTokenIsIdentifier); } return false; @@ -10373,7 +5665,9 @@ var ts; var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - if (node.kind === 7 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + if (node.kind === 7 + && sourceText.charCodeAt(tokenPos) === 48 + && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { node.flags |= 16384; } return node; @@ -10412,7 +5706,9 @@ var ts; } function parseParameterType() { if (parseOptional(51)) { - return token === 8 ? parseLiteralNode(true) : parseType(); + return token === 8 + ? parseLiteralNode(true) + : parseType(); } return undefined; } @@ -10570,7 +5866,11 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 || token === 24 || token === 50 || token === 51 || canParseSemicolon(); + return token === 16 || + token === 24 || + token === 50 || + token === 51 || + canParseSemicolon(); } function parseTypeMember() { switch (token) { @@ -10578,7 +5878,9 @@ var ts; case 24: return parseSignatureMember(136); case 18: - return isIndexSignature() ? parseIndexSignatureDeclaration(undefined) : parsePropertyOrMethodSignature(); + return isIndexSignature() + ? parseIndexSignatureDeclaration(undefined) + : parsePropertyOrMethodSignature(); case 87: if (lookAhead(isStartOfConstructSignature)) { return parseSignatureMember(137); @@ -10600,7 +5902,9 @@ var ts; } function parseIndexSignatureWithModifiers() { var modifiers = parseModifiers(); - return isIndexSignature() ? parseIndexSignatureDeclaration(modifiers) : undefined; + return isIndexSignature() + ? parseIndexSignatureDeclaration(modifiers) + : undefined; } function isStartOfConstructSignature() { nextToken(); @@ -10706,9 +6010,7 @@ var ts; function parseUnionTypeOrHigher() { var type = parseArrayTypeOrHigher(); if (token === 44) { - var types = [ - type - ]; + var types = [type]; types.pos = type.pos; while (parseOptional(44)) { types.push(parseArrayTypeOrHigher()); @@ -10733,7 +6035,9 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 51 || token === 23 || token === 50 || token === 52 || isIdentifier() || ts.isModifier(token)) { + if (token === 51 || token === 23 || + token === 50 || token === 52 || + isIdentifier() || ts.isModifier(token)) { return true; } if (token === 17) { @@ -10860,12 +6164,14 @@ var ts; } function nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() { nextToken(); - return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 14 || token === 18); + return !scanner.hasPrecedingLineBreak() && + (isIdentifier() || token === 14 || token === 18); } function parseYieldExpression() { var node = createNode(170); nextToken(); - if (!scanner.hasPrecedingLineBreak() && (token === 35 || isStartOfExpression())) { + if (!scanner.hasPrecedingLineBreak() && + (token === 35 || isStartOfExpression())) { node.asteriskToken = parseOptionalToken(35); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); @@ -10880,9 +6186,7 @@ var ts; var parameter = createNode(128, identifier.pos); parameter.name = identifier; finishNode(parameter); - node.parameters = [ - parameter - ]; + node.parameters = [parameter]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; parseExpected(32); @@ -10894,7 +6198,9 @@ var ts; if (triState === 0) { return undefined; } - var arrowFunction = triState === 1 ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + var arrowFunction = triState === 1 + ? parseParenthesizedArrowFunctionExpressionHead(true) + : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); if (!arrowFunction) { return undefined; } @@ -11116,7 +6422,9 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 90 ? parseSuperExpression() : parseMemberExpressionOrHigher(); + var expression = token === 90 + ? parseSuperExpression() + : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); } function parseMemberExpressionOrHigher() { @@ -11170,7 +6478,9 @@ var ts; if (token === 10 || token === 11) { var tagExpression = createNode(157, expression.pos); tagExpression.tag = expression; - tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); + tagExpression.template = token === 10 + ? parseLiteralNode() + : parseTemplateExpression(); expression = finishNode(tagExpression); continue; } @@ -11216,7 +6526,9 @@ var ts; if (!parseExpected(25)) { return undefined; } - return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; + return typeArguments && canFollowTypeArgumentsInExpression() + ? typeArguments + : undefined; } function canFollowTypeArgumentsInExpression() { switch (token) { @@ -11291,7 +6603,9 @@ var ts; return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 ? parseSpreadElement() : token === 23 ? createNode(172) : parseAssignmentExpressionOrHigher(); + return token === 21 ? parseSpreadElement() : + token === 23 ? createNode(172) : + parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return allowInAnd(parseArgumentOrArrayLiteralElement); @@ -11941,7 +7255,11 @@ var ts; if (isIndexSignature()) { return parseIndexSignatureDeclaration(modifiers); } - if (isIdentifierOrKeyword() || token === 8 || token === 7 || token === 35 || token === 18) { + if (isIdentifierOrKeyword() || + token === 8 || + token === 7 || + token === 35 || + token === 18) { return parsePropertyOrMethodDeclaration(fullStart, modifiers); } ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -11954,7 +7272,9 @@ var ts; node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); if (parseExpected(14)) { - node.members = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); + node.members = inGeneratorParameterContext() + ? doOutsideOfYieldContext(parseClassMembers) + : parseClassMembers(); parseExpected(15); } else { @@ -11964,7 +7284,9 @@ var ts; } function parseHeritageClauses(isClassHeritageClause) { if (isHeritageClause()) { - return isClassHeritageClause && inGeneratorParameterContext() ? doOutsideOfYieldContext(parseHeritageClausesWorker) : parseHeritageClausesWorker(); + return isClassHeritageClause && inGeneratorParameterContext() + ? doOutsideOfYieldContext(parseHeritageClausesWorker) + : parseHeritageClausesWorker(); } return undefined; } @@ -12043,7 +7365,9 @@ var ts; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(20) ? parseInternalModuleTail(getNodePos(), undefined, 1) : parseModuleBlock(); + node.body = parseOptional(20) + ? parseInternalModuleTail(getNodePos(), undefined, 1) + : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { @@ -12055,17 +7379,21 @@ var ts; } function parseModuleDeclaration(fullStart, modifiers) { parseExpected(116); - return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); + return token === 8 + ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) + : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); } function isExternalModuleReference() { - return token === 117 && lookAhead(nextTokenIsOpenParen); + return token === 117 && + lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 16; } function nextTokenIsCommaOrFromKeyword() { nextToken(); - return token === 23 || token === 123; + return token === 23 || + token === 123; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, modifiers) { parseExpected(84); @@ -12085,7 +7413,9 @@ var ts; } var importDeclaration = createNode(204, fullStart); setModifiers(importDeclaration, modifiers); - if (identifier || token === 35 || token === 14) { + if (identifier || + token === 35 || + token === 14) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); parseExpected(123); } @@ -12098,13 +7428,16 @@ var ts; if (identifier) { importClause.name = identifier; } - if (!importClause.name || parseOptional(23)) { + if (!importClause.name || + parseOptional(23)) { importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(207); } return finishNode(importClause); } function parseModuleReference() { - return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); + return isExternalModuleReference() + ? parseExternalModuleReference() + : parseEntityName(false); } function parseExternalModuleReference() { var node = createNode(213); @@ -12234,11 +7567,13 @@ var ts; } function nextTokenCanFollowImportKeyword() { nextToken(); - return isIdentifierOrKeyword() || token === 8 || token === 35 || token === 14; + return isIdentifierOrKeyword() || token === 8 || + token === 35 || token === 14; } function nextTokenCanFollowExportKeyword() { nextToken(); - return token === 52 || token === 35 || token === 14 || token === 72 || isDeclarationStart(); + return token === 52 || token === 35 || + token === 14 || token === 72 || isDeclarationStart(); } function nextTokenIsDeclarationStart() { nextToken(); @@ -12292,7 +7627,9 @@ var ts; return parseSourceElementOrModuleElement(); } function parseSourceElementOrModuleElement() { - return isDeclarationStart() ? parseDeclaration() : parseStatement(); + return isDeclarationStart() + ? parseDeclaration() + : parseStatement(); } function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, sourceText); @@ -12307,10 +7644,7 @@ var ts; if (kind !== 2) { break; } - var range = { - pos: triviaScanner.getTokenPos(), - end: triviaScanner.getTextPos() - }; + var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; var comment = sourceText.substring(range.pos, range.end); var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { @@ -12341,10 +7675,7 @@ var ts; var pathMatchResult = pathRegex.exec(comment); var nameMatchResult = nameRegex.exec(comment); if (pathMatchResult) { - var amdDependency = { - path: pathMatchResult[2], - name: nameMatchResult ? nameMatchResult[2] : undefined - }; + var amdDependency = { path: pathMatchResult[2], name: nameMatchResult ? nameMatchResult[2] : undefined }; amdDependencies.push(amdDependency); } } @@ -12356,7 +7687,13 @@ var ts; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 1 || node.kind === 203 && node.moduleReference.kind === 213 || node.kind === 204 || node.kind === 209 || node.kind === 210 ? node : undefined; + return node.flags & 1 + || node.kind === 203 && node.moduleReference.kind === 213 + || node.kind === 204 + || node.kind === 209 + || node.kind === 210 + ? node + : undefined; }); } } @@ -12525,7 +7862,9 @@ var ts; if (node.name) { node.name.parent = node; } - var message = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = symbol.flags & 2 + ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 + : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); @@ -12571,7 +7910,9 @@ var ts; } else { if (hasExportModifier || isAmbientContext(container)) { - var exportKind = (symbolKind & 107455 ? 1048576 : 0) | (symbolKind & 793056 ? 2097152 : 0) | (symbolKind & 1536 ? 4194304 : 0); + var exportKind = (symbolKind & 107455 ? 1048576 : 0) | + (symbolKind & 793056 ? 2097152 : 0) | + (symbolKind & 1536 ? 4194304 : 0); var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); node.localSymbol = local; @@ -12851,7 +8192,9 @@ var ts; else { bindDeclaration(node, 1, 107455, false); } - if (node.flags & 112 && node.parent.kind === 133 && node.parent.parent.kind === 196) { + if (node.flags & 112 && + node.parent.kind === 133 && + node.parent.parent.kind === 196) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -12885,24 +8228,12 @@ var ts; var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var checker = { - getNodeCount: function () { - return ts.sum(host.getSourceFiles(), "nodeCount"); - }, - getIdentifierCount: function () { - return ts.sum(host.getSourceFiles(), "identifierCount"); - }, - getSymbolCount: function () { - return ts.sum(host.getSourceFiles(), "symbolCount"); - }, - getTypeCount: function () { - return typeCount; - }, - isUndefinedSymbol: function (symbol) { - return symbol === undefinedSymbol; - }, - isArgumentsSymbol: function (symbol) { - return symbol === argumentsSymbol; - }, + getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, + getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, + getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, + getTypeCount: function () { return typeCount; }, + isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, + isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, @@ -12996,7 +8327,9 @@ var ts; return emitResolver; } function error(location, message, arg0, arg1, arg2) { - var diagnostic = location ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); + var diagnostic = location + ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) + : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); diagnostics.add(diagnostic); } function createSymbol(flags, name) { @@ -13082,7 +8415,8 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = target.flags & 2 || source.flags & 2 + ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { error(node.name ? node.name : node, message, symbolToString(source)); }); @@ -13269,18 +8603,18 @@ var ts; } function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert((result.flags & 2) !== 0); - var declaration = ts.forEach(result.declarations, function (d) { - return ts.isBlockOrCatchScoped(d) ? d : undefined; - }); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { var variableDeclaration = ts.getAncestor(declaration, 193); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 175 || variableDeclaration.parent.parent.kind === 181) { + if (variableDeclaration.parent.parent.kind === 175 || + variableDeclaration.parent.parent.kind === 181) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 183 || variableDeclaration.parent.parent.kind === 182) { + else if (variableDeclaration.parent.parent.kind === 183 || + variableDeclaration.parent.parent.kind === 182) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -13301,12 +8635,15 @@ var ts; return false; } function isAliasSymbolDeclaration(node) { - return node.kind === 203 || node.kind === 205 && !!node.name || node.kind === 206 || node.kind === 208 || node.kind === 212 || node.kind === 209; + return node.kind === 203 || + node.kind === 205 && !!node.name || + node.kind === 206 || + node.kind === 208 || + node.kind === 212 || + node.kind === 209; } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { - return isAliasSymbolDeclaration(d) ? d : undefined; - }); + return ts.forEach(symbol.declarations, function (d) { return isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { if (node.moduleReference.kind === 213) { @@ -13347,7 +8684,9 @@ var ts; return getExternalModuleMember(node.parent.parent.parent, node); } function getTargetOfExportSpecifier(node) { - return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); + return node.parent.parent.moduleSpecifier ? + getExternalModuleMember(node.parent.parent, node) : + resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); } function getTargetOfExportAssignment(node) { return resolveEntityName(node.expression, 107455 | 793056 | 1536); @@ -13566,7 +8905,9 @@ var ts; return getMergedSymbol(symbol.parent); } function getExportSymbolOfValueSymbolIfExported(symbol) { - return symbol && (symbol.flags & 1048576) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; + return symbol && (symbol.flags & 1048576) !== 0 + ? getMergedSymbol(symbol.exportSymbol) + : symbol; } function symbolIsValue(symbol) { if (symbol.flags & 16777216) { @@ -13605,7 +8946,10 @@ var ts; return type; } function isReservedMemberName(name) { - return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && name.charCodeAt(2) !== 95 && name.charCodeAt(2) !== 64; + return name.charCodeAt(0) === 95 && + name.charCodeAt(1) === 95 && + name.charCodeAt(2) !== 95 && + name.charCodeAt(2) !== 64; } function getNamedMembers(members) { var result; @@ -13679,28 +9023,24 @@ var ts; } function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { - return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && + canQualifySymbol(symbolFromSymbolTable, meaning); } } if (isAccessible(ts.lookUp(symbols, symbol.name))) { - return [ - symbol - ]; + return [symbol]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608) { - if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [ - symbolFromSymbolTable - ]; + return [symbolFromSymbolTable]; } var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [ - symbolFromSymbolTable - ].concat(accessibleSymbolsFromExports); + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); } } } @@ -13765,9 +9105,7 @@ var ts; errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) }; } - return { - accessibility: 0 - }; + return { accessibility: 0 }; function getExternalModuleContainer(declaration) { for (; declaration; declaration = declaration.parent) { if (hasExternalModuleSymbol(declaration)) { @@ -13777,22 +9115,20 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 200 && declaration.name.kind === 8) || (declaration.kind === 221 && ts.isExternalModule(declaration)); + return (declaration.kind === 200 && declaration.name.kind === 8) || + (declaration.kind === 221 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; - if (ts.forEach(symbol.declarations, function (declaration) { - return !getIsDeclarationVisible(declaration); - })) { + if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { return undefined; } - return { - accessibility: 0, - aliasesToMakeVisible: aliasesToMakeVisible - }; + return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 203 && !(declaration.flags & 1) && isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 203 && + !(declaration.flags & 1) && + isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -13800,9 +9136,7 @@ var ts; } } else { - aliasesToMakeVisible = [ - declaration - ]; + aliasesToMakeVisible = [declaration]; } return true; } @@ -13816,7 +9150,8 @@ var ts; if (entityName.parent.kind === 142) { meaning = 107455 | 1048576; } - else if (entityName.kind === 125 || entityName.parent.kind === 203) { + else if (entityName.kind === 125 || + entityName.parent.kind === 203) { meaning = 1536; } else { @@ -13902,7 +9237,8 @@ var ts; function walkSymbol(symbol, meaning) { if (symbol) { var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); - if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { @@ -13935,7 +9271,8 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { if (type.flags & 1048703) { - writer.writeKeyword(!(globalFlags & 16) && (type.flags & 1) ? "any" : type.intrinsicName); + writer.writeKeyword(!(globalFlags & 16) && + (type.flags & 1) ? "any" : type.intrinsicName); } else if (type.flags & 4096) { writeTypeReference(type, flags); @@ -14028,14 +9365,16 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.flags & 128; - })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 221 || declaration.parent.kind === 201; - })); + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && + ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && + (type.symbol.parent || + ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.parent.kind === 221 || declaration.parent.kind === 201; + })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { - return !!(flags & 2) || (typeStack && ts.contains(typeStack, type)); + return !!(flags & 2) || + (typeStack && ts.contains(typeStack, type)); } } } @@ -14321,7 +9660,8 @@ var ts; case 199: case 203: var _parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 203 && _parent.kind !== 221 && ts.isInAmbientContext(_parent))) { + if (!(ts.getCombinedNodeFlags(node) & 1) && + !(node.kind !== 203 && _parent.kind !== 221 && ts.isInAmbientContext(_parent))) { return isGlobalSourceFile(_parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(_parent); @@ -14376,9 +9716,7 @@ var ts; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); - return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { - return anyType; - })) : classType; + return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; } function getTypeOfPropertyOfType(type, name) { var prop = getPropertyOfType(type, name); @@ -14399,7 +9737,9 @@ var ts; var type; if (pattern.kind === 148) { var _name = declaration.propertyName || declaration.name; - type = getTypeOfPropertyOfType(parentType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); + type = getTypeOfPropertyOfType(parentType, _name.text) || + isNumericLiteralName(_name.text) && getIndexTypeOfType(parentType, 1) || + getIndexTypeOfType(parentType, 0); if (!type) { error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(_name)); return unknownType; @@ -14495,7 +9835,9 @@ var ts; return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 148 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); + return pattern.kind === 148 + ? getTypeFromObjectBindingPattern(pattern) + : getTypeFromArrayBindingPattern(pattern); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -14539,7 +9881,9 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + var diagnostic = symbol.valueDeclaration.type ? + ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : + ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); } } @@ -14673,9 +10017,7 @@ var ts; ts.forEach(declaration.typeParameters, function (node) { var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); if (!result) { - result = [ - tp - ]; + result = [tp]; } else if (!ts.contains(result, tp)) { result.push(tp); @@ -14922,15 +10264,14 @@ var ts; var baseType = classType.baseTypes[0]; var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1); return ts.map(baseSignatures, function (baseSignature) { - var signature = baseType.flags & 4096 ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); + var signature = baseType.flags & 4096 ? + getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); signature.typeParameters = classType.typeParameters; signature.resolvedReturnType = classType; return signature; }); } - return [ - createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false) - ]; + return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; } function createTupleTypeMemberSymbols(memberTypes) { var members = {}; @@ -14959,9 +10300,7 @@ var ts; return true; } function getUnionSignatures(types, kind) { - var signatureLists = ts.map(types, function (t) { - return getSignaturesOfType(t, kind); - }); + var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; for (var _i = 0, _n = signatures.length; _i < _n; _i++) { var signature = signatures[_i]; @@ -14978,9 +10317,7 @@ var ts; for (var i = 0; i < result.length; i++) { var s = result[i]; s.resolvedReturnType = undefined; - s.unionSignatures = ts.map(signatureLists, function (signatures) { - return signatures[i]; - }); + s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); } return result; } @@ -15131,9 +10468,7 @@ var ts; return undefined; } if (!props) { - props = [ - prop - ]; + props = [prop]; } else { props.push(prop); @@ -15233,7 +10568,8 @@ var ts; var links = getNodeLinks(declaration); if (!links.resolvedSignature) { var classType = declaration.kind === 133 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; - var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; + var typeParameters = classType ? classType.typeParameters : + declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; @@ -15365,12 +10701,8 @@ var ts; var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; - type.callSignatures = !isConstructor ? [ - signature - ] : emptyArray; - type.constructSignatures = isConstructor ? [ - signature - ] : emptyArray; + type.callSignatures = !isConstructor ? [signature] : emptyArray; + type.constructSignatures = isConstructor ? [signature] : emptyArray; signature.isolatedSignatureType = type; } return signature.isolatedSignatureType; @@ -15398,7 +10730,9 @@ var ts; } function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); - return declaration ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType : undefined; + return declaration + ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType + : undefined; } function getConstraintOfTypeParameter(type) { if (!type.constraint) { @@ -15454,9 +10788,7 @@ var ts; return links.isIllegalTypeReferenceInConstraint; } var currentNode = typeReferenceNode; - while (!ts.forEach(typeParameterSymbol.declarations, function (d) { - return d.parent === currentNode.parent; - })) { + while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } links.isIllegalTypeReferenceInConstraint = currentNode.kind === 127; @@ -15470,9 +10802,7 @@ var ts; if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); if (symbol && (symbol.flags & 262144)) { - links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { - return d.parent == typeParameter.parent; - }); + links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); } } if (links.isIllegalTypeReferenceInConstraint) { @@ -15571,9 +10901,7 @@ var ts; } function createArrayType(elementType) { var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); - return arrayType !== emptyObjectType ? createTypeReference(arrayType, [ - elementType - ]) : emptyObjectType; + return arrayType !== emptyObjectType ? createTypeReference(arrayType, [elementType]) : emptyObjectType; } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); @@ -15763,21 +11091,15 @@ var ts; return items; } function createUnaryTypeMapper(source, target) { - return function (t) { - return t === source ? target : t; - }; + return function (t) { return t === source ? target : t; }; } function createBinaryTypeMapper(source1, target1, source2, target2) { - return function (t) { - return t === source1 ? target1 : t === source2 ? target2 : t; - }; + return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } function createTypeMapper(sources, targets) { switch (sources.length) { - case 1: - return createUnaryTypeMapper(sources[0], targets[0]); - case 2: - return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); + case 1: return createUnaryTypeMapper(sources[0], targets[0]); + case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); } return function (t) { for (var i = 0; i < sources.length; i++) { @@ -15789,21 +11111,15 @@ var ts; }; } function createUnaryTypeEraser(source) { - return function (t) { - return t === source ? anyType : t; - }; + return function (t) { return t === source ? anyType : t; }; } function createBinaryTypeEraser(source1, source2) { - return function (t) { - return t === source1 || t === source2 ? anyType : t; - }; + return function (t) { return t === source1 || t === source2 ? anyType : t; }; } function createTypeEraser(sources) { switch (sources.length) { - case 1: - return createUnaryTypeEraser(sources[0]); - case 2: - return createBinaryTypeEraser(sources[0], sources[1]); + case 1: return createUnaryTypeEraser(sources[0]); + case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { for (var _i = 0, _n = sources.length; _i < _n; _i++) { @@ -15829,9 +11145,7 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { - return mapper2(mapper1(t)); - }; + return function (t) { return mapper2(mapper1(t)); }; } function instantiateTypeParameter(typeParameter, mapper) { var result = createType(512); @@ -15892,7 +11206,8 @@ var ts; return mapper(type); } if (type.flags & 32768) { - return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? instantiateAnonymousType(type, mapper) : type; + return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? + instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096) { return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); @@ -15917,9 +11232,11 @@ var ts; case 151: return ts.forEach(node.elements, isContextSensitive); case 168: - return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); + return isContextSensitive(node.whenTrue) || + isContextSensitive(node.whenFalse); case 167: - return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); + return node.operatorToken.kind === 49 && + (isContextSensitive(node.left) || isContextSensitive(node.right)); case 218: return isContextSensitive(node.initializer); case 132: @@ -15931,9 +11248,7 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { - return p.type; - }); + return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); } function getTypeWithoutConstructors(type) { if (type.flags & 48128) { @@ -16072,7 +11387,8 @@ var ts; } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (_result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && + (_result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; return _result; } @@ -16533,7 +11849,9 @@ var ts; if (source === target) { return -1; } - if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { + if (source.parameters.length !== target.parameters.length || + source.minArgumentCount !== target.minArgumentCount || + source.hasRestParameter !== target.hasRestParameter) { return 0; } var result = -1; @@ -16577,9 +11895,7 @@ var ts; return true; } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { - return isSupertypeOfEach(t, types) ? t : undefined; - }); + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { var bestSupertype; @@ -16699,7 +12015,9 @@ var ts; diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; case 128: - diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + diagnostic = declaration.dotDotDotToken ? + ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : + ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; case 195: case 132: @@ -16756,10 +12074,7 @@ var ts; var inferences = []; for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { var unused = typeParameters[_i]; - inferences.push({ - primary: undefined, - secondary: undefined - }); + inferences.push({ primary: undefined, secondary: undefined }); } return { typeParameters: typeParameters, @@ -16806,7 +12121,9 @@ var ts; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { var inferences = context.inferences[i]; - var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); + var candidates = inferiority ? + inferences.secondary || (inferences.secondary = []) : + inferences.primary || (inferences.primary = []); if (!ts.contains(candidates, source)) candidates.push(source); break; @@ -16847,7 +12164,8 @@ var ts; inferFromTypes(sourceType, target); } } - else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || + (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -16957,12 +12275,8 @@ var ts; function removeTypesFromUnionType(type, typeKind, isOfTypeKind, allowEmptyUnionResult) { if (type.flags & 16384) { var types = type.types; - if (ts.forEach(types, function (t) { - return !!(t.flags & typeKind) === isOfTypeKind; - })) { - var narrowedType = getUnionType(ts.filter(types, function (t) { - return !(t.flags & typeKind) === isOfTypeKind; - })); + if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { + var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { return narrowedType; } @@ -17056,13 +12370,12 @@ var ts; function resolveLocation(node) { var containerNodes = []; for (var _parent = node.parent; _parent; _parent = _parent.parent) { - if ((ts.isExpression(_parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(_parent)) { + if ((ts.isExpression(_parent) || ts.isObjectLiteralMethod(node)) && + isContextSensitive(_parent)) { containerNodes.unshift(_parent); } } - ts.forEach(containerNodes, function (node) { - getTypeOfNode(node); - }); + ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); } function getSymbolAtLocation(node) { resolveLocation(node); @@ -17191,9 +12504,7 @@ var ts; return targetType; } if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { - return isTypeSubtypeOf(t, targetType); - })); + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); } return type; } @@ -17249,7 +12560,9 @@ var ts; return false; } function checkBlockScopedBindingCapturedInLoop(node, symbol) { - if (languageVersion >= 2 || (symbol.flags & 2) === 0 || symbol.valueDeclaration.parent.kind === 217) { + if (languageVersion >= 2 || + (symbol.flags & 2) === 0 || + symbol.valueDeclaration.parent.kind === 217) { return; } var container = symbol.valueDeclaration; @@ -17357,10 +12670,21 @@ var ts; } if (container && container.parent && container.parent.kind === 196) { if (container.flags & 128) { - canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135; + canUseSuperExpression = + container.kind === 132 || + container.kind === 131 || + container.kind === 134 || + container.kind === 135; } else { - canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135 || container.kind === 130 || container.kind === 129 || container.kind === 133; + canUseSuperExpression = + container.kind === 132 || + container.kind === 131 || + container.kind === 134 || + container.kind === 135 || + container.kind === 130 || + container.kind === 129 || + container.kind === 133; } } } @@ -17407,7 +12731,8 @@ var ts; if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } - if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + if (indexOfParameter === (func.parameters.length - 1) && + funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); } } @@ -17493,10 +12818,7 @@ var ts; mappedType = t; } else if (!mappedTypes) { - mappedTypes = [ - mappedType, - t - ]; + mappedTypes = [mappedType, t]; } else { mappedTypes.push(t); @@ -17512,17 +12834,13 @@ var ts; }); } function getIndexTypeOfContextualType(type, kind) { - return applyToContextualType(type, function (t) { - return getIndexTypeOfObjectOrUnionType(t, kind); - }); + return applyToContextualType(type, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }); } function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } function contextualTypeHasIndexSignature(type, kind) { - return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { - return getIndexTypeOfObjectOrUnionType(t, kind); - }) : getIndexTypeOfObjectOrUnionType(type, kind)); + return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); } function getContextualTypeForObjectLiteralMethod(node) { ts.Debug.assert(ts.isObjectLiteralMethod(node)); @@ -17542,7 +12860,8 @@ var ts; return propertyType; } } - return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || getIndexTypeOfContextualType(type, 0); + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || + getIndexTypeOfContextualType(type, 0); } return undefined; } @@ -17551,7 +12870,9 @@ var ts; var type = getContextualType(arrayLiteral); if (type) { var index = ts.indexOf(arrayLiteral.elements, node); - return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1) || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); + return getTypeOfPropertyOfContextualType(type, "" + index) + || getIndexTypeOfContextualType(type, 1) + || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); } return undefined; } @@ -17615,7 +12936,9 @@ var ts; } function getContextualSignature(node) { ts.Debug.assert(node.kind !== 132 || ts.isObjectLiteralMethod(node)); - var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); + var type = ts.isObjectLiteralMethod(node) + ? getContextualTypeForObjectLiteralMethod(node) + : getContextualType(node); if (!type) { return undefined; } @@ -17626,15 +12949,14 @@ var ts; var types = type.types; for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; - if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { + if (signatureList && + getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; } var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { - signatureList = [ - signature - ]; + signatureList = [signature]; } else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { return undefined; @@ -17732,7 +13054,9 @@ var ts; for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 218 || + memberDecl.kind === 219 || + ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; if (memberDecl.kind === 218) { type = checkPropertyAssignment(memberDecl, contextualMapper); @@ -17742,7 +13066,9 @@ var ts; } else { ts.Debug.assert(memberDecl.kind === 219); - type = memberDecl.name.kind === 126 ? unknownType : checkExpression(memberDecl.name, contextualMapper); + type = memberDecl.name.kind === 126 + ? unknownType + : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -17858,7 +13184,9 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 153 ? node.expression : node.left; + var left = node.kind === 153 + ? node.expression + : node.left; var type = checkExpressionOrQualifiedName(left); if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); @@ -17895,7 +13223,8 @@ var ts; return unknownType; } var isConstEnum = isConstEnumObjectType(objectType); - if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + if (isConstEnum && + (!node.argumentExpression || node.argumentExpression.kind !== 8)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } @@ -18062,7 +13391,8 @@ var ts; callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; } - var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + var hasRightNumberOfTypeArgs = !typeArguments || + (signature.typeParameters && typeArguments.length === signature.typeParameters.length); if (!hasRightNumberOfTypeArgs) { return false; } @@ -18079,7 +13409,8 @@ var ts; function getSingleCallSignature(type) { if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); - if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && + resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { return resolved.callSignatures[0]; } } @@ -18150,7 +13481,9 @@ var ts; var arg = args[i]; if (arg.kind !== 172) { var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); - var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : + arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : + checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { return false; } @@ -18162,9 +13495,7 @@ var ts; var args; if (node.kind === 157) { var template = node.template; - args = [ - template - ]; + args = [template]; if (template.kind === 169) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); @@ -18419,7 +13750,10 @@ var ts; } if (node.kind === 156) { var declaration = signature.declaration; - if (declaration && declaration.kind !== 133 && declaration.kind !== 137 && declaration.kind !== 141) { + if (declaration && + declaration.kind !== 133 && + declaration.kind !== 137 && + declaration.kind !== 141) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -18444,9 +13778,13 @@ var ts; } function getTypeAtPosition(signature, pos) { if (pos >= 0) { - return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + return signature.hasRestParameter ? + pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : + pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; } - return signature.hasRestParameter ? getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : anyArrayType; + return signature.hasRestParameter ? + getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : + anyArrayType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -18595,16 +13933,14 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 64: - { - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; - } - case 153: - { - var _symbol = findSymbol(n); - return !_symbol || _symbol === unknownSymbol || (_symbol.flags & ~8) !== 0; - } + case 64: { + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + } + case 153: { + var _symbol = findSymbol(n); + return !_symbol || _symbol === unknownSymbol || (_symbol.flags & ~8) !== 0; + } case 154: return true; case 159: @@ -18616,22 +13952,20 @@ var ts; function isConstVariableReference(n) { switch (n.kind) { case 64: - case 153: - { - var symbol = findSymbol(n); - return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; - } - case 154: - { - var index = n.argumentExpression; - var _symbol = findSymbol(n.expression); - if (_symbol && index && index.kind === 8) { - var _name = index.text; - var prop = getPropertyOfType(getTypeOfSymbol(_symbol), _name); - return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; - } - return false; + case 153: { + var symbol = findSymbol(n); + return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; + } + case 154: { + var index = n.argumentExpression; + var _symbol = findSymbol(n.expression); + if (_symbol && index && index.kind === 8) { + var _name = index.text; + var prop = getPropertyOfType(getTypeOfSymbol(_symbol), _name); + return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; } + return false; + } case 159: return isConstVariableReference(n.expression); default: @@ -18759,7 +14093,10 @@ var ts; var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var _name = p.name; - var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); + var type = sourceType.flags & 1 ? sourceType : + getTypeOfPropertyOfType(sourceType, _name.text) || + isNumericLiteralName(_name.text) && getIndexTypeOfType(sourceType, 1) || + getIndexTypeOfType(sourceType, 0); if (type) { checkDestructuringAssignment(p.initializer || _name, type); } @@ -18784,7 +14121,9 @@ var ts; if (e.kind !== 172) { if (e.kind !== 171) { var propName = "" + i; - var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); + var type = sourceType.flags & 1 ? sourceType : + isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : + getIndexTypeOfType(sourceType, 1); if (type) { checkDestructuringAssignment(e, type, contextualMapper); } @@ -18865,7 +14204,9 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var suggestedOperator; - if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + if ((leftType.flags & 8) && + (rightType.flags & 8) && + (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { @@ -18927,10 +14268,7 @@ var ts; case 48: return rightType; case 49: - return getUnionType([ - leftType, - rightType - ]); + return getUnionType([leftType, rightType]); case 52: checkAssignmentOperator(rightType); return rightType; @@ -18938,7 +14276,9 @@ var ts; return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : + someConstituentTypeHasKind(rightType, 1048576) ? node.right : + undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); return false; @@ -18984,10 +14324,7 @@ var ts; checkExpression(node.condition); var type1 = checkExpression(node.whenTrue, contextualMapper); var type2 = checkExpression(node.whenFalse, contextualMapper); - return getUnionType([ - type1, - type2 - ]); + return getUnionType([type1, type2]); } function checkTemplateExpression(node) { ts.forEach(node.templateSpans, function (templateSpan) { @@ -19051,7 +14388,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 153 && node.parent.expression === node) || (node.parent.kind === 154 && node.parent.expression === node) || ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 153 && node.parent.expression === node) || + (node.parent.kind === 154 && node.parent.expression === node) || + ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -19161,7 +14500,9 @@ var ts; if (node.kind === 138) { checkGrammarIndexSignature(node); } - else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || node.kind === 136 || node.kind === 133 || node.kind === 137) { + else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || + node.kind === 136 || node.kind === 133 || + node.kind === 137) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -19255,10 +14596,8 @@ var ts; case 160: case 195: case 161: - case 152: - return false; - default: - return ts.forEachChild(n, containsSuperCall); + case 152: return false; + default: return ts.forEachChild(n, containsSuperCall); } } function markThisReferencesAsErrors(n) { @@ -19270,13 +14609,14 @@ var ts; } } function isInstancePropertyWithInitializer(n) { - return n.kind === 130 && !(n.flags & 128) && !!n.initializer; + return n.kind === 130 && + !(n.flags & 128) && + !!n.initializer; } if (ts.getClassBaseTypeNode(node.parent)) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { - return p.flags & (16 | 32 | 64); - }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || + ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); if (superCallShouldBeFirst) { var statements = node.body.statements; if (!statements.length || statements[0].kind !== 177 || !isSuperCallExpression(statements[0].expression)) { @@ -19599,16 +14939,16 @@ var ts; case 197: return 2097152; case 200: - return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; + return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 + ? 4194304 | 1048576 + : 4194304; case 196: case 199: return 2097152 | 1048576; case 203: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { - result |= getDeclarationSpaces(d); - }); + ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); return result; default: return 1048576; @@ -19617,7 +14957,10 @@ var ts; } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); + checkFunctionLikeDeclaration(node) || + checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionName(node.name) || + checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -19672,7 +15015,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 130 || node.kind === 129 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135) { + if (node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 131 || + node.kind === 134 || + node.kind === 135) { return false; } if (ts.isInAmbientContext(node)) { @@ -19740,11 +15088,17 @@ var ts; var symbol = getSymbolOfNode(node); if (symbol.flags & 1) { var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); - if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { + if (localDeclarationSymbol && + localDeclarationSymbol !== symbol && + localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 194); - var container = varDeclList.parent.kind === 175 && varDeclList.parent.parent; - var namesShareScope = container && (container.kind === 174 && ts.isFunctionLike(container.parent) || (container.kind === 201 && container.kind === 200) || container.kind === 221); + var container = varDeclList.parent.kind === 175 && + varDeclList.parent.parent; + var namesShareScope = container && + (container.kind === 174 && ts.isFunctionLike(container.parent) || + (container.kind === 201 && container.kind === 200) || + container.kind === 221); if (!namesShareScope) { var _name = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, _name, _name); @@ -19961,15 +15315,17 @@ var ts; } function checkRightHandSideOfForOf(rhsExpression) { var expressionType = getTypeOfExpression(rhsExpression); - return languageVersion >= 2 ? checkIteratedType(expressionType, rhsExpression) : checkElementTypeOfArrayOrString(expressionType, rhsExpression); + return languageVersion >= 2 + ? checkIteratedType(expressionType, rhsExpression) + : checkElementTypeOfArrayOrString(expressionType, rhsExpression); } function checkIteratedType(iterable, expressionForError) { ts.Debug.assert(languageVersion >= 2); var iteratedType = getIteratedType(iterable, expressionForError); if (expressionForError && iteratedType) { - var completeIterableType = globalIterableType !== emptyObjectType ? createTypeReference(globalIterableType, [ - iteratedType - ]) : emptyObjectType; + var completeIterableType = globalIterableType !== emptyObjectType + ? createTypeReference(globalIterableType, [iteratedType]) + : emptyObjectType; checkTypeAssignableTo(iterable, completeIterableType, expressionForError); } return iteratedType; @@ -20033,7 +15389,9 @@ var ts; } if (!isArrayLikeType(arrayType)) { if (!reportedError) { - var diagnostic = hasStringConstituent ? ts.Diagnostics.Type_0_is_not_an_array_type : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + var diagnostic = hasStringConstituent + ? ts.Diagnostics.Type_0_is_not_an_array_type + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; error(expressionForError, diagnostic, typeToString(arrayType)); } return hasStringConstituent ? stringType : unknownType; @@ -20043,10 +15401,7 @@ var ts; if (arrayElementType.flags & 258) { return stringType; } - return getUnionType([ - arrayElementType, - stringType - ]); + return getUnionType([arrayElementType, stringType]); } return arrayElementType; } @@ -20208,9 +15563,7 @@ var ts; if (stringIndexType && numberIndexType) { errorNode = declaredNumberIndexer || declaredStringIndexer; if (!errorNode && (type.flags & 2048)) { - var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { - return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); - }); + var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); }); errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; } } @@ -20232,13 +15585,13 @@ var ts; _errorNode = indexDeclaration; } else if (containingType.flags & 2048) { - var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { - return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); - }); + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); _errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } if (_errorNode && !isTypeAssignableTo(propertyType, indexType)) { - var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + var errorMessage = indexKind === 0 + ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 + : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; error(_errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); } } @@ -20403,12 +15756,7 @@ var ts; return true; } var seen = {}; - ts.forEach(type.declaredProperties, function (p) { - seen[p.name] = { - prop: p, - containingType: type - }; - }); + ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { var base = _a[_i]; @@ -20416,10 +15764,7 @@ var ts; for (var _b = 0, _c = properties.length; _b < _c; _b++) { var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { - seen[prop.name] = { - prop: prop, - containingType: base - }; + seen[prop.name] = { prop: prop, containingType: base }; } else { var existing = seen[prop.name]; @@ -20522,12 +15867,9 @@ var ts; return undefined; } switch (e.operator) { - case 33: - return value; - case 34: - return -value; - case 47: - return enumIsConst ? ~value : undefined; + case 33: return value; + case 34: return -value; + case 47: return enumIsConst ? ~value : undefined; } return undefined; case 167: @@ -20543,28 +15885,17 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 44: - return left | right; - case 43: - return left & right; - case 41: - return left >> right; - case 42: - return left >>> right; - case 40: - return left << right; - case 45: - return left ^ right; - case 35: - return left * right; - case 36: - return left / right; - case 33: - return left + right; - case 34: - return left - right; - case 37: - return left % right; + case 44: return left | right; + case 43: return left & right; + case 41: return left >> right; + case 42: return left >>> right; + case 40: return left << right; + case 45: return left ^ right; + case 35: return left * right; + case 36: return left / right; + case 33: return left + right; + case 34: return left - right; + case 37: return left % right; } return undefined; case 7: @@ -20587,7 +15918,8 @@ var ts; } else { if (e.kind === 154) { - if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { + if (e.argumentExpression === undefined || + e.argumentExpression.kind !== 8) { return undefined; } _enumType = getTypeOfNode(e.expression); @@ -20683,7 +16015,10 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + if (symbol.flags & 512 + && symbol.declarations.length > 1 + && !ts.isInAmbientContext(node) + && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -20719,7 +16054,9 @@ var ts; } var inAmbientExternalModule = node.parent.kind === 201 && node.parent.parent.name.kind === 8; if (node.parent.kind !== 221 && !inAmbientExternalModule) { - error(moduleName, node.kind === 210 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + error(moduleName, node.kind === 210 ? + ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : + ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { @@ -20732,9 +16069,13 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | + (symbol.flags & 793056 ? 793056 : 0) | + (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 212 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; + var message = node.kind === 212 ? + ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : + ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); } } @@ -21168,7 +16509,9 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 64 && isTypeDeclaration(name.parent) && name.parent.name === name; + return name.kind == 64 && + isTypeDeclaration(name.parent) && + name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { @@ -21262,7 +16605,8 @@ var ts; return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 125 && node.parent.right === node) || (node.parent.kind === 153 && node.parent.name === node); + return (node.parent.kind === 125 && node.parent.right === node) || + (node.parent.kind === 153 && node.parent.name === node); } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { @@ -21317,7 +16661,9 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 64 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 209 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); + return node.parent.kind === 209 + ? getSymbolOfEntityNameOrPropertyAccessExpression(node) + : getSymbolOfPartOfRightHandSideOfImportEquals(node); } switch (node.kind) { case 64: @@ -21336,7 +16682,10 @@ var ts; return undefined; case 8: var moduleName; - if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || ((node.parent.kind === 204 || node.parent.kind === 210) && node.parent.moduleSpecifier === node)) { + if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && + ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || + ((node.parent.kind === 204 || node.parent.kind === 210) && + node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 7: @@ -21422,14 +16771,10 @@ var ts; else if (symbol.flags & 67108864) { var target = getSymbolLinks(symbol).target; if (target) { - return [ - target - ]; + return [target]; } } - return [ - symbol - ]; + return [symbol]; } function isExternalModuleSymbol(symbol) { return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 221; @@ -21511,7 +16856,8 @@ var ts; } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 8 ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + var baseName = expr.kind === 8 ? + ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; assignGeneratedName(node, makeUniqueName(baseName)); } function generateNameForImportDeclaration(node) { @@ -21609,7 +16955,8 @@ var ts; if (ts.nodeIsPresent(node.body)) { var symbol = getSymbolOfNode(node); var signaturesOfSymbol = getSignaturesOfSymbol(symbol); - return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + return signaturesOfSymbol.length > 1 || + (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); } return false; } @@ -21636,7 +16983,9 @@ var ts; } function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { var symbol = getSymbolOfNode(declaration); - var type = symbol && !(symbol.flags & (2048 | 131072)) ? getTypeOfSymbol(symbol) : unknownType; + var type = symbol && !(symbol.flags & (2048 | 131072)) + ? getTypeOfSymbol(symbol) + : unknownType; getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -21645,19 +16994,29 @@ var ts; } function isUnknownIdentifier(location, name) { ts.Debug.assert(!ts.nodeIsSynthesized(location), "isUnknownIdentifier called with a synthesized location"); - return !resolveName(location, name, 107455, undefined, undefined) && !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); + return !resolveName(location, name, 107455, undefined, undefined) && + !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - if (n.parent.kind === 153 && n.parent.name === n) { + if (n.parent.kind === 153 && + n.parent.name === n) { return undefined; } - if (n.parent.kind === 150 && n.parent.propertyName === n) { + if (n.parent.kind === 150 && + n.parent.propertyName === n) { return undefined; } - var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || n.parent.kind === 150 ? getSymbolOfNode(n.parent) : undefined; - var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); - var isLetOrConst = symbol && (symbol.flags & 2) && symbol.valueDeclaration.parent.kind !== 217; + var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || + n.parent.kind === 150 + ? getSymbolOfNode(n.parent) + : undefined; + var symbol = declarationSymbol || + getNodeLinks(n).resolvedSymbol || + resolveName(n, n.text, 107455 | 8388608, undefined, undefined); + var isLetOrConst = symbol && + (symbol.flags & 2) && + symbol.valueDeclaration.parent.kind !== 217; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -21947,7 +17306,8 @@ var ts; } } function checkGrammarTypeArguments(node, typeArguments) { - return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + return checkGrammarForDisallowedTrailingComma(typeArguments) || + checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { @@ -21961,7 +17321,8 @@ var ts; } } function checkGrammarArguments(node, arguments) { - return checkGrammarForDisallowedTrailingComma(arguments) || checkGrammarForOmittedArgument(node, arguments); + return checkGrammarForDisallowedTrailingComma(arguments) || + checkGrammarForOmittedArgument(node, arguments); } function checkGrammarHeritageClause(node) { var types = node.types; @@ -22055,7 +17416,8 @@ var ts; for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var prop = _a[_i]; var _name = prop.name; - if (prop.kind === 172 || _name.kind === 126) { + if (prop.kind === 172 || + _name.kind === 126) { checkGrammarComputedPropertyName(_name); continue; } @@ -22111,16 +17473,22 @@ var ts; var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + var diagnostic = forInOrOfStatement.kind === 182 + ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement + : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var _diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + var _diagnostic = forInOrOfStatement.kind === 182 + ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer + : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, _diagnostic); } if (firstDeclaration.type) { - var _diagnostic_1 = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + var _diagnostic_1 = forInOrOfStatement.kind === 182 + ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation + : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, _diagnostic_1); } } @@ -22174,7 +17542,9 @@ var ts; } } function checkGrammarMethod(node) { - if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarForGenerator(node)) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionLikeDeclaration(node) || + checkGrammarForGenerator(node)) { return true; } if (node.parent.kind === 152) { @@ -22225,7 +17595,8 @@ var ts; switch (current.kind) { case 189: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 184 && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 184 + && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } @@ -22246,11 +17617,15 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + var message = node.kind === 185 + ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement + : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var _message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + var _message = node.kind === 185 + ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement + : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, _message); } } @@ -22287,7 +17662,8 @@ var ts; } } var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); - return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || + checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 64) { @@ -22420,7 +17796,8 @@ var ts; } function checkGrammarProperty(node) { if (node.parent.kind === 196) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || + checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } @@ -22439,7 +17816,12 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 197 || node.kind === 204 || node.kind === 203 || node.kind === 210 || node.kind === 209 || (node.flags & 2)) { + if (node.kind === 197 || + node.kind === 204 || + node.kind === 203 || + node.kind === 210 || + node.kind === 209 || + (node.flags & 2)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -22501,10 +17883,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var indentStrings = [ - "", - " " - ]; + var indentStrings = ["", " "]; function getIndentString(level) { if (indentStrings[level] === undefined) { indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; @@ -22579,34 +17958,21 @@ var ts; writeTextOfNode: writeTextOfNode, writeLiteral: writeLiteral, writeLine: writeLine, - increaseIndent: function () { - return indent++; - }, - decreaseIndent: function () { - return indent--; - }, - getIndent: function () { - return indent; - }, - getTextPos: function () { - return output.length; - }, - getLine: function () { - return lineCount + 1; - }, - getColumn: function () { - return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; - }, - getText: function () { - return output; - } + increaseIndent: function () { return indent++; }, + decreaseIndent: function () { return indent--; }, + getIndent: function () { return indent; }, + getTextPos: function () { return output.length; }, + getLine: function () { return lineCount + 1; }, + getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, + getText: function () { return output; } }; } function getLineOfLocalPosition(currentSourceFile, pos) { return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { - if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && + getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -22635,7 +18001,9 @@ var ts; var lineCount = ts.getLineStarts(currentSourceFile).length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); + var nextLineStart = (currentLine + 1) === lineCount + ? currentSourceFile.text.length + 1 + : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { firstCommentLineIndent = calculateIndent(ts.getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); @@ -22713,7 +18081,8 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 134 || member.kind === 135) && (member.flags & 128) === (accessor.flags & 128)) { + if ((member.kind === 134 || member.kind === 135) + && (member.flags & 128) === (accessor.flags & 128)) { var memberName = ts.getPropertyNameForPropertyNameNode(member.name); var accessorName = ts.getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -22770,8 +18139,7 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { - } : writeJsDocComments; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var aliasDeclarationEmitInfo = []; var referencePathsOutput = ""; @@ -22780,7 +18148,9 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 2048) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { + if (referencedFile && ((referencedFile.flags & 2048) || + shouldEmitToOwnFile(referencedFile, compilerOptions) || + !addedGlobalFileReference)) { writeReferencePath(referencedFile); if (!isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -22797,7 +18167,8 @@ var ts; if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && + !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } @@ -22851,9 +18222,7 @@ var ts; function writeAsychronousImportEqualsDeclarations(importEqualsDeclarations) { var oldWriter = writer; ts.forEach(importEqualsDeclarations, function (aliasToWrite) { - var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { - return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; - }); + var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; }); if (aliasEmitInfo) { createAndSetNewTextWriterWithSymbolWriter(); for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { @@ -23180,8 +18549,15 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 140 || node.parent.kind === 141 || (node.parent.parent && node.parent.parent.kind === 143)) { - ts.Debug.assert(node.parent.kind === 132 || node.parent.kind === 131 || node.parent.kind === 140 || node.parent.kind === 141 || node.parent.kind === 136 || node.parent.kind === 137); + if (node.parent.kind === 140 || + node.parent.kind === 141 || + (node.parent.parent && node.parent.parent.kind === 143)) { + ts.Debug.assert(node.parent.kind === 132 || + node.parent.kind === 131 || + node.parent.kind === 140 || + node.parent.kind === 141 || + node.parent.kind === 136 || + node.parent.kind === 137); emitType(node.constraint); } else { @@ -23244,7 +18620,9 @@ var ts; function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.parent.parent.kind === 196) { - diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + diagnosticMessage = isImplementsList ? + ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : + ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; @@ -23277,9 +18655,7 @@ var ts; emitTypeParameters(node.typeParameters); var baseTypeNode = ts.getClassBaseTypeNode(node); if (baseTypeNode) { - emitHeritageClause([ - baseTypeNode - ], false); + emitHeritageClause([baseTypeNode], false); } emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); write(" {"); @@ -23339,17 +18715,31 @@ var ts; function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.kind === 193) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } else if (node.kind === 130 || node.kind === 129) { if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } return diagnosticMessage !== undefined ? { @@ -23366,9 +18756,7 @@ var ts; } } function emitVariableStatement(node) { - var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { - return resolver.isDeclarationVisible(varDeclaration); - }); + var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); if (hasDeclarationWithEmit) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); @@ -23414,17 +18802,25 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 134 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; + return accessor.kind === 134 + ? accessor.type + : accessor.parameters.length > 0 + ? accessor.parameters[0].type + : undefined; } } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (accessorWithTypeAnnotation.kind === 135) { if (accessorWithTypeAnnotation.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } return { diagnosticMessage: diagnosticMessage, @@ -23434,10 +18830,18 @@ var ts; } else { if (accessorWithTypeAnnotation.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; } return { diagnosticMessage: diagnosticMessage, @@ -23451,7 +18855,8 @@ var ts; if (ts.hasDynamicName(node)) { return; } - if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && + !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); if (node.kind === 195) { emitModuleElementDeclarationFlags(node); @@ -23518,28 +18923,48 @@ var ts; var diagnosticMessage; switch (node.kind) { case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 132: case 131: if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: ts.Debug.fail("This is unknown kind for signature: " + node.kind); @@ -23566,7 +18991,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 140 || node.parent.kind === 141 || node.parent.parent.kind === 143) { + if (node.parent.kind === 140 || + node.parent.kind === 141 || + node.parent.parent.kind === 143) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -23576,28 +19003,50 @@ var ts; var diagnosticMessage; switch (node.parent.kind) { case 133: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; break; case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 132: case 131: if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } else if (node.parent.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); @@ -23649,7 +19098,11 @@ var ts; } } function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 2048 ? referencedFile.fileName : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + var declFileName = referencedFile.flags & 2048 + ? referencedFile.fileName + : shouldEmitToOwnFile(referencedFile, compilerOptions) + ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") + : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencePathsOutput += "/// " + newLine; } @@ -23713,28 +19166,20 @@ var ts; var exportSpecifiers; var exportDefault; var writeEmittedFiles = writeJavaScriptFile; - var emitLeadingComments = compilerOptions.removeComments ? function (node) { - } : emitLeadingDeclarationComments; - var emitTrailingComments = compilerOptions.removeComments ? function (node) { - } : emitTrailingDeclarationComments; - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { - } : emitLeadingCommentsOfLocalPosition; + var emitLeadingComments = compilerOptions.removeComments ? function (node) { } : emitLeadingDeclarationComments; + var emitTrailingComments = compilerOptions.removeComments ? function (node) { } : emitTrailingDeclarationComments; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfLocalPosition; var detachedCommentsInfo; - var emitDetachedComments = compilerOptions.removeComments ? function (node) { - } : emitDetachedCommentsAtPosition; + var emitDetachedComments = compilerOptions.removeComments ? function (node) { } : emitDetachedCommentsAtPosition; var writeComment = writeCommentRange; var emitNodeWithoutSourceMap = compilerOptions.removeComments ? emitNodeWithoutSourceMapWithoutComments : emitNodeWithoutSourceMapWithComments; var emit = emitNodeWithoutSourceMap; var emitWithoutComments = emitNodeWithoutSourceMapWithoutComments; - var emitStart = function (node) { - }; - var emitEnd = function (node) { - }; + var emitStart = function (node) { }; + var emitEnd = function (node) { }; var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { - }; - var scopeEmitEnd = function () { - }; + var scopeEmitStart = function (scopeDeclaration, scopeName) { }; + var scopeEmitEnd = function () { }; var sourceMapData; if (compilerOptions.sourceMap) { initializeEmitterWithSourceMaps(); @@ -23760,10 +19205,7 @@ var ts; var names = currentScopeNames; currentScopeNames = undefined; if (names) { - lastFrame = { - names: names, - previous: lastFrame - }; + lastFrame = { names: names, previous: lastFrame }; return true; } return false; @@ -23783,9 +19225,7 @@ var ts; _name = baseName; } else { - _name = ts.generateUniqueName(baseName, function (n) { - return isExistingName(location, n); - }); + _name = ts.generateUniqueName(baseName, function (n) { return isExistingName(location, n); }); } return recordNameInCurrentScope(_name); } @@ -23885,7 +19325,12 @@ var ts; sourceLinePos.character++; var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine != emittedLine || + lastRecordedSourceMapSpan.emittedColumn != emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { encodeLastRecordedSourceMapSpan(); lastRecordedSourceMapSpan = { emittedLine: emittedLine, @@ -23948,10 +19393,20 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 195 || node.kind === 160 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135 || node.kind === 200 || node.kind === 196 || node.kind === 199) { + else if (node.kind === 195 || + node.kind === 160 || + node.kind === 132 || + node.kind === 131 || + node.kind === 134 || + node.kind === 135 || + node.kind === 200 || + node.kind === 196 || + node.kind === 199) { if (node.name) { var _name = node.name; - scopeName = _name.kind === 126 ? ts.getTextOfNode(_name) : node.name.text; + scopeName = _name.kind === 126 + ? ts.getTextOfNode(_name) + : node.name.text; } recordScopeNameStart(scopeName); } @@ -24298,7 +19753,8 @@ var ts; if (node.template.kind === 169) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 167 && templateSpan.expression.operatorToken.kind === 23; + var needsParens = templateSpan.expression.kind === 167 + && templateSpan.expression.operatorToken.kind === 23; emitParenthesizedIf(templateSpan.expression, needsParens); }); } @@ -24309,7 +19765,8 @@ var ts; ts.forEachChild(node, emit); return; } - var emitOuterParens = ts.isExpression(node.parent) && templateNeedsParens(node, node.parent); + var emitOuterParens = ts.isExpression(node.parent) + && templateNeedsParens(node, node.parent); if (emitOuterParens) { write("("); } @@ -24320,7 +19777,8 @@ var ts; } for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 159 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + var needsParens = templateSpan.expression.kind !== 159 + && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); } @@ -24817,9 +20275,7 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { - return e.kind === 171; - }); + return ts.forEach(elements, function (e) { return e.kind === 171; }); } function skipParentheses(node) { while (node.kind === 159 || node.kind === 158) { @@ -24932,7 +20388,14 @@ var ts; while (operand.kind == 158) { operand = operand.expression; } - if (operand.kind !== 165 && operand.kind !== 164 && operand.kind !== 163 && operand.kind !== 162 && operand.kind !== 166 && operand.kind !== 156 && !(operand.kind === 155 && node.parent.kind === 156) && !(operand.kind === 160 && node.parent.kind === 155)) { + if (operand.kind !== 165 && + operand.kind !== 164 && + operand.kind !== 163 && + operand.kind !== 162 && + operand.kind !== 166 && + operand.kind !== 156 && + !(operand.kind === 155 && node.parent.kind === 156) && + !(operand.kind === 160 && node.parent.kind === 155)) { emit(operand); return; } @@ -24975,7 +20438,8 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operatorToken.kind === 52 && (node.left.kind === 152 || node.left.kind === 151)) { + if (languageVersion < 2 && node.operatorToken.kind === 52 && + (node.left.kind === 152 || node.left.kind === 151)) { emitDestructuring(node, node.parent.kind === 177); } else { @@ -25295,13 +20759,16 @@ var ts; emitToken(15, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function nodeEndPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, node2.end); + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { if (node.kind === 214) { @@ -25595,8 +21062,11 @@ var ts; emitModuleMemberName(node); var initializer = node.initializer; if (!initializer && languageVersion < 2) { - var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); - if (isUninitializedLet && node.parent.parent.kind !== 182 && node.parent.parent.kind !== 183) { + var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && + (getCombinedFlagsForIdentifier(node.name) & 4096); + if (isUninitializedLet && + node.parent.parent.kind !== 182 && + node.parent.parent.kind !== 183) { initializer = createVoidZero(); } } @@ -25619,7 +21089,10 @@ var ts; return ts.getCombinedNodeFlags(node.parent); } function renameNonTopLevelLetAndConst(node) { - if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 64 || (node.parent.kind !== 193 && node.parent.kind !== 150)) { + if (languageVersion >= 2 || + ts.nodeIsSynthesized(node) || + node.kind !== 64 || + (node.parent.kind !== 193 && node.parent.kind !== 150)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); @@ -25631,7 +21104,9 @@ var ts; return; } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var _parent = blockScopeContainer.kind === 221 ? blockScopeContainer : blockScopeContainer.parent; + var _parent = blockScopeContainer.kind === 221 + ? blockScopeContainer + : blockScopeContainer.parent; var generatedName = generateUniqueNameForLocation(_parent, node.text); var variableId = resolver.getBlockScopedVariableId(node); if (!generatedBlockScopeNames) { @@ -26394,7 +21869,8 @@ var ts; emitImportDeclaration(node); return; } - if (resolver.isReferencedAliasDeclaration(node) || (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + if (resolver.isReferencedAliasDeclaration(node) || + (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); if (!(node.flags & 1)) @@ -26916,10 +22392,7 @@ var ts; else { leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); } - emitNewLineBeforeLeadingComments(currentSourceFile, writer, { - pos: pos, - end: pos - }, leadingComments); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitDetachedCommentsAtPosition(node) { @@ -26944,17 +22417,12 @@ var ts; if (nodeLine >= lastCommentLine + 2) { emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { - nodePos: node.pos, - detachedCommentEndPos: detachedComments[detachedComments.length - 1].end - }; + var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); } else { - detachedCommentsInfo = [ - currentDetachedCommentInfo - ]; + detachedCommentsInfo = [currentDetachedCommentInfo]; } } } @@ -26966,7 +22434,10 @@ var ts; if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && + currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { return true; } } @@ -27020,7 +22491,9 @@ var ts; } catch (e) { if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText : e.message); + onError(e.number === unsupportedFileEncodingErrorCode + ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText + : e.message); } text = ""; } @@ -27056,20 +22529,12 @@ var ts; } return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { - return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); - }, + getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, writeFile: writeFile, - getCurrentDirectory: function () { - return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); - }, - useCaseSensitiveFileNames: function () { - return ts.sys.useCaseSensitiveFileNames; - }, + getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, + useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, getCanonicalFileName: getCanonicalFileName, - getNewLine: function () { - return ts.sys.newLine; - } + getNewLine: function () { return ts.sys.newLine; } }; } ts.createCompilerHost = createCompilerHost; @@ -27109,9 +22574,7 @@ var ts; var seenNoDefaultLib = options.noLib; var commonSourceDirectory; host = host || createCompilerHost(options); - ts.forEach(rootNames, function (name) { - return processRootFile(name, false); - }); + ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); if (!seenNoDefaultLib) { processRootFile(host.getDefaultLibFileName(options), true); } @@ -27120,35 +22583,21 @@ var ts; var noDiagnosticsTypeChecker; program = { getSourceFile: getSourceFile, - getSourceFiles: function () { - return files; - }, - getCompilerOptions: function () { - return options; - }, + getSourceFiles: function () { return files; }, + getCompilerOptions: function () { return options; }, getSyntacticDiagnostics: getSyntacticDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, getDeclarationDiagnostics: getDeclarationDiagnostics, getTypeChecker: getTypeChecker, getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, - getCommonSourceDirectory: function () { - return commonSourceDirectory; - }, + getCommonSourceDirectory: function () { return commonSourceDirectory; }, emit: emit, getCurrentDirectory: host.getCurrentDirectory, - getNodeCount: function () { - return getDiagnosticsProducingTypeChecker().getNodeCount(); - }, - getIdentifierCount: function () { - return getDiagnosticsProducingTypeChecker().getIdentifierCount(); - }, - getSymbolCount: function () { - return getDiagnosticsProducingTypeChecker().getSymbolCount(); - }, - getTypeCount: function () { - return getDiagnosticsProducingTypeChecker().getTypeCount(); - } + getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, + getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, + getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, + getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } }; return program; function getEmitHost(writeFileCallback) { @@ -27175,11 +22624,7 @@ var ts; } function emit(sourceFile, writeFileCallback) { if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { - return { - diagnostics: [], - sourceMaps: undefined, - emitSkipped: true - }; + return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); var start = new Date().getTime(); @@ -27345,7 +22790,8 @@ var ts; } else if (node.kind === 200 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportEqualsDeclaration(node) && + ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { @@ -27373,17 +22819,19 @@ var ts; } return; } - var firstExternalModuleSourceFile = ts.forEach(files, function (f) { - return ts.isExternalModule(f) ? f : undefined; - }); + var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (firstExternalModuleSourceFile && !options.module) { var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } - if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModuleSourceFile !== undefined))) { + if (options.outDir || + options.sourceRoot || + (options.mapRoot && + (!options.out || firstExternalModuleSourceFile !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { - if (!(sourceFile.flags & 2048) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { + if (!(sourceFile.flags & 2048) + && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); sourcePathComponents.pop(); if (commonPathComponents) { @@ -27576,11 +23024,7 @@ var ts; { name: "target", shortName: "t", - type: { - "es3": 0, - "es5": 1, - "es6": 2 - }, + type: { "es3": 0, "es5": 1, "es6": 2 }, description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, paramType: ts.Diagnostics.VERSION, error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6 @@ -27760,9 +23204,7 @@ var ts; var files = []; if (ts.hasProperty(json, "files")) { if (json["files"] instanceof Array) { - var files = ts.map(json["files"], function (s) { - return ts.combinePaths(basePath, s); - }); + var files = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } } else { @@ -27812,7 +23254,14 @@ var ts; var _parent = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (_parent.kind === 179 || _parent.kind === 182 || _parent.kind === 183 || _parent.kind === 181 || _parent.kind === 178 || _parent.kind === 180 || _parent.kind === 187 || _parent.kind === 217) { + if (_parent.kind === 179 || + _parent.kind === 182 || + _parent.kind === 183 || + _parent.kind === 181 || + _parent.kind === 178 || + _parent.kind === 180 || + _parent.kind === 187 || + _parent.kind === 217) { addOutliningSpan(_parent, openBrace, closeBrace, autoCollapse(n)); break; } @@ -27839,24 +23288,22 @@ var ts; }); break; } - case 201: - { - var _openBrace = ts.findChildOfKind(n, 14, sourceFile); - var _closeBrace = ts.findChildOfKind(n, 15, sourceFile); - addOutliningSpan(n.parent, _openBrace, _closeBrace, autoCollapse(n)); - break; - } + case 201: { + var _openBrace = ts.findChildOfKind(n, 14, sourceFile); + var _closeBrace = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n.parent, _openBrace, _closeBrace, autoCollapse(n)); + break; + } case 196: case 197: case 199: case 152: - case 202: - { - var _openBrace_1 = ts.findChildOfKind(n, 14, sourceFile); - var _closeBrace_1 = ts.findChildOfKind(n, 15, sourceFile); - addOutliningSpan(n, _openBrace_1, _closeBrace_1, autoCollapse(n)); - break; - } + case 202: { + var _openBrace_1 = ts.findChildOfKind(n, 14, sourceFile); + var _closeBrace_1 = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n, _openBrace_1, _closeBrace_1, autoCollapse(n)); + break; + } case 151: var openBracket = ts.findChildOfKind(n, 18, sourceFile); var closeBracket = ts.findChildOfKind(n, 19, sourceFile); @@ -27903,13 +23350,7 @@ var ts; } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ - name: name, - fileName: fileName, - matchKind: matchKind, - isCaseSensitive: allMatchesAreCaseSensitive(matches), - declaration: declaration - }); + rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } }); @@ -27944,7 +23385,9 @@ var ts; return undefined; } function getTextOfIdentifierOrLiteral(node) { - if (node.kind === 64 || node.kind === 8 || node.kind === 7) { + if (node.kind === 64 || + node.kind === 8 || + node.kind === 7) { return node.text; } return undefined; @@ -28009,11 +23452,11 @@ var ts; } return _bestMatchKind; } - var baseSensitivity = { - sensitivity: "base" - }; + var baseSensitivity = { sensitivity: "base" }; function compareNavigateToItems(i1, i2) { - return i1.matchKind - i2.matchKind || i1.name.localeCompare(i2.name, undefined, baseSensitivity) || i1.name.localeCompare(i2.name); + return i1.matchKind - i2.matchKind || + i1.name.localeCompare(i2.name, undefined, baseSensitivity) || + i1.name.localeCompare(i2.name); } function createNavigateToItem(rawItem) { var declaration = rawItem.declaration; @@ -28163,9 +23606,7 @@ var ts; function isTopLevelFunctionDeclaration(functionDeclaration) { if (functionDeclaration.kind === 195) { if (functionDeclaration.body && functionDeclaration.body.kind === 174) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { - return s.kind === 195 && !isEmpty(s.name.text); - })) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 195 && !isEmpty(s.name.text); })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -28283,9 +23724,7 @@ var ts; } return undefined; function createItem(node, name, scriptElementKind) { - return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ]); + return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)]); } } function isEmpty(text) { @@ -28339,16 +23778,12 @@ var ts; function createModuleItem(node) { var moduleName = getModuleName(node); var childItems = getItemsWorker(getChildNodes(getInnermostModule(node).body.statements), createChildItem); - return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ], childItems, getIndent(node)); + return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { if (node.name && node.body && node.body.kind === 174) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } return undefined; } @@ -28358,10 +23793,10 @@ var ts; return undefined; } hasGlobalNode = true; - var rootName = ts.isExternalModule(node) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(node.fileName)))) + "\"" : ""; - return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [ - getNodeSpan(node) - ], childItems); + var rootName = ts.isExternalModule(node) + ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(node.fileName)))) + "\"" + : ""; + return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [getNodeSpan(node)], childItems); } function createClassItem(node) { if (!node.name) { @@ -28374,38 +23809,26 @@ var ts; }); var nodes = removeDynamicallyNamedProperties(node); if (constructor) { - nodes.push.apply(nodes, ts.filter(constructor.parameters, function (p) { - return !ts.isBindingPattern(p.name); - })); + nodes.push.apply(nodes, ts.filter(constructor.parameters, function (p) { return !ts.isBindingPattern(p.name); })); } childItems = getItemsWorker(sortNodes(nodes), createChildItem); } - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createEnumItem(node) { var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createIterfaceItem(node) { var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { - return member.name === undefined || member.name.kind !== 126; - }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 126; }); } function removeDynamicallyNamedProperties(node) { - return ts.filter(node.members, function (member) { - return !ts.hasDynamicName(member); - }); + return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { while (node.body.kind === 200) { @@ -28414,7 +23837,9 @@ var ts; return node; } function getNodeSpan(node) { - return node.kind === 221 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + return node.kind === 221 + ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) + : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } function getTextOfNode(node) { return ts.getTextOfNodeFromSourceText(sourceFile.text, node); @@ -28444,9 +23869,7 @@ var ts; var stringToWordSpans = {}; pattern = pattern.trim(); var fullPatternSegment = createSegment(pattern); - var dotSeparatedSegments = pattern.split(".").map(function (p) { - return createSegment(p.trim()); - }); + var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); return { getMatches: getMatches, @@ -28554,9 +23977,7 @@ var ts; if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { var match = matchTextChunk(candidate, segment.totalTextChunk, false); if (match) { - return [ - match - ]; + return [match]; } } var subWordTextChunks = segment.subWordTextChunks; @@ -28623,7 +24044,8 @@ var ts; for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; if (gotOneMatchThisCandidate) { - if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { break; } } @@ -28644,7 +24066,10 @@ var ts; } ts.createPatternMatcher = createPatternMatcher; function patternMatchCompareTo(match1, match2) { - return compareType(match1, match2) || compareCamelCase(match1, match2) || compareCase(match1, match2) || comparePunctuation(match1, match2); + return compareType(match1, match2) || + compareCamelCase(match1, match2) || + compareCase(match1, match2) || + comparePunctuation(match1, match2); } function comparePunctuation(result1, result2) { if (result1.punctuationStripped !== result2.punctuationStripped) { @@ -28793,7 +24218,11 @@ var ts; var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); - if (charIsPunctuation(identifier.charCodeAt(i - 1)) || charIsPunctuation(identifier.charCodeAt(i)) || lastIsDigit != currentIsDigit || hasTransitionFromLowerToUpper || hasTransitionFromUpperToLower) { + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || + charIsPunctuation(identifier.charCodeAt(i)) || + lastIsDigit != currentIsDigit || + hasTransitionFromLowerToUpper || + hasTransitionFromUpperToLower) { if (!isAllPunctuation(identifier, wordStart, i)) { result.push(ts.createTextSpan(wordStart, i - wordStart)); } @@ -28845,7 +24274,8 @@ var ts; } function transitionFromUpperToLower(identifier, word, index, wordStart) { if (word) { - if (index != wordStart && index + 1 < identifier.length) { + if (index != wordStart && + index + 1 < identifier.length) { var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); if (currentIsUpper && nextIsLower) { @@ -28863,7 +24293,9 @@ var ts; function transitionFromLowerToUpper(identifier, word, index) { var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); - var transition = word ? (currentIsUpper && !lastIsUpper) : currentIsUpper; + var transition = word + ? (currentIsUpper && !lastIsUpper) + : currentIsUpper; return transition; } })(ts || (ts = {})); @@ -28899,7 +24331,8 @@ var ts; function getImmediatelyContainingArgumentInfo(node) { if (node.parent.kind === 155 || node.parent.kind === 156) { var callExpression = node.parent; - if (node.kind === 24 || node.kind === 16) { + if (node.kind === 24 || + node.kind === 16) { var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; ts.Debug.assert(list !== undefined); @@ -28969,9 +24402,7 @@ var ts; } function getArgumentCount(argumentsList) { var listChildren = argumentsList.getChildren(); - var argumentCount = ts.countWhere(listChildren, function (arg) { - return arg.kind !== 23; - }); + var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 23; }); if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 23) { argumentCount++; } @@ -28988,7 +24419,9 @@ var ts; return spanIndex + 1; } function getArgumentListInfoForTemplate(tagExpression, argumentIndex) { - var argumentCount = tagExpression.template.kind === 10 ? 1 : tagExpression.template.templateSpans.length + 1; + var argumentCount = tagExpression.template.kind === 10 + ? 1 + : tagExpression.template.templateSpans.length + 1; ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); return { kind: 2, @@ -29093,10 +24526,7 @@ var ts; isVariadic: candidateSignature.hasRestParameter, prefixDisplayParts: prefixDisplayParts, suffixDisplayParts: suffixDisplayParts, - separatorDisplayParts: [ - ts.punctuationPart(23), - ts.spacePart() - ], + separatorDisplayParts: [ts.punctuationPart(23), ts.spacePart()], parameters: signatureHelpParameters, documentation: candidateSignature.getDocumentationComment() }; @@ -29205,9 +24635,7 @@ var ts; } ts.findListItemInfo = findListItemInfo; function findChildOfKind(n, kind, sourceFile) { - return ts.forEach(n.getChildren(sourceFile), function (c) { - return c.kind === kind && c; - }); + return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; }); } ts.findChildOfKind = findChildOfKind; function findContainingList(node) { @@ -29221,15 +24649,11 @@ var ts; } ts.findContainingList = findContainingList; function getTouchingWord(sourceFile, position) { - return getTouchingToken(sourceFile, position, function (n) { - return isWord(n.kind); - }); + return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }); } ts.getTouchingWord = getTouchingWord; function getTouchingPropertyName(sourceFile, position) { - return getTouchingToken(sourceFile, position, function (n) { - return isPropertyName(n.kind); - }); + return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }); } ts.getTouchingPropertyName = getTouchingPropertyName; function getTouchingToken(sourceFile, position, includeItemAtEndPosition) { @@ -29283,7 +24707,8 @@ var ts; var children = n.getChildren(); for (var _i = 0, _n = children.length; _i < _n; _i++) { var child = children[_i]; - var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); + var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || + (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { return find(child); } @@ -29386,7 +24811,8 @@ var ts; } ts.isPunctuation = isPunctuation; function isInsideTemplateLiteral(node, position) { - return ts.isTemplateLiteralKind(node.kind) && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); + return ts.isTemplateLiteralKind(node.kind) + && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); } ts.isInsideTemplateLiteral = isInsideTemplateLiteral; function compareDataObjects(dst, src) { @@ -29419,38 +24845,19 @@ var ts; var indent; resetWriter(); return { - displayParts: function () { - return displayParts; - }, - writeKeyword: function (text) { - return writeKind(text, 5); - }, - writeOperator: function (text) { - return writeKind(text, 12); - }, - writePunctuation: function (text) { - return writeKind(text, 15); - }, - writeSpace: function (text) { - return writeKind(text, 16); - }, - writeStringLiteral: function (text) { - return writeKind(text, 8); - }, - writeParameter: function (text) { - return writeKind(text, 13); - }, + displayParts: function () { return displayParts; }, + writeKeyword: function (text) { return writeKind(text, 5); }, + writeOperator: function (text) { return writeKind(text, 12); }, + writePunctuation: function (text) { return writeKind(text, 15); }, + writeSpace: function (text) { return writeKind(text, 16); }, + writeStringLiteral: function (text) { return writeKind(text, 8); }, + writeParameter: function (text) { return writeKind(text, 13); }, writeSymbol: writeSymbol, writeLine: writeLine, - increaseIndent: function () { - indent++; - }, - decreaseIndent: function () { - indent--; - }, + increaseIndent: function () { indent++; }, + decreaseIndent: function () { indent--; }, clear: resetWriter, - trackSymbol: function () { - } + trackSymbol: function () { } }; function writeIndent() { if (lineStart) { @@ -29611,9 +25018,7 @@ var ts; advance: advance, readTokenInfo: readTokenInfo, isOnToken: isOnToken, - lastTrailingTriviaWasNewLine: function () { - return wasNewLine; - }, + lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, close: function () { lastTokenInfo = undefined; scanner.setText(undefined); @@ -29674,7 +25079,8 @@ var ts; return container.kind === 9; } function shouldRescanTemplateToken(container) { - return container.kind === 12 || container.kind === 13; + return container.kind === 12 || + container.kind === 13; } function startsWithSlashToken(t) { return t === 36 || t === 56; @@ -29687,7 +25093,13 @@ var ts; token: undefined }; } - var expectedScanAction = shouldRescanGreaterThanToken(n) ? 1 : shouldRescanSlashToken(n) ? 2 : shouldRescanTemplateToken(n) ? 3 : 0; + var expectedScanAction = shouldRescanGreaterThanToken(n) + ? 1 + : shouldRescanSlashToken(n) + ? 2 + : shouldRescanTemplateToken(n) + ? 3 + : 0; if (lastTokenInfo && expectedScanAction === lastScanAction) { return fixTokenKind(lastTokenInfo, n); } @@ -29867,7 +25279,9 @@ var ts; this.Flag = Flag; } Rule.prototype.toString = function () { - return "[desc=" + this.Descriptor + "," + "operation=" + this.Operation + "," + "flag=" + this.Flag + "]"; + return "[desc=" + this.Descriptor + "," + + "operation=" + this.Operation + "," + + "flag=" + this.Flag + "]"; }; return Rule; })(); @@ -29897,7 +25311,8 @@ var ts; this.RightTokenRange = RightTokenRange; } RuleDescriptor.prototype.toString = function () { - return "[leftRange=" + this.LeftTokenRange + "," + "rightRange=" + this.RightTokenRange + "]"; + return "[leftRange=" + this.LeftTokenRange + "," + + "rightRange=" + this.RightTokenRange + "]"; }; RuleDescriptor.create1 = function (left, right) { return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right)); @@ -29937,7 +25352,8 @@ var ts; this.Action = null; } RuleOperation.prototype.toString = function () { - return "[context=" + this.Context + "," + "action=" + this.Action + "]"; + return "[context=" + this.Context + "," + + "action=" + this.Action + "]"; }; RuleOperation.create1 = function (action) { return RuleOperation.create2(formatting.RuleOperationContext.Any, action); @@ -30004,12 +25420,7 @@ var ts; this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(15, 75), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(15, 99), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.FromTokens([ - 17, - 19, - 23, - 22 - ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.FromTokens([17, 19, 23, 22])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); @@ -30018,19 +25429,9 @@ var ts; this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([ - 64, - 3 - ]); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([64, 3]); this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([ - 17, - 3, - 74, - 95, - 80, - 75 - ]); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([17, 3, 74, 95, 80, 75]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(14, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); @@ -30049,151 +25450,79 @@ var ts; this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(34, 34), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(34, 39), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ - 97, - 93, - 87, - 73, - 89, - 96 - ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ - 104, - 69 - ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([97, 93, 87, 73, 89, 96]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([104, 69]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(82, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(98, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2)); this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(89, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ - 17, - 74, - 75, - 66 - ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ - 95, - 80 - ]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ - 115, - 119 - ]), 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([17, 74, 75, 66]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([95, 80]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([115, 119]), 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(113, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ - 116, - 117 - ]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ - 68, - 114, - 76, - 77, - 78, - 115, - 102, - 84, - 103, - 116, - 106, - 108, - 119, - 109 - ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([ - 78, - 102 - ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([116, 117]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([68, 114, 76, 77, 78, 115, 102, 84, 103, 116, 106, 108, 119, 109]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([78, 102])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(8, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(32, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(21, 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.FromTokens([ - 17, - 23 - ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.FromTokens([17, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(17, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.TypeNames), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); - this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([ - 16, - 18, - 25, - 23 - ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([16, 18, 25, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8)); - this.HighPriorityCommonRules = [ - this.IgnoreBeforeComment, - this.IgnoreAfterLineComment, - this.NoSpaceBeforeColon, - this.SpaceAfterColon, - this.NoSpaceBeforeQuestionMark, - this.SpaceAfterQuestionMarkInConditionalOperator, - this.NoSpaceAfterQuestionMark, - this.NoSpaceBeforeDot, - this.NoSpaceAfterDot, - this.NoSpaceAfterUnaryPrefixOperator, - this.NoSpaceAfterUnaryPreincrementOperator, - this.NoSpaceAfterUnaryPredecrementOperator, - this.NoSpaceBeforeUnaryPostincrementOperator, - this.NoSpaceBeforeUnaryPostdecrementOperator, - this.SpaceAfterPostincrementWhenFollowedByAdd, - this.SpaceAfterAddWhenFollowedByUnaryPlus, - this.SpaceAfterAddWhenFollowedByPreincrement, - this.SpaceAfterPostdecrementWhenFollowedBySubtract, - this.SpaceAfterSubtractWhenFollowedByUnaryMinus, - this.SpaceAfterSubtractWhenFollowedByPredecrement, - this.NoSpaceAfterCloseBrace, - this.SpaceAfterOpenBrace, - this.SpaceBeforeCloseBrace, - this.NewLineBeforeCloseBraceInBlockContext, - this.SpaceAfterCloseBrace, - this.SpaceBetweenCloseBraceAndElse, - this.SpaceBetweenCloseBraceAndWhile, - this.NoSpaceBetweenEmptyBraceBrackets, - this.SpaceAfterFunctionInFuncDecl, - this.NewLineAfterOpenBraceInBlockContext, - this.SpaceAfterGetSetInMember, - this.NoSpaceBetweenReturnAndSemicolon, - this.SpaceAfterCertainKeywords, - this.SpaceAfterLetConstInVariableDeclaration, - this.NoSpaceBeforeOpenParenInFuncCall, - this.SpaceBeforeBinaryKeywordOperator, - this.SpaceAfterBinaryKeywordOperator, - this.SpaceAfterVoidOperator, - this.NoSpaceAfterConstructor, - this.NoSpaceAfterModuleImport, - this.SpaceAfterCertainTypeScriptKeywords, - this.SpaceBeforeCertainTypeScriptKeywords, - this.SpaceAfterModuleName, - this.SpaceAfterArrow, - this.NoSpaceAfterEllipsis, - this.NoSpaceAfterOptionalParameters, - this.NoSpaceBetweenEmptyInterfaceBraceBrackets, - this.NoSpaceBeforeOpenAngularBracket, - this.NoSpaceBetweenCloseParenAndAngularBracket, - this.NoSpaceAfterOpenAngularBracket, - this.NoSpaceBeforeCloseAngularBracket, - this.NoSpaceAfterCloseAngularBracket - ]; - this.LowPriorityCommonRules = [ - this.NoSpaceBeforeSemicolon, - this.SpaceBeforeOpenBraceInControl, - this.SpaceBeforeOpenBraceInFunction, - this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, - this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, - this.NoSpaceAfterOpenBracket, - this.NoSpaceBeforeCloseBracket, - this.NoSpaceAfterCloseBracket, - this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, - this.SpaceBetweenStatements, - this.SpaceAfterTryFinally - ]; + this.HighPriorityCommonRules = + [ + this.IgnoreBeforeComment, this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, + this.NoSpaceAfterQuestionMark, + this.NoSpaceBeforeDot, this.NoSpaceAfterDot, + this.NoSpaceAfterUnaryPrefixOperator, + this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, + this.SpaceAfterPostincrementWhenFollowedByAdd, + this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterPostdecrementWhenFollowedBySubtract, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.NoSpaceAfterCloseBrace, + this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, + this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, + this.NoSpaceBetweenReturnAndSemicolon, + this.SpaceAfterCertainKeywords, + this.SpaceAfterLetConstInVariableDeclaration, + this.NoSpaceBeforeOpenParenInFuncCall, + this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, + this.SpaceAfterVoidOperator, + this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, + this.SpaceAfterModuleName, + this.SpaceAfterArrow, + this.NoSpaceAfterEllipsis, + this.NoSpaceAfterOptionalParameters, + this.NoSpaceBetweenEmptyInterfaceBraceBrackets, + this.NoSpaceBeforeOpenAngularBracket, + this.NoSpaceBetweenCloseParenAndAngularBracket, + this.NoSpaceAfterOpenAngularBracket, + this.NoSpaceBeforeCloseAngularBracket, + this.NoSpaceAfterCloseAngularBracket + ]; + this.LowPriorityCommonRules = + [ + this.NoSpaceBeforeSemicolon, + this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.NoSpaceBeforeComma, + this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket, + this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket, + this.SpaceAfterSemicolon, + this.NoSpaceBeforeOpenParenInFuncDecl, + this.SpaceBetweenStatements, this.SpaceAfterTryFinally + ]; this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); @@ -30367,7 +25696,8 @@ var ts; return context.TokensAreOnSameLine(); }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 194 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; + return context.currentTokenParent.kind === 194 && + context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind != 2; @@ -30401,7 +25731,8 @@ var ts; } }; Rules.IsTypeArgumentOrParameterContext = function (context) { - return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); + return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || + Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsVoidOpContext = function (context) { return context.currentTokenSpan.kind === 98 && context.currentTokenParent.kind === 164; @@ -30444,7 +25775,8 @@ var ts; }; RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) { var _this = this; - var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; + var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && + rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) { rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) { var rulesBucketIndex = _this.GetRuleBucketIndex(left, right); @@ -30519,13 +25851,19 @@ var ts; RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) { var position; if (rule.Operation.Action == 1) { - position = specificTokens ? 0 : RulesPosition.IgnoreRulesAny; + position = specificTokens ? + 0 : + RulesPosition.IgnoreRulesAny; } else if (!rule.Operation.Context.IsAny()) { - position = specificTokens ? RulesPosition.ContextRulesSpecific : RulesPosition.ContextRulesAny; + position = specificTokens ? + RulesPosition.ContextRulesSpecific : + RulesPosition.ContextRulesAny; } else { - position = specificTokens ? RulesPosition.NoContextRulesSpecific : RulesPosition.NoContextRulesAny; + position = specificTokens ? + RulesPosition.NoContextRulesSpecific : + RulesPosition.NoContextRulesAny; } var state = constructionState[rulesBucketIndex]; if (state === undefined) { @@ -30582,9 +25920,7 @@ var ts; this.token = token; } TokenSingleValueAccess.prototype.GetTokens = function () { - return [ - this.token - ]; + return [this.token]; }; TokenSingleValueAccess.prototype.Contains = function (tokenValue) { return tokenValue == this.token; @@ -30638,68 +25974,18 @@ var ts; return this.tokenAccess.toString(); }; TokenRange.Any = TokenRange.AllTokens(); - TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([ - 3 - ])); + TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); TokenRange.Keywords = TokenRange.FromRange(65, 124); TokenRange.BinaryOperators = TokenRange.FromRange(24, 63); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([ - 85, - 86, - 124 - ]); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([ - 38, - 39, - 47, - 46 - ]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([ - 7, - 64, - 16, - 18, - 14, - 92, - 87 - ]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([ - 64, - 16, - 92, - 87 - ]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([ - 64, - 17, - 19, - 87 - ]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([ - 64, - 16, - 92, - 87 - ]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([ - 64, - 17, - 19, - 87 - ]); - TokenRange.Comments = TokenRange.FromTokens([ - 2, - 3 - ]); - TokenRange.TypeNames = TokenRange.FromTokens([ - 64, - 118, - 120, - 112, - 121, - 98, - 111 - ]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([85, 86, 124]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([38, 39, 47, 46]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7, 64, 16, 18, 14, 92, 87]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); + TokenRange.Comments = TokenRange.FromTokens([2, 3]); + TokenRange.TypeNames = TokenRange.FromTokens([64, 118, 120, 112, 121, 98, 111]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -30848,11 +26134,16 @@ var ts; } function findOutermostParent(position, expectedTokenKind, sourceFile) { var precedingToken = ts.findPrecedingToken(position, sourceFile); - if (!precedingToken || precedingToken.kind !== expectedTokenKind || position !== precedingToken.getEnd()) { + if (!precedingToken || + precedingToken.kind !== expectedTokenKind || + position !== precedingToken.getEnd()) { return undefined; } var current = precedingToken; - while (current && current.parent && current.parent.end === precedingToken.end && !isListElement(current.parent, current)) { + while (current && + current.parent && + current.parent.end === precedingToken.end && + !isListElement(current.parent, current)) { current = current.parent; } return current; @@ -30877,9 +26168,7 @@ var ts; function findEnclosingNode(range, sourceFile) { return find(sourceFile); function find(n) { - var candidate = ts.forEachChild(n, function (c) { - return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; - }); + var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; }); if (candidate) { var result = find(candidate); if (result) { @@ -30893,11 +26182,9 @@ var ts; if (!errors.length) { return rangeHasNoErrors; } - var sorted = errors.filter(function (d) { - return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); - }).sort(function (e1, e2) { - return e1.start - e2.start; - }); + var sorted = errors + .filter(function (d) { return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); }) + .sort(function (e1, e2) { return e1.start - e2.start; }); if (!sorted.length) { return rangeHasNoErrors; } @@ -30991,7 +26278,10 @@ var ts; var indentation = inheritedIndentation; if (indentation === -1) { if (isSomeBlock(node.kind)) { - if (isSomeBlock(parent.kind) || parent.kind === 221 || parent.kind === 214 || parent.kind === 215) { + if (isSomeBlock(parent.kind) || + parent.kind === 221 || + parent.kind === 214 || + parent.kind === 215) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -31040,12 +26330,8 @@ var ts; return nodeStartLine !== line ? indentation + delta : indentation; } }, - getIndentation: function () { - return indentation; - }, - getDelta: function () { - return delta; - }, + getIndentation: function () { return indentation; }, + getDelta: function () { return delta; }, recomputeIndentation: function (lineAdded) { if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent.kind, node.kind)) { if (lineAdded) { @@ -31239,7 +26525,8 @@ var ts; trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { - lineAdded = processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); + lineAdded = + processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); } } previousRange = range; @@ -31267,7 +26554,9 @@ var ts; dynamicIndentation.recomputeIndentation(true); } } - trimTrailingWhitespaces = (rule.Operation.Action & (4 | 2)) && rule.Flag !== 1; + trimTrailingWhitespaces = + (rule.Operation.Action & (4 | 2)) && + rule.Flag !== 1; } else { trimTrailingWhitespaces = true; @@ -31305,16 +26594,10 @@ var ts; var startPos = commentRange.pos; for (var line = _startLine; line < endLine; ++line) { var endOfLine = ts.getEndLinePosition(line, sourceFile); - parts.push({ - pos: startPos, - end: endOfLine - }); + parts.push({ pos: startPos, end: endOfLine }); startPos = ts.getStartPositionOfLine(line + 1, sourceFile); } - parts.push({ - pos: startPos, - end: commentRange.end - }); + parts.push({ pos: startPos, end: commentRange.end }); } var startLinePos = ts.getStartPositionOfLine(_startLine, sourceFile); var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options); @@ -31329,7 +26612,9 @@ var ts; var _delta = indentation - nonWhitespaceColumnInFirstPart.column; for (var i = startIndex, len = parts.length; i < len; ++i, ++_startLine) { var _startLinePos = ts.getStartPositionOfLine(_startLine, sourceFile); - var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); + var nonWhitespaceCharacterAndColumn = i === 0 + ? nonWhitespaceColumnInFirstPart + : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); var newIndentation = nonWhitespaceCharacterAndColumn.column + _delta; if (newIndentation > 0) { var indentationString = getIndentationString(newIndentation, options); @@ -31358,10 +26643,7 @@ var ts; } } function newTextChange(start, len, newText) { - return { - span: ts.createTextSpan(start, len), - newText: newText - }; + return { span: ts.createTextSpan(start, len), newText: newText }; } function recordDelete(start, len) { if (len) { @@ -31515,7 +26797,12 @@ var ts; if (!precedingToken) { return 0; } - var precedingTokenIsLiteral = precedingToken.kind === 8 || precedingToken.kind === 9 || precedingToken.kind === 10 || precedingToken.kind === 11 || precedingToken.kind === 12 || precedingToken.kind === 13; + var precedingTokenIsLiteral = precedingToken.kind === 8 || + precedingToken.kind === 9 || + precedingToken.kind === 10 || + precedingToken.kind === 11 || + precedingToken.kind === 12 || + precedingToken.kind === 13; if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } @@ -31575,7 +26862,8 @@ var ts; } } parentStart = getParentStart(_parent, current, sourceFile); - var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(_parent, current, currentStart.line, sourceFile); + var parentAndChildShareLine = parentStart.line === currentStart.line || + childStartsOnTheSameLineWithElseInIfStatement(_parent, current, currentStart.line, sourceFile); if (useActualIndentation) { var _actualIndentation = getActualIndentationForNode(current, _parent, currentStart, parentAndChildShareLine, sourceFile, options); if (_actualIndentation !== -1) { @@ -31608,7 +26896,8 @@ var ts; } } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { - var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && (parent.kind === 221 || !parentAndChildShareLine); + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && + (parent.kind === 221 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -31648,7 +26937,8 @@ var ts; if (node.parent) { switch (node.parent.kind) { case 139: - if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; @@ -31662,29 +26952,30 @@ var ts; case 132: case 131: case 136: - case 137: - { - var start = node.getStart(sourceFile); - if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { - return node.parent.typeParameters; - } - if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { - return node.parent.parameters; - } - break; + case 137: { + var start = node.getStart(sourceFile); + if (node.parent.typeParameters && + ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { + return node.parent.typeParameters; } + if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { + return node.parent.parameters; + } + break; + } case 156: - case 155: - { - var _start = node.getStart(sourceFile); - if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, _start, node.getEnd())) { - return node.parent.typeArguments; - } - if (node.parent.arguments && ts.rangeContainsStartEnd(node.parent.arguments, _start, node.getEnd())) { - return node.parent.arguments; - } - break; + case 155: { + var _start = node.getStart(sourceFile); + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, _start, node.getEnd())) { + return node.parent.typeArguments; } + if (node.parent.arguments && + ts.rangeContainsStartEnd(node.parent.arguments, _start, node.getEnd())) { + return node.parent.arguments; + } + break; + } } } return undefined; @@ -31733,10 +27024,7 @@ var ts; } character++; } - return { - column: column, - character: character - }; + return { column: column, character: character }; } SmartIndenter.findFirstNonWhitespaceCharacterAndColumn = findFirstNonWhitespaceCharacterAndColumn; function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { @@ -32120,7 +27408,10 @@ var ts; return pos; } function isName(pos, end, sourceFile, name) { - return pos + name.length < end && sourceFile.text.substr(pos, name.length) === name && (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); + return pos + name.length < end && + sourceFile.text.substr(pos, name.length) === name && + (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || + ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); } function isParamTag(pos, end, sourceFile) { return isName(pos, end, sourceFile, paramTag); @@ -32336,9 +27627,7 @@ var ts; }; SignatureObject.prototype.getDocumentationComment = function () { if (this.documentationComment === undefined) { - this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([ - this.declaration - ], undefined, false) : []; + this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration], undefined, false) : []; } return this.documentationComment; }; @@ -32372,7 +27661,9 @@ var ts; case 131: var functionDeclaration = node; if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) { - var lastDeclaration = namedDeclarations.length > 0 ? namedDeclarations[namedDeclarations.length - 1] : undefined; + var lastDeclaration = namedDeclarations.length > 0 ? + namedDeclarations[namedDeclarations.length - 1] : + undefined; if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) { if (functionDeclaration.body && !lastDeclaration.body) { namedDeclarations[namedDeclarations.length - 1] = functionDeclaration; @@ -32586,9 +27877,7 @@ var ts; ts.ClassificationTypeNames = ClassificationTypeNames; function displayPartsToString(displayParts) { if (displayParts) { - return ts.map(displayParts, function (displayPart) { - return displayPart.text; - }).join(""); + return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(""); } return ""; } @@ -32766,9 +28055,7 @@ var ts; return bucket; } function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { - return name && name.charAt(0) === '_'; - }).map(function (name) { + var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === '_'; }).map(function (name) { var entries = ts.lookUp(buckets, name); var sourceFiles = []; for (var i in entries) { @@ -32779,9 +28066,7 @@ var ts; references: entry.owners.slice(0) }); } - sourceFiles.sort(function (x, y) { - return y.refCount - x.refCount; - }); + sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); return { bucket: name, sourceFiles: sourceFiles @@ -32970,11 +28255,7 @@ var ts; processImport(); } processTripleSlashDirectives(); - return { - referencedFiles: referencedFiles, - importedFiles: importedFiles, - isLibFile: isNoDefaultLib - }; + return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib }; } ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { @@ -32987,10 +28268,14 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 64 && (node.parent.kind === 185 || node.parent.kind === 184) && node.parent.label === node; + return node.kind === 64 && + (node.parent.kind === 185 || node.parent.kind === 184) && + node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 64 && node.parent.kind === 189 && node.parent.label === node; + return node.kind === 64 && + node.parent.kind === 189 && + node.parent.label === node; } function isLabeledBy(node, labelName) { for (var owner = node.parent; owner.kind === 189; owner = owner.parent) { @@ -33025,10 +28310,12 @@ var ts; return node.parent.kind === 200 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 64 && ts.isFunctionLike(node.parent) && node.parent.name === node; + return node.kind === 64 && + ts.isFunctionLike(node.parent) && node.parent.name === node; } function isNameOfPropertyAssignment(node) { - return (node.kind === 64 || node.kind === 8 || node.kind === 7) && (node.parent.kind === 218 || node.parent.kind === 219) && node.parent.name === node; + return (node.kind === 64 || node.kind === 8 || node.kind === 7) && + (node.parent.kind === 218 || node.parent.kind === 219) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 || node.kind === 7) { @@ -33051,12 +28338,15 @@ var ts; } function isNameOfExternalModuleImportOrDeclaration(node) { if (node.kind === 8) { - return isNameOfModuleDeclaration(node) || (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); + return isNameOfModuleDeclaration(node) || + (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); } return false; } function isInsideComment(sourceFile, token, position) { - return position <= token.getStart(sourceFile) && (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); + return position <= token.getStart(sourceFile) && + (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || + isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); function isInsideCommentRange(comments) { return ts.forEach(comments, function (comment) { if (comment.pos < position && position < comment.end) { @@ -33069,7 +28359,8 @@ var ts; return true; } else { - return !(text.charCodeAt(comment.end - 1) === 47 && text.charCodeAt(comment.end - 2) === 42); + return !(text.charCodeAt(comment.end - 1) === 47 && + text.charCodeAt(comment.end - 2) === 42); } } return false; @@ -33124,44 +28415,33 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 200: - return ScriptElementKind.moduleElement; - case 196: - return ScriptElementKind.classElement; - case 197: - return ScriptElementKind.interfaceElement; - case 198: - return ScriptElementKind.typeElement; - case 199: - return ScriptElementKind.enumElement; + case 200: return ScriptElementKind.moduleElement; + case 196: return ScriptElementKind.classElement; + case 197: return ScriptElementKind.interfaceElement; + case 198: return ScriptElementKind.typeElement; + case 199: return ScriptElementKind.enumElement; case 193: - return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 195: - return ScriptElementKind.functionElement; - case 134: - return ScriptElementKind.memberGetAccessorElement; - case 135: - return ScriptElementKind.memberSetAccessorElement; + return ts.isConst(node) + ? ScriptElementKind.constElement + : ts.isLet(node) + ? ScriptElementKind.letElement + : ScriptElementKind.variableElement; + case 195: return ScriptElementKind.functionElement; + case 134: return ScriptElementKind.memberGetAccessorElement; + case 135: return ScriptElementKind.memberSetAccessorElement; case 132: case 131: return ScriptElementKind.memberFunctionElement; case 130: case 129: return ScriptElementKind.memberVariableElement; - case 138: - return ScriptElementKind.indexSignatureElement; - case 137: - return ScriptElementKind.constructSignatureElement; - case 136: - return ScriptElementKind.callSignatureElement; - case 133: - return ScriptElementKind.constructorImplementationElement; - case 127: - return ScriptElementKind.typeParameterElement; - case 220: - return ScriptElementKind.variableElement; - case 128: - return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 138: return ScriptElementKind.indexSignatureElement; + case 137: return ScriptElementKind.constructSignatureElement; + case 136: return ScriptElementKind.callSignatureElement; + case 133: return ScriptElementKind.constructorImplementationElement; + case 127: return ScriptElementKind.typeParameterElement; + case 220: return ScriptElementKind.variableElement; + case 128: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; case 203: case 208: case 205: @@ -33217,26 +28497,13 @@ var ts; var changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { getSourceFile: getOrCreateSourceFile, - getCancellationToken: function () { - return cancellationToken; - }, - getCanonicalFileName: function (fileName) { - return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); - }, - useCaseSensitiveFileNames: function () { - return useCaseSensitivefileNames; - }, - getNewLine: function () { - return host.getNewLine ? host.getNewLine() : "\r\n"; - }, - getDefaultLibFileName: function (options) { - return host.getDefaultLibFileName(options); - }, - writeFile: function (fileName, data, writeByteOrderMark) { - }, - getCurrentDirectory: function () { - return host.getCurrentDirectory(); - } + getCancellationToken: function () { return cancellationToken; }, + getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); }, + useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, + getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, + getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, + writeFile: function (fileName, data, writeByteOrderMark) { }, + getCurrentDirectory: function () { return host.getCurrentDirectory(); } }); if (program) { var oldSourceFiles = program.getSourceFiles(); @@ -33325,7 +28592,8 @@ var ts; if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { return undefined; } - if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && (firstCharCode === 39 || firstCharCode === 34)) { + if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && + (firstCharCode === 39 || firstCharCode === 34)) { displayName = displayName.substring(1, displayName.length - 1); } var isValid = ts.isIdentifierStart(displayName.charCodeAt(0), target); @@ -33488,7 +28756,9 @@ var ts; } function isCompletionListBlocker(previousToken) { var _start_1 = new Date().getTime(); - var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); + var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || + isIdentifierDefinitionLocation(previousToken) || + isRightOfIllegalDot(previousToken); log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - _start_1)); return result; } @@ -33505,9 +28775,16 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 155 || containingNodeKind === 133 || containingNodeKind === 156 || containingNodeKind === 151 || containingNodeKind === 167; + return containingNodeKind === 155 + || containingNodeKind === 133 + || containingNodeKind === 156 + || containingNodeKind === 151 + || containingNodeKind === 167; case 16: - return containingNodeKind === 155 || containingNodeKind === 133 || containingNodeKind === 156 || containingNodeKind === 159; + return containingNodeKind === 155 + || containingNodeKind === 133 + || containingNodeKind === 156 + || containingNodeKind === 159; case 18: return containingNodeKind === 151; case 116: @@ -33517,7 +28794,8 @@ var ts; case 14: return containingNodeKind === 196; case 52: - return containingNodeKind === 193 || containingNodeKind === 167; + return containingNodeKind === 193 + || containingNodeKind === 167; case 11: return containingNodeKind === 169; case 12: @@ -33537,7 +28815,9 @@ var ts; return false; } function isInStringOrRegularExpressionOrTemplateLiteral(previousToken) { - if (previousToken.kind === 8 || previousToken.kind === 9 || ts.isTemplateLiteralKind(previousToken.kind)) { + if (previousToken.kind === 8 + || previousToken.kind === 9 + || ts.isTemplateLiteralKind(previousToken.kind)) { var _start_1 = previousToken.getStart(); var end = previousToken.getEnd(); if (_start_1 < position && position < end) { @@ -33584,23 +28864,43 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 193 || containingNodeKind === 194 || containingNodeKind === 175 || containingNodeKind === 199 || isFunction(containingNodeKind) || containingNodeKind === 196 || containingNodeKind === 195 || containingNodeKind === 197 || containingNodeKind === 149 || containingNodeKind === 148; + return containingNodeKind === 193 || + containingNodeKind === 194 || + containingNodeKind === 175 || + containingNodeKind === 199 || + isFunction(containingNodeKind) || + containingNodeKind === 196 || + containingNodeKind === 195 || + containingNodeKind === 197 || + containingNodeKind === 149 || + containingNodeKind === 148; case 20: return containingNodeKind === 149; case 18: return containingNodeKind === 149; case 16: - return containingNodeKind === 217 || isFunction(containingNodeKind); + return containingNodeKind === 217 || + isFunction(containingNodeKind); case 14: - return containingNodeKind === 199 || containingNodeKind === 197 || containingNodeKind === 143 || containingNodeKind === 148; + return containingNodeKind === 199 || + containingNodeKind === 197 || + containingNodeKind === 143 || + containingNodeKind === 148; case 22: - return containingNodeKind === 129 && (previousToken.parent.parent.kind === 197 || previousToken.parent.parent.kind === 143); + return containingNodeKind === 129 && + (previousToken.parent.parent.kind === 197 || + previousToken.parent.parent.kind === 143); case 24: - return containingNodeKind === 196 || containingNodeKind === 195 || containingNodeKind === 197 || isFunction(containingNodeKind); + return containingNodeKind === 196 || + containingNodeKind === 195 || + containingNodeKind === 197 || + isFunction(containingNodeKind); case 109: return containingNodeKind === 130; case 21: - return containingNodeKind === 128 || containingNodeKind === 133 || (previousToken.parent.parent.kind === 149); + return containingNodeKind === 128 || + containingNodeKind === 133 || + (previousToken.parent.parent.kind === 149); case 108: case 106: case 107: @@ -33645,7 +28945,8 @@ var ts; if (!importDeclaration.importClause) { return exports; } - if (importDeclaration.importClause.namedBindings && importDeclaration.importClause.namedBindings.kind === 207) { + if (importDeclaration.importClause.namedBindings && + importDeclaration.importClause.namedBindings.kind === 207) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { var _name = el.propertyName || el.name; exisingImports[_name.text] = true; @@ -33654,9 +28955,7 @@ var ts; if (ts.isEmpty(exisingImports)) { return exports; } - return ts.filter(exports, function (e) { - return !ts.lookUp(exisingImports, e.name); - }); + return ts.filter(exports, function (e) { return !ts.lookUp(exisingImports, e.name); }); } function filterContextualMembersList(contextualMemberSymbols, existingMembers) { if (!existingMembers || existingMembers.length === 0) { @@ -33706,9 +29005,7 @@ var ts; name: entryName, kind: ScriptElementKind.keyword, kindModifiers: ScriptElementKindModifier.none, - displayParts: [ - ts.displayPart(entryName, 5) - ], + displayParts: [ts.displayPart(entryName, 5)], documentation: undefined }; } @@ -33806,7 +29103,9 @@ var ts; return ScriptElementKind.unknown; } function getSymbolModifiers(symbol) { - return symbol && symbol.declarations && symbol.declarations.length > 0 ? ts.getNodeModifiers(symbol.declarations[0]) : ScriptElementKindModifier.none; + return symbol && symbol.declarations && symbol.declarations.length > 0 + ? ts.getNodeModifiers(symbol.declarations[0]) + : ScriptElementKindModifier.none; } function getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, enclosingDeclaration, typeResolver, location, semanticMeaning) { if (semanticMeaning === void 0) { semanticMeaning = getMeaningFromLocation(location); } @@ -33891,7 +29190,8 @@ var ts; hasAddedSymbolInfo = true; } } - else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || (location.kind === 113 && location.parent.kind === 133)) { + else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || + (location.kind === 113 && location.parent.kind === 133)) { var functionDeclaration = location.parent; var _allSignatures = functionDeclaration.kind === 133 ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeResolver.isImplementationOfOverload(functionDeclaration)) { @@ -33905,7 +29205,8 @@ var ts; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 136 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 136 && + !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, _allSignatures); hasAddedSymbolInfo = true; @@ -34025,7 +29326,9 @@ var ts; if (symbolKind !== ScriptElementKind.unknown) { if (type) { addPrefixForAnyFunctionOrVar(symbol, symbolKind); - if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 || symbolKind === ScriptElementKind.localVariableElement) { + if (symbolKind === ScriptElementKind.memberVariableElement || + symbolFlags & 3 || + symbolKind === ScriptElementKind.localVariableElement) { displayParts.push(ts.punctuationPart(51)); displayParts.push(ts.spacePart()); if (type.symbol && type.symbol.flags & 262144) { @@ -34038,7 +29341,12 @@ var ts; displayParts.push.apply(displayParts, ts.typeToDisplayParts(typeResolver, type, enclosingDeclaration)); } } - else if (symbolFlags & 16 || symbolFlags & 8192 || symbolFlags & 16384 || symbolFlags & 131072 || symbolFlags & 98304 || symbolKind === ScriptElementKind.memberFunctionElement) { + else if (symbolFlags & 16 || + symbolFlags & 8192 || + symbolFlags & 16384 || + symbolFlags & 131072 || + symbolFlags & 98304 || + symbolKind === ScriptElementKind.memberFunctionElement) { var _allSignatures_1 = type.getCallSignatures(); addSignatureDisplayParts(_allSignatures_1[0], _allSignatures_1); } @@ -34051,11 +29359,7 @@ var ts; if (!documentation) { documentation = symbol.getDocumentationComment(); } - return { - displayParts: displayParts, - documentation: documentation, - symbolKind: symbolKind - }; + return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; function addNewLineIfDisplayPartsExist() { if (displayParts.length) { displayParts.push(ts.lineBreakPart()); @@ -34142,26 +29446,20 @@ var ts; if (isJumpStatementTarget(node)) { var labelName = node.text; var label = getTargetLabel(node.parent, node.text); - return label ? [ - getDefinitionInfo(label, ScriptElementKind.label, labelName, undefined) - ] : undefined; + return label ? [getDefinitionInfo(label, ScriptElementKind.label, labelName, undefined)] : undefined; } - var comment = ts.forEach(sourceFile.referencedFiles, function (r) { - return (r.pos <= position && position < r.end) ? r : undefined; - }); + var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); if (comment) { var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); if (referenceFile) { - return [ - { + return [{ fileName: referenceFile.fileName, textSpan: ts.createTextSpanFromBounds(0, 0), kind: ScriptElementKind.scriptElement, name: comment.fileName, containerName: undefined, containerKind: undefined - } - ]; + }]; } return undefined; } @@ -34192,7 +29490,8 @@ var ts; var symbolKind = getSymbolKind(symbol, typeInfoResolver, node); var containerSymbol = symbol.parent; var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : ""; - if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { + if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && + !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { ts.forEach(declarations, function (declaration) { result.push(getDefinitionInfo(declaration, symbolKind, symbolName, containerName)); }); @@ -34212,7 +29511,8 @@ var ts; var _declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 133) || (!selectConstructors && (d.kind === 195 || d.kind === 132 || d.kind === 131))) { + if ((selectConstructors && d.kind === 133) || + (!selectConstructors && (d.kind === 195 || d.kind === 132 || d.kind === 131))) { _declarations.push(d); if (d.body) definition = d; @@ -34252,10 +29552,9 @@ var ts; if (!node) { return undefined; } - if (node.kind === 64 || node.kind === 92 || node.kind === 90 || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { - return getReferencesForNode(node, [ - sourceFile - ], true, false, false); + if (node.kind === 64 || node.kind === 92 || node.kind === 90 || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + return getReferencesForNode(node, [sourceFile], true, false, false); } switch (node.kind) { case 83: @@ -34303,7 +29602,9 @@ var ts; } break; case 81: - if (hasKind(node.parent, 181) || hasKind(node.parent, 182) || hasKind(node.parent, 183)) { + if (hasKind(node.parent, 181) || + hasKind(node.parent, 182) || + hasKind(node.parent, 183)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -34324,7 +29625,8 @@ var ts; return getGetAndSetOccurrences(node.parent); } default: - if (ts.isModifier(node.kind) && node.parent && (ts.isDeclaration(node.parent) || node.parent.kind === 175)) { + if (ts.isModifier(node.kind) && node.parent && + (ts.isDeclaration(node.parent) || node.parent.kind === 175)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -34569,16 +29871,15 @@ var ts; function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { - return pushKeywordIf(keywords, child, 115, 119); - }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 115, 119); }); } } } function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (declaration.flags & 112) { - if (!(container.kind === 196 || (declaration.kind === 128 && hasKind(container, 133)))) { + if (!(container.kind === 196 || + (declaration.kind === 128 && hasKind(container, 133)))) { return undefined; } } @@ -34622,9 +29923,7 @@ var ts; } ts.forEach(nodes, function (node) { if (node.modifiers && node.flags & modifierFlag) { - ts.forEach(node.modifiers, function (child) { - return pushKeywordIf(keywords, child, modifier); - }); + ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); } }); return ts.map(keywords, getReferenceEntryFromNode); @@ -34678,7 +29977,9 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 64 && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { + if (node.kind !== 64 && + !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && + !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } ts.Debug.assert(node.kind === 64 || node.kind === 7 || node.kind === 8); @@ -34688,9 +29989,7 @@ var ts; if (isLabelName(node)) { if (isJumpStatementTarget(node)) { var labelDefinition = getTargetLabel(node.parent, node.text); - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [ - getReferenceEntryFromNode(node) - ]; + return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [getReferenceEntryFromNode(node)]; } else { return getLabelReferencesInNode(node.parent, node); @@ -34704,9 +30003,7 @@ var ts; } var symbol = typeInfoResolver.getSymbolAtLocation(node); if (!symbol) { - return [ - getReferenceEntryFromNode(node) - ]; + return [getReferenceEntryFromNode(node)]; } var declarations = symbol.declarations; if (!declarations || !declarations.length) { @@ -34740,7 +30037,9 @@ var ts; } return result; function isImportOrExportSpecifierName(location) { - return location.parent && (location.parent.kind === 208 || location.parent.kind === 212) && location.parent.propertyName === location; + return location.parent && + (location.parent.kind === 208 || location.parent.kind === 212) && + location.parent.propertyName === location; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { @@ -34748,9 +30047,7 @@ var ts; }); } function getDeclaredName(symbol, location) { - var functionExpression = ts.forEach(symbol.declarations, function (d) { - return d.kind === 160 ? d : undefined; - }); + var functionExpression = ts.forEach(symbol.declarations, function (d) { return d.kind === 160 ? d : undefined; }); var _name; if (functionExpression && functionExpression.name) { _name = functionExpression.name.text; @@ -34765,10 +30062,10 @@ var ts; if (isImportOrExportSpecifierName(location)) { return location.getText(); } - var functionExpression = ts.forEach(declarations, function (d) { - return d.kind === 160 ? d : undefined; - }); - var _name = functionExpression && functionExpression.name ? functionExpression.name.text : symbol.name; + var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 160 ? d : undefined; }); + var _name = functionExpression && functionExpression.name + ? functionExpression.name.text + : symbol.name; return stripQuotes(_name); } function stripQuotes(name) { @@ -34781,9 +30078,7 @@ var ts; } function getSymbolScope(symbol) { if (symbol.flags & (4 | 8192)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { - return (d.flags & 32) ? d : undefined; - }); + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); if (privateDeclaration) { return ts.getAncestor(privateDeclaration, 196); } @@ -34828,7 +30123,8 @@ var ts; if (position > end) break; var endPosition = position + symbolNameLength; - if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && + (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { positions.push(position); } position = text.indexOf(symbolName, position + symbolNameLength + 1); @@ -34846,7 +30142,8 @@ var ts; if (!_node || _node.getWidth() !== labelName.length) { return; } - if (_node === targetLabel || (isJumpStatementTarget(_node) && getTargetLabel(_node, labelName) === targetLabel)) { + if (_node === targetLabel || + (isJumpStatementTarget(_node) && getTargetLabel(_node, labelName) === targetLabel)) { _result.push(getReferenceEntryFromNode(_node)); } }); @@ -34858,7 +30155,8 @@ var ts; case 64: return node.getWidth() === searchSymbolName.length; case 8: - if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + isNameOfExternalModuleImportOrDeclaration(node)) { return node.getWidth() === searchSymbolName.length + 2; } break; @@ -34881,7 +30179,8 @@ var ts; cancellationToken.throwIfCancellationRequested(); var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); if (!isValidReferencePosition(referenceLocation, searchText)) { - if ((findInStrings && isInString(position)) || (findInComments && isInComment(position))) { + if ((findInStrings && isInString(position)) || + (findInComments && isInComment(position))) { result.push({ fileName: sourceFile.fileName, textSpan: ts.createTextSpan(position, searchText.length), @@ -35039,9 +30338,7 @@ var ts; } } function populateSearchSymbolSet(symbol, location) { - var _result = [ - symbol - ]; + var _result = [symbol]; if (isImportOrExportSpecifierImportSymbol(symbol)) { _result.push(typeInfoResolver.getAliasedSymbol(symbol)); } @@ -35094,14 +30391,13 @@ var ts; if (searchSymbols.indexOf(referenceSymbol) >= 0) { return true; } - if (isImportOrExportSpecifierImportSymbol(referenceSymbol) && searchSymbols.indexOf(typeInfoResolver.getAliasedSymbol(referenceSymbol)) >= 0) { + if (isImportOrExportSpecifierImportSymbol(referenceSymbol) && + searchSymbols.indexOf(typeInfoResolver.getAliasedSymbol(referenceSymbol)) >= 0) { return true; } if (isNameOfPropertyAssignment(referenceLocation)) { return ts.forEach(getPropertySymbolsFromContextualType(referenceLocation), function (contextualSymbol) { - return ts.forEach(typeInfoResolver.getRootSymbols(contextualSymbol), function (s) { - return searchSymbols.indexOf(s) >= 0; - }); + return ts.forEach(typeInfoResolver.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0; }); }); } return ts.forEach(typeInfoResolver.getRootSymbols(referenceSymbol), function (rootSymbol) { @@ -35111,9 +30407,7 @@ var ts; if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { var _result = []; getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), _result); - return ts.forEach(_result, function (s) { - return searchSymbols.indexOf(s) >= 0; - }); + return ts.forEach(_result, function (s) { return searchSymbols.indexOf(s) >= 0; }); } return false; }); @@ -35127,9 +30421,7 @@ var ts; if (contextualType.flags & 16384) { var unionProperty = contextualType.getProperty(_name); if (unionProperty) { - return [ - unionProperty - ]; + return [unionProperty]; } else { var _result = []; @@ -35145,9 +30437,7 @@ var ts; else { var _symbol = contextualType.getProperty(_name); if (_symbol) { - return [ - _symbol - ]; + return [_symbol]; } } } @@ -35205,9 +30495,7 @@ var ts; return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); } function containErrors(diagnostics) { - return ts.forEach(diagnostics, function (diagnostic) { - return diagnostic.category === 1; - }); + return ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1; }); } function getEmitOutput(fileName) { synchronizeHostData(); @@ -35301,7 +30589,9 @@ var ts; } function getMeaningFromRightHandSideOfImportEquals(node) { ts.Debug.assert(node.kind === 64); - if (node.parent.kind === 125 && node.parent.right === node && node.parent.parent.kind === 203) { + if (node.parent.kind === 125 && + node.parent.right === node && + node.parent.parent.kind === 203) { return 1 | 2 | 4; } return 4; @@ -35360,7 +30650,8 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 200 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + if (nodeForStartPos.parent.parent.kind === 200 && + nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } else { @@ -35407,7 +30698,8 @@ var ts; } } else if (flags & 1536) { - if (meaningAtPosition & 4 || (meaningAtPosition & 1 && hasValueSideModule(symbol))) { + if (meaningAtPosition & 4 || + (meaningAtPosition & 1 && hasValueSideModule(symbol))) { return ClassificationTypeNames.moduleName; } } @@ -35532,11 +30824,16 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 52) { - if (token.parent.kind === 193 || token.parent.kind === 130 || token.parent.kind === 128) { + if (token.parent.kind === 193 || + token.parent.kind === 130 || + token.parent.kind === 128) { return ClassificationTypeNames.operator; } } - if (token.parent.kind === 167 || token.parent.kind === 165 || token.parent.kind === 166 || token.parent.kind === 168) { + if (token.parent.kind === 167 || + token.parent.kind === 165 || + token.parent.kind === 166 || + token.parent.kind === 168) { return ClassificationTypeNames.operator; } } @@ -35634,22 +30931,14 @@ var ts; return result; function getMatchingTokenKind(token) { switch (token.kind) { - case 14: - return 15; - case 16: - return 17; - case 18: - return 19; - case 24: - return 25; - case 15: - return 14; - case 17: - return 16; - case 19: - return 18; - case 25: - return 24; + case 14: return 15; + case 16: return 17; + case 18: return 19; + case 24: return 25; + case 15: return 14; + case 17: return 16; + case 19: return 18; + case 25: return 24; } return undefined; } @@ -35730,9 +31019,7 @@ var ts; var multiLineCommentStart = /(?:\/\*+\s*)/.source; var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; var _preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; - var literals = "(?:" + ts.map(descriptors, function (d) { - return "(" + escapeRegExp(d.text) + ")"; - }).join("|") + ")"; + var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; var messageRemainder = /(?:.*?)/.source; var messagePortion = "(" + literals + messageRemainder + ")"; @@ -35740,7 +31027,9 @@ var ts; return new RegExp(regExpString, "gim"); } function isLetterOrDigit(char) { - return (char >= 97 && char <= 122) || (char >= 65 && char <= 90) || (char >= 48 && char <= 57); + return (char >= 97 && char <= 122) || + (char >= 65 && char <= 90) || + (char >= 48 && char <= 57); } } function getRenameInfo(fileName, position) { @@ -35842,7 +31131,9 @@ var ts; break; case 8: case 7: - if (ts.isDeclarationName(node) || node.parent.kind === 213 || isArgumentOfElementAccessExpression(node)) { + if (ts.isDeclarationName(node) || + node.parent.kind === 213 || + isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } break; @@ -35852,7 +31143,10 @@ var ts; } } function isArgumentOfElementAccessExpression(node) { - return node && node.parent && node.parent.kind === 154 && node.parent.argumentExpression === node; + return node && + node.parent && + node.parent.kind === 154 && + node.parent.argumentExpression === node; } function createClassifier() { var _scanner = ts.createScanner(2, false); @@ -35881,7 +31175,10 @@ var ts; } function canFollow(keyword1, keyword2) { if (isAccessibilityModifier(keyword1)) { - if (keyword2 === 115 || keyword2 === 119 || keyword2 === 113 || keyword2 === 109) { + if (keyword2 === 115 || + keyword2 === 119 || + keyword2 === 113 || + keyword2 === 109) { return true; } return false; @@ -35939,13 +31236,18 @@ var ts; else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { token = 64; } - else if (lastNonTriviaToken === 64 && token === 24) { + else if (lastNonTriviaToken === 64 && + token === 24) { angleBracketStack++; } else if (token === 25 && angleBracketStack > 0) { angleBracketStack--; } - else if (token === 111 || token === 120 || token === 118 || token === 112 || token === 121) { + else if (token === 111 || + token === 120 || + token === 118 || + token === 112 || + token === 121) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { token = 64; } @@ -35996,7 +31298,9 @@ var ts; } if (numBackslashes & 1) { var quoteChar = tokenText.charCodeAt(0); - result.finalLexState = quoteChar === 34 ? 3 : 2; + result.finalLexState = quoteChar === 34 + ? 3 + : 2; } } } @@ -36028,10 +31332,7 @@ var ts; if (result.entries.length === 0) { length -= offset; } - result.entries.push({ - length: length, - classification: classification - }); + result.entries.push({ length: length, classification: classification }); } } } @@ -36126,9 +31427,7 @@ var ts; return 5; } } - return { - getClassificationsForLine: getClassificationsForLine - }; + return { getClassificationsForLine: getClassificationsForLine }; } ts.createClassifier = createClassifier; function getDefaultLibFilePath(options) { @@ -36152,15 +31451,9 @@ var ts; Node.prototype = proto; return Node; }, - getSymbolConstructor: function () { - return SymbolObject; - }, - getTypeConstructor: function () { - return TypeObject; - }, - getSignatureConstructor: function () { - return SignatureObject; - } + getSymbolConstructor: function () { return SymbolObject; }, + getTypeConstructor: function () { return TypeObject; }, + getSignatureConstructor: function () { return SignatureObject; } }; } initializeServices(); @@ -36334,12 +31627,17 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 182 || variableDeclaration.parent.parent.kind === 183) { + if (variableDeclaration.parent.parent.kind === 182 || + variableDeclaration.parent.parent.kind === 183) { return spanInNode(variableDeclaration.parent.parent); } var isParentVariableStatement = variableDeclaration.parent.parent.kind === 175; var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 181 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); - var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement ? variableDeclaration.parent.parent.initializer.declarations : undefined; + var declarations = isParentVariableStatement + ? variableDeclaration.parent.parent.declarationList.declarations + : isDeclarationOfForStatement + ? variableDeclaration.parent.parent.initializer.declarations + : undefined; if (variableDeclaration.initializer || (variableDeclaration.flags & 1)) { if (declarations && declarations[0] === variableDeclaration) { if (isParentVariableStatement) { @@ -36360,7 +31658,8 @@ var ts; } } function canHaveSpanInParameterDeclaration(parameter) { - return !!parameter.initializer || parameter.dotDotDotToken !== undefined || !!(parameter.flags & 16) || !!(parameter.flags & 32); + return !!parameter.initializer || parameter.dotDotDotToken !== undefined || + !!(parameter.flags & 16) || !!(parameter.flags & 32); } function spanInParameterDeclaration(parameter) { if (canHaveSpanInParameterDeclaration(parameter)) { @@ -36378,7 +31677,8 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 1) || (functionDeclaration.parent.kind === 196 && functionDeclaration.kind !== 133); + return !!(functionDeclaration.flags & 1) || + (functionDeclaration.parent.kind === 196 && functionDeclaration.kind !== 133); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -36630,21 +31930,15 @@ var ts; function forwardJSONCall(logger, actionDescription, action) { try { var result = simpleForwardCall(logger, actionDescription, action); - return JSON.stringify({ - result: result - }); + return JSON.stringify({ result: result }); } catch (err) { if (err instanceof ts.OperationCanceledException) { - return JSON.stringify({ - canceled: true - }); + return JSON.stringify({ canceled: true }); } logInternalError(logger, err); err.description = actionDescription; - return JSON.stringify({ - error: err - }); + return JSON.stringify({ error: err }); } } var ShimBase = (function () { @@ -36694,9 +31988,7 @@ var ts; LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) { var _this = this; var newLine = this.getNewLine(); - return diagnostics.map(function (d) { - return _this.realizeDiagnostic(d, newLine); - }); + return diagnostics.map(function (d) { return _this.realizeDiagnostic(d, newLine); }); }; LanguageServiceShimObject.prototype.realizeDiagnostic = function (diagnostic, newLine) { return { diff --git a/bin/typescriptServices.d.ts b/bin/typescriptServices.d.ts index 913bb206f63..a557e814a79 100644 --- a/bin/typescriptServices.d.ts +++ b/bin/typescriptServices.d.ts @@ -1200,9 +1200,6 @@ declare module ts { target?: ScriptTarget; version?: boolean; watch?: boolean; - stripInternal?: boolean; - preserveNewLines?: boolean; - cacheDownlevelForOfLength?: boolean; [option: string]: string | number | boolean; } const enum ModuleKind { diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index 1cefda2a274..9e939631006 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -834,13 +834,13 @@ var ts; ts.arrayToMap = arrayToMap; function formatStringFromArgs(text, args, baseIndex) { baseIndex = baseIndex || 0; - return text.replace(/{(\d+)}/g, function (match, index) { - return args[+index + baseIndex]; - }); + return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); } ts.localizedDiagnosticMessages = undefined; function getLocaleSpecificMessage(message) { - return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] ? ts.localizedDiagnosticMessages[message] : message; + return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] + ? ts.localizedDiagnosticMessages[message] + : message; } ts.getLocaleSpecificMessage = getLocaleSpecificMessage; function createFileDiagnostic(file, start, length, message) { @@ -911,7 +911,12 @@ var ts; return diagnostic.file ? diagnostic.file.fileName : undefined; } function compareDiagnostics(d1, d2) { - return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0; + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || + compareValues(d1.start, d2.start) || + compareValues(d1.length, d2.length) || + compareValues(d1.code, d2.code) || + compareMessageText(d1.messageText, d2.messageText) || + 0; } ts.compareDiagnostics = compareDiagnostics; function compareMessageText(text1, text2) { @@ -938,9 +943,7 @@ var ts; if (diagnostics.length < 2) { return diagnostics; } - var newDiagnostics = [ - diagnostics[0] - ]; + var newDiagnostics = [diagnostics[0]]; var previousDiagnostic = diagnostics[0]; for (var i = 1; i < diagnostics.length; i++) { var currentDiagnostic = diagnostics[i]; @@ -1017,9 +1020,7 @@ var ts; ts.isRootedDiskPath = isRootedDiskPath; function normalizedPathComponents(path, rootLength) { var normalizedParts = getNormalizedParts(path, rootLength); - return [ - path.substr(0, rootLength) - ].concat(normalizedParts); + return [path.substr(0, rootLength)].concat(normalizedParts); } function getNormalizedPathComponents(path, currentDirectory) { path = normalizeSlashes(path); @@ -1053,9 +1054,7 @@ var ts; } } if (rootLength === urlLength) { - return [ - url - ]; + return [url]; } var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); if (indexOfNextSlash !== -1) { @@ -1063,9 +1062,7 @@ var ts; return normalizedPathComponents(url, rootLength); } else { - return [ - url + ts.directorySeparator - ]; + return [url + ts.directorySeparator]; } } function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { @@ -1127,11 +1124,7 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - var supportedExtensions = [ - ".d.ts", - ".ts", - ".js" - ]; + var supportedExtensions = [".d.ts", ".ts", ".js"]; function removeFileExtension(path) { for (var _i = 0, _n = supportedExtensions.length; _i < _n; _i++) { var ext = supportedExtensions[_i]; @@ -1185,15 +1178,9 @@ var ts; }; return Node; }, - getSymbolConstructor: function () { - return Symbol; - }, - getTypeConstructor: function () { - return Type; - }, - getSignatureConstructor: function () { - return Signature; - } + getSymbolConstructor: function () { return Symbol; }, + getTypeConstructor: function () { return Type; }, + getSignatureConstructor: function () { return Signature; } }; (function (AssertionLevel) { AssertionLevel[AssertionLevel["None"] = 0] = "None"; @@ -1421,14 +1408,9 @@ var ts; readFile: readFile, writeFile: writeFile, watchFile: function (fileName, callback) { - _fs.watchFile(fileName, { - persistent: true, - interval: 250 - }, fileChanged); + _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); return { - close: function () { - _fs.unwatchFile(fileName, fileChanged); - } + close: function () { _fs.unwatchFile(fileName, fileChanged); } }; function fileChanged(curr, prev) { if (+curr.mtime <= +prev.mtime) { @@ -1484,2431 +1466,491 @@ var ts; var ts; (function (ts) { ts.Diagnostics = { - Unterminated_string_literal: { - code: 1002, - category: 1, - key: "Unterminated string literal." - }, - Identifier_expected: { - code: 1003, - category: 1, - key: "Identifier expected." - }, - _0_expected: { - code: 1005, - category: 1, - key: "'{0}' expected." - }, - A_file_cannot_have_a_reference_to_itself: { - code: 1006, - category: 1, - key: "A file cannot have a reference to itself." - }, - Trailing_comma_not_allowed: { - code: 1009, - category: 1, - key: "Trailing comma not allowed." - }, - Asterisk_Slash_expected: { - code: 1010, - category: 1, - key: "'*/' expected." - }, - Unexpected_token: { - code: 1012, - category: 1, - key: "Unexpected token." - }, - A_rest_parameter_must_be_last_in_a_parameter_list: { - code: 1014, - category: 1, - key: "A rest parameter must be last in a parameter list." - }, - Parameter_cannot_have_question_mark_and_initializer: { - code: 1015, - category: 1, - key: "Parameter cannot have question mark and initializer." - }, - A_required_parameter_cannot_follow_an_optional_parameter: { - code: 1016, - category: 1, - key: "A required parameter cannot follow an optional parameter." - }, - An_index_signature_cannot_have_a_rest_parameter: { - code: 1017, - category: 1, - key: "An index signature cannot have a rest parameter." - }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { - code: 1018, - category: 1, - key: "An index signature parameter cannot have an accessibility modifier." - }, - An_index_signature_parameter_cannot_have_a_question_mark: { - code: 1019, - category: 1, - key: "An index signature parameter cannot have a question mark." - }, - An_index_signature_parameter_cannot_have_an_initializer: { - code: 1020, - category: 1, - key: "An index signature parameter cannot have an initializer." - }, - An_index_signature_must_have_a_type_annotation: { - code: 1021, - category: 1, - key: "An index signature must have a type annotation." - }, - An_index_signature_parameter_must_have_a_type_annotation: { - code: 1022, - category: 1, - key: "An index signature parameter must have a type annotation." - }, - An_index_signature_parameter_type_must_be_string_or_number: { - code: 1023, - category: 1, - key: "An index signature parameter type must be 'string' or 'number'." - }, - A_class_or_interface_declaration_can_only_have_one_extends_clause: { - code: 1024, - category: 1, - key: "A class or interface declaration can only have one 'extends' clause." - }, - An_extends_clause_must_precede_an_implements_clause: { - code: 1025, - category: 1, - key: "An 'extends' clause must precede an 'implements' clause." - }, - A_class_can_only_extend_a_single_class: { - code: 1026, - category: 1, - key: "A class can only extend a single class." - }, - A_class_declaration_can_only_have_one_implements_clause: { - code: 1027, - category: 1, - key: "A class declaration can only have one 'implements' clause." - }, - Accessibility_modifier_already_seen: { - code: 1028, - category: 1, - key: "Accessibility modifier already seen." - }, - _0_modifier_must_precede_1_modifier: { - code: 1029, - category: 1, - key: "'{0}' modifier must precede '{1}' modifier." - }, - _0_modifier_already_seen: { - code: 1030, - category: 1, - key: "'{0}' modifier already seen." - }, - _0_modifier_cannot_appear_on_a_class_element: { - code: 1031, - category: 1, - key: "'{0}' modifier cannot appear on a class element." - }, - An_interface_declaration_cannot_have_an_implements_clause: { - code: 1032, - category: 1, - key: "An interface declaration cannot have an 'implements' clause." - }, - super_must_be_followed_by_an_argument_list_or_member_access: { - code: 1034, - category: 1, - key: "'super' must be followed by an argument list or member access." - }, - Only_ambient_modules_can_use_quoted_names: { - code: 1035, - category: 1, - key: "Only ambient modules can use quoted names." - }, - Statements_are_not_allowed_in_ambient_contexts: { - code: 1036, - category: 1, - key: "Statements are not allowed in ambient contexts." - }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { - code: 1038, - category: 1, - key: "A 'declare' modifier cannot be used in an already ambient context." - }, - Initializers_are_not_allowed_in_ambient_contexts: { - code: 1039, - category: 1, - key: "Initializers are not allowed in ambient contexts." - }, - _0_modifier_cannot_appear_on_a_module_element: { - code: 1044, - category: 1, - key: "'{0}' modifier cannot appear on a module element." - }, - A_declare_modifier_cannot_be_used_with_an_interface_declaration: { - code: 1045, - category: 1, - key: "A 'declare' modifier cannot be used with an interface declaration." - }, - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { - code: 1046, - category: 1, - key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." - }, - A_rest_parameter_cannot_be_optional: { - code: 1047, - category: 1, - key: "A rest parameter cannot be optional." - }, - A_rest_parameter_cannot_have_an_initializer: { - code: 1048, - category: 1, - key: "A rest parameter cannot have an initializer." - }, - A_set_accessor_must_have_exactly_one_parameter: { - code: 1049, - category: 1, - key: "A 'set' accessor must have exactly one parameter." - }, - A_set_accessor_cannot_have_an_optional_parameter: { - code: 1051, - category: 1, - key: "A 'set' accessor cannot have an optional parameter." - }, - A_set_accessor_parameter_cannot_have_an_initializer: { - code: 1052, - category: 1, - key: "A 'set' accessor parameter cannot have an initializer." - }, - A_set_accessor_cannot_have_rest_parameter: { - code: 1053, - category: 1, - key: "A 'set' accessor cannot have rest parameter." - }, - A_get_accessor_cannot_have_parameters: { - code: 1054, - category: 1, - key: "A 'get' accessor cannot have parameters." - }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { - code: 1056, - category: 1, - key: "Accessors are only available when targeting ECMAScript 5 and higher." - }, - Enum_member_must_have_initializer: { - code: 1061, - category: 1, - key: "Enum member must have initializer." - }, - An_export_assignment_cannot_be_used_in_an_internal_module: { - code: 1063, - category: 1, - key: "An export assignment cannot be used in an internal module." - }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { - code: 1066, - category: 1, - key: "Ambient enum elements can only have integer literal initializers." - }, - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { - code: 1068, - category: 1, - key: "Unexpected token. A constructor, method, accessor, or property was expected." - }, - A_declare_modifier_cannot_be_used_with_an_import_declaration: { - code: 1079, - category: 1, - key: "A 'declare' modifier cannot be used with an import declaration." - }, - Invalid_reference_directive_syntax: { - code: 1084, - category: 1, - key: "Invalid 'reference' directive syntax." - }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { - code: 1085, - category: 1, - key: "Octal literals are not available when targeting ECMAScript 5 and higher." - }, - An_accessor_cannot_be_declared_in_an_ambient_context: { - code: 1086, - category: 1, - key: "An accessor cannot be declared in an ambient context." - }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { - code: 1089, - category: 1, - key: "'{0}' modifier cannot appear on a constructor declaration." - }, - _0_modifier_cannot_appear_on_a_parameter: { - code: 1090, - category: 1, - key: "'{0}' modifier cannot appear on a parameter." - }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { - code: 1091, - category: 1, - key: "Only a single variable declaration is allowed in a 'for...in' statement." - }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { - code: 1092, - category: 1, - key: "Type parameters cannot appear on a constructor declaration." - }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { - code: 1093, - category: 1, - key: "Type annotation cannot appear on a constructor declaration." - }, - An_accessor_cannot_have_type_parameters: { - code: 1094, - category: 1, - key: "An accessor cannot have type parameters." - }, - A_set_accessor_cannot_have_a_return_type_annotation: { - code: 1095, - category: 1, - key: "A 'set' accessor cannot have a return type annotation." - }, - An_index_signature_must_have_exactly_one_parameter: { - code: 1096, - category: 1, - key: "An index signature must have exactly one parameter." - }, - _0_list_cannot_be_empty: { - code: 1097, - category: 1, - key: "'{0}' list cannot be empty." - }, - Type_parameter_list_cannot_be_empty: { - code: 1098, - category: 1, - key: "Type parameter list cannot be empty." - }, - Type_argument_list_cannot_be_empty: { - code: 1099, - category: 1, - key: "Type argument list cannot be empty." - }, - Invalid_use_of_0_in_strict_mode: { - code: 1100, - category: 1, - key: "Invalid use of '{0}' in strict mode." - }, - with_statements_are_not_allowed_in_strict_mode: { - code: 1101, - category: 1, - key: "'with' statements are not allowed in strict mode." - }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { - code: 1102, - category: 1, - key: "'delete' cannot be called on an identifier in strict mode." - }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { - code: 1104, - category: 1, - key: "A 'continue' statement can only be used within an enclosing iteration statement." - }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { - code: 1105, - category: 1, - key: "A 'break' statement can only be used within an enclosing iteration or switch statement." - }, - Jump_target_cannot_cross_function_boundary: { - code: 1107, - category: 1, - key: "Jump target cannot cross function boundary." - }, - A_return_statement_can_only_be_used_within_a_function_body: { - code: 1108, - category: 1, - key: "A 'return' statement can only be used within a function body." - }, - Expression_expected: { - code: 1109, - category: 1, - key: "Expression expected." - }, - Type_expected: { - code: 1110, - category: 1, - key: "Type expected." - }, - A_class_member_cannot_be_declared_optional: { - code: 1112, - category: 1, - key: "A class member cannot be declared optional." - }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { - code: 1113, - category: 1, - key: "A 'default' clause cannot appear more than once in a 'switch' statement." - }, - Duplicate_label_0: { - code: 1114, - category: 1, - key: "Duplicate label '{0}'" - }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { - code: 1115, - category: 1, - key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." - }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { - code: 1116, - category: 1, - key: "A 'break' statement can only jump to a label of an enclosing statement." - }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { - code: 1117, - category: 1, - key: "An object literal cannot have multiple properties with the same name in strict mode." - }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { - code: 1118, - category: 1, - key: "An object literal cannot have multiple get/set accessors with the same name." - }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { - code: 1119, - category: 1, - key: "An object literal cannot have property and accessor with the same name." - }, - An_export_assignment_cannot_have_modifiers: { - code: 1120, - category: 1, - key: "An export assignment cannot have modifiers." - }, - Octal_literals_are_not_allowed_in_strict_mode: { - code: 1121, - category: 1, - key: "Octal literals are not allowed in strict mode." - }, - A_tuple_type_element_list_cannot_be_empty: { - code: 1122, - category: 1, - key: "A tuple type element list cannot be empty." - }, - Variable_declaration_list_cannot_be_empty: { - code: 1123, - category: 1, - key: "Variable declaration list cannot be empty." - }, - Digit_expected: { - code: 1124, - category: 1, - key: "Digit expected." - }, - Hexadecimal_digit_expected: { - code: 1125, - category: 1, - key: "Hexadecimal digit expected." - }, - Unexpected_end_of_text: { - code: 1126, - category: 1, - key: "Unexpected end of text." - }, - Invalid_character: { - code: 1127, - category: 1, - key: "Invalid character." - }, - Declaration_or_statement_expected: { - code: 1128, - category: 1, - key: "Declaration or statement expected." - }, - Statement_expected: { - code: 1129, - category: 1, - key: "Statement expected." - }, - case_or_default_expected: { - code: 1130, - category: 1, - key: "'case' or 'default' expected." - }, - Property_or_signature_expected: { - code: 1131, - category: 1, - key: "Property or signature expected." - }, - Enum_member_expected: { - code: 1132, - category: 1, - key: "Enum member expected." - }, - Type_reference_expected: { - code: 1133, - category: 1, - key: "Type reference expected." - }, - Variable_declaration_expected: { - code: 1134, - category: 1, - key: "Variable declaration expected." - }, - Argument_expression_expected: { - code: 1135, - category: 1, - key: "Argument expression expected." - }, - Property_assignment_expected: { - code: 1136, - category: 1, - key: "Property assignment expected." - }, - Expression_or_comma_expected: { - code: 1137, - category: 1, - key: "Expression or comma expected." - }, - Parameter_declaration_expected: { - code: 1138, - category: 1, - key: "Parameter declaration expected." - }, - Type_parameter_declaration_expected: { - code: 1139, - category: 1, - key: "Type parameter declaration expected." - }, - Type_argument_expected: { - code: 1140, - category: 1, - key: "Type argument expected." - }, - String_literal_expected: { - code: 1141, - category: 1, - key: "String literal expected." - }, - Line_break_not_permitted_here: { - code: 1142, - category: 1, - key: "Line break not permitted here." - }, - or_expected: { - code: 1144, - category: 1, - key: "'{' or ';' expected." - }, - Modifiers_not_permitted_on_index_signature_members: { - code: 1145, - category: 1, - key: "Modifiers not permitted on index signature members." - }, - Declaration_expected: { - code: 1146, - category: 1, - key: "Declaration expected." - }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { - code: 1147, - category: 1, - key: "Import declarations in an internal module cannot reference an external module." - }, - Cannot_compile_external_modules_unless_the_module_flag_is_provided: { - code: 1148, - category: 1, - key: "Cannot compile external modules unless the '--module' flag is provided." - }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { - code: 1149, - category: 1, - key: "File name '{0}' differs from already included file name '{1}' only in casing" - }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { - code: 1150, - category: 1, - key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." - }, - var_let_or_const_expected: { - code: 1152, - category: 1, - key: "'var', 'let' or 'const' expected." - }, - let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 1153, - category: 1, - key: "'let' declarations are only available when targeting ECMAScript 6 and higher." - }, - const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 1154, - category: 1, - key: "'const' declarations are only available when targeting ECMAScript 6 and higher." - }, - const_declarations_must_be_initialized: { - code: 1155, - category: 1, - key: "'const' declarations must be initialized" - }, - const_declarations_can_only_be_declared_inside_a_block: { - code: 1156, - category: 1, - key: "'const' declarations can only be declared inside a block." - }, - let_declarations_can_only_be_declared_inside_a_block: { - code: 1157, - category: 1, - key: "'let' declarations can only be declared inside a block." - }, - Unterminated_template_literal: { - code: 1160, - category: 1, - key: "Unterminated template literal." - }, - Unterminated_regular_expression_literal: { - code: 1161, - category: 1, - key: "Unterminated regular expression literal." - }, - An_object_member_cannot_be_declared_optional: { - code: 1162, - category: 1, - key: "An object member cannot be declared optional." - }, - yield_expression_must_be_contained_within_a_generator_declaration: { - code: 1163, - category: 1, - key: "'yield' expression must be contained_within a generator declaration." - }, - Computed_property_names_are_not_allowed_in_enums: { - code: 1164, - category: 1, - key: "Computed property names are not allowed in enums." - }, - A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { - code: 1165, - category: 1, - key: "A computed property name in an ambient context must directly refer to a built-in symbol." - }, - A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { - code: 1166, - category: 1, - key: "A computed property name in a class property declaration must directly refer to a built-in symbol." - }, - Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 1167, - category: 1, - key: "Computed property names are only available when targeting ECMAScript 6 and higher." - }, - A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { - code: 1168, - category: 1, - key: "A computed property name in a method overload must directly refer to a built-in symbol." - }, - A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { - code: 1169, - category: 1, - key: "A computed property name in an interface must directly refer to a built-in symbol." - }, - A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { - code: 1170, - category: 1, - key: "A computed property name in a type literal must directly refer to a built-in symbol." - }, - A_comma_expression_is_not_allowed_in_a_computed_property_name: { - code: 1171, - category: 1, - key: "A comma expression is not allowed in a computed property name." - }, - extends_clause_already_seen: { - code: 1172, - category: 1, - key: "'extends' clause already seen." - }, - extends_clause_must_precede_implements_clause: { - code: 1173, - category: 1, - key: "'extends' clause must precede 'implements' clause." - }, - Classes_can_only_extend_a_single_class: { - code: 1174, - category: 1, - key: "Classes can only extend a single class." - }, - implements_clause_already_seen: { - code: 1175, - category: 1, - key: "'implements' clause already seen." - }, - Interface_declaration_cannot_have_implements_clause: { - code: 1176, - category: 1, - key: "Interface declaration cannot have 'implements' clause." - }, - Binary_digit_expected: { - code: 1177, - category: 1, - key: "Binary digit expected." - }, - Octal_digit_expected: { - code: 1178, - category: 1, - key: "Octal digit expected." - }, - Unexpected_token_expected: { - code: 1179, - category: 1, - key: "Unexpected token. '{' expected." - }, - Property_destructuring_pattern_expected: { - code: 1180, - category: 1, - key: "Property destructuring pattern expected." - }, - Array_element_destructuring_pattern_expected: { - code: 1181, - category: 1, - key: "Array element destructuring pattern expected." - }, - A_destructuring_declaration_must_have_an_initializer: { - code: 1182, - category: 1, - key: "A destructuring declaration must have an initializer." - }, - Destructuring_declarations_are_not_allowed_in_ambient_contexts: { - code: 1183, - category: 1, - key: "Destructuring declarations are not allowed in ambient contexts." - }, - An_implementation_cannot_be_declared_in_ambient_contexts: { - code: 1184, - category: 1, - key: "An implementation cannot be declared in ambient contexts." - }, - Modifiers_cannot_appear_here: { - code: 1184, - category: 1, - key: "Modifiers cannot appear here." - }, - Merge_conflict_marker_encountered: { - code: 1185, - category: 1, - key: "Merge conflict marker encountered." - }, - A_rest_element_cannot_have_an_initializer: { - code: 1186, - category: 1, - key: "A rest element cannot have an initializer." - }, - A_parameter_property_may_not_be_a_binding_pattern: { - code: 1187, - category: 1, - key: "A parameter property may not be a binding pattern." - }, - Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { - code: 1188, - category: 1, - key: "Only a single variable declaration is allowed in a 'for...of' statement." - }, - The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { - code: 1189, - category: 1, - key: "The variable declaration of a 'for...in' statement cannot have an initializer." - }, - The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { - code: 1190, - category: 1, - key: "The variable declaration of a 'for...of' statement cannot have an initializer." - }, - An_import_declaration_cannot_have_modifiers: { - code: 1191, - category: 1, - key: "An import declaration cannot have modifiers." - }, - External_module_0_has_no_default_export_or_export_assignment: { - code: 1192, - category: 1, - key: "External module '{0}' has no default export or export assignment." - }, - An_export_declaration_cannot_have_modifiers: { - code: 1193, - category: 1, - key: "An export declaration cannot have modifiers." - }, - Export_declarations_are_not_permitted_in_an_internal_module: { - code: 1194, - category: 1, - key: "Export declarations are not permitted in an internal module." - }, - Catch_clause_variable_name_must_be_an_identifier: { - code: 1195, - category: 1, - key: "Catch clause variable name must be an identifier." - }, - Catch_clause_variable_cannot_have_a_type_annotation: { - code: 1196, - category: 1, - key: "Catch clause variable cannot have a type annotation." - }, - Catch_clause_variable_cannot_have_an_initializer: { - code: 1197, - category: 1, - key: "Catch clause variable cannot have an initializer." - }, - An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { - code: 1198, - category: 1, - key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." - }, - Unterminated_Unicode_escape_sequence: { - code: 1199, - category: 1, - key: "Unterminated Unicode escape sequence." - }, - Duplicate_identifier_0: { - code: 2300, - category: 1, - key: "Duplicate identifier '{0}'." - }, - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { - code: 2301, - category: 1, - key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." - }, - Static_members_cannot_reference_class_type_parameters: { - code: 2302, - category: 1, - key: "Static members cannot reference class type parameters." - }, - Circular_definition_of_import_alias_0: { - code: 2303, - category: 1, - key: "Circular definition of import alias '{0}'." - }, - Cannot_find_name_0: { - code: 2304, - category: 1, - key: "Cannot find name '{0}'." - }, - Module_0_has_no_exported_member_1: { - code: 2305, - category: 1, - key: "Module '{0}' has no exported member '{1}'." - }, - File_0_is_not_an_external_module: { - code: 2306, - category: 1, - key: "File '{0}' is not an external module." - }, - Cannot_find_external_module_0: { - code: 2307, - category: 1, - key: "Cannot find external module '{0}'." - }, - A_module_cannot_have_more_than_one_export_assignment: { - code: 2308, - category: 1, - key: "A module cannot have more than one export assignment." - }, - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { - code: 2309, - category: 1, - key: "An export assignment cannot be used in a module with other exported elements." - }, - Type_0_recursively_references_itself_as_a_base_type: { - code: 2310, - category: 1, - key: "Type '{0}' recursively references itself as a base type." - }, - A_class_may_only_extend_another_class: { - code: 2311, - category: 1, - key: "A class may only extend another class." - }, - An_interface_may_only_extend_a_class_or_another_interface: { - code: 2312, - category: 1, - key: "An interface may only extend a class or another interface." - }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { - code: 2313, - category: 1, - key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." - }, - Generic_type_0_requires_1_type_argument_s: { - code: 2314, - category: 1, - key: "Generic type '{0}' requires {1} type argument(s)." - }, - Type_0_is_not_generic: { - code: 2315, - category: 1, - key: "Type '{0}' is not generic." - }, - Global_type_0_must_be_a_class_or_interface_type: { - code: 2316, - category: 1, - key: "Global type '{0}' must be a class or interface type." - }, - Global_type_0_must_have_1_type_parameter_s: { - code: 2317, - category: 1, - key: "Global type '{0}' must have {1} type parameter(s)." - }, - Cannot_find_global_type_0: { - code: 2318, - category: 1, - key: "Cannot find global type '{0}'." - }, - Named_property_0_of_types_1_and_2_are_not_identical: { - code: 2319, - category: 1, - key: "Named property '{0}' of types '{1}' and '{2}' are not identical." - }, - Interface_0_cannot_simultaneously_extend_types_1_and_2: { - code: 2320, - category: 1, - key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." - }, - Excessive_stack_depth_comparing_types_0_and_1: { - code: 2321, - category: 1, - key: "Excessive stack depth comparing types '{0}' and '{1}'." - }, - Type_0_is_not_assignable_to_type_1: { - code: 2322, - category: 1, - key: "Type '{0}' is not assignable to type '{1}'." - }, - Property_0_is_missing_in_type_1: { - code: 2324, - category: 1, - key: "Property '{0}' is missing in type '{1}'." - }, - Property_0_is_private_in_type_1_but_not_in_type_2: { - code: 2325, - category: 1, - key: "Property '{0}' is private in type '{1}' but not in type '{2}'." - }, - Types_of_property_0_are_incompatible: { - code: 2326, - category: 1, - key: "Types of property '{0}' are incompatible." - }, - Property_0_is_optional_in_type_1_but_required_in_type_2: { - code: 2327, - category: 1, - key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." - }, - Types_of_parameters_0_and_1_are_incompatible: { - code: 2328, - category: 1, - key: "Types of parameters '{0}' and '{1}' are incompatible." - }, - Index_signature_is_missing_in_type_0: { - code: 2329, - category: 1, - key: "Index signature is missing in type '{0}'." - }, - Index_signatures_are_incompatible: { - code: 2330, - category: 1, - key: "Index signatures are incompatible." - }, - this_cannot_be_referenced_in_a_module_body: { - code: 2331, - category: 1, - key: "'this' cannot be referenced in a module body." - }, - this_cannot_be_referenced_in_current_location: { - code: 2332, - category: 1, - key: "'this' cannot be referenced in current location." - }, - this_cannot_be_referenced_in_constructor_arguments: { - code: 2333, - category: 1, - key: "'this' cannot be referenced in constructor arguments." - }, - this_cannot_be_referenced_in_a_static_property_initializer: { - code: 2334, - category: 1, - key: "'this' cannot be referenced in a static property initializer." - }, - super_can_only_be_referenced_in_a_derived_class: { - code: 2335, - category: 1, - key: "'super' can only be referenced in a derived class." - }, - super_cannot_be_referenced_in_constructor_arguments: { - code: 2336, - category: 1, - key: "'super' cannot be referenced in constructor arguments." - }, - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { - code: 2337, - category: 1, - key: "Super calls are not permitted outside constructors or in nested functions inside constructors" - }, - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { - code: 2338, - category: 1, - key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" - }, - Property_0_does_not_exist_on_type_1: { - code: 2339, - category: 1, - key: "Property '{0}' does not exist on type '{1}'." - }, - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { - code: 2340, - category: 1, - key: "Only public and protected methods of the base class are accessible via the 'super' keyword" - }, - Property_0_is_private_and_only_accessible_within_class_1: { - code: 2341, - category: 1, - key: "Property '{0}' is private and only accessible within class '{1}'." - }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { - code: 2342, - category: 1, - key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." - }, - Type_0_does_not_satisfy_the_constraint_1: { - code: 2344, - category: 1, - key: "Type '{0}' does not satisfy the constraint '{1}'." - }, - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { - code: 2345, - category: 1, - key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." - }, - Supplied_parameters_do_not_match_any_signature_of_call_target: { - code: 2346, - category: 1, - key: "Supplied parameters do not match any signature of call target." - }, - Untyped_function_calls_may_not_accept_type_arguments: { - code: 2347, - category: 1, - key: "Untyped function calls may not accept type arguments." - }, - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { - code: 2348, - category: 1, - key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" - }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { - code: 2349, - category: 1, - key: "Cannot invoke an expression whose type lacks a call signature." - }, - Only_a_void_function_can_be_called_with_the_new_keyword: { - code: 2350, - category: 1, - key: "Only a void function can be called with the 'new' keyword." - }, - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { - code: 2351, - category: 1, - key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." - }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { - code: 2352, - category: 1, - key: "Neither type '{0}' nor type '{1}' is assignable to the other." - }, - No_best_common_type_exists_among_return_expressions: { - code: 2354, - category: 1, - key: "No best common type exists among return expressions." - }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { - code: 2355, - category: 1, - key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." - }, - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { - code: 2356, - category: 1, - key: "An arithmetic operand must be of type 'any', 'number' or an enum type." - }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { - code: 2357, - category: 1, - key: "The operand of an increment or decrement operator must be a variable, property or indexer." - }, - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: 2358, - category: 1, - key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." - }, - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { - code: 2359, - category: 1, - key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." - }, - The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { - code: 2360, - category: 1, - key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." - }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: 2361, - category: 1, - key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" - }, - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { - code: 2362, - category: 1, - key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." - }, - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { - code: 2363, - category: 1, - key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." - }, - Invalid_left_hand_side_of_assignment_expression: { - code: 2364, - category: 1, - key: "Invalid left-hand side of assignment expression." - }, - Operator_0_cannot_be_applied_to_types_1_and_2: { - code: 2365, - category: 1, - key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." - }, - Type_parameter_name_cannot_be_0: { - code: 2368, - category: 1, - key: "Type parameter name cannot be '{0}'" - }, - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { - code: 2369, - category: 1, - key: "A parameter property is only allowed in a constructor implementation." - }, - A_rest_parameter_must_be_of_an_array_type: { - code: 2370, - category: 1, - key: "A rest parameter must be of an array type." - }, - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { - code: 2371, - category: 1, - key: "A parameter initializer is only allowed in a function or constructor implementation." - }, - Parameter_0_cannot_be_referenced_in_its_initializer: { - code: 2372, - category: 1, - key: "Parameter '{0}' cannot be referenced in its initializer." - }, - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { - code: 2373, - category: 1, - key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." - }, - Duplicate_string_index_signature: { - code: 2374, - category: 1, - key: "Duplicate string index signature." - }, - Duplicate_number_index_signature: { - code: 2375, - category: 1, - key: "Duplicate number index signature." - }, - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { - code: 2376, - category: 1, - key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." - }, - Constructors_for_derived_classes_must_contain_a_super_call: { - code: 2377, - category: 1, - key: "Constructors for derived classes must contain a 'super' call." - }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { - code: 2378, - category: 1, - key: "A 'get' accessor must return a value or consist of a single 'throw' statement." - }, - Getter_and_setter_accessors_do_not_agree_in_visibility: { - code: 2379, - category: 1, - key: "Getter and setter accessors do not agree in visibility." - }, - get_and_set_accessor_must_have_the_same_type: { - code: 2380, - category: 1, - key: "'get' and 'set' accessor must have the same type." - }, - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { - code: 2381, - category: 1, - key: "A signature with an implementation cannot use a string literal type." - }, - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { - code: 2382, - category: 1, - key: "Specialized overload signature is not assignable to any non-specialized signature." - }, - Overload_signatures_must_all_be_exported_or_not_exported: { - code: 2383, - category: 1, - key: "Overload signatures must all be exported or not exported." - }, - Overload_signatures_must_all_be_ambient_or_non_ambient: { - code: 2384, - category: 1, - key: "Overload signatures must all be ambient or non-ambient." - }, - Overload_signatures_must_all_be_public_private_or_protected: { - code: 2385, - category: 1, - key: "Overload signatures must all be public, private or protected." - }, - Overload_signatures_must_all_be_optional_or_required: { - code: 2386, - category: 1, - key: "Overload signatures must all be optional or required." - }, - Function_overload_must_be_static: { - code: 2387, - category: 1, - key: "Function overload must be static." - }, - Function_overload_must_not_be_static: { - code: 2388, - category: 1, - key: "Function overload must not be static." - }, - Function_implementation_name_must_be_0: { - code: 2389, - category: 1, - key: "Function implementation name must be '{0}'." - }, - Constructor_implementation_is_missing: { - code: 2390, - category: 1, - key: "Constructor implementation is missing." - }, - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { - code: 2391, - category: 1, - key: "Function implementation is missing or not immediately following the declaration." - }, - Multiple_constructor_implementations_are_not_allowed: { - code: 2392, - category: 1, - key: "Multiple constructor implementations are not allowed." - }, - Duplicate_function_implementation: { - code: 2393, - category: 1, - key: "Duplicate function implementation." - }, - Overload_signature_is_not_compatible_with_function_implementation: { - code: 2394, - category: 1, - key: "Overload signature is not compatible with function implementation." - }, - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { - code: 2395, - category: 1, - key: "Individual declarations in merged declaration {0} must be all exported or all local." - }, - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { - code: 2396, - category: 1, - key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." - }, - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { - code: 2399, - category: 1, - key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." - }, - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { - code: 2400, - category: 1, - key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." - }, - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { - code: 2401, - category: 1, - key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." - }, - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { - code: 2402, - category: 1, - key: "Expression resolves to '_super' that compiler uses to capture base class reference." - }, - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { - code: 2403, - category: 1, - key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." - }, - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { - code: 2404, - category: 1, - key: "The left-hand side of a 'for...in' statement cannot use a type annotation." - }, - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { - code: 2405, - category: 1, - key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." - }, - Invalid_left_hand_side_in_for_in_statement: { - code: 2406, - category: 1, - key: "Invalid left-hand side in 'for...in' statement." - }, - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { - code: 2407, - category: 1, - key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." - }, - Setters_cannot_return_a_value: { - code: 2408, - category: 1, - key: "Setters cannot return a value." - }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { - code: 2409, - category: 1, - key: "Return type of constructor signature must be assignable to the instance type of the class" - }, - All_symbols_within_a_with_block_will_be_resolved_to_any: { - code: 2410, - category: 1, - key: "All symbols within a 'with' block will be resolved to 'any'." - }, - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { - code: 2411, - category: 1, - key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." - }, - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { - code: 2412, - category: 1, - key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." - }, - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { - code: 2413, - category: 1, - key: "Numeric index type '{0}' is not assignable to string index type '{1}'." - }, - Class_name_cannot_be_0: { - code: 2414, - category: 1, - key: "Class name cannot be '{0}'" - }, - Class_0_incorrectly_extends_base_class_1: { - code: 2415, - category: 1, - key: "Class '{0}' incorrectly extends base class '{1}'." - }, - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { - code: 2417, - category: 1, - key: "Class static side '{0}' incorrectly extends base class static side '{1}'." - }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { - code: 2419, - category: 1, - key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." - }, - Class_0_incorrectly_implements_interface_1: { - code: 2420, - category: 1, - key: "Class '{0}' incorrectly implements interface '{1}'." - }, - A_class_may_only_implement_another_class_or_interface: { - code: 2422, - category: 1, - key: "A class may only implement another class or interface." - }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { - code: 2423, - category: 1, - key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." - }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { - code: 2424, - category: 1, - key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." - }, - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { - code: 2425, - category: 1, - key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." - }, - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { - code: 2426, - category: 1, - key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." - }, - Interface_name_cannot_be_0: { - code: 2427, - category: 1, - key: "Interface name cannot be '{0}'" - }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { - code: 2428, - category: 1, - key: "All declarations of an interface must have identical type parameters." - }, - Interface_0_incorrectly_extends_interface_1: { - code: 2430, - category: 1, - key: "Interface '{0}' incorrectly extends interface '{1}'." - }, - Enum_name_cannot_be_0: { - code: 2431, - category: 1, - key: "Enum name cannot be '{0}'" - }, - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { - code: 2432, - category: 1, - key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." - }, - A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { - code: 2433, - category: 1, - key: "A module declaration cannot be in a different file from a class or function with which it is merged" - }, - A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { - code: 2434, - category: 1, - key: "A module declaration cannot be located prior to a class or function with which it is merged" - }, - Ambient_external_modules_cannot_be_nested_in_other_modules: { - code: 2435, - category: 1, - key: "Ambient external modules cannot be nested in other modules." - }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { - code: 2436, - category: 1, - key: "Ambient external module declaration cannot specify relative module name." - }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { - code: 2437, - category: 1, - key: "Module '{0}' is hidden by a local declaration with the same name" - }, - Import_name_cannot_be_0: { - code: 2438, - category: 1, - key: "Import name cannot be '{0}'" - }, - Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { - code: 2439, - category: 1, - key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." - }, - Import_declaration_conflicts_with_local_declaration_of_0: { - code: 2440, - category: 1, - key: "Import declaration conflicts with local declaration of '{0}'" - }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { - code: 2441, - category: 1, - key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." - }, - Types_have_separate_declarations_of_a_private_property_0: { - code: 2442, - category: 1, - key: "Types have separate declarations of a private property '{0}'." - }, - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { - code: 2443, - category: 1, - key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." - }, - Property_0_is_protected_in_type_1_but_public_in_type_2: { - code: 2444, - category: 1, - key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." - }, - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { - code: 2445, - category: 1, - key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." - }, - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { - code: 2446, - category: 1, - key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." - }, - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { - code: 2447, - category: 1, - key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." - }, - Block_scoped_variable_0_used_before_its_declaration: { - code: 2448, - category: 1, - key: "Block-scoped variable '{0}' used before its declaration." - }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { - code: 2449, - category: 1, - key: "The operand of an increment or decrement operator cannot be a constant." - }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { - code: 2450, - category: 1, - key: "Left-hand side of assignment expression cannot be a constant." - }, - Cannot_redeclare_block_scoped_variable_0: { - code: 2451, - category: 1, - key: "Cannot redeclare block-scoped variable '{0}'." - }, - An_enum_member_cannot_have_a_numeric_name: { - code: 2452, - category: 1, - key: "An enum member cannot have a numeric name." - }, - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { - code: 2453, - category: 1, - key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." - }, - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { - code: 2455, - category: 1, - key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." - }, - Type_alias_0_circularly_references_itself: { - code: 2456, - category: 1, - key: "Type alias '{0}' circularly references itself." - }, - Type_alias_name_cannot_be_0: { - code: 2457, - category: 1, - key: "Type alias name cannot be '{0}'" - }, - An_AMD_module_cannot_have_multiple_name_assignments: { - code: 2458, - category: 1, - key: "An AMD module cannot have multiple name assignments." - }, - Type_0_has_no_property_1_and_no_string_index_signature: { - code: 2459, - category: 1, - key: "Type '{0}' has no property '{1}' and no string index signature." - }, - Type_0_has_no_property_1: { - code: 2460, - category: 1, - key: "Type '{0}' has no property '{1}'." - }, - Type_0_is_not_an_array_type: { - code: 2461, - category: 1, - key: "Type '{0}' is not an array type." - }, - A_rest_element_must_be_last_in_an_array_destructuring_pattern: { - code: 2462, - category: 1, - key: "A rest element must be last in an array destructuring pattern" - }, - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { - code: 2463, - category: 1, - key: "A binding pattern parameter cannot be optional in an implementation signature." - }, - A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { - code: 2464, - category: 1, - key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." - }, - this_cannot_be_referenced_in_a_computed_property_name: { - code: 2465, - category: 1, - key: "'this' cannot be referenced in a computed property name." - }, - super_cannot_be_referenced_in_a_computed_property_name: { - code: 2466, - category: 1, - key: "'super' cannot be referenced in a computed property name." - }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { - code: 2467, - category: 1, - key: "A computed property name cannot reference a type parameter from its containing type." - }, - Cannot_find_global_value_0: { - code: 2468, - category: 1, - key: "Cannot find global value '{0}'." - }, - The_0_operator_cannot_be_applied_to_type_symbol: { - code: 2469, - category: 1, - key: "The '{0}' operator cannot be applied to type 'symbol'." - }, - Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { - code: 2470, - category: 1, - key: "'Symbol' reference does not refer to the global Symbol constructor object." - }, - A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { - code: 2471, - category: 1, - key: "A computed property name of the form '{0}' must be of type 'symbol'." - }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { - code: 2472, - category: 1, - key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." - }, - Enum_declarations_must_all_be_const_or_non_const: { - code: 2473, - category: 1, - key: "Enum declarations must all be const or non-const." - }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { - code: 2474, - category: 1, - key: "In 'const' enum declarations member initializer must be constant expression." - }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { - code: 2475, - category: 1, - key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." - }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { - code: 2476, - category: 1, - key: "A const enum member can only be accessed using a string literal." - }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { - code: 2477, - category: 1, - key: "'const' enum member initializer was evaluated to a non-finite value." - }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { - code: 2478, - category: 1, - key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." - }, - Property_0_does_not_exist_on_const_enum_1: { - code: 2479, - category: 1, - key: "Property '{0}' does not exist on 'const' enum '{1}'." - }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { - code: 2480, - category: 1, - key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." - }, - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { - code: 2481, - category: 1, - key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." - }, - The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { - code: 2483, - category: 1, - key: "The left-hand side of a 'for...of' statement cannot use a type annotation." - }, - Export_declaration_conflicts_with_exported_declaration_of_0: { - code: 2484, - category: 1, - key: "Export declaration conflicts with exported declaration of '{0}'" - }, - The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { - code: 2485, - category: 1, - key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." - }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { - code: 2486, - category: 1, - key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." - }, - Invalid_left_hand_side_in_for_of_statement: { - code: 2487, - category: 1, - key: "Invalid left-hand side in 'for...of' statement." - }, - The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { - code: 2488, - category: 1, - key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." - }, - The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { - code: 2489, - category: 1, - key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." - }, - The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { - code: 2490, - category: 1, - key: "The type returned by the 'next()' method of an iterator must have a 'value' property." - }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { - code: 2491, - category: 1, - key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." - }, - Cannot_redeclare_identifier_0_in_catch_clause: { - code: 2492, - category: 1, - key: "Cannot redeclare identifier '{0}' in catch clause" - }, - Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { - code: 2493, - category: 1, - key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." - }, - Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { - code: 2494, - category: 1, - key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." - }, - Type_0_is_not_an_array_type_or_a_string_type: { - code: 2461, - category: 1, - key: "Type '{0}' is not an array type or a string type." - }, - Import_declaration_0_is_using_private_name_1: { - code: 4000, - category: 1, - key: "Import declaration '{0}' is using private name '{1}'." - }, - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { - code: 4002, - category: 1, - key: "Type parameter '{0}' of exported class has or is using private name '{1}'." - }, - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { - code: 4004, - category: 1, - key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4006, - category: 1, - key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4008, - category: 1, - key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4010, - category: 1, - key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." - }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4012, - category: 1, - key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." - }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { - code: 4014, - category: 1, - key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." - }, - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { - code: 4016, - category: 1, - key: "Type parameter '{0}' of exported function has or is using private name '{1}'." - }, - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { - code: 4019, - category: 1, - key: "Implements clause of exported class '{0}' has or is using private name '{1}'." - }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { - code: 4020, - category: 1, - key: "Extends clause of exported class '{0}' has or is using private name '{1}'." - }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { - code: 4022, - category: 1, - key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." - }, - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4023, - category: 1, - key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." - }, - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { - code: 4024, - category: 1, - key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." - }, - Exported_variable_0_has_or_is_using_private_name_1: { - code: 4025, - category: 1, - key: "Exported variable '{0}' has or is using private name '{1}'." - }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4026, - category: 1, - key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4027, - category: 1, - key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." - }, - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { - code: 4028, - category: 1, - key: "Public static property '{0}' of exported class has or is using private name '{1}'." - }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4029, - category: 1, - key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4030, - category: 1, - key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." - }, - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { - code: 4031, - category: 1, - key: "Public property '{0}' of exported class has or is using private name '{1}'." - }, - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4032, - category: 1, - key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." - }, - Property_0_of_exported_interface_has_or_is_using_private_name_1: { - code: 4033, - category: 1, - key: "Property '{0}' of exported interface has or is using private name '{1}'." - }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4034, - category: 1, - key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { - code: 4035, - category: 1, - key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." - }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4036, - category: 1, - key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { - code: 4037, - category: 1, - key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." - }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4038, - category: 1, - key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4039, - category: 1, - key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { - code: 4040, - category: 1, - key: "Return type of public static property getter from exported class has or is using private name '{0}'." - }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4041, - category: 1, - key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4042, - category: 1, - key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { - code: 4043, - category: 1, - key: "Return type of public property getter from exported class has or is using private name '{0}'." - }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4044, - category: 1, - key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: 4045, - category: 1, - key: "Return type of constructor signature from exported interface has or is using private name '{0}'." - }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4046, - category: 1, - key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: 4047, - category: 1, - key: "Return type of call signature from exported interface has or is using private name '{0}'." - }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4048, - category: 1, - key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { - code: 4049, - category: 1, - key: "Return type of index signature from exported interface has or is using private name '{0}'." - }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4050, - category: 1, - key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4051, - category: 1, - key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { - code: 4052, - category: 1, - key: "Return type of public static method from exported class has or is using private name '{0}'." - }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4053, - category: 1, - key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { - code: 4054, - category: 1, - key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { - code: 4055, - category: 1, - key: "Return type of public method from exported class has or is using private name '{0}'." - }, - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { - code: 4056, - category: 1, - key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { - code: 4057, - category: 1, - key: "Return type of method from exported interface has or is using private name '{0}'." - }, - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { - code: 4058, - category: 1, - key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." - }, - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { - code: 4059, - category: 1, - key: "Return type of exported function has or is using name '{0}' from private module '{1}'." - }, - Return_type_of_exported_function_has_or_is_using_private_name_0: { - code: 4060, - category: 1, - key: "Return type of exported function has or is using private name '{0}'." - }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4061, - category: 1, - key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4062, - category: 1, - key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { - code: 4063, - category: 1, - key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." - }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4064, - category: 1, - key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4065, - category: 1, - key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." - }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4066, - category: 1, - key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { - code: 4067, - category: 1, - key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." - }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4068, - category: 1, - key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4069, - category: 1, - key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4070, - category: 1, - key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." - }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4071, - category: 1, - key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { - code: 4072, - category: 1, - key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { - code: 4073, - category: 1, - key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." - }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { - code: 4074, - category: 1, - key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { - code: 4075, - category: 1, - key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." - }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { - code: 4076, - category: 1, - key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." - }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { - code: 4077, - category: 1, - key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." - }, - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { - code: 4078, - category: 1, - key: "Parameter '{0}' of exported function has or is using private name '{1}'." - }, - Exported_type_alias_0_has_or_is_using_private_name_1: { - code: 4081, - category: 1, - key: "Exported type alias '{0}' has or is using private name '{1}'." - }, - Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { - code: 4091, - category: 1, - key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." - }, - The_current_host_does_not_support_the_0_option: { - code: 5001, - category: 1, - key: "The current host does not support the '{0}' option." - }, - Cannot_find_the_common_subdirectory_path_for_the_input_files: { - code: 5009, - category: 1, - key: "Cannot find the common subdirectory path for the input files." - }, - Cannot_read_file_0_Colon_1: { - code: 5012, - category: 1, - key: "Cannot read file '{0}': {1}" - }, - Unsupported_file_encoding: { - code: 5013, - category: 1, - key: "Unsupported file encoding." - }, - Unknown_compiler_option_0: { - code: 5023, - category: 1, - key: "Unknown compiler option '{0}'." - }, - Compiler_option_0_requires_a_value_of_type_1: { - code: 5024, - category: 1, - key: "Compiler option '{0}' requires a value of type {1}." - }, - Could_not_write_file_0_Colon_1: { - code: 5033, - category: 1, - key: "Could not write file '{0}': {1}" - }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { - code: 5038, - category: 1, - key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." - }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { - code: 5039, - category: 1, - key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." - }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { - code: 5040, - category: 1, - key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." - }, - Option_noEmit_cannot_be_specified_with_option_declaration: { - code: 5041, - category: 1, - key: "Option 'noEmit' cannot be specified with option 'declaration'." - }, - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { - code: 5042, - category: 1, - key: "Option 'project' cannot be mixed with source files on a command line." - }, - Concatenate_and_emit_output_to_single_file: { - code: 6001, - category: 2, - key: "Concatenate and emit output to single file." - }, - Generates_corresponding_d_ts_file: { - code: 6002, - category: 2, - key: "Generates corresponding '.d.ts' file." - }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { - code: 6003, - category: 2, - key: "Specifies the location where debugger should locate map files instead of generated locations." - }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { - code: 6004, - category: 2, - key: "Specifies the location where debugger should locate TypeScript files instead of source locations." - }, - Watch_input_files: { - code: 6005, - category: 2, - key: "Watch input files." - }, - Redirect_output_structure_to_the_directory: { - code: 6006, - category: 2, - key: "Redirect output structure to the directory." - }, - Do_not_erase_const_enum_declarations_in_generated_code: { - code: 6007, - category: 2, - key: "Do not erase const enum declarations in generated code." - }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { - code: 6008, - category: 2, - key: "Do not emit outputs if any type checking errors were reported." - }, - Do_not_emit_comments_to_output: { - code: 6009, - category: 2, - key: "Do not emit comments to output." - }, - Do_not_emit_outputs: { - code: 6010, - category: 2, - key: "Do not emit outputs." - }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { - code: 6015, - category: 2, - key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" - }, - Specify_module_code_generation_Colon_commonjs_or_amd: { - code: 6016, - category: 2, - key: "Specify module code generation: 'commonjs' or 'amd'" - }, - Print_this_message: { - code: 6017, - category: 2, - key: "Print this message." - }, - Print_the_compiler_s_version: { - code: 6019, - category: 2, - key: "Print the compiler's version." - }, - Compile_the_project_in_the_given_directory: { - code: 6020, - category: 2, - key: "Compile the project in the given directory." - }, - Syntax_Colon_0: { - code: 6023, - category: 2, - key: "Syntax: {0}" - }, - options: { - code: 6024, - category: 2, - key: "options" - }, - file: { - code: 6025, - category: 2, - key: "file" - }, - Examples_Colon_0: { - code: 6026, - category: 2, - key: "Examples: {0}" - }, - Options_Colon: { - code: 6027, - category: 2, - key: "Options:" - }, - Version_0: { - code: 6029, - category: 2, - key: "Version {0}" - }, - Insert_command_line_options_and_files_from_a_file: { - code: 6030, - category: 2, - key: "Insert command line options and files from a file." - }, - File_change_detected_Starting_incremental_compilation: { - code: 6032, - category: 2, - key: "File change detected. Starting incremental compilation..." - }, - KIND: { - code: 6034, - category: 2, - key: "KIND" - }, - FILE: { - code: 6035, - category: 2, - key: "FILE" - }, - VERSION: { - code: 6036, - category: 2, - key: "VERSION" - }, - LOCATION: { - code: 6037, - category: 2, - key: "LOCATION" - }, - DIRECTORY: { - code: 6038, - category: 2, - key: "DIRECTORY" - }, - Compilation_complete_Watching_for_file_changes: { - code: 6042, - category: 2, - key: "Compilation complete. Watching for file changes." - }, - Generates_corresponding_map_file: { - code: 6043, - category: 2, - key: "Generates corresponding '.map' file." - }, - Compiler_option_0_expects_an_argument: { - code: 6044, - category: 1, - key: "Compiler option '{0}' expects an argument." - }, - Unterminated_quoted_string_in_response_file_0: { - code: 6045, - category: 1, - key: "Unterminated quoted string in response file '{0}'." - }, - Argument_for_module_option_must_be_commonjs_or_amd: { - code: 6046, - category: 1, - key: "Argument for '--module' option must be 'commonjs' or 'amd'." - }, - Argument_for_target_option_must_be_es3_es5_or_es6: { - code: 6047, - category: 1, - key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." - }, - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { - code: 6048, - category: 1, - key: "Locale must be of the form or -. For example '{0}' or '{1}'." - }, - Unsupported_locale_0: { - code: 6049, - category: 1, - key: "Unsupported locale '{0}'." - }, - Unable_to_open_file_0: { - code: 6050, - category: 1, - key: "Unable to open file '{0}'." - }, - Corrupted_locale_file_0: { - code: 6051, - category: 1, - key: "Corrupted locale file {0}." - }, - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { - code: 6052, - category: 2, - key: "Raise error on expressions and declarations with an implied 'any' type." - }, - File_0_not_found: { - code: 6053, - category: 1, - key: "File '{0}' not found." - }, - File_0_must_have_extension_ts_or_d_ts: { - code: 6054, - category: 1, - key: "File '{0}' must have extension '.ts' or '.d.ts'." - }, - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { - code: 6055, - category: 2, - key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." - }, - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { - code: 6056, - category: 2, - key: "Do not emit declarations for code that has an '@internal' annotation." - }, - Preserve_new_lines_when_emitting_code: { - code: 6057, - category: 2, - key: "Preserve new-lines when emitting code." - }, - Variable_0_implicitly_has_an_1_type: { - code: 7005, - category: 1, - key: "Variable '{0}' implicitly has an '{1}' type." - }, - Parameter_0_implicitly_has_an_1_type: { - code: 7006, - category: 1, - key: "Parameter '{0}' implicitly has an '{1}' type." - }, - Member_0_implicitly_has_an_1_type: { - code: 7008, - category: 1, - key: "Member '{0}' implicitly has an '{1}' type." - }, - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { - code: 7009, - category: 1, - key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." - }, - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { - code: 7010, - category: 1, - key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." - }, - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { - code: 7011, - category: 1, - key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." - }, - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { - code: 7013, - category: 1, - key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." - }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { - code: 7016, - category: 1, - key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." - }, - Index_signature_of_object_type_implicitly_has_an_any_type: { - code: 7017, - category: 1, - key: "Index signature of object type implicitly has an 'any' type." - }, - Object_literal_s_property_0_implicitly_has_an_1_type: { - code: 7018, - category: 1, - key: "Object literal's property '{0}' implicitly has an '{1}' type." - }, - Rest_parameter_0_implicitly_has_an_any_type: { - code: 7019, - category: 1, - key: "Rest parameter '{0}' implicitly has an 'any[]' type." - }, - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { - code: 7020, - category: 1, - key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." - }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { - code: 7021, - category: 1, - key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." - }, - _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { - code: 7022, - category: 1, - key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." - }, - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { - code: 7023, - category: 1, - key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." - }, - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { - code: 7024, - category: 1, - key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." - }, - You_cannot_rename_this_element: { - code: 8000, - category: 1, - key: "You cannot rename this element." - }, - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { - code: 8001, - category: 1, - key: "You cannot rename elements that are defined in the standard TypeScript library." - }, - yield_expressions_are_not_currently_supported: { - code: 9000, - category: 1, - key: "'yield' expressions are not currently supported." - }, - Generators_are_not_currently_supported: { - code: 9001, - category: 1, - key: "Generators are not currently supported." - }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { - code: 9002, - category: 1, - key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." - } + Unterminated_string_literal: { code: 1002, category: 1, key: "Unterminated string literal." }, + Identifier_expected: { code: 1003, category: 1, key: "Identifier expected." }, + _0_expected: { code: 1005, category: 1, key: "'{0}' expected." }, + A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1, key: "A file cannot have a reference to itself." }, + Trailing_comma_not_allowed: { code: 1009, category: 1, key: "Trailing comma not allowed." }, + Asterisk_Slash_expected: { code: 1010, category: 1, key: "'*/' expected." }, + Unexpected_token: { code: 1012, category: 1, key: "Unexpected token." }, + A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1, key: "A rest parameter must be last in a parameter list." }, + Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1, key: "Parameter cannot have question mark and initializer." }, + A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1, key: "A required parameter cannot follow an optional parameter." }, + An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1, key: "An index signature cannot have a rest parameter." }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1, key: "An index signature parameter cannot have an accessibility modifier." }, + An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1, key: "An index signature parameter cannot have a question mark." }, + An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1, key: "An index signature parameter cannot have an initializer." }, + An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1, key: "An index signature must have a type annotation." }, + An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1, key: "An index signature parameter must have a type annotation." }, + An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1, key: "An index signature parameter type must be 'string' or 'number'." }, + A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1, key: "A class or interface declaration can only have one 'extends' clause." }, + An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1, key: "An 'extends' clause must precede an 'implements' clause." }, + A_class_can_only_extend_a_single_class: { code: 1026, category: 1, key: "A class can only extend a single class." }, + A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1, key: "A class declaration can only have one 'implements' clause." }, + Accessibility_modifier_already_seen: { code: 1028, category: 1, key: "Accessibility modifier already seen." }, + _0_modifier_must_precede_1_modifier: { code: 1029, category: 1, key: "'{0}' modifier must precede '{1}' modifier." }, + _0_modifier_already_seen: { code: 1030, category: 1, key: "'{0}' modifier already seen." }, + _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1, key: "'{0}' modifier cannot appear on a class element." }, + An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1, key: "An interface declaration cannot have an 'implements' clause." }, + super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1, key: "'super' must be followed by an argument list or member access." }, + Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1, key: "Only ambient modules can use quoted names." }, + Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1, key: "Statements are not allowed in ambient contexts." }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1, key: "A 'declare' modifier cannot be used in an already ambient context." }, + Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1, key: "Initializers are not allowed in ambient contexts." }, + _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1, key: "'{0}' modifier cannot appear on a module element." }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1, key: "A 'declare' modifier cannot be used with an interface declaration." }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, + A_rest_parameter_cannot_be_optional: { code: 1047, category: 1, key: "A rest parameter cannot be optional." }, + A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1, key: "A rest parameter cannot have an initializer." }, + A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1, key: "A 'set' accessor must have exactly one parameter." }, + A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1, key: "A 'set' accessor cannot have an optional parameter." }, + A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1, key: "A 'set' accessor parameter cannot have an initializer." }, + A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1, key: "A 'set' accessor cannot have rest parameter." }, + A_get_accessor_cannot_have_parameters: { code: 1054, category: 1, key: "A 'get' accessor cannot have parameters." }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, + Enum_member_must_have_initializer: { code: 1061, category: 1, key: "Enum member must have initializer." }, + An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1, key: "An export assignment cannot be used in an internal module." }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1, key: "Ambient enum elements can only have integer literal initializers." }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1, key: "A 'declare' modifier cannot be used with an import declaration." }, + Invalid_reference_directive_syntax: { code: 1084, category: 1, key: "Invalid 'reference' directive syntax." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1, key: "An accessor cannot be declared in an ambient context." }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1, key: "'{0}' modifier cannot appear on a constructor declaration." }, + _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1, key: "'{0}' modifier cannot appear on a parameter." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1, key: "Type parameters cannot appear on a constructor declaration." }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1, key: "Type annotation cannot appear on a constructor declaration." }, + An_accessor_cannot_have_type_parameters: { code: 1094, category: 1, key: "An accessor cannot have type parameters." }, + A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1, key: "A 'set' accessor cannot have a return type annotation." }, + An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1, key: "An index signature must have exactly one parameter." }, + _0_list_cannot_be_empty: { code: 1097, category: 1, key: "'{0}' list cannot be empty." }, + Type_parameter_list_cannot_be_empty: { code: 1098, category: 1, key: "Type parameter list cannot be empty." }, + Type_argument_list_cannot_be_empty: { code: 1099, category: 1, key: "Type argument list cannot be empty." }, + Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1, key: "Invalid use of '{0}' in strict mode." }, + with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1, key: "'with' statements are not allowed in strict mode." }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1, key: "'delete' cannot be called on an identifier in strict mode." }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, + Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1, key: "Jump target cannot cross function boundary." }, + A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1, key: "A 'return' statement can only be used within a function body." }, + Expression_expected: { code: 1109, category: 1, key: "Expression expected." }, + Type_expected: { code: 1110, category: 1, key: "Type expected." }, + A_class_member_cannot_be_declared_optional: { code: 1112, category: 1, key: "A class member cannot be declared optional." }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, + Duplicate_label_0: { code: 1114, category: 1, key: "Duplicate label '{0}'" }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1, key: "A 'break' statement can only jump to a label of an enclosing statement." }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1, key: "An object literal cannot have multiple properties with the same name in strict mode." }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1, key: "An object literal cannot have multiple get/set accessors with the same name." }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1, key: "An object literal cannot have property and accessor with the same name." }, + An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1, key: "An export assignment cannot have modifiers." }, + Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1, key: "A tuple type element list cannot be empty." }, + Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1, key: "Variable declaration list cannot be empty." }, + Digit_expected: { code: 1124, category: 1, key: "Digit expected." }, + Hexadecimal_digit_expected: { code: 1125, category: 1, key: "Hexadecimal digit expected." }, + Unexpected_end_of_text: { code: 1126, category: 1, key: "Unexpected end of text." }, + Invalid_character: { code: 1127, category: 1, key: "Invalid character." }, + Declaration_or_statement_expected: { code: 1128, category: 1, key: "Declaration or statement expected." }, + Statement_expected: { code: 1129, category: 1, key: "Statement expected." }, + case_or_default_expected: { code: 1130, category: 1, key: "'case' or 'default' expected." }, + Property_or_signature_expected: { code: 1131, category: 1, key: "Property or signature expected." }, + Enum_member_expected: { code: 1132, category: 1, key: "Enum member expected." }, + Type_reference_expected: { code: 1133, category: 1, key: "Type reference expected." }, + Variable_declaration_expected: { code: 1134, category: 1, key: "Variable declaration expected." }, + Argument_expression_expected: { code: 1135, category: 1, key: "Argument expression expected." }, + Property_assignment_expected: { code: 1136, category: 1, key: "Property assignment expected." }, + Expression_or_comma_expected: { code: 1137, category: 1, key: "Expression or comma expected." }, + Parameter_declaration_expected: { code: 1138, category: 1, key: "Parameter declaration expected." }, + Type_parameter_declaration_expected: { code: 1139, category: 1, key: "Type parameter declaration expected." }, + Type_argument_expected: { code: 1140, category: 1, key: "Type argument expected." }, + String_literal_expected: { code: 1141, category: 1, key: "String literal expected." }, + Line_break_not_permitted_here: { code: 1142, category: 1, key: "Line break not permitted here." }, + or_expected: { code: 1144, category: 1, key: "'{' or ';' expected." }, + Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1, key: "Modifiers not permitted on index signature members." }, + Declaration_expected: { code: 1146, category: 1, key: "Declaration expected." }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1, key: "Import declarations in an internal module cannot reference an external module." }, + Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1, key: "Cannot compile external modules unless the '--module' flag is provided." }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: 1, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, + var_let_or_const_expected: { code: 1152, category: 1, key: "'var', 'let' or 'const' expected." }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_must_be_initialized: { code: 1155, category: 1, key: "'const' declarations must be initialized" }, + const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1, key: "'const' declarations can only be declared inside a block." }, + let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1, key: "'let' declarations can only be declared inside a block." }, + Unterminated_template_literal: { code: 1160, category: 1, key: "Unterminated template literal." }, + Unterminated_regular_expression_literal: { code: 1161, category: 1, key: "Unterminated regular expression literal." }, + An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, + yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, + Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, + Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, + A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, + extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, + extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, + Classes_can_only_extend_a_single_class: { code: 1174, category: 1, key: "Classes can only extend a single class." }, + implements_clause_already_seen: { code: 1175, category: 1, key: "'implements' clause already seen." }, + Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1, key: "Interface declaration cannot have 'implements' clause." }, + Binary_digit_expected: { code: 1177, category: 1, key: "Binary digit expected." }, + Octal_digit_expected: { code: 1178, category: 1, key: "Octal digit expected." }, + Unexpected_token_expected: { code: 1179, category: 1, key: "Unexpected token. '{' expected." }, + Property_destructuring_pattern_expected: { code: 1180, category: 1, key: "Property destructuring pattern expected." }, + Array_element_destructuring_pattern_expected: { code: 1181, category: 1, key: "Array element destructuring pattern expected." }, + A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: 1, key: "A destructuring declaration must have an initializer." }, + Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: 1, key: "Destructuring declarations are not allowed in ambient contexts." }, + An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: 1, key: "An implementation cannot be declared in ambient contexts." }, + Modifiers_cannot_appear_here: { code: 1184, category: 1, key: "Modifiers cannot appear here." }, + Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, + A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, + A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, + An_import_declaration_cannot_have_modifiers: { code: 1191, category: 1, key: "An import declaration cannot have modifiers." }, + External_module_0_has_no_default_export_or_export_assignment: { code: 1192, category: 1, key: "External module '{0}' has no default export or export assignment." }, + An_export_declaration_cannot_have_modifiers: { code: 1193, category: 1, key: "An export declaration cannot have modifiers." }, + Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: 1, key: "Export declarations are not permitted in an internal module." }, + Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: 1, key: "Catch clause variable name must be an identifier." }, + Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: 1, key: "Catch clause variable cannot have a type annotation." }, + Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: 1, key: "Catch clause variable cannot have an initializer." }, + An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: 1, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, + Unterminated_Unicode_escape_sequence: { code: 1199, category: 1, key: "Unterminated Unicode escape sequence." }, + Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, + Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1, key: "Static members cannot reference class type parameters." }, + Circular_definition_of_import_alias_0: { code: 2303, category: 1, key: "Circular definition of import alias '{0}'." }, + Cannot_find_name_0: { code: 2304, category: 1, key: "Cannot find name '{0}'." }, + Module_0_has_no_exported_member_1: { code: 2305, category: 1, key: "Module '{0}' has no exported member '{1}'." }, + File_0_is_not_an_external_module: { code: 2306, category: 1, key: "File '{0}' is not an external module." }, + Cannot_find_external_module_0: { code: 2307, category: 1, key: "Cannot find external module '{0}'." }, + A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1, key: "A module cannot have more than one export assignment." }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1, key: "An export assignment cannot be used in a module with other exported elements." }, + Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1, key: "Type '{0}' recursively references itself as a base type." }, + A_class_may_only_extend_another_class: { code: 2311, category: 1, key: "A class may only extend another class." }, + An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1, key: "An interface may only extend a class or another interface." }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, + Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1, key: "Generic type '{0}' requires {1} type argument(s)." }, + Type_0_is_not_generic: { code: 2315, category: 1, key: "Type '{0}' is not generic." }, + Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, + Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, + Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, + Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, + Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, + Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, + Property_0_is_missing_in_type_1: { code: 2324, category: 1, key: "Property '{0}' is missing in type '{1}'." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, + Types_of_property_0_are_incompatible: { code: 2326, category: 1, key: "Types of property '{0}' are incompatible." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, + Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1, key: "Types of parameters '{0}' and '{1}' are incompatible." }, + Index_signature_is_missing_in_type_0: { code: 2329, category: 1, key: "Index signature is missing in type '{0}'." }, + Index_signatures_are_incompatible: { code: 2330, category: 1, key: "Index signatures are incompatible." }, + this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1, key: "'this' cannot be referenced in a module body." }, + this_cannot_be_referenced_in_current_location: { code: 2332, category: 1, key: "'this' cannot be referenced in current location." }, + this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1, key: "'this' cannot be referenced in constructor arguments." }, + this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1, key: "'this' cannot be referenced in a static property initializer." }, + super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1, key: "'super' can only be referenced in a derived class." }, + super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1, key: "'super' cannot be referenced in constructor arguments." }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, + Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, + Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, + Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1, key: "Untyped function calls may not accept type arguments." }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1, key: "Cannot invoke an expression whose type lacks a call signature." }, + Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1, key: "Only a void function can be called with the 'new' keyword." }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1, key: "No best common type exists among return expressions." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1, key: "Invalid left-hand side of assignment expression." }, + Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Type_parameter_name_cannot_be_0: { code: 2368, category: 1, key: "Type parameter name cannot be '{0}'" }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1, key: "A parameter property is only allowed in a constructor implementation." }, + A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1, key: "A rest parameter must be of an array type." }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1, key: "A parameter initializer is only allowed in a function or constructor implementation." }, + Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1, key: "Parameter '{0}' cannot be referenced in its initializer." }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, + Duplicate_string_index_signature: { code: 2374, category: 1, key: "Duplicate string index signature." }, + Duplicate_number_index_signature: { code: 2375, category: 1, key: "Duplicate number index signature." }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, + Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1, key: "Constructors for derived classes must contain a 'super' call." }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1, key: "Getter and setter accessors do not agree in visibility." }, + get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1, key: "'get' and 'set' accessor must have the same type." }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1, key: "A signature with an implementation cannot use a string literal type." }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1, key: "Specialized overload signature is not assignable to any non-specialized signature." }, + Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1, key: "Overload signatures must all be exported or not exported." }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1, key: "Overload signatures must all be ambient or non-ambient." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1, key: "Overload signatures must all be public, private or protected." }, + Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1, key: "Overload signatures must all be optional or required." }, + Function_overload_must_be_static: { code: 2387, category: 1, key: "Function overload must be static." }, + Function_overload_must_not_be_static: { code: 2388, category: 1, key: "Function overload must not be static." }, + Function_implementation_name_must_be_0: { code: 2389, category: 1, key: "Function implementation name must be '{0}'." }, + Constructor_implementation_is_missing: { code: 2390, category: 1, key: "Constructor implementation is missing." }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1, key: "Function implementation is missing or not immediately following the declaration." }, + Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1, key: "Multiple constructor implementations are not allowed." }, + Duplicate_function_implementation: { code: 2393, category: 1, key: "Duplicate function implementation." }, + Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1, key: "Overload signature is not compatible with function implementation." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, + Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1, key: "Invalid left-hand side in 'for...in' statement." }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, + Setters_cannot_return_a_value: { code: 2408, category: 1, key: "Setters cannot return a value." }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1, key: "Return type of constructor signature must be assignable to the instance type of the class" }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1, key: "All symbols within a 'with' block will be resolved to 'any'." }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, + Class_name_cannot_be_0: { code: 2414, category: 1, key: "Class name cannot be '{0}'" }, + Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1, key: "Class '{0}' incorrectly extends base class '{1}'." }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, + Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1, key: "Class '{0}' incorrectly implements interface '{1}'." }, + A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1, key: "A class may only implement another class or interface." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, + Interface_name_cannot_be_0: { code: 2427, category: 1, key: "Interface name cannot be '{0}'" }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1, key: "All declarations of an interface must have identical type parameters." }, + Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1, key: "Interface '{0}' incorrectly extends interface '{1}'." }, + Enum_name_cannot_be_0: { code: 2431, category: 1, key: "Enum name cannot be '{0}'" }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1, key: "Ambient external modules cannot be nested in other modules." }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1, key: "Ambient external module declaration cannot specify relative module name." }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1, key: "Module '{0}' is hidden by a local declaration with the same name" }, + Import_name_cannot_be_0: { code: 2438, category: 1, key: "Import name cannot be '{0}'" }, + Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1, key: "Import declaration conflicts with local declaration of '{0}'" }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1, key: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, + Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1, key: "Block-scoped variable '{0}' used before its declaration." }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1, key: "The operand of an increment or decrement operator cannot be a constant." }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1, key: "Left-hand side of assignment expression cannot be a constant." }, + Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1, key: "Cannot redeclare block-scoped variable '{0}'." }, + An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1, key: "An enum member cannot have a numeric name." }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, + Type_alias_0_circularly_references_itself: { code: 2456, category: 1, key: "Type alias '{0}' circularly references itself." }, + Type_alias_name_cannot_be_0: { code: 2457, category: 1, key: "Type alias name cannot be '{0}'" }, + An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1, key: "An AMD module cannot have multiple name assignments." }, + Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: 1, key: "Type '{0}' has no property '{1}' and no string index signature." }, + Type_0_has_no_property_1: { code: 2460, category: 1, key: "Type '{0}' has no property '{1}'." }, + Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, + A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, + this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, + super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, + Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, + The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, + Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: 1, key: "Export declaration conflicts with exported declaration of '{0}'" }, + The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant: { code: 2485, category: 1, key: "The left-hand side of a 'for...of' statement cannot be a previously defined constant." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant: { code: 2486, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a previously defined constant." }, + Invalid_left_hand_side_in_for_of_statement: { code: 2487, category: 1, key: "Invalid left-hand side in 'for...of' statement." }, + The_right_hand_side_of_a_for_of_statement_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: 1, key: "The right-hand side of a 'for...of' statement must have a '[Symbol.iterator]()' method that returns an iterator." }, + The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { code: 2489, category: 1, key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." }, + The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: 1, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, + The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: 1, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, + Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: 1, key: "Cannot redeclare identifier '{0}' in catch clause" }, + Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: 1, key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: 1, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, + Type_0_is_not_an_array_type_or_a_string_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type or a string type." }, + Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, + Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1, key: "Exported variable '{0}' has or is using private name '{1}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1, key: "Return type of public static method from exported class has or is using private name '{0}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1, key: "Return type of public method from exported class has or is using private name '{0}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1, key: "Return type of method from exported interface has or is using private name '{0}'." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1, key: "Return type of exported function has or is using private name '{0}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, + Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, + Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher: { code: 4091, category: 1, key: "Loop contains block-scoped variable '{0}' referenced by a function in the loop. This is only supported in ECMAScript 6 or higher." }, + The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, + Unsupported_file_encoding: { code: 5013, category: 1, key: "Unsupported file encoding." }, + Unknown_compiler_option_0: { code: 5023, category: 1, key: "Unknown compiler option '{0}'." }, + Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1, key: "Compiler option '{0}' requires a value of type {1}." }, + Could_not_write_file_0_Colon_1: { code: 5033, category: 1, key: "Could not write file '{0}': {1}" }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, + Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: 1, key: "Option 'project' cannot be mixed with source files on a command line." }, + Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2, key: "Concatenate and emit output to single file." }, + Generates_corresponding_d_ts_file: { code: 6002, category: 2, key: "Generates corresponding '.d.ts' file." }, + Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2, key: "Specifies the location where debugger should locate map files instead of generated locations." }, + Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + Watch_input_files: { code: 6005, category: 2, key: "Watch input files." }, + Redirect_output_structure_to_the_directory: { code: 6006, category: 2, key: "Redirect output structure to the directory." }, + Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2, key: "Do not erase const enum declarations in generated code." }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_comments_to_output: { code: 6009, category: 2, key: "Do not emit comments to output." }, + Do_not_emit_outputs: { code: 6010, category: 2, key: "Do not emit outputs." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, + Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2, key: "Specify module code generation: 'commonjs' or 'amd'" }, + Print_this_message: { code: 6017, category: 2, key: "Print this message." }, + Print_the_compiler_s_version: { code: 6019, category: 2, key: "Print the compiler's version." }, + Compile_the_project_in_the_given_directory: { code: 6020, category: 2, key: "Compile the project in the given directory." }, + Syntax_Colon_0: { code: 6023, category: 2, key: "Syntax: {0}" }, + options: { code: 6024, category: 2, key: "options" }, + file: { code: 6025, category: 2, key: "file" }, + Examples_Colon_0: { code: 6026, category: 2, key: "Examples: {0}" }, + Options_Colon: { code: 6027, category: 2, key: "Options:" }, + Version_0: { code: 6029, category: 2, key: "Version {0}" }, + Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2, key: "Insert command line options and files from a file." }, + File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2, key: "File change detected. Starting incremental compilation..." }, + KIND: { code: 6034, category: 2, key: "KIND" }, + FILE: { code: 6035, category: 2, key: "FILE" }, + VERSION: { code: 6036, category: 2, key: "VERSION" }, + LOCATION: { code: 6037, category: 2, key: "LOCATION" }, + DIRECTORY: { code: 6038, category: 2, key: "DIRECTORY" }, + Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2, key: "Compilation complete. Watching for file changes." }, + Generates_corresponding_map_file: { code: 6043, category: 2, key: "Generates corresponding '.map' file." }, + Compiler_option_0_expects_an_argument: { code: 6044, category: 1, key: "Compiler option '{0}' expects an argument." }, + Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1, key: "Unterminated quoted string in response file '{0}'." }, + Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, + Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, + Unsupported_locale_0: { code: 6049, category: 1, key: "Unsupported locale '{0}'." }, + Unable_to_open_file_0: { code: 6050, category: 1, key: "Unable to open file '{0}'." }, + Corrupted_locale_file_0: { code: 6051, category: 1, key: "Corrupted locale file {0}." }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2, key: "Raise error on expressions and declarations with an implied 'any' type." }, + File_0_not_found: { code: 6053, category: 1, key: "File '{0}' not found." }, + File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: 2, key: "Do not emit declarations for code that has an '@internal' annotation." }, + Preserve_new_lines_when_emitting_code: { code: 6057, category: 2, key: "Preserve new-lines when emitting code." }, + Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1, key: "Variable '{0}' implicitly has an '{1}' type." }, + Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1, key: "Parameter '{0}' implicitly has an '{1}' type." }, + Member_0_implicitly_has_an_1_type: { code: 7008, category: 1, key: "Member '{0}' implicitly has an '{1}' type." }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, + Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1, key: "Index signature of object type implicitly has an 'any' type." }, + Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, + Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + You_cannot_rename_this_element: { code: 8000, category: 1, key: "You cannot rename this element." }, + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, + yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, + Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." }, + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." } }; })(ts || (ts = {})); var ts; @@ -4025,2806 +2067,10 @@ var ts; "|=": 62, "^=": 63 }; - var unicodeES3IdentifierStart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 543, - 546, - 563, - 592, - 685, - 688, - 696, - 699, - 705, - 720, - 721, - 736, - 740, - 750, - 750, - 890, - 890, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 974, - 976, - 983, - 986, - 1011, - 1024, - 1153, - 1164, - 1220, - 1223, - 1224, - 1227, - 1228, - 1232, - 1269, - 1272, - 1273, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1488, - 1514, - 1520, - 1522, - 1569, - 1594, - 1600, - 1610, - 1649, - 1747, - 1749, - 1749, - 1765, - 1766, - 1786, - 1788, - 1808, - 1808, - 1810, - 1836, - 1920, - 1957, - 2309, - 2361, - 2365, - 2365, - 2384, - 2384, - 2392, - 2401, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2524, - 2525, - 2527, - 2529, - 2544, - 2545, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2649, - 2652, - 2654, - 2654, - 2674, - 2676, - 2693, - 2699, - 2701, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2749, - 2749, - 2768, - 2768, - 2784, - 2784, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2870, - 2873, - 2877, - 2877, - 2908, - 2909, - 2911, - 2913, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 2997, - 2999, - 3001, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3168, - 3169, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3294, - 3294, - 3296, - 3297, - 3333, - 3340, - 3342, - 3344, - 3346, - 3368, - 3370, - 3385, - 3424, - 3425, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3585, - 3632, - 3634, - 3635, - 3648, - 3654, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3760, - 3762, - 3763, - 3773, - 3773, - 3776, - 3780, - 3782, - 3782, - 3804, - 3805, - 3840, - 3840, - 3904, - 3911, - 3913, - 3946, - 3976, - 3979, - 4096, - 4129, - 4131, - 4135, - 4137, - 4138, - 4176, - 4181, - 4256, - 4293, - 4304, - 4342, - 4352, - 4441, - 4447, - 4514, - 4520, - 4601, - 4608, - 4614, - 4616, - 4678, - 4680, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4742, - 4744, - 4744, - 4746, - 4749, - 4752, - 4782, - 4784, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4814, - 4816, - 4822, - 4824, - 4846, - 4848, - 4878, - 4880, - 4880, - 4882, - 4885, - 4888, - 4894, - 4896, - 4934, - 4936, - 4954, - 5024, - 5108, - 5121, - 5740, - 5743, - 5750, - 5761, - 5786, - 5792, - 5866, - 6016, - 6067, - 6176, - 6263, - 6272, - 6312, - 7680, - 7835, - 7840, - 7929, - 7936, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8319, - 8319, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8497, - 8499, - 8505, - 8544, - 8579, - 12293, - 12295, - 12321, - 12329, - 12337, - 12341, - 12344, - 12346, - 12353, - 12436, - 12445, - 12446, - 12449, - 12538, - 12540, - 12542, - 12549, - 12588, - 12593, - 12686, - 12704, - 12727, - 13312, - 19893, - 19968, - 40869, - 40960, - 42124, - 44032, - 55203, - 63744, - 64045, - 64256, - 64262, - 64275, - 64279, - 64285, - 64285, - 64287, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65136, - 65138, - 65140, - 65140, - 65142, - 65276, - 65313, - 65338, - 65345, - 65370, - 65382, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; - var unicodeES3IdentifierPart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 543, - 546, - 563, - 592, - 685, - 688, - 696, - 699, - 705, - 720, - 721, - 736, - 740, - 750, - 750, - 768, - 846, - 864, - 866, - 890, - 890, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 974, - 976, - 983, - 986, - 1011, - 1024, - 1153, - 1155, - 1158, - 1164, - 1220, - 1223, - 1224, - 1227, - 1228, - 1232, - 1269, - 1272, - 1273, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1425, - 1441, - 1443, - 1465, - 1467, - 1469, - 1471, - 1471, - 1473, - 1474, - 1476, - 1476, - 1488, - 1514, - 1520, - 1522, - 1569, - 1594, - 1600, - 1621, - 1632, - 1641, - 1648, - 1747, - 1749, - 1756, - 1759, - 1768, - 1770, - 1773, - 1776, - 1788, - 1808, - 1836, - 1840, - 1866, - 1920, - 1968, - 2305, - 2307, - 2309, - 2361, - 2364, - 2381, - 2384, - 2388, - 2392, - 2403, - 2406, - 2415, - 2433, - 2435, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2492, - 2492, - 2494, - 2500, - 2503, - 2504, - 2507, - 2509, - 2519, - 2519, - 2524, - 2525, - 2527, - 2531, - 2534, - 2545, - 2562, - 2562, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2620, - 2620, - 2622, - 2626, - 2631, - 2632, - 2635, - 2637, - 2649, - 2652, - 2654, - 2654, - 2662, - 2676, - 2689, - 2691, - 2693, - 2699, - 2701, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2748, - 2757, - 2759, - 2761, - 2763, - 2765, - 2768, - 2768, - 2784, - 2784, - 2790, - 2799, - 2817, - 2819, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2870, - 2873, - 2876, - 2883, - 2887, - 2888, - 2891, - 2893, - 2902, - 2903, - 2908, - 2909, - 2911, - 2913, - 2918, - 2927, - 2946, - 2947, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 2997, - 2999, - 3001, - 3006, - 3010, - 3014, - 3016, - 3018, - 3021, - 3031, - 3031, - 3047, - 3055, - 3073, - 3075, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3134, - 3140, - 3142, - 3144, - 3146, - 3149, - 3157, - 3158, - 3168, - 3169, - 3174, - 3183, - 3202, - 3203, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3262, - 3268, - 3270, - 3272, - 3274, - 3277, - 3285, - 3286, - 3294, - 3294, - 3296, - 3297, - 3302, - 3311, - 3330, - 3331, - 3333, - 3340, - 3342, - 3344, - 3346, - 3368, - 3370, - 3385, - 3390, - 3395, - 3398, - 3400, - 3402, - 3405, - 3415, - 3415, - 3424, - 3425, - 3430, - 3439, - 3458, - 3459, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3530, - 3530, - 3535, - 3540, - 3542, - 3542, - 3544, - 3551, - 3570, - 3571, - 3585, - 3642, - 3648, - 3662, - 3664, - 3673, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3769, - 3771, - 3773, - 3776, - 3780, - 3782, - 3782, - 3784, - 3789, - 3792, - 3801, - 3804, - 3805, - 3840, - 3840, - 3864, - 3865, - 3872, - 3881, - 3893, - 3893, - 3895, - 3895, - 3897, - 3897, - 3902, - 3911, - 3913, - 3946, - 3953, - 3972, - 3974, - 3979, - 3984, - 3991, - 3993, - 4028, - 4038, - 4038, - 4096, - 4129, - 4131, - 4135, - 4137, - 4138, - 4140, - 4146, - 4150, - 4153, - 4160, - 4169, - 4176, - 4185, - 4256, - 4293, - 4304, - 4342, - 4352, - 4441, - 4447, - 4514, - 4520, - 4601, - 4608, - 4614, - 4616, - 4678, - 4680, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4742, - 4744, - 4744, - 4746, - 4749, - 4752, - 4782, - 4784, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4814, - 4816, - 4822, - 4824, - 4846, - 4848, - 4878, - 4880, - 4880, - 4882, - 4885, - 4888, - 4894, - 4896, - 4934, - 4936, - 4954, - 4969, - 4977, - 5024, - 5108, - 5121, - 5740, - 5743, - 5750, - 5761, - 5786, - 5792, - 5866, - 6016, - 6099, - 6112, - 6121, - 6160, - 6169, - 6176, - 6263, - 6272, - 6313, - 7680, - 7835, - 7840, - 7929, - 7936, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8255, - 8256, - 8319, - 8319, - 8400, - 8412, - 8417, - 8417, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8497, - 8499, - 8505, - 8544, - 8579, - 12293, - 12295, - 12321, - 12335, - 12337, - 12341, - 12344, - 12346, - 12353, - 12436, - 12441, - 12442, - 12445, - 12446, - 12449, - 12542, - 12549, - 12588, - 12593, - 12686, - 12704, - 12727, - 13312, - 19893, - 19968, - 40869, - 40960, - 42124, - 44032, - 55203, - 63744, - 64045, - 64256, - 64262, - 64275, - 64279, - 64285, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65056, - 65059, - 65075, - 65076, - 65101, - 65103, - 65136, - 65138, - 65140, - 65140, - 65142, - 65276, - 65296, - 65305, - 65313, - 65338, - 65343, - 65343, - 65345, - 65370, - 65381, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; - var unicodeES5IdentifierStart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 705, - 710, - 721, - 736, - 740, - 748, - 748, - 750, - 750, - 880, - 884, - 886, - 887, - 890, - 893, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 1013, - 1015, - 1153, - 1162, - 1319, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1488, - 1514, - 1520, - 1522, - 1568, - 1610, - 1646, - 1647, - 1649, - 1747, - 1749, - 1749, - 1765, - 1766, - 1774, - 1775, - 1786, - 1788, - 1791, - 1791, - 1808, - 1808, - 1810, - 1839, - 1869, - 1957, - 1969, - 1969, - 1994, - 2026, - 2036, - 2037, - 2042, - 2042, - 2048, - 2069, - 2074, - 2074, - 2084, - 2084, - 2088, - 2088, - 2112, - 2136, - 2208, - 2208, - 2210, - 2220, - 2308, - 2361, - 2365, - 2365, - 2384, - 2384, - 2392, - 2401, - 2417, - 2423, - 2425, - 2431, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2493, - 2493, - 2510, - 2510, - 2524, - 2525, - 2527, - 2529, - 2544, - 2545, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2649, - 2652, - 2654, - 2654, - 2674, - 2676, - 2693, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2749, - 2749, - 2768, - 2768, - 2784, - 2785, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2869, - 2873, - 2877, - 2877, - 2908, - 2909, - 2911, - 2913, - 2929, - 2929, - 2947, - 2947, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 3001, - 3024, - 3024, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3133, - 3133, - 3160, - 3161, - 3168, - 3169, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3261, - 3261, - 3294, - 3294, - 3296, - 3297, - 3313, - 3314, - 3333, - 3340, - 3342, - 3344, - 3346, - 3386, - 3389, - 3389, - 3406, - 3406, - 3424, - 3425, - 3450, - 3455, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3585, - 3632, - 3634, - 3635, - 3648, - 3654, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3760, - 3762, - 3763, - 3773, - 3773, - 3776, - 3780, - 3782, - 3782, - 3804, - 3807, - 3840, - 3840, - 3904, - 3911, - 3913, - 3948, - 3976, - 3980, - 4096, - 4138, - 4159, - 4159, - 4176, - 4181, - 4186, - 4189, - 4193, - 4193, - 4197, - 4198, - 4206, - 4208, - 4213, - 4225, - 4238, - 4238, - 4256, - 4293, - 4295, - 4295, - 4301, - 4301, - 4304, - 4346, - 4348, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4744, - 4746, - 4749, - 4752, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4822, - 4824, - 4880, - 4882, - 4885, - 4888, - 4954, - 4992, - 5007, - 5024, - 5108, - 5121, - 5740, - 5743, - 5759, - 5761, - 5786, - 5792, - 5866, - 5870, - 5872, - 5888, - 5900, - 5902, - 5905, - 5920, - 5937, - 5952, - 5969, - 5984, - 5996, - 5998, - 6000, - 6016, - 6067, - 6103, - 6103, - 6108, - 6108, - 6176, - 6263, - 6272, - 6312, - 6314, - 6314, - 6320, - 6389, - 6400, - 6428, - 6480, - 6509, - 6512, - 6516, - 6528, - 6571, - 6593, - 6599, - 6656, - 6678, - 6688, - 6740, - 6823, - 6823, - 6917, - 6963, - 6981, - 6987, - 7043, - 7072, - 7086, - 7087, - 7098, - 7141, - 7168, - 7203, - 7245, - 7247, - 7258, - 7293, - 7401, - 7404, - 7406, - 7409, - 7413, - 7414, - 7424, - 7615, - 7680, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8305, - 8305, - 8319, - 8319, - 8336, - 8348, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8505, - 8508, - 8511, - 8517, - 8521, - 8526, - 8526, - 8544, - 8584, - 11264, - 11310, - 11312, - 11358, - 11360, - 11492, - 11499, - 11502, - 11506, - 11507, - 11520, - 11557, - 11559, - 11559, - 11565, - 11565, - 11568, - 11623, - 11631, - 11631, - 11648, - 11670, - 11680, - 11686, - 11688, - 11694, - 11696, - 11702, - 11704, - 11710, - 11712, - 11718, - 11720, - 11726, - 11728, - 11734, - 11736, - 11742, - 11823, - 11823, - 12293, - 12295, - 12321, - 12329, - 12337, - 12341, - 12344, - 12348, - 12353, - 12438, - 12445, - 12447, - 12449, - 12538, - 12540, - 12543, - 12549, - 12589, - 12593, - 12686, - 12704, - 12730, - 12784, - 12799, - 13312, - 19893, - 19968, - 40908, - 40960, - 42124, - 42192, - 42237, - 42240, - 42508, - 42512, - 42527, - 42538, - 42539, - 42560, - 42606, - 42623, - 42647, - 42656, - 42735, - 42775, - 42783, - 42786, - 42888, - 42891, - 42894, - 42896, - 42899, - 42912, - 42922, - 43000, - 43009, - 43011, - 43013, - 43015, - 43018, - 43020, - 43042, - 43072, - 43123, - 43138, - 43187, - 43250, - 43255, - 43259, - 43259, - 43274, - 43301, - 43312, - 43334, - 43360, - 43388, - 43396, - 43442, - 43471, - 43471, - 43520, - 43560, - 43584, - 43586, - 43588, - 43595, - 43616, - 43638, - 43642, - 43642, - 43648, - 43695, - 43697, - 43697, - 43701, - 43702, - 43705, - 43709, - 43712, - 43712, - 43714, - 43714, - 43739, - 43741, - 43744, - 43754, - 43762, - 43764, - 43777, - 43782, - 43785, - 43790, - 43793, - 43798, - 43808, - 43814, - 43816, - 43822, - 43968, - 44002, - 44032, - 55203, - 55216, - 55238, - 55243, - 55291, - 63744, - 64109, - 64112, - 64217, - 64256, - 64262, - 64275, - 64279, - 64285, - 64285, - 64287, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65136, - 65140, - 65142, - 65276, - 65313, - 65338, - 65345, - 65370, - 65382, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; - var unicodeES5IdentifierPart = [ - 170, - 170, - 181, - 181, - 186, - 186, - 192, - 214, - 216, - 246, - 248, - 705, - 710, - 721, - 736, - 740, - 748, - 748, - 750, - 750, - 768, - 884, - 886, - 887, - 890, - 893, - 902, - 902, - 904, - 906, - 908, - 908, - 910, - 929, - 931, - 1013, - 1015, - 1153, - 1155, - 1159, - 1162, - 1319, - 1329, - 1366, - 1369, - 1369, - 1377, - 1415, - 1425, - 1469, - 1471, - 1471, - 1473, - 1474, - 1476, - 1477, - 1479, - 1479, - 1488, - 1514, - 1520, - 1522, - 1552, - 1562, - 1568, - 1641, - 1646, - 1747, - 1749, - 1756, - 1759, - 1768, - 1770, - 1788, - 1791, - 1791, - 1808, - 1866, - 1869, - 1969, - 1984, - 2037, - 2042, - 2042, - 2048, - 2093, - 2112, - 2139, - 2208, - 2208, - 2210, - 2220, - 2276, - 2302, - 2304, - 2403, - 2406, - 2415, - 2417, - 2423, - 2425, - 2431, - 2433, - 2435, - 2437, - 2444, - 2447, - 2448, - 2451, - 2472, - 2474, - 2480, - 2482, - 2482, - 2486, - 2489, - 2492, - 2500, - 2503, - 2504, - 2507, - 2510, - 2519, - 2519, - 2524, - 2525, - 2527, - 2531, - 2534, - 2545, - 2561, - 2563, - 2565, - 2570, - 2575, - 2576, - 2579, - 2600, - 2602, - 2608, - 2610, - 2611, - 2613, - 2614, - 2616, - 2617, - 2620, - 2620, - 2622, - 2626, - 2631, - 2632, - 2635, - 2637, - 2641, - 2641, - 2649, - 2652, - 2654, - 2654, - 2662, - 2677, - 2689, - 2691, - 2693, - 2701, - 2703, - 2705, - 2707, - 2728, - 2730, - 2736, - 2738, - 2739, - 2741, - 2745, - 2748, - 2757, - 2759, - 2761, - 2763, - 2765, - 2768, - 2768, - 2784, - 2787, - 2790, - 2799, - 2817, - 2819, - 2821, - 2828, - 2831, - 2832, - 2835, - 2856, - 2858, - 2864, - 2866, - 2867, - 2869, - 2873, - 2876, - 2884, - 2887, - 2888, - 2891, - 2893, - 2902, - 2903, - 2908, - 2909, - 2911, - 2915, - 2918, - 2927, - 2929, - 2929, - 2946, - 2947, - 2949, - 2954, - 2958, - 2960, - 2962, - 2965, - 2969, - 2970, - 2972, - 2972, - 2974, - 2975, - 2979, - 2980, - 2984, - 2986, - 2990, - 3001, - 3006, - 3010, - 3014, - 3016, - 3018, - 3021, - 3024, - 3024, - 3031, - 3031, - 3046, - 3055, - 3073, - 3075, - 3077, - 3084, - 3086, - 3088, - 3090, - 3112, - 3114, - 3123, - 3125, - 3129, - 3133, - 3140, - 3142, - 3144, - 3146, - 3149, - 3157, - 3158, - 3160, - 3161, - 3168, - 3171, - 3174, - 3183, - 3202, - 3203, - 3205, - 3212, - 3214, - 3216, - 3218, - 3240, - 3242, - 3251, - 3253, - 3257, - 3260, - 3268, - 3270, - 3272, - 3274, - 3277, - 3285, - 3286, - 3294, - 3294, - 3296, - 3299, - 3302, - 3311, - 3313, - 3314, - 3330, - 3331, - 3333, - 3340, - 3342, - 3344, - 3346, - 3386, - 3389, - 3396, - 3398, - 3400, - 3402, - 3406, - 3415, - 3415, - 3424, - 3427, - 3430, - 3439, - 3450, - 3455, - 3458, - 3459, - 3461, - 3478, - 3482, - 3505, - 3507, - 3515, - 3517, - 3517, - 3520, - 3526, - 3530, - 3530, - 3535, - 3540, - 3542, - 3542, - 3544, - 3551, - 3570, - 3571, - 3585, - 3642, - 3648, - 3662, - 3664, - 3673, - 3713, - 3714, - 3716, - 3716, - 3719, - 3720, - 3722, - 3722, - 3725, - 3725, - 3732, - 3735, - 3737, - 3743, - 3745, - 3747, - 3749, - 3749, - 3751, - 3751, - 3754, - 3755, - 3757, - 3769, - 3771, - 3773, - 3776, - 3780, - 3782, - 3782, - 3784, - 3789, - 3792, - 3801, - 3804, - 3807, - 3840, - 3840, - 3864, - 3865, - 3872, - 3881, - 3893, - 3893, - 3895, - 3895, - 3897, - 3897, - 3902, - 3911, - 3913, - 3948, - 3953, - 3972, - 3974, - 3991, - 3993, - 4028, - 4038, - 4038, - 4096, - 4169, - 4176, - 4253, - 4256, - 4293, - 4295, - 4295, - 4301, - 4301, - 4304, - 4346, - 4348, - 4680, - 4682, - 4685, - 4688, - 4694, - 4696, - 4696, - 4698, - 4701, - 4704, - 4744, - 4746, - 4749, - 4752, - 4784, - 4786, - 4789, - 4792, - 4798, - 4800, - 4800, - 4802, - 4805, - 4808, - 4822, - 4824, - 4880, - 4882, - 4885, - 4888, - 4954, - 4957, - 4959, - 4992, - 5007, - 5024, - 5108, - 5121, - 5740, - 5743, - 5759, - 5761, - 5786, - 5792, - 5866, - 5870, - 5872, - 5888, - 5900, - 5902, - 5908, - 5920, - 5940, - 5952, - 5971, - 5984, - 5996, - 5998, - 6000, - 6002, - 6003, - 6016, - 6099, - 6103, - 6103, - 6108, - 6109, - 6112, - 6121, - 6155, - 6157, - 6160, - 6169, - 6176, - 6263, - 6272, - 6314, - 6320, - 6389, - 6400, - 6428, - 6432, - 6443, - 6448, - 6459, - 6470, - 6509, - 6512, - 6516, - 6528, - 6571, - 6576, - 6601, - 6608, - 6617, - 6656, - 6683, - 6688, - 6750, - 6752, - 6780, - 6783, - 6793, - 6800, - 6809, - 6823, - 6823, - 6912, - 6987, - 6992, - 7001, - 7019, - 7027, - 7040, - 7155, - 7168, - 7223, - 7232, - 7241, - 7245, - 7293, - 7376, - 7378, - 7380, - 7414, - 7424, - 7654, - 7676, - 7957, - 7960, - 7965, - 7968, - 8005, - 8008, - 8013, - 8016, - 8023, - 8025, - 8025, - 8027, - 8027, - 8029, - 8029, - 8031, - 8061, - 8064, - 8116, - 8118, - 8124, - 8126, - 8126, - 8130, - 8132, - 8134, - 8140, - 8144, - 8147, - 8150, - 8155, - 8160, - 8172, - 8178, - 8180, - 8182, - 8188, - 8204, - 8205, - 8255, - 8256, - 8276, - 8276, - 8305, - 8305, - 8319, - 8319, - 8336, - 8348, - 8400, - 8412, - 8417, - 8417, - 8421, - 8432, - 8450, - 8450, - 8455, - 8455, - 8458, - 8467, - 8469, - 8469, - 8473, - 8477, - 8484, - 8484, - 8486, - 8486, - 8488, - 8488, - 8490, - 8493, - 8495, - 8505, - 8508, - 8511, - 8517, - 8521, - 8526, - 8526, - 8544, - 8584, - 11264, - 11310, - 11312, - 11358, - 11360, - 11492, - 11499, - 11507, - 11520, - 11557, - 11559, - 11559, - 11565, - 11565, - 11568, - 11623, - 11631, - 11631, - 11647, - 11670, - 11680, - 11686, - 11688, - 11694, - 11696, - 11702, - 11704, - 11710, - 11712, - 11718, - 11720, - 11726, - 11728, - 11734, - 11736, - 11742, - 11744, - 11775, - 11823, - 11823, - 12293, - 12295, - 12321, - 12335, - 12337, - 12341, - 12344, - 12348, - 12353, - 12438, - 12441, - 12442, - 12445, - 12447, - 12449, - 12538, - 12540, - 12543, - 12549, - 12589, - 12593, - 12686, - 12704, - 12730, - 12784, - 12799, - 13312, - 19893, - 19968, - 40908, - 40960, - 42124, - 42192, - 42237, - 42240, - 42508, - 42512, - 42539, - 42560, - 42607, - 42612, - 42621, - 42623, - 42647, - 42655, - 42737, - 42775, - 42783, - 42786, - 42888, - 42891, - 42894, - 42896, - 42899, - 42912, - 42922, - 43000, - 43047, - 43072, - 43123, - 43136, - 43204, - 43216, - 43225, - 43232, - 43255, - 43259, - 43259, - 43264, - 43309, - 43312, - 43347, - 43360, - 43388, - 43392, - 43456, - 43471, - 43481, - 43520, - 43574, - 43584, - 43597, - 43600, - 43609, - 43616, - 43638, - 43642, - 43643, - 43648, - 43714, - 43739, - 43741, - 43744, - 43759, - 43762, - 43766, - 43777, - 43782, - 43785, - 43790, - 43793, - 43798, - 43808, - 43814, - 43816, - 43822, - 43968, - 44010, - 44012, - 44013, - 44016, - 44025, - 44032, - 55203, - 55216, - 55238, - 55243, - 55291, - 63744, - 64109, - 64112, - 64217, - 64256, - 64262, - 64275, - 64279, - 64285, - 64296, - 64298, - 64310, - 64312, - 64316, - 64318, - 64318, - 64320, - 64321, - 64323, - 64324, - 64326, - 64433, - 64467, - 64829, - 64848, - 64911, - 64914, - 64967, - 65008, - 65019, - 65024, - 65039, - 65056, - 65062, - 65075, - 65076, - 65101, - 65103, - 65136, - 65140, - 65142, - 65276, - 65296, - 65305, - 65313, - 65338, - 65343, - 65343, - 65345, - 65370, - 65382, - 65470, - 65474, - 65479, - 65482, - 65487, - 65490, - 65495, - 65498, - 65500, - ]; + var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; function lookupInUnicodeMap(code, map) { if (code < map[0]) { return false; @@ -6848,11 +2094,15 @@ var ts; return false; } function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); + return languageVersion >= 1 ? + lookupInUnicodeMap(code, unicodeES5IdentifierStart) : + lookupInUnicodeMap(code, unicodeES3IdentifierStart); } ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); + return languageVersion >= 1 ? + lookupInUnicodeMap(code, unicodeES5IdentifierPart) : + lookupInUnicodeMap(code, unicodeES3IdentifierPart); } function makeReverseMap(source) { var result = []; @@ -6925,7 +2175,9 @@ var ts; ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { - return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || + ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || + ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { @@ -7012,7 +2264,8 @@ var ts; return false; } } - return ch === 61 || text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + return ch === 61 || + text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } return false; @@ -7092,11 +2345,7 @@ var ts; if (collecting) { if (!result) result = []; - result.push({ - pos: startPos, - end: pos, - hasTrailingNewLine: hasTrailingNewLine - }); + result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); } continue; } @@ -7123,11 +2372,15 @@ var ts; } ts.getTrailingCommentRanges = getTrailingCommentRanges; function isIdentifierStart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } ts.isIdentifierStart = isIdentifierStart; function isIdentifierPart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; function createScanner(languageVersion, skipTrivia, text, onError) { @@ -7146,10 +2399,14 @@ var ts; } } function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } function isIdentifierPart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } function scanNumber() { var start = pos; @@ -7872,39 +3129,17 @@ var ts; } setText(text); return { - getStartPos: function () { - return startPos; - }, - getTextPos: function () { - return pos; - }, - getToken: function () { - return token; - }, - getTokenPos: function () { - return tokenPos; - }, - getTokenText: function () { - return text.substring(tokenPos, pos); - }, - getTokenValue: function () { - return tokenValue; - }, - hasExtendedUnicodeEscape: function () { - return hasExtendedUnicodeEscape; - }, - hasPrecedingLineBreak: function () { - return precedingLineBreak; - }, - isIdentifier: function () { - return token === 64 || token > 100; - }, - isReservedWord: function () { - return token >= 65 && token <= 100; - }, - isUnterminated: function () { - return tokenIsUnterminated; - }, + getStartPos: function () { return startPos; }, + getTextPos: function () { return pos; }, + getToken: function () { return token; }, + getTokenPos: function () { return tokenPos; }, + getTokenText: function () { return text.substring(tokenPos, pos); }, + getTokenValue: function () { return tokenValue; }, + hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, + hasPrecedingLineBreak: function () { return precedingLineBreak; }, + isIdentifier: function () { return token === 64 || token > 100; }, + isReservedWord: function () { return token >= 65 && token <= 100; }, + isUnterminated: function () { return tokenIsUnterminated; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, reScanTemplateToken: reScanTemplateToken, @@ -7934,13 +3169,9 @@ var ts; function getSingleLineStringWriter() { if (stringWriters.length == 0) { var str = ""; - var writeText = function (text) { - return str += text; - }; + var writeText = function (text) { return str += text; }; return { - string: function () { - return str; - }, + string: function () { return str; }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -7948,18 +3179,11 @@ var ts; writeStringLiteral: writeText, writeParameter: writeText, writeSymbol: writeText, - writeLine: function () { - return str += " "; - }, - increaseIndent: function () { - }, - decreaseIndent: function () { - }, - clear: function () { - return str = ""; - }, - trackSymbol: function () { - } + writeLine: function () { return str += " "; }, + increaseIndent: function () { }, + decreaseIndent: function () { }, + clear: function () { return str = ""; }, + trackSymbol: function () { } }; } return stringWriters.pop(); @@ -7981,7 +3205,8 @@ var ts; ts.containsParseError = containsParseError; function aggregateChildData(node) { if (!(node.parserContextFlags & 64)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || ts.forEachChild(node, containsParseError); + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || + ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { node.parserContextFlags |= 32; } @@ -8060,7 +3285,8 @@ var ts; } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { - return (getCombinedNodeFlags(declaration) & 12288) !== 0 || isCatchClauseVariableDeclaration(declaration); + return (getCombinedNodeFlags(declaration) & 12288) !== 0 || + isCatchClauseVariableDeclaration(declaration); } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function getEnclosingBlockScopeContainer(node) { @@ -8088,7 +3314,10 @@ var ts; } ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { - return declaration && declaration.kind === 193 && declaration.parent && declaration.parent.kind === 217; + return declaration && + declaration.kind === 193 && + declaration.parent && + declaration.parent.kind === 217; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -8140,7 +3369,9 @@ var ts; if (errorNode === undefined) { return getSpanOfTokenAtPosition(sourceFile, node.pos); } - var pos = nodeIsMissing(errorNode) ? errorNode.pos : ts.skipTrivia(sourceFile.text, errorNode.pos); + var pos = nodeIsMissing(errorNode) + ? errorNode.pos + : ts.skipTrivia(sourceFile.text, errorNode.pos); return createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; @@ -8203,7 +3434,9 @@ var ts; function getJsDocComments(node, sourceFileOfNode) { return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); function isJsDocComment(comment) { - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; + return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; } } ts.getJsDocComments = getJsDocComments; @@ -8429,11 +3662,14 @@ var ts; return _parent.expression === node; case 181: var forStatement = _parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || forStatement.condition === node || forStatement.iterator === node; + return (forStatement.initializer === node && forStatement.initializer.kind !== 194) || + forStatement.condition === node || + forStatement.iterator === node; case 182: case 183: var forInStatement = _parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || forInStatement.expression === node; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 194) || + forInStatement.expression === node; case 158: return node === _parent.expression; case 173: @@ -8451,7 +3687,8 @@ var ts; ts.isExpression = isExpression; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 || (preserveConstEnums && moduleState === 2); + return moduleState === 1 || + (preserveConstEnums && moduleState === 2); } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { @@ -8699,7 +3936,9 @@ var ts; } ts.isTrivia = isTrivia; function hasDynamicName(declaration) { - return declaration.name && declaration.name.kind === 126 && !isWellKnownSymbolSyntactically(declaration.name.expression); + return declaration.name && + declaration.name.kind === 126 && + !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { @@ -8803,10 +4042,7 @@ var ts; if (length < 0) { throw new Error("length < 0"); } - return { - start: start, - length: length - }; + return { start: start, length: length }; } ts.createTextSpan = createTextSpan; function createTextSpanFromBounds(start, end) { @@ -8825,10 +4061,7 @@ var ts; if (newLength < 0) { throw new Error("newLength < 0"); } - return { - span: span, - newLength: newLength - }; + return { span: span, newLength: newLength }; } ts.createTextChangeRange = createTextChangeRange; ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); @@ -8989,9 +4222,9 @@ var ts; } var nonAsciiCharacters = /[^\u0000-\u007F]/g; function escapeNonAsciiCharacters(s) { - return nonAsciiCharacters.test(s) ? s.replace(nonAsciiCharacters, function (c) { - return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); - }) : s; + return nonAsciiCharacters.test(s) ? + s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) : + s; } ts.escapeNonAsciiCharacters = escapeNonAsciiCharacters; })(ts || (ts = {})); @@ -9036,9 +4269,12 @@ var ts; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { case 125: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); case 127: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.expression); case 128: case 130: case 129: @@ -9046,13 +4282,22 @@ var ts; case 219: case 193: case 150: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); case 140: case 141: case 136: case 137: case 138: - return visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); case 132: case 131: case 133: @@ -9061,9 +4306,17 @@ var ts; case 160: case 195: case 161: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); case 139: - return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); + return visitNode(cbNode, node.typeName) || + visitNodes(cbNodes, node.typeArguments); case 142: return visitNode(cbNode, node.exprName); case 143: @@ -9084,16 +4337,23 @@ var ts; case 152: return visitNodes(cbNodes, node.properties); case 153: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.dotToken) || + visitNode(cbNode, node.name); case 154: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.argumentExpression); case 155: case 156: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments) || + visitNodes(cbNodes, node.arguments); case 157: - return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.template); case 158: - return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); case 159: return visitNode(cbNode, node.expression); case 162: @@ -9105,91 +4365,142 @@ var ts; case 165: return visitNode(cbNode, node.operand); case 170: - return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); case 166: return visitNode(cbNode, node.operand); case 167: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); case 168: - return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); case 171: return visitNode(cbNode, node.expression); case 174: case 201: return visitNodes(cbNodes, node.statements); case 221: - return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); + return visitNodes(cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); case 175: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); case 194: return visitNodes(cbNodes, node.declarations); case 177: return visitNode(cbNode, node.expression); case 178: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); case 179: - return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); case 180: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 181: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.iterator) || + visitNode(cbNode, node.statement); case 182: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 183: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 184: case 185: return visitNode(cbNode, node.label); case 186: return visitNode(cbNode, node.expression); case 187: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); case 188: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); case 202: return visitNodes(cbNodes, node.clauses); case 214: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); case 215: return visitNodes(cbNodes, node.statements); case 189: - return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); case 190: return visitNode(cbNode, node.expression); case 191: - return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); case 217: - return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); case 196: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 197: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 198: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); case 199: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); case 220: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); case 200: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); case 203: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); case 204: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier); case 205: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); case 206: return visitNode(cbNode, node.name); case 207: case 211: return visitNodes(cbNodes, node.elements); case 210: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier); case 208: case 212: - return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); case 209: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); case 169: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); case 173: @@ -9236,69 +4547,40 @@ var ts; })(Tristate || (Tristate = {})); function parsingContextErrors(context) { switch (context) { - case 0: - return ts.Diagnostics.Declaration_or_statement_expected; - case 1: - return ts.Diagnostics.Declaration_or_statement_expected; - case 2: - return ts.Diagnostics.Statement_expected; - case 3: - return ts.Diagnostics.case_or_default_expected; - case 4: - return ts.Diagnostics.Statement_expected; - case 5: - return ts.Diagnostics.Property_or_signature_expected; - case 6: - return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; - case 7: - return ts.Diagnostics.Enum_member_expected; - case 8: - return ts.Diagnostics.Type_reference_expected; - case 9: - return ts.Diagnostics.Variable_declaration_expected; - case 10: - return ts.Diagnostics.Property_destructuring_pattern_expected; - case 11: - return ts.Diagnostics.Array_element_destructuring_pattern_expected; - case 12: - return ts.Diagnostics.Argument_expression_expected; - case 13: - return ts.Diagnostics.Property_assignment_expected; - case 14: - return ts.Diagnostics.Expression_or_comma_expected; - case 15: - return ts.Diagnostics.Parameter_declaration_expected; - case 16: - return ts.Diagnostics.Type_parameter_declaration_expected; - case 17: - return ts.Diagnostics.Type_argument_expected; - case 18: - return ts.Diagnostics.Type_expected; - case 19: - return ts.Diagnostics.Unexpected_token_expected; - case 20: - return ts.Diagnostics.Identifier_expected; + case 0: return ts.Diagnostics.Declaration_or_statement_expected; + case 1: return ts.Diagnostics.Declaration_or_statement_expected; + case 2: return ts.Diagnostics.Statement_expected; + case 3: return ts.Diagnostics.case_or_default_expected; + case 4: return ts.Diagnostics.Statement_expected; + case 5: return ts.Diagnostics.Property_or_signature_expected; + case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7: return ts.Diagnostics.Enum_member_expected; + case 8: return ts.Diagnostics.Type_reference_expected; + case 9: return ts.Diagnostics.Variable_declaration_expected; + case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; + case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; + case 12: return ts.Diagnostics.Argument_expression_expected; + case 13: return ts.Diagnostics.Property_assignment_expected; + case 14: return ts.Diagnostics.Expression_or_comma_expected; + case 15: return ts.Diagnostics.Parameter_declaration_expected; + case 16: return ts.Diagnostics.Type_parameter_declaration_expected; + case 17: return ts.Diagnostics.Type_argument_expected; + case 18: return ts.Diagnostics.Type_expected; + case 19: return ts.Diagnostics.Unexpected_token_expected; + case 20: return ts.Diagnostics.Identifier_expected; } } ; function modifierToFlag(token) { switch (token) { - case 109: - return 128; - case 108: - return 16; - case 107: - return 64; - case 106: - return 32; - case 77: - return 1; - case 114: - return 2; - case 69: - return 8192; - case 72: - return 256; + case 109: return 128; + case 108: return 16; + case 107: return 64; + case 106: return 32; + case 77: return 1; + case 114: return 2; + case 69: return 8192; + case 72: return 256; } return 0; } @@ -9531,7 +4813,8 @@ var ts; } ts.updateSourceFile = updateSourceFile; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 64 && (node.text === "eval" || node.text === "arguments"); + return node.kind === 64 && + (node.text === "eval" || node.text === "arguments"); } ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; function isUseStrictPrologueDirective(sourceFile, node) { @@ -9753,7 +5036,9 @@ var ts; var saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; var saveContextFlags = contextFlags; - var result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); + var result = isLookAhead + ? scanner.lookAhead(callback) + : scanner.tryScan(callback); ts.Debug.assert(saveContextFlags === contextFlags); if (!result || isLookAhead) { token = saveToken; @@ -9804,7 +5089,8 @@ var ts; return undefined; } function parseExpectedToken(t, reportAtCurrentPosition, diagnosticMessage, arg0) { - return parseOptionalToken(t) || createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); + return parseOptionalToken(t) || + createMissingNode(t, reportAtCurrentPosition, diagnosticMessage, arg0); } function parseTokenNode() { var node = createNode(token); @@ -9881,7 +5167,9 @@ var ts; return createIdentifier(isIdentifierOrKeyword()); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || token === 8 || token === 7; + return isIdentifierOrKeyword() || + token === 8 || + token === 7; } function parsePropertyName() { if (token === 8 || token === 7) { @@ -9934,7 +5222,10 @@ var ts; return canFollowModifier(); } function canFollowModifier() { - return token === 18 || token === 14 || token === 35 || isLiteralPropertyName(); + return token === 18 + || token === 14 + || token === 35 + || isLiteralPropertyName(); } function nextTokenIsClassOrFunction() { nextToken(); @@ -9992,7 +5283,8 @@ var ts; return isIdentifier(); } function isNotHeritageClauseTypeName() { - if (token === 102 || token === 78) { + if (token === 102 || + token === 78) { return lookAhead(nextTokenIsIdentifier); } return false; @@ -10373,7 +5665,9 @@ var ts; var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - if (node.kind === 7 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + if (node.kind === 7 + && sourceText.charCodeAt(tokenPos) === 48 + && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { node.flags |= 16384; } return node; @@ -10412,7 +5706,9 @@ var ts; } function parseParameterType() { if (parseOptional(51)) { - return token === 8 ? parseLiteralNode(true) : parseType(); + return token === 8 + ? parseLiteralNode(true) + : parseType(); } return undefined; } @@ -10570,7 +5866,11 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 || token === 24 || token === 50 || token === 51 || canParseSemicolon(); + return token === 16 || + token === 24 || + token === 50 || + token === 51 || + canParseSemicolon(); } function parseTypeMember() { switch (token) { @@ -10578,7 +5878,9 @@ var ts; case 24: return parseSignatureMember(136); case 18: - return isIndexSignature() ? parseIndexSignatureDeclaration(undefined) : parsePropertyOrMethodSignature(); + return isIndexSignature() + ? parseIndexSignatureDeclaration(undefined) + : parsePropertyOrMethodSignature(); case 87: if (lookAhead(isStartOfConstructSignature)) { return parseSignatureMember(137); @@ -10600,7 +5902,9 @@ var ts; } function parseIndexSignatureWithModifiers() { var modifiers = parseModifiers(); - return isIndexSignature() ? parseIndexSignatureDeclaration(modifiers) : undefined; + return isIndexSignature() + ? parseIndexSignatureDeclaration(modifiers) + : undefined; } function isStartOfConstructSignature() { nextToken(); @@ -10706,9 +6010,7 @@ var ts; function parseUnionTypeOrHigher() { var type = parseArrayTypeOrHigher(); if (token === 44) { - var types = [ - type - ]; + var types = [type]; types.pos = type.pos; while (parseOptional(44)) { types.push(parseArrayTypeOrHigher()); @@ -10733,7 +6035,9 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 51 || token === 23 || token === 50 || token === 52 || isIdentifier() || ts.isModifier(token)) { + if (token === 51 || token === 23 || + token === 50 || token === 52 || + isIdentifier() || ts.isModifier(token)) { return true; } if (token === 17) { @@ -10860,12 +6164,14 @@ var ts; } function nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() { nextToken(); - return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 14 || token === 18); + return !scanner.hasPrecedingLineBreak() && + (isIdentifier() || token === 14 || token === 18); } function parseYieldExpression() { var node = createNode(170); nextToken(); - if (!scanner.hasPrecedingLineBreak() && (token === 35 || isStartOfExpression())) { + if (!scanner.hasPrecedingLineBreak() && + (token === 35 || isStartOfExpression())) { node.asteriskToken = parseOptionalToken(35); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); @@ -10880,9 +6186,7 @@ var ts; var parameter = createNode(128, identifier.pos); parameter.name = identifier; finishNode(parameter); - node.parameters = [ - parameter - ]; + node.parameters = [parameter]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; parseExpected(32); @@ -10894,7 +6198,9 @@ var ts; if (triState === 0) { return undefined; } - var arrowFunction = triState === 1 ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + var arrowFunction = triState === 1 + ? parseParenthesizedArrowFunctionExpressionHead(true) + : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); if (!arrowFunction) { return undefined; } @@ -11116,7 +6422,9 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 90 ? parseSuperExpression() : parseMemberExpressionOrHigher(); + var expression = token === 90 + ? parseSuperExpression() + : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); } function parseMemberExpressionOrHigher() { @@ -11170,7 +6478,9 @@ var ts; if (token === 10 || token === 11) { var tagExpression = createNode(157, expression.pos); tagExpression.tag = expression; - tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); + tagExpression.template = token === 10 + ? parseLiteralNode() + : parseTemplateExpression(); expression = finishNode(tagExpression); continue; } @@ -11216,7 +6526,9 @@ var ts; if (!parseExpected(25)) { return undefined; } - return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; + return typeArguments && canFollowTypeArgumentsInExpression() + ? typeArguments + : undefined; } function canFollowTypeArgumentsInExpression() { switch (token) { @@ -11291,7 +6603,9 @@ var ts; return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 ? parseSpreadElement() : token === 23 ? createNode(172) : parseAssignmentExpressionOrHigher(); + return token === 21 ? parseSpreadElement() : + token === 23 ? createNode(172) : + parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return allowInAnd(parseArgumentOrArrayLiteralElement); @@ -11941,7 +7255,11 @@ var ts; if (isIndexSignature()) { return parseIndexSignatureDeclaration(modifiers); } - if (isIdentifierOrKeyword() || token === 8 || token === 7 || token === 35 || token === 18) { + if (isIdentifierOrKeyword() || + token === 8 || + token === 7 || + token === 35 || + token === 18) { return parsePropertyOrMethodDeclaration(fullStart, modifiers); } ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -11954,7 +7272,9 @@ var ts; node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); if (parseExpected(14)) { - node.members = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); + node.members = inGeneratorParameterContext() + ? doOutsideOfYieldContext(parseClassMembers) + : parseClassMembers(); parseExpected(15); } else { @@ -11964,7 +7284,9 @@ var ts; } function parseHeritageClauses(isClassHeritageClause) { if (isHeritageClause()) { - return isClassHeritageClause && inGeneratorParameterContext() ? doOutsideOfYieldContext(parseHeritageClausesWorker) : parseHeritageClausesWorker(); + return isClassHeritageClause && inGeneratorParameterContext() + ? doOutsideOfYieldContext(parseHeritageClausesWorker) + : parseHeritageClausesWorker(); } return undefined; } @@ -12043,7 +7365,9 @@ var ts; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(20) ? parseInternalModuleTail(getNodePos(), undefined, 1) : parseModuleBlock(); + node.body = parseOptional(20) + ? parseInternalModuleTail(getNodePos(), undefined, 1) + : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { @@ -12055,17 +7379,21 @@ var ts; } function parseModuleDeclaration(fullStart, modifiers) { parseExpected(116); - return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); + return token === 8 + ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) + : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); } function isExternalModuleReference() { - return token === 117 && lookAhead(nextTokenIsOpenParen); + return token === 117 && + lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 16; } function nextTokenIsCommaOrFromKeyword() { nextToken(); - return token === 23 || token === 123; + return token === 23 || + token === 123; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, modifiers) { parseExpected(84); @@ -12085,7 +7413,9 @@ var ts; } var importDeclaration = createNode(204, fullStart); setModifiers(importDeclaration, modifiers); - if (identifier || token === 35 || token === 14) { + if (identifier || + token === 35 || + token === 14) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); parseExpected(123); } @@ -12098,13 +7428,16 @@ var ts; if (identifier) { importClause.name = identifier; } - if (!importClause.name || parseOptional(23)) { + if (!importClause.name || + parseOptional(23)) { importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(207); } return finishNode(importClause); } function parseModuleReference() { - return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); + return isExternalModuleReference() + ? parseExternalModuleReference() + : parseEntityName(false); } function parseExternalModuleReference() { var node = createNode(213); @@ -12234,11 +7567,13 @@ var ts; } function nextTokenCanFollowImportKeyword() { nextToken(); - return isIdentifierOrKeyword() || token === 8 || token === 35 || token === 14; + return isIdentifierOrKeyword() || token === 8 || + token === 35 || token === 14; } function nextTokenCanFollowExportKeyword() { nextToken(); - return token === 52 || token === 35 || token === 14 || token === 72 || isDeclarationStart(); + return token === 52 || token === 35 || + token === 14 || token === 72 || isDeclarationStart(); } function nextTokenIsDeclarationStart() { nextToken(); @@ -12292,7 +7627,9 @@ var ts; return parseSourceElementOrModuleElement(); } function parseSourceElementOrModuleElement() { - return isDeclarationStart() ? parseDeclaration() : parseStatement(); + return isDeclarationStart() + ? parseDeclaration() + : parseStatement(); } function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, sourceText); @@ -12307,10 +7644,7 @@ var ts; if (kind !== 2) { break; } - var range = { - pos: triviaScanner.getTokenPos(), - end: triviaScanner.getTextPos() - }; + var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; var comment = sourceText.substring(range.pos, range.end); var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); if (referencePathMatchResult) { @@ -12341,10 +7675,7 @@ var ts; var pathMatchResult = pathRegex.exec(comment); var nameMatchResult = nameRegex.exec(comment); if (pathMatchResult) { - var amdDependency = { - path: pathMatchResult[2], - name: nameMatchResult ? nameMatchResult[2] : undefined - }; + var amdDependency = { path: pathMatchResult[2], name: nameMatchResult ? nameMatchResult[2] : undefined }; amdDependencies.push(amdDependency); } } @@ -12356,7 +7687,13 @@ var ts; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { - return node.flags & 1 || node.kind === 203 && node.moduleReference.kind === 213 || node.kind === 204 || node.kind === 209 || node.kind === 210 ? node : undefined; + return node.flags & 1 + || node.kind === 203 && node.moduleReference.kind === 213 + || node.kind === 204 + || node.kind === 209 + || node.kind === 210 + ? node + : undefined; }); } } @@ -12525,7 +7862,9 @@ var ts; if (node.name) { node.name.parent = node; } - var message = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = symbol.flags & 2 + ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 + : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration))); }); @@ -12571,7 +7910,9 @@ var ts; } else { if (hasExportModifier || isAmbientContext(container)) { - var exportKind = (symbolKind & 107455 ? 1048576 : 0) | (symbolKind & 793056 ? 2097152 : 0) | (symbolKind & 1536 ? 4194304 : 0); + var exportKind = (symbolKind & 107455 ? 1048576 : 0) | + (symbolKind & 793056 ? 2097152 : 0) | + (symbolKind & 1536 ? 4194304 : 0); var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); node.localSymbol = local; @@ -12851,7 +8192,9 @@ var ts; else { bindDeclaration(node, 1, 107455, false); } - if (node.flags & 112 && node.parent.kind === 133 && node.parent.parent.kind === 196) { + if (node.flags & 112 && + node.parent.kind === 133 && + node.parent.parent.kind === 196) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -12885,24 +8228,12 @@ var ts; var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); var checker = { - getNodeCount: function () { - return ts.sum(host.getSourceFiles(), "nodeCount"); - }, - getIdentifierCount: function () { - return ts.sum(host.getSourceFiles(), "identifierCount"); - }, - getSymbolCount: function () { - return ts.sum(host.getSourceFiles(), "symbolCount"); - }, - getTypeCount: function () { - return typeCount; - }, - isUndefinedSymbol: function (symbol) { - return symbol === undefinedSymbol; - }, - isArgumentsSymbol: function (symbol) { - return symbol === argumentsSymbol; - }, + getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, + getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, + getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, + getTypeCount: function () { return typeCount; }, + isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, + isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, @@ -12996,7 +8327,9 @@ var ts; return emitResolver; } function error(location, message, arg0, arg1, arg2) { - var diagnostic = location ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); + var diagnostic = location + ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) + : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); diagnostics.add(diagnostic); } function createSymbol(flags, name) { @@ -13082,7 +8415,8 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = target.flags & 2 || source.flags & 2 + ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { error(node.name ? node.name : node, message, symbolToString(source)); }); @@ -13269,18 +8603,18 @@ var ts; } function checkResolvedBlockScopedVariable(result, errorLocation) { ts.Debug.assert((result.flags & 2) !== 0); - var declaration = ts.forEach(result.declarations, function (d) { - return ts.isBlockOrCatchScoped(d) ? d : undefined; - }); + var declaration = ts.forEach(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { var variableDeclaration = ts.getAncestor(declaration, 193); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 175 || variableDeclaration.parent.parent.kind === 181) { + if (variableDeclaration.parent.parent.kind === 175 || + variableDeclaration.parent.parent.kind === 181) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 183 || variableDeclaration.parent.parent.kind === 182) { + else if (variableDeclaration.parent.parent.kind === 183 || + variableDeclaration.parent.parent.kind === 182) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -13301,12 +8635,15 @@ var ts; return false; } function isAliasSymbolDeclaration(node) { - return node.kind === 203 || node.kind === 205 && !!node.name || node.kind === 206 || node.kind === 208 || node.kind === 212 || node.kind === 209; + return node.kind === 203 || + node.kind === 205 && !!node.name || + node.kind === 206 || + node.kind === 208 || + node.kind === 212 || + node.kind === 209; } function getDeclarationOfAliasSymbol(symbol) { - return ts.forEach(symbol.declarations, function (d) { - return isAliasSymbolDeclaration(d) ? d : undefined; - }); + return ts.forEach(symbol.declarations, function (d) { return isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { if (node.moduleReference.kind === 213) { @@ -13347,7 +8684,9 @@ var ts; return getExternalModuleMember(node.parent.parent.parent, node); } function getTargetOfExportSpecifier(node) { - return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); + return node.parent.parent.moduleSpecifier ? + getExternalModuleMember(node.parent.parent, node) : + resolveEntityName(node.propertyName || node.name, 107455 | 793056 | 1536); } function getTargetOfExportAssignment(node) { return resolveEntityName(node.expression, 107455 | 793056 | 1536); @@ -13566,7 +8905,9 @@ var ts; return getMergedSymbol(symbol.parent); } function getExportSymbolOfValueSymbolIfExported(symbol) { - return symbol && (symbol.flags & 1048576) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; + return symbol && (symbol.flags & 1048576) !== 0 + ? getMergedSymbol(symbol.exportSymbol) + : symbol; } function symbolIsValue(symbol) { if (symbol.flags & 16777216) { @@ -13605,7 +8946,10 @@ var ts; return type; } function isReservedMemberName(name) { - return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && name.charCodeAt(2) !== 95 && name.charCodeAt(2) !== 64; + return name.charCodeAt(0) === 95 && + name.charCodeAt(1) === 95 && + name.charCodeAt(2) !== 95 && + name.charCodeAt(2) !== 64; } function getNamedMembers(members) { var result; @@ -13679,28 +9023,24 @@ var ts; } function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { - return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && + canQualifySymbol(symbolFromSymbolTable, meaning); } } if (isAccessible(ts.lookUp(symbols, symbol.name))) { - return [ - symbol - ]; + return [symbol]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608) { - if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) { - return [ - symbolFromSymbolTable - ]; + return [symbolFromSymbolTable]; } var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { - return [ - symbolFromSymbolTable - ].concat(accessibleSymbolsFromExports); + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); } } } @@ -13765,9 +9105,7 @@ var ts; errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) }; } - return { - accessibility: 0 - }; + return { accessibility: 0 }; function getExternalModuleContainer(declaration) { for (; declaration; declaration = declaration.parent) { if (hasExternalModuleSymbol(declaration)) { @@ -13777,22 +9115,20 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 200 && declaration.name.kind === 8) || (declaration.kind === 221 && ts.isExternalModule(declaration)); + return (declaration.kind === 200 && declaration.name.kind === 8) || + (declaration.kind === 221 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; - if (ts.forEach(symbol.declarations, function (declaration) { - return !getIsDeclarationVisible(declaration); - })) { + if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { return undefined; } - return { - accessibility: 0, - aliasesToMakeVisible: aliasesToMakeVisible - }; + return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 203 && !(declaration.flags & 1) && isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 203 && + !(declaration.flags & 1) && + isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -13800,9 +9136,7 @@ var ts; } } else { - aliasesToMakeVisible = [ - declaration - ]; + aliasesToMakeVisible = [declaration]; } return true; } @@ -13816,7 +9150,8 @@ var ts; if (entityName.parent.kind === 142) { meaning = 107455 | 1048576; } - else if (entityName.kind === 125 || entityName.parent.kind === 203) { + else if (entityName.kind === 125 || + entityName.parent.kind === 203) { meaning = 1536; } else { @@ -13902,7 +9237,8 @@ var ts; function walkSymbol(symbol, meaning) { if (symbol) { var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); - if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { @@ -13935,7 +9271,8 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { if (type.flags & 1048703) { - writer.writeKeyword(!(globalFlags & 16) && (type.flags & 1) ? "any" : type.intrinsicName); + writer.writeKeyword(!(globalFlags & 16) && + (type.flags & 1) ? "any" : type.intrinsicName); } else if (type.flags & 4096) { writeTypeReference(type, flags); @@ -14028,14 +9365,16 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.flags & 128; - })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 221 || declaration.parent.kind === 201; - })); + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && + ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && + (type.symbol.parent || + ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.parent.kind === 221 || declaration.parent.kind === 201; + })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { - return !!(flags & 2) || (typeStack && ts.contains(typeStack, type)); + return !!(flags & 2) || + (typeStack && ts.contains(typeStack, type)); } } } @@ -14321,7 +9660,8 @@ var ts; case 199: case 203: var _parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 203 && _parent.kind !== 221 && ts.isInAmbientContext(_parent))) { + if (!(ts.getCombinedNodeFlags(node) & 1) && + !(node.kind !== 203 && _parent.kind !== 221 && ts.isInAmbientContext(_parent))) { return isGlobalSourceFile(_parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(_parent); @@ -14376,9 +9716,7 @@ var ts; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); - return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { - return anyType; - })) : classType; + return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; } function getTypeOfPropertyOfType(type, name) { var prop = getPropertyOfType(type, name); @@ -14399,7 +9737,9 @@ var ts; var type; if (pattern.kind === 148) { var _name = declaration.propertyName || declaration.name; - type = getTypeOfPropertyOfType(parentType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); + type = getTypeOfPropertyOfType(parentType, _name.text) || + isNumericLiteralName(_name.text) && getIndexTypeOfType(parentType, 1) || + getIndexTypeOfType(parentType, 0); if (!type) { error(_name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(_name)); return unknownType; @@ -14495,7 +9835,9 @@ var ts; return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 148 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); + return pattern.kind === 148 + ? getTypeFromObjectBindingPattern(pattern) + : getTypeFromArrayBindingPattern(pattern); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -14539,7 +9881,9 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + var diagnostic = symbol.valueDeclaration.type ? + ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : + ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); } } @@ -14673,9 +10017,7 @@ var ts; ts.forEach(declaration.typeParameters, function (node) { var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); if (!result) { - result = [ - tp - ]; + result = [tp]; } else if (!ts.contains(result, tp)) { result.push(tp); @@ -14922,15 +10264,14 @@ var ts; var baseType = classType.baseTypes[0]; var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1); return ts.map(baseSignatures, function (baseSignature) { - var signature = baseType.flags & 4096 ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); + var signature = baseType.flags & 4096 ? + getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); signature.typeParameters = classType.typeParameters; signature.resolvedReturnType = classType; return signature; }); } - return [ - createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false) - ]; + return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; } function createTupleTypeMemberSymbols(memberTypes) { var members = {}; @@ -14959,9 +10300,7 @@ var ts; return true; } function getUnionSignatures(types, kind) { - var signatureLists = ts.map(types, function (t) { - return getSignaturesOfType(t, kind); - }); + var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); var signatures = signatureLists[0]; for (var _i = 0, _n = signatures.length; _i < _n; _i++) { var signature = signatures[_i]; @@ -14978,9 +10317,7 @@ var ts; for (var i = 0; i < result.length; i++) { var s = result[i]; s.resolvedReturnType = undefined; - s.unionSignatures = ts.map(signatureLists, function (signatures) { - return signatures[i]; - }); + s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); } return result; } @@ -15131,9 +10468,7 @@ var ts; return undefined; } if (!props) { - props = [ - prop - ]; + props = [prop]; } else { props.push(prop); @@ -15233,7 +10568,8 @@ var ts; var links = getNodeLinks(declaration); if (!links.resolvedSignature) { var classType = declaration.kind === 133 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; - var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; + var typeParameters = classType ? classType.typeParameters : + declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; @@ -15365,12 +10701,8 @@ var ts; var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; - type.callSignatures = !isConstructor ? [ - signature - ] : emptyArray; - type.constructSignatures = isConstructor ? [ - signature - ] : emptyArray; + type.callSignatures = !isConstructor ? [signature] : emptyArray; + type.constructSignatures = isConstructor ? [signature] : emptyArray; signature.isolatedSignatureType = type; } return signature.isolatedSignatureType; @@ -15398,7 +10730,9 @@ var ts; } function getIndexTypeOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); - return declaration ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType : undefined; + return declaration + ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType + : undefined; } function getConstraintOfTypeParameter(type) { if (!type.constraint) { @@ -15454,9 +10788,7 @@ var ts; return links.isIllegalTypeReferenceInConstraint; } var currentNode = typeReferenceNode; - while (!ts.forEach(typeParameterSymbol.declarations, function (d) { - return d.parent === currentNode.parent; - })) { + while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } links.isIllegalTypeReferenceInConstraint = currentNode.kind === 127; @@ -15470,9 +10802,7 @@ var ts; if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); if (symbol && (symbol.flags & 262144)) { - links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { - return d.parent == typeParameter.parent; - }); + links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); } } if (links.isIllegalTypeReferenceInConstraint) { @@ -15571,9 +10901,7 @@ var ts; } function createArrayType(elementType) { var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); - return arrayType !== emptyObjectType ? createTypeReference(arrayType, [ - elementType - ]) : emptyObjectType; + return arrayType !== emptyObjectType ? createTypeReference(arrayType, [elementType]) : emptyObjectType; } function getTypeFromArrayTypeNode(node) { var links = getNodeLinks(node); @@ -15763,21 +11091,15 @@ var ts; return items; } function createUnaryTypeMapper(source, target) { - return function (t) { - return t === source ? target : t; - }; + return function (t) { return t === source ? target : t; }; } function createBinaryTypeMapper(source1, target1, source2, target2) { - return function (t) { - return t === source1 ? target1 : t === source2 ? target2 : t; - }; + return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } function createTypeMapper(sources, targets) { switch (sources.length) { - case 1: - return createUnaryTypeMapper(sources[0], targets[0]); - case 2: - return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); + case 1: return createUnaryTypeMapper(sources[0], targets[0]); + case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); } return function (t) { for (var i = 0; i < sources.length; i++) { @@ -15789,21 +11111,15 @@ var ts; }; } function createUnaryTypeEraser(source) { - return function (t) { - return t === source ? anyType : t; - }; + return function (t) { return t === source ? anyType : t; }; } function createBinaryTypeEraser(source1, source2) { - return function (t) { - return t === source1 || t === source2 ? anyType : t; - }; + return function (t) { return t === source1 || t === source2 ? anyType : t; }; } function createTypeEraser(sources) { switch (sources.length) { - case 1: - return createUnaryTypeEraser(sources[0]); - case 2: - return createBinaryTypeEraser(sources[0], sources[1]); + case 1: return createUnaryTypeEraser(sources[0]); + case 2: return createBinaryTypeEraser(sources[0], sources[1]); } return function (t) { for (var _i = 0, _n = sources.length; _i < _n; _i++) { @@ -15829,9 +11145,7 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { - return mapper2(mapper1(t)); - }; + return function (t) { return mapper2(mapper1(t)); }; } function instantiateTypeParameter(typeParameter, mapper) { var result = createType(512); @@ -15892,7 +11206,8 @@ var ts; return mapper(type); } if (type.flags & 32768) { - return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? instantiateAnonymousType(type, mapper) : type; + return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? + instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096) { return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); @@ -15917,9 +11232,11 @@ var ts; case 151: return ts.forEach(node.elements, isContextSensitive); case 168: - return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); + return isContextSensitive(node.whenTrue) || + isContextSensitive(node.whenFalse); case 167: - return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); + return node.operatorToken.kind === 49 && + (isContextSensitive(node.left) || isContextSensitive(node.right)); case 218: return isContextSensitive(node.initializer); case 132: @@ -15931,9 +11248,7 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { - return p.type; - }); + return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); } function getTypeWithoutConstructors(type) { if (type.flags & 48128) { @@ -16072,7 +11387,8 @@ var ts; } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (_result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && + (_result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; return _result; } @@ -16533,7 +11849,9 @@ var ts; if (source === target) { return -1; } - if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { + if (source.parameters.length !== target.parameters.length || + source.minArgumentCount !== target.minArgumentCount || + source.hasRestParameter !== target.hasRestParameter) { return 0; } var result = -1; @@ -16577,9 +11895,7 @@ var ts; return true; } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { - return isSupertypeOfEach(t, types) ? t : undefined; - }); + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { var bestSupertype; @@ -16699,7 +12015,9 @@ var ts; diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; case 128: - diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + diagnostic = declaration.dotDotDotToken ? + ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : + ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; case 195: case 132: @@ -16756,10 +12074,7 @@ var ts; var inferences = []; for (var _i = 0, _n = typeParameters.length; _i < _n; _i++) { var unused = typeParameters[_i]; - inferences.push({ - primary: undefined, - secondary: undefined - }); + inferences.push({ primary: undefined, secondary: undefined }); } return { typeParameters: typeParameters, @@ -16806,7 +12121,9 @@ var ts; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { var inferences = context.inferences[i]; - var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); + var candidates = inferiority ? + inferences.secondary || (inferences.secondary = []) : + inferences.primary || (inferences.primary = []); if (!ts.contains(candidates, source)) candidates.push(source); break; @@ -16847,7 +12164,8 @@ var ts; inferFromTypes(sourceType, target); } } - else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || + (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -16957,12 +12275,8 @@ var ts; function removeTypesFromUnionType(type, typeKind, isOfTypeKind, allowEmptyUnionResult) { if (type.flags & 16384) { var types = type.types; - if (ts.forEach(types, function (t) { - return !!(t.flags & typeKind) === isOfTypeKind; - })) { - var narrowedType = getUnionType(ts.filter(types, function (t) { - return !(t.flags & typeKind) === isOfTypeKind; - })); + if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { + var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); if (allowEmptyUnionResult || narrowedType !== emptyObjectType) { return narrowedType; } @@ -17056,13 +12370,12 @@ var ts; function resolveLocation(node) { var containerNodes = []; for (var _parent = node.parent; _parent; _parent = _parent.parent) { - if ((ts.isExpression(_parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(_parent)) { + if ((ts.isExpression(_parent) || ts.isObjectLiteralMethod(node)) && + isContextSensitive(_parent)) { containerNodes.unshift(_parent); } } - ts.forEach(containerNodes, function (node) { - getTypeOfNode(node); - }); + ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); } function getSymbolAtLocation(node) { resolveLocation(node); @@ -17191,9 +12504,7 @@ var ts; return targetType; } if (type.flags & 16384) { - return getUnionType(ts.filter(type.types, function (t) { - return isTypeSubtypeOf(t, targetType); - })); + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); } return type; } @@ -17249,7 +12560,9 @@ var ts; return false; } function checkBlockScopedBindingCapturedInLoop(node, symbol) { - if (languageVersion >= 2 || (symbol.flags & 2) === 0 || symbol.valueDeclaration.parent.kind === 217) { + if (languageVersion >= 2 || + (symbol.flags & 2) === 0 || + symbol.valueDeclaration.parent.kind === 217) { return; } var container = symbol.valueDeclaration; @@ -17357,10 +12670,21 @@ var ts; } if (container && container.parent && container.parent.kind === 196) { if (container.flags & 128) { - canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135; + canUseSuperExpression = + container.kind === 132 || + container.kind === 131 || + container.kind === 134 || + container.kind === 135; } else { - canUseSuperExpression = container.kind === 132 || container.kind === 131 || container.kind === 134 || container.kind === 135 || container.kind === 130 || container.kind === 129 || container.kind === 133; + canUseSuperExpression = + container.kind === 132 || + container.kind === 131 || + container.kind === 134 || + container.kind === 135 || + container.kind === 130 || + container.kind === 129 || + container.kind === 133; } } } @@ -17407,7 +12731,8 @@ var ts; if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } - if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + if (indexOfParameter === (func.parameters.length - 1) && + funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); } } @@ -17493,10 +12818,7 @@ var ts; mappedType = t; } else if (!mappedTypes) { - mappedTypes = [ - mappedType, - t - ]; + mappedTypes = [mappedType, t]; } else { mappedTypes.push(t); @@ -17512,17 +12834,13 @@ var ts; }); } function getIndexTypeOfContextualType(type, kind) { - return applyToContextualType(type, function (t) { - return getIndexTypeOfObjectOrUnionType(t, kind); - }); + return applyToContextualType(type, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }); } function contextualTypeIsTupleLikeType(type) { return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } function contextualTypeHasIndexSignature(type, kind) { - return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { - return getIndexTypeOfObjectOrUnionType(t, kind); - }) : getIndexTypeOfObjectOrUnionType(type, kind)); + return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); } function getContextualTypeForObjectLiteralMethod(node) { ts.Debug.assert(ts.isObjectLiteralMethod(node)); @@ -17542,7 +12860,8 @@ var ts; return propertyType; } } - return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || getIndexTypeOfContextualType(type, 0); + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || + getIndexTypeOfContextualType(type, 0); } return undefined; } @@ -17551,7 +12870,9 @@ var ts; var type = getContextualType(arrayLiteral); if (type) { var index = ts.indexOf(arrayLiteral.elements, node); - return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1) || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); + return getTypeOfPropertyOfContextualType(type, "" + index) + || getIndexTypeOfContextualType(type, 1) + || (languageVersion >= 2 ? checkIteratedType(type, undefined) : undefined); } return undefined; } @@ -17615,7 +12936,9 @@ var ts; } function getContextualSignature(node) { ts.Debug.assert(node.kind !== 132 || ts.isObjectLiteralMethod(node)); - var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); + var type = ts.isObjectLiteralMethod(node) + ? getContextualTypeForObjectLiteralMethod(node) + : getContextualType(node); if (!type) { return undefined; } @@ -17626,15 +12949,14 @@ var ts; var types = type.types; for (var _i = 0, _n = types.length; _i < _n; _i++) { var current = types[_i]; - if (signatureList && getSignaturesOfObjectOrUnionType(current, 0).length > 1) { + if (signatureList && + getSignaturesOfObjectOrUnionType(current, 0).length > 1) { return undefined; } var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { - signatureList = [ - signature - ]; + signatureList = [signature]; } else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { return undefined; @@ -17732,7 +13054,9 @@ var ts; for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 218 || memberDecl.kind === 219 || ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 218 || + memberDecl.kind === 219 || + ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; if (memberDecl.kind === 218) { type = checkPropertyAssignment(memberDecl, contextualMapper); @@ -17742,7 +13066,9 @@ var ts; } else { ts.Debug.assert(memberDecl.kind === 219); - type = memberDecl.name.kind === 126 ? unknownType : checkExpression(memberDecl.name, contextualMapper); + type = memberDecl.name.kind === 126 + ? unknownType + : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -17858,7 +13184,9 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 153 ? node.expression : node.left; + var left = node.kind === 153 + ? node.expression + : node.left; var type = checkExpressionOrQualifiedName(left); if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); @@ -17895,7 +13223,8 @@ var ts; return unknownType; } var isConstEnum = isConstEnumObjectType(objectType); - if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + if (isConstEnum && + (!node.argumentExpression || node.argumentExpression.kind !== 8)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } @@ -18062,7 +13391,8 @@ var ts; callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; } - var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + var hasRightNumberOfTypeArgs = !typeArguments || + (signature.typeParameters && typeArguments.length === signature.typeParameters.length); if (!hasRightNumberOfTypeArgs) { return false; } @@ -18079,7 +13409,8 @@ var ts; function getSingleCallSignature(type) { if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); - if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && + resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { return resolved.callSignatures[0]; } } @@ -18150,7 +13481,9 @@ var ts; var arg = args[i]; if (arg.kind !== 172) { var paramType = getTypeAtPosition(signature, arg.kind === 171 ? -1 : i); - var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + var argType = i === 0 && node.kind === 157 ? globalTemplateStringsArrayType : + arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : + checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { return false; } @@ -18162,9 +13495,7 @@ var ts; var args; if (node.kind === 157) { var template = node.template; - args = [ - template - ]; + args = [template]; if (template.kind === 169) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); @@ -18419,7 +13750,10 @@ var ts; } if (node.kind === 156) { var declaration = signature.declaration; - if (declaration && declaration.kind !== 133 && declaration.kind !== 137 && declaration.kind !== 141) { + if (declaration && + declaration.kind !== 133 && + declaration.kind !== 137 && + declaration.kind !== 141) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -18444,9 +13778,13 @@ var ts; } function getTypeAtPosition(signature, pos) { if (pos >= 0) { - return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + return signature.hasRestParameter ? + pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : + pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; } - return signature.hasRestParameter ? getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : anyArrayType; + return signature.hasRestParameter ? + getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : + anyArrayType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -18595,16 +13933,14 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 64: - { - var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; - } - case 153: - { - var _symbol = findSymbol(n); - return !_symbol || _symbol === unknownSymbol || (_symbol.flags & ~8) !== 0; - } + case 64: { + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + } + case 153: { + var _symbol = findSymbol(n); + return !_symbol || _symbol === unknownSymbol || (_symbol.flags & ~8) !== 0; + } case 154: return true; case 159: @@ -18616,22 +13952,20 @@ var ts; function isConstVariableReference(n) { switch (n.kind) { case 64: - case 153: - { - var symbol = findSymbol(n); - return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; - } - case 154: - { - var index = n.argumentExpression; - var _symbol = findSymbol(n.expression); - if (_symbol && index && index.kind === 8) { - var _name = index.text; - var prop = getPropertyOfType(getTypeOfSymbol(_symbol), _name); - return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; - } - return false; + case 153: { + var symbol = findSymbol(n); + return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; + } + case 154: { + var index = n.argumentExpression; + var _symbol = findSymbol(n.expression); + if (_symbol && index && index.kind === 8) { + var _name = index.text; + var prop = getPropertyOfType(getTypeOfSymbol(_symbol), _name); + return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 8192) !== 0; } + return false; + } case 159: return isConstVariableReference(n.expression); default: @@ -18759,7 +14093,10 @@ var ts; var p = properties[_i]; if (p.kind === 218 || p.kind === 219) { var _name = p.name; - var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, _name.text) || isNumericLiteralName(_name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); + var type = sourceType.flags & 1 ? sourceType : + getTypeOfPropertyOfType(sourceType, _name.text) || + isNumericLiteralName(_name.text) && getIndexTypeOfType(sourceType, 1) || + getIndexTypeOfType(sourceType, 0); if (type) { checkDestructuringAssignment(p.initializer || _name, type); } @@ -18784,7 +14121,9 @@ var ts; if (e.kind !== 172) { if (e.kind !== 171) { var propName = "" + i; - var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); + var type = sourceType.flags & 1 ? sourceType : + isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : + getIndexTypeOfType(sourceType, 1); if (type) { checkDestructuringAssignment(e, type, contextualMapper); } @@ -18865,7 +14204,9 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var suggestedOperator; - if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + if ((leftType.flags & 8) && + (rightType.flags & 8) && + (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { @@ -18927,10 +14268,7 @@ var ts; case 48: return rightType; case 49: - return getUnionType([ - leftType, - rightType - ]); + return getUnionType([leftType, rightType]); case 52: checkAssignmentOperator(rightType); return rightType; @@ -18938,7 +14276,9 @@ var ts; return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : + someConstituentTypeHasKind(rightType, 1048576) ? node.right : + undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); return false; @@ -18984,10 +14324,7 @@ var ts; checkExpression(node.condition); var type1 = checkExpression(node.whenTrue, contextualMapper); var type2 = checkExpression(node.whenFalse, contextualMapper); - return getUnionType([ - type1, - type2 - ]); + return getUnionType([type1, type2]); } function checkTemplateExpression(node) { ts.forEach(node.templateSpans, function (templateSpan) { @@ -19051,7 +14388,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 153 && node.parent.expression === node) || (node.parent.kind === 154 && node.parent.expression === node) || ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 153 && node.parent.expression === node) || + (node.parent.kind === 154 && node.parent.expression === node) || + ((node.kind === 64 || node.kind === 125) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -19161,7 +14500,9 @@ var ts; if (node.kind === 138) { checkGrammarIndexSignature(node); } - else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || node.kind === 136 || node.kind === 133 || node.kind === 137) { + else if (node.kind === 140 || node.kind === 195 || node.kind === 141 || + node.kind === 136 || node.kind === 133 || + node.kind === 137) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -19255,10 +14596,8 @@ var ts; case 160: case 195: case 161: - case 152: - return false; - default: - return ts.forEachChild(n, containsSuperCall); + case 152: return false; + default: return ts.forEachChild(n, containsSuperCall); } } function markThisReferencesAsErrors(n) { @@ -19270,13 +14609,14 @@ var ts; } } function isInstancePropertyWithInitializer(n) { - return n.kind === 130 && !(n.flags & 128) && !!n.initializer; + return n.kind === 130 && + !(n.flags & 128) && + !!n.initializer; } if (ts.getClassBaseTypeNode(node.parent)) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { - return p.flags & (16 | 32 | 64); - }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || + ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); if (superCallShouldBeFirst) { var statements = node.body.statements; if (!statements.length || statements[0].kind !== 177 || !isSuperCallExpression(statements[0].expression)) { @@ -19599,16 +14939,16 @@ var ts; case 197: return 2097152; case 200: - return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; + return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 + ? 4194304 | 1048576 + : 4194304; case 196: case 199: return 2097152 | 1048576; case 203: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { - result |= getDeclarationSpaces(d); - }); + ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); return result; default: return 1048576; @@ -19617,7 +14957,10 @@ var ts; } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); + checkFunctionLikeDeclaration(node) || + checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionName(node.name) || + checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -19672,7 +15015,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 130 || node.kind === 129 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135) { + if (node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 131 || + node.kind === 134 || + node.kind === 135) { return false; } if (ts.isInAmbientContext(node)) { @@ -19740,11 +15088,17 @@ var ts; var symbol = getSymbolOfNode(node); if (symbol.flags & 1) { var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); - if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { + if (localDeclarationSymbol && + localDeclarationSymbol !== symbol && + localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 194); - var container = varDeclList.parent.kind === 175 && varDeclList.parent.parent; - var namesShareScope = container && (container.kind === 174 && ts.isFunctionLike(container.parent) || (container.kind === 201 && container.kind === 200) || container.kind === 221); + var container = varDeclList.parent.kind === 175 && + varDeclList.parent.parent; + var namesShareScope = container && + (container.kind === 174 && ts.isFunctionLike(container.parent) || + (container.kind === 201 && container.kind === 200) || + container.kind === 221); if (!namesShareScope) { var _name = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, _name, _name); @@ -19961,15 +15315,17 @@ var ts; } function checkRightHandSideOfForOf(rhsExpression) { var expressionType = getTypeOfExpression(rhsExpression); - return languageVersion >= 2 ? checkIteratedType(expressionType, rhsExpression) : checkElementTypeOfArrayOrString(expressionType, rhsExpression); + return languageVersion >= 2 + ? checkIteratedType(expressionType, rhsExpression) + : checkElementTypeOfArrayOrString(expressionType, rhsExpression); } function checkIteratedType(iterable, expressionForError) { ts.Debug.assert(languageVersion >= 2); var iteratedType = getIteratedType(iterable, expressionForError); if (expressionForError && iteratedType) { - var completeIterableType = globalIterableType !== emptyObjectType ? createTypeReference(globalIterableType, [ - iteratedType - ]) : emptyObjectType; + var completeIterableType = globalIterableType !== emptyObjectType + ? createTypeReference(globalIterableType, [iteratedType]) + : emptyObjectType; checkTypeAssignableTo(iterable, completeIterableType, expressionForError); } return iteratedType; @@ -20033,7 +15389,9 @@ var ts; } if (!isArrayLikeType(arrayType)) { if (!reportedError) { - var diagnostic = hasStringConstituent ? ts.Diagnostics.Type_0_is_not_an_array_type : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; + var diagnostic = hasStringConstituent + ? ts.Diagnostics.Type_0_is_not_an_array_type + : ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type; error(expressionForError, diagnostic, typeToString(arrayType)); } return hasStringConstituent ? stringType : unknownType; @@ -20043,10 +15401,7 @@ var ts; if (arrayElementType.flags & 258) { return stringType; } - return getUnionType([ - arrayElementType, - stringType - ]); + return getUnionType([arrayElementType, stringType]); } return arrayElementType; } @@ -20208,9 +15563,7 @@ var ts; if (stringIndexType && numberIndexType) { errorNode = declaredNumberIndexer || declaredStringIndexer; if (!errorNode && (type.flags & 2048)) { - var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { - return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); - }); + var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); }); errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; } } @@ -20232,13 +15585,13 @@ var ts; _errorNode = indexDeclaration; } else if (containingType.flags & 2048) { - var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { - return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); - }); + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); _errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } if (_errorNode && !isTypeAssignableTo(propertyType, indexType)) { - var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + var errorMessage = indexKind === 0 + ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 + : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; error(_errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); } } @@ -20403,12 +15756,7 @@ var ts; return true; } var seen = {}; - ts.forEach(type.declaredProperties, function (p) { - seen[p.name] = { - prop: p, - containingType: type - }; - }); + ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; for (var _i = 0, _a = type.baseTypes, _n = _a.length; _i < _n; _i++) { var base = _a[_i]; @@ -20416,10 +15764,7 @@ var ts; for (var _b = 0, _c = properties.length; _b < _c; _b++) { var prop = properties[_b]; if (!ts.hasProperty(seen, prop.name)) { - seen[prop.name] = { - prop: prop, - containingType: base - }; + seen[prop.name] = { prop: prop, containingType: base }; } else { var existing = seen[prop.name]; @@ -20522,12 +15867,9 @@ var ts; return undefined; } switch (e.operator) { - case 33: - return value; - case 34: - return -value; - case 47: - return enumIsConst ? ~value : undefined; + case 33: return value; + case 34: return -value; + case 47: return enumIsConst ? ~value : undefined; } return undefined; case 167: @@ -20543,28 +15885,17 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 44: - return left | right; - case 43: - return left & right; - case 41: - return left >> right; - case 42: - return left >>> right; - case 40: - return left << right; - case 45: - return left ^ right; - case 35: - return left * right; - case 36: - return left / right; - case 33: - return left + right; - case 34: - return left - right; - case 37: - return left % right; + case 44: return left | right; + case 43: return left & right; + case 41: return left >> right; + case 42: return left >>> right; + case 40: return left << right; + case 45: return left ^ right; + case 35: return left * right; + case 36: return left / right; + case 33: return left + right; + case 34: return left - right; + case 37: return left % right; } return undefined; case 7: @@ -20587,7 +15918,8 @@ var ts; } else { if (e.kind === 154) { - if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { + if (e.argumentExpression === undefined || + e.argumentExpression.kind !== 8) { return undefined; } _enumType = getTypeOfNode(e.expression); @@ -20683,7 +16015,10 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + if (symbol.flags & 512 + && symbol.declarations.length > 1 + && !ts.isInAmbientContext(node) + && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -20719,7 +16054,9 @@ var ts; } var inAmbientExternalModule = node.parent.kind === 201 && node.parent.parent.name.kind === 8; if (node.parent.kind !== 221 && !inAmbientExternalModule) { - error(moduleName, node.kind === 210 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + error(moduleName, node.kind === 210 ? + ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : + ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { @@ -20732,9 +16069,13 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | + (symbol.flags & 793056 ? 793056 : 0) | + (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 212 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; + var message = node.kind === 212 ? + ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : + ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); } } @@ -21168,7 +16509,9 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 64 && isTypeDeclaration(name.parent) && name.parent.name === name; + return name.kind == 64 && + isTypeDeclaration(name.parent) && + name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { @@ -21262,7 +16605,8 @@ var ts; return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 125 && node.parent.right === node) || (node.parent.kind === 153 && node.parent.name === node); + return (node.parent.kind === 125 && node.parent.right === node) || + (node.parent.kind === 153 && node.parent.name === node); } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationName(entityName)) { @@ -21317,7 +16661,9 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 64 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 209 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); + return node.parent.kind === 209 + ? getSymbolOfEntityNameOrPropertyAccessExpression(node) + : getSymbolOfPartOfRightHandSideOfImportEquals(node); } switch (node.kind) { case 64: @@ -21336,7 +16682,10 @@ var ts; return undefined; case 8: var moduleName; - if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || ((node.parent.kind === 204 || node.parent.kind === 210) && node.parent.moduleSpecifier === node)) { + if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && + ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || + ((node.parent.kind === 204 || node.parent.kind === 210) && + node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 7: @@ -21422,14 +16771,10 @@ var ts; else if (symbol.flags & 67108864) { var target = getSymbolLinks(symbol).target; if (target) { - return [ - target - ]; + return [target]; } } - return [ - symbol - ]; + return [symbol]; } function isExternalModuleSymbol(symbol) { return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 221; @@ -21511,7 +16856,8 @@ var ts; } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 8 ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + var baseName = expr.kind === 8 ? + ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; assignGeneratedName(node, makeUniqueName(baseName)); } function generateNameForImportDeclaration(node) { @@ -21609,7 +16955,8 @@ var ts; if (ts.nodeIsPresent(node.body)) { var symbol = getSymbolOfNode(node); var signaturesOfSymbol = getSignaturesOfSymbol(symbol); - return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + return signaturesOfSymbol.length > 1 || + (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); } return false; } @@ -21636,7 +16983,9 @@ var ts; } function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { var symbol = getSymbolOfNode(declaration); - var type = symbol && !(symbol.flags & (2048 | 131072)) ? getTypeOfSymbol(symbol) : unknownType; + var type = symbol && !(symbol.flags & (2048 | 131072)) + ? getTypeOfSymbol(symbol) + : unknownType; getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -21645,19 +16994,29 @@ var ts; } function isUnknownIdentifier(location, name) { ts.Debug.assert(!ts.nodeIsSynthesized(location), "isUnknownIdentifier called with a synthesized location"); - return !resolveName(location, name, 107455, undefined, undefined) && !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); + return !resolveName(location, name, 107455, undefined, undefined) && + !ts.hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - if (n.parent.kind === 153 && n.parent.name === n) { + if (n.parent.kind === 153 && + n.parent.name === n) { return undefined; } - if (n.parent.kind === 150 && n.parent.propertyName === n) { + if (n.parent.kind === 150 && + n.parent.propertyName === n) { return undefined; } - var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || n.parent.kind === 150 ? getSymbolOfNode(n.parent) : undefined; - var symbol = declarationSymbol || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); - var isLetOrConst = symbol && (symbol.flags & 2) && symbol.valueDeclaration.parent.kind !== 217; + var declarationSymbol = (n.parent.kind === 193 && n.parent.name === n) || + n.parent.kind === 150 + ? getSymbolOfNode(n.parent) + : undefined; + var symbol = declarationSymbol || + getNodeLinks(n).resolvedSymbol || + resolveName(n, n.text, 107455 | 8388608, undefined, undefined); + var isLetOrConst = symbol && + (symbol.flags & 2) && + symbol.valueDeclaration.parent.kind !== 217; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -21947,7 +17306,8 @@ var ts; } } function checkGrammarTypeArguments(node, typeArguments) { - return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + return checkGrammarForDisallowedTrailingComma(typeArguments) || + checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { @@ -21961,7 +17321,8 @@ var ts; } } function checkGrammarArguments(node, arguments) { - return checkGrammarForDisallowedTrailingComma(arguments) || checkGrammarForOmittedArgument(node, arguments); + return checkGrammarForDisallowedTrailingComma(arguments) || + checkGrammarForOmittedArgument(node, arguments); } function checkGrammarHeritageClause(node) { var types = node.types; @@ -22055,7 +17416,8 @@ var ts; for (var _i = 0, _a = node.properties, _n = _a.length; _i < _n; _i++) { var prop = _a[_i]; var _name = prop.name; - if (prop.kind === 172 || _name.kind === 126) { + if (prop.kind === 172 || + _name.kind === 126) { checkGrammarComputedPropertyName(_name); continue; } @@ -22111,16 +17473,22 @@ var ts; var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + var diagnostic = forInOrOfStatement.kind === 182 + ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement + : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var _diagnostic = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + var _diagnostic = forInOrOfStatement.kind === 182 + ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer + : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, _diagnostic); } if (firstDeclaration.type) { - var _diagnostic_1 = forInOrOfStatement.kind === 182 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + var _diagnostic_1 = forInOrOfStatement.kind === 182 + ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation + : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, _diagnostic_1); } } @@ -22174,7 +17542,9 @@ var ts; } } function checkGrammarMethod(node) { - if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarForGenerator(node)) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionLikeDeclaration(node) || + checkGrammarForGenerator(node)) { return true; } if (node.parent.kind === 152) { @@ -22225,7 +17595,8 @@ var ts; switch (current.kind) { case 189: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 184 && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 184 + && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } @@ -22246,11 +17617,15 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + var message = node.kind === 185 + ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement + : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var _message = node.kind === 185 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + var _message = node.kind === 185 + ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement + : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, _message); } } @@ -22287,7 +17662,8 @@ var ts; } } var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); - return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || + checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 64) { @@ -22420,7 +17796,8 @@ var ts; } function checkGrammarProperty(node) { if (node.parent.kind === 196) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || + checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } @@ -22439,7 +17816,12 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 197 || node.kind === 204 || node.kind === 203 || node.kind === 210 || node.kind === 209 || (node.flags & 2)) { + if (node.kind === 197 || + node.kind === 204 || + node.kind === 203 || + node.kind === 210 || + node.kind === 209 || + (node.flags & 2)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -22501,10 +17883,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var indentStrings = [ - "", - " " - ]; + var indentStrings = ["", " "]; function getIndentString(level) { if (indentStrings[level] === undefined) { indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; @@ -22579,34 +17958,21 @@ var ts; writeTextOfNode: writeTextOfNode, writeLiteral: writeLiteral, writeLine: writeLine, - increaseIndent: function () { - return indent++; - }, - decreaseIndent: function () { - return indent--; - }, - getIndent: function () { - return indent; - }, - getTextPos: function () { - return output.length; - }, - getLine: function () { - return lineCount + 1; - }, - getColumn: function () { - return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; - }, - getText: function () { - return output; - } + increaseIndent: function () { return indent++; }, + decreaseIndent: function () { return indent--; }, + getIndent: function () { return indent; }, + getTextPos: function () { return output.length; }, + getLine: function () { return lineCount + 1; }, + getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, + getText: function () { return output; } }; } function getLineOfLocalPosition(currentSourceFile, pos) { return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { - if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && + getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -22635,7 +18001,9 @@ var ts; var lineCount = ts.getLineStarts(currentSourceFile).length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); + var nextLineStart = (currentLine + 1) === lineCount + ? currentSourceFile.text.length + 1 + : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { firstCommentLineIndent = calculateIndent(ts.getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); @@ -22713,7 +18081,8 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 134 || member.kind === 135) && (member.flags & 128) === (accessor.flags & 128)) { + if ((member.kind === 134 || member.kind === 135) + && (member.flags & 128) === (accessor.flags & 128)) { var memberName = ts.getPropertyNameForPropertyNameNode(member.name); var accessorName = ts.getPropertyNameForPropertyNameNode(accessor.name); if (memberName === accessorName) { @@ -22770,8 +18139,7 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { - } : writeJsDocComments; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var aliasDeclarationEmitInfo = []; var referencePathsOutput = ""; @@ -22780,7 +18148,9 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 2048) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { + if (referencedFile && ((referencedFile.flags & 2048) || + shouldEmitToOwnFile(referencedFile, compilerOptions) || + !addedGlobalFileReference)) { writeReferencePath(referencedFile); if (!isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -22797,7 +18167,8 @@ var ts; if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && + !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } @@ -22851,9 +18222,7 @@ var ts; function writeAsychronousImportEqualsDeclarations(importEqualsDeclarations) { var oldWriter = writer; ts.forEach(importEqualsDeclarations, function (aliasToWrite) { - var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { - return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; - }); + var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; }); if (aliasEmitInfo) { createAndSetNewTextWriterWithSymbolWriter(); for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { @@ -23180,8 +18549,15 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 140 || node.parent.kind === 141 || (node.parent.parent && node.parent.parent.kind === 143)) { - ts.Debug.assert(node.parent.kind === 132 || node.parent.kind === 131 || node.parent.kind === 140 || node.parent.kind === 141 || node.parent.kind === 136 || node.parent.kind === 137); + if (node.parent.kind === 140 || + node.parent.kind === 141 || + (node.parent.parent && node.parent.parent.kind === 143)) { + ts.Debug.assert(node.parent.kind === 132 || + node.parent.kind === 131 || + node.parent.kind === 140 || + node.parent.kind === 141 || + node.parent.kind === 136 || + node.parent.kind === 137); emitType(node.constraint); } else { @@ -23244,7 +18620,9 @@ var ts; function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.parent.parent.kind === 196) { - diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + diagnosticMessage = isImplementsList ? + ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : + ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; @@ -23277,9 +18655,7 @@ var ts; emitTypeParameters(node.typeParameters); var baseTypeNode = ts.getClassBaseTypeNode(node); if (baseTypeNode) { - emitHeritageClause([ - baseTypeNode - ], false); + emitHeritageClause([baseTypeNode], false); } emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); write(" {"); @@ -23339,17 +18715,31 @@ var ts; function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (node.kind === 193) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } else if (node.kind === 130 || node.kind === 129) { if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; } } return diagnosticMessage !== undefined ? { @@ -23366,9 +18756,7 @@ var ts; } } function emitVariableStatement(node) { - var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { - return resolver.isDeclarationVisible(varDeclaration); - }); + var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); if (hasDeclarationWithEmit) { emitJsDocComments(node); emitModuleElementDeclarationFlags(node); @@ -23414,17 +18802,25 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 134 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; + return accessor.kind === 134 + ? accessor.type + : accessor.parameters.length > 0 + ? accessor.parameters[0].type + : undefined; } } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; if (accessorWithTypeAnnotation.kind === 135) { if (accessorWithTypeAnnotation.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; } return { diagnosticMessage: diagnosticMessage, @@ -23434,10 +18830,18 @@ var ts; } else { if (accessorWithTypeAnnotation.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; } return { diagnosticMessage: diagnosticMessage, @@ -23451,7 +18855,8 @@ var ts; if (ts.hasDynamicName(node)) { return; } - if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 195 || resolver.isDeclarationVisible(node)) && + !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); if (node.kind === 195) { emitModuleElementDeclarationFlags(node); @@ -23518,28 +18923,48 @@ var ts; var diagnosticMessage; switch (node.kind) { case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 138: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; case 132: case 131: if (node.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } else if (node.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : + ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: ts.Debug.fail("This is unknown kind for signature: " + node.kind); @@ -23566,7 +18991,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 140 || node.parent.kind === 141 || node.parent.parent.kind === 143) { + if (node.parent.kind === 140 || + node.parent.kind === 141 || + node.parent.parent.kind === 143) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -23576,28 +19003,50 @@ var ts; var diagnosticMessage; switch (node.parent.kind) { case 133: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; break; case 137: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 136: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; case 132: case 131: if (node.parent.flags & 128) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } else if (node.parent.parent.kind === 196) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; case 195: - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? + symbolAccesibilityResult.accessibility === 2 ? + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : + ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); @@ -23649,7 +19098,11 @@ var ts; } } function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 2048 ? referencedFile.fileName : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + var declFileName = referencedFile.flags & 2048 + ? referencedFile.fileName + : shouldEmitToOwnFile(referencedFile, compilerOptions) + ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") + : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencePathsOutput += "/// " + newLine; } @@ -23713,28 +19166,20 @@ var ts; var exportSpecifiers; var exportDefault; var writeEmittedFiles = writeJavaScriptFile; - var emitLeadingComments = compilerOptions.removeComments ? function (node) { - } : emitLeadingDeclarationComments; - var emitTrailingComments = compilerOptions.removeComments ? function (node) { - } : emitTrailingDeclarationComments; - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { - } : emitLeadingCommentsOfLocalPosition; + var emitLeadingComments = compilerOptions.removeComments ? function (node) { } : emitLeadingDeclarationComments; + var emitTrailingComments = compilerOptions.removeComments ? function (node) { } : emitTrailingDeclarationComments; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfLocalPosition; var detachedCommentsInfo; - var emitDetachedComments = compilerOptions.removeComments ? function (node) { - } : emitDetachedCommentsAtPosition; + var emitDetachedComments = compilerOptions.removeComments ? function (node) { } : emitDetachedCommentsAtPosition; var writeComment = writeCommentRange; var emitNodeWithoutSourceMap = compilerOptions.removeComments ? emitNodeWithoutSourceMapWithoutComments : emitNodeWithoutSourceMapWithComments; var emit = emitNodeWithoutSourceMap; var emitWithoutComments = emitNodeWithoutSourceMapWithoutComments; - var emitStart = function (node) { - }; - var emitEnd = function (node) { - }; + var emitStart = function (node) { }; + var emitEnd = function (node) { }; var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { - }; - var scopeEmitEnd = function () { - }; + var scopeEmitStart = function (scopeDeclaration, scopeName) { }; + var scopeEmitEnd = function () { }; var sourceMapData; if (compilerOptions.sourceMap) { initializeEmitterWithSourceMaps(); @@ -23760,10 +19205,7 @@ var ts; var names = currentScopeNames; currentScopeNames = undefined; if (names) { - lastFrame = { - names: names, - previous: lastFrame - }; + lastFrame = { names: names, previous: lastFrame }; return true; } return false; @@ -23783,9 +19225,7 @@ var ts; _name = baseName; } else { - _name = ts.generateUniqueName(baseName, function (n) { - return isExistingName(location, n); - }); + _name = ts.generateUniqueName(baseName, function (n) { return isExistingName(location, n); }); } return recordNameInCurrentScope(_name); } @@ -23885,7 +19325,12 @@ var ts; sourceLinePos.character++; var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine != emittedLine || + lastRecordedSourceMapSpan.emittedColumn != emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { encodeLastRecordedSourceMapSpan(); lastRecordedSourceMapSpan = { emittedLine: emittedLine, @@ -23948,10 +19393,20 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 195 || node.kind === 160 || node.kind === 132 || node.kind === 131 || node.kind === 134 || node.kind === 135 || node.kind === 200 || node.kind === 196 || node.kind === 199) { + else if (node.kind === 195 || + node.kind === 160 || + node.kind === 132 || + node.kind === 131 || + node.kind === 134 || + node.kind === 135 || + node.kind === 200 || + node.kind === 196 || + node.kind === 199) { if (node.name) { var _name = node.name; - scopeName = _name.kind === 126 ? ts.getTextOfNode(_name) : node.name.text; + scopeName = _name.kind === 126 + ? ts.getTextOfNode(_name) + : node.name.text; } recordScopeNameStart(scopeName); } @@ -24298,7 +19753,8 @@ var ts; if (node.template.kind === 169) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 167 && templateSpan.expression.operatorToken.kind === 23; + var needsParens = templateSpan.expression.kind === 167 + && templateSpan.expression.operatorToken.kind === 23; emitParenthesizedIf(templateSpan.expression, needsParens); }); } @@ -24309,7 +19765,8 @@ var ts; ts.forEachChild(node, emit); return; } - var emitOuterParens = ts.isExpression(node.parent) && templateNeedsParens(node, node.parent); + var emitOuterParens = ts.isExpression(node.parent) + && templateNeedsParens(node, node.parent); if (emitOuterParens) { write("("); } @@ -24320,7 +19777,8 @@ var ts; } for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 159 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + var needsParens = templateSpan.expression.kind !== 159 + && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); } @@ -24817,9 +20275,7 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { - return e.kind === 171; - }); + return ts.forEach(elements, function (e) { return e.kind === 171; }); } function skipParentheses(node) { while (node.kind === 159 || node.kind === 158) { @@ -24932,7 +20388,14 @@ var ts; while (operand.kind == 158) { operand = operand.expression; } - if (operand.kind !== 165 && operand.kind !== 164 && operand.kind !== 163 && operand.kind !== 162 && operand.kind !== 166 && operand.kind !== 156 && !(operand.kind === 155 && node.parent.kind === 156) && !(operand.kind === 160 && node.parent.kind === 155)) { + if (operand.kind !== 165 && + operand.kind !== 164 && + operand.kind !== 163 && + operand.kind !== 162 && + operand.kind !== 166 && + operand.kind !== 156 && + !(operand.kind === 155 && node.parent.kind === 156) && + !(operand.kind === 160 && node.parent.kind === 155)) { emit(operand); return; } @@ -24975,7 +20438,8 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operatorToken.kind === 52 && (node.left.kind === 152 || node.left.kind === 151)) { + if (languageVersion < 2 && node.operatorToken.kind === 52 && + (node.left.kind === 152 || node.left.kind === 151)) { emitDestructuring(node, node.parent.kind === 177); } else { @@ -25295,13 +20759,16 @@ var ts; emitToken(15, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function nodeEndPositionsAreOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, node2.end); + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { if (node.kind === 214) { @@ -25595,8 +21062,11 @@ var ts; emitModuleMemberName(node); var initializer = node.initializer; if (!initializer && languageVersion < 2) { - var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); - if (isUninitializedLet && node.parent.parent.kind !== 182 && node.parent.parent.kind !== 183) { + var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && + (getCombinedFlagsForIdentifier(node.name) & 4096); + if (isUninitializedLet && + node.parent.parent.kind !== 182 && + node.parent.parent.kind !== 183) { initializer = createVoidZero(); } } @@ -25619,7 +21089,10 @@ var ts; return ts.getCombinedNodeFlags(node.parent); } function renameNonTopLevelLetAndConst(node) { - if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 64 || (node.parent.kind !== 193 && node.parent.kind !== 150)) { + if (languageVersion >= 2 || + ts.nodeIsSynthesized(node) || + node.kind !== 64 || + (node.parent.kind !== 193 && node.parent.kind !== 150)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); @@ -25631,7 +21104,9 @@ var ts; return; } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var _parent = blockScopeContainer.kind === 221 ? blockScopeContainer : blockScopeContainer.parent; + var _parent = blockScopeContainer.kind === 221 + ? blockScopeContainer + : blockScopeContainer.parent; var generatedName = generateUniqueNameForLocation(_parent, node.text); var variableId = resolver.getBlockScopedVariableId(node); if (!generatedBlockScopeNames) { @@ -26394,7 +21869,8 @@ var ts; emitImportDeclaration(node); return; } - if (resolver.isReferencedAliasDeclaration(node) || (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + if (resolver.isReferencedAliasDeclaration(node) || + (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); if (!(node.flags & 1)) @@ -26916,10 +22392,7 @@ var ts; else { leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); } - emitNewLineBeforeLeadingComments(currentSourceFile, writer, { - pos: pos, - end: pos - }, leadingComments); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitDetachedCommentsAtPosition(node) { @@ -26944,17 +22417,12 @@ var ts; if (nodeLine >= lastCommentLine + 2) { emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { - nodePos: node.pos, - detachedCommentEndPos: detachedComments[detachedComments.length - 1].end - }; + var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); } else { - detachedCommentsInfo = [ - currentDetachedCommentInfo - ]; + detachedCommentsInfo = [currentDetachedCommentInfo]; } } } @@ -26966,7 +22434,10 @@ var ts; if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && + currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { return true; } } @@ -27020,7 +22491,9 @@ var ts; } catch (e) { if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText : e.message); + onError(e.number === unsupportedFileEncodingErrorCode + ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText + : e.message); } text = ""; } @@ -27056,20 +22529,12 @@ var ts; } return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { - return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); - }, + getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, writeFile: writeFile, - getCurrentDirectory: function () { - return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); - }, - useCaseSensitiveFileNames: function () { - return ts.sys.useCaseSensitiveFileNames; - }, + getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, + useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, getCanonicalFileName: getCanonicalFileName, - getNewLine: function () { - return ts.sys.newLine; - } + getNewLine: function () { return ts.sys.newLine; } }; } ts.createCompilerHost = createCompilerHost; @@ -27109,9 +22574,7 @@ var ts; var seenNoDefaultLib = options.noLib; var commonSourceDirectory; host = host || createCompilerHost(options); - ts.forEach(rootNames, function (name) { - return processRootFile(name, false); - }); + ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); if (!seenNoDefaultLib) { processRootFile(host.getDefaultLibFileName(options), true); } @@ -27120,35 +22583,21 @@ var ts; var noDiagnosticsTypeChecker; program = { getSourceFile: getSourceFile, - getSourceFiles: function () { - return files; - }, - getCompilerOptions: function () { - return options; - }, + getSourceFiles: function () { return files; }, + getCompilerOptions: function () { return options; }, getSyntacticDiagnostics: getSyntacticDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, getSemanticDiagnostics: getSemanticDiagnostics, getDeclarationDiagnostics: getDeclarationDiagnostics, getTypeChecker: getTypeChecker, getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, - getCommonSourceDirectory: function () { - return commonSourceDirectory; - }, + getCommonSourceDirectory: function () { return commonSourceDirectory; }, emit: emit, getCurrentDirectory: host.getCurrentDirectory, - getNodeCount: function () { - return getDiagnosticsProducingTypeChecker().getNodeCount(); - }, - getIdentifierCount: function () { - return getDiagnosticsProducingTypeChecker().getIdentifierCount(); - }, - getSymbolCount: function () { - return getDiagnosticsProducingTypeChecker().getSymbolCount(); - }, - getTypeCount: function () { - return getDiagnosticsProducingTypeChecker().getTypeCount(); - } + getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, + getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, + getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, + getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } }; return program; function getEmitHost(writeFileCallback) { @@ -27175,11 +22624,7 @@ var ts; } function emit(sourceFile, writeFileCallback) { if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { - return { - diagnostics: [], - sourceMaps: undefined, - emitSkipped: true - }; + return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); var start = new Date().getTime(); @@ -27345,7 +22790,8 @@ var ts; } else if (node.kind === 200 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportEqualsDeclaration(node) && + ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { @@ -27373,17 +22819,19 @@ var ts; } return; } - var firstExternalModuleSourceFile = ts.forEach(files, function (f) { - return ts.isExternalModule(f) ? f : undefined; - }); + var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (firstExternalModuleSourceFile && !options.module) { var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } - if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModuleSourceFile !== undefined))) { + if (options.outDir || + options.sourceRoot || + (options.mapRoot && + (!options.out || firstExternalModuleSourceFile !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { - if (!(sourceFile.flags & 2048) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { + if (!(sourceFile.flags & 2048) + && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); sourcePathComponents.pop(); if (commonPathComponents) { @@ -27576,11 +23024,7 @@ var ts; { name: "target", shortName: "t", - type: { - "es3": 0, - "es5": 1, - "es6": 2 - }, + type: { "es3": 0, "es5": 1, "es6": 2 }, description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, paramType: ts.Diagnostics.VERSION, error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6 @@ -27760,9 +23204,7 @@ var ts; var files = []; if (ts.hasProperty(json, "files")) { if (json["files"] instanceof Array) { - var files = ts.map(json["files"], function (s) { - return ts.combinePaths(basePath, s); - }); + var files = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } } else { @@ -27812,7 +23254,14 @@ var ts; var _parent = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (_parent.kind === 179 || _parent.kind === 182 || _parent.kind === 183 || _parent.kind === 181 || _parent.kind === 178 || _parent.kind === 180 || _parent.kind === 187 || _parent.kind === 217) { + if (_parent.kind === 179 || + _parent.kind === 182 || + _parent.kind === 183 || + _parent.kind === 181 || + _parent.kind === 178 || + _parent.kind === 180 || + _parent.kind === 187 || + _parent.kind === 217) { addOutliningSpan(_parent, openBrace, closeBrace, autoCollapse(n)); break; } @@ -27839,24 +23288,22 @@ var ts; }); break; } - case 201: - { - var _openBrace = ts.findChildOfKind(n, 14, sourceFile); - var _closeBrace = ts.findChildOfKind(n, 15, sourceFile); - addOutliningSpan(n.parent, _openBrace, _closeBrace, autoCollapse(n)); - break; - } + case 201: { + var _openBrace = ts.findChildOfKind(n, 14, sourceFile); + var _closeBrace = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n.parent, _openBrace, _closeBrace, autoCollapse(n)); + break; + } case 196: case 197: case 199: case 152: - case 202: - { - var _openBrace_1 = ts.findChildOfKind(n, 14, sourceFile); - var _closeBrace_1 = ts.findChildOfKind(n, 15, sourceFile); - addOutliningSpan(n, _openBrace_1, _closeBrace_1, autoCollapse(n)); - break; - } + case 202: { + var _openBrace_1 = ts.findChildOfKind(n, 14, sourceFile); + var _closeBrace_1 = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n, _openBrace_1, _closeBrace_1, autoCollapse(n)); + break; + } case 151: var openBracket = ts.findChildOfKind(n, 18, sourceFile); var closeBracket = ts.findChildOfKind(n, 19, sourceFile); @@ -27903,13 +23350,7 @@ var ts; } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ - name: name, - fileName: fileName, - matchKind: matchKind, - isCaseSensitive: allMatchesAreCaseSensitive(matches), - declaration: declaration - }); + rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } }); @@ -27944,7 +23385,9 @@ var ts; return undefined; } function getTextOfIdentifierOrLiteral(node) { - if (node.kind === 64 || node.kind === 8 || node.kind === 7) { + if (node.kind === 64 || + node.kind === 8 || + node.kind === 7) { return node.text; } return undefined; @@ -28009,11 +23452,11 @@ var ts; } return _bestMatchKind; } - var baseSensitivity = { - sensitivity: "base" - }; + var baseSensitivity = { sensitivity: "base" }; function compareNavigateToItems(i1, i2) { - return i1.matchKind - i2.matchKind || i1.name.localeCompare(i2.name, undefined, baseSensitivity) || i1.name.localeCompare(i2.name); + return i1.matchKind - i2.matchKind || + i1.name.localeCompare(i2.name, undefined, baseSensitivity) || + i1.name.localeCompare(i2.name); } function createNavigateToItem(rawItem) { var declaration = rawItem.declaration; @@ -28163,9 +23606,7 @@ var ts; function isTopLevelFunctionDeclaration(functionDeclaration) { if (functionDeclaration.kind === 195) { if (functionDeclaration.body && functionDeclaration.body.kind === 174) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { - return s.kind === 195 && !isEmpty(s.name.text); - })) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 195 && !isEmpty(s.name.text); })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -28283,9 +23724,7 @@ var ts; } return undefined; function createItem(node, name, scriptElementKind) { - return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ]); + return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)]); } } function isEmpty(text) { @@ -28339,16 +23778,12 @@ var ts; function createModuleItem(node) { var moduleName = getModuleName(node); var childItems = getItemsWorker(getChildNodes(getInnermostModule(node).body.statements), createChildItem); - return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ], childItems, getIndent(node)); + return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { if (node.name && node.body && node.body.kind === 174) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } return undefined; } @@ -28358,10 +23793,10 @@ var ts; return undefined; } hasGlobalNode = true; - var rootName = ts.isExternalModule(node) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(node.fileName)))) + "\"" : ""; - return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [ - getNodeSpan(node) - ], childItems); + var rootName = ts.isExternalModule(node) + ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(node.fileName)))) + "\"" + : ""; + return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [getNodeSpan(node)], childItems); } function createClassItem(node) { if (!node.name) { @@ -28374,38 +23809,26 @@ var ts; }); var nodes = removeDynamicallyNamedProperties(node); if (constructor) { - nodes.push.apply(nodes, ts.filter(constructor.parameters, function (p) { - return !ts.isBindingPattern(p.name); - })); + nodes.push.apply(nodes, ts.filter(constructor.parameters, function (p) { return !ts.isBindingPattern(p.name); })); } childItems = getItemsWorker(sortNodes(nodes), createChildItem); } - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createEnumItem(node) { var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createIterfaceItem(node) { var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); - return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [ - getNodeSpan(node) - ], childItems, getIndent(node)); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { - return member.name === undefined || member.name.kind !== 126; - }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 126; }); } function removeDynamicallyNamedProperties(node) { - return ts.filter(node.members, function (member) { - return !ts.hasDynamicName(member); - }); + return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { while (node.body.kind === 200) { @@ -28414,7 +23837,9 @@ var ts; return node; } function getNodeSpan(node) { - return node.kind === 221 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + return node.kind === 221 + ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) + : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } function getTextOfNode(node) { return ts.getTextOfNodeFromSourceText(sourceFile.text, node); @@ -28444,9 +23869,7 @@ var ts; var stringToWordSpans = {}; pattern = pattern.trim(); var fullPatternSegment = createSegment(pattern); - var dotSeparatedSegments = pattern.split(".").map(function (p) { - return createSegment(p.trim()); - }); + var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); return { getMatches: getMatches, @@ -28554,9 +23977,7 @@ var ts; if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { var match = matchTextChunk(candidate, segment.totalTextChunk, false); if (match) { - return [ - match - ]; + return [match]; } } var subWordTextChunks = segment.subWordTextChunks; @@ -28623,7 +24044,8 @@ var ts; for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; if (gotOneMatchThisCandidate) { - if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { break; } } @@ -28644,7 +24066,10 @@ var ts; } ts.createPatternMatcher = createPatternMatcher; function patternMatchCompareTo(match1, match2) { - return compareType(match1, match2) || compareCamelCase(match1, match2) || compareCase(match1, match2) || comparePunctuation(match1, match2); + return compareType(match1, match2) || + compareCamelCase(match1, match2) || + compareCase(match1, match2) || + comparePunctuation(match1, match2); } function comparePunctuation(result1, result2) { if (result1.punctuationStripped !== result2.punctuationStripped) { @@ -28793,7 +24218,11 @@ var ts; var currentIsDigit = isDigit(identifier.charCodeAt(i)); var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); - if (charIsPunctuation(identifier.charCodeAt(i - 1)) || charIsPunctuation(identifier.charCodeAt(i)) || lastIsDigit != currentIsDigit || hasTransitionFromLowerToUpper || hasTransitionFromUpperToLower) { + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || + charIsPunctuation(identifier.charCodeAt(i)) || + lastIsDigit != currentIsDigit || + hasTransitionFromLowerToUpper || + hasTransitionFromUpperToLower) { if (!isAllPunctuation(identifier, wordStart, i)) { result.push(ts.createTextSpan(wordStart, i - wordStart)); } @@ -28845,7 +24274,8 @@ var ts; } function transitionFromUpperToLower(identifier, word, index, wordStart) { if (word) { - if (index != wordStart && index + 1 < identifier.length) { + if (index != wordStart && + index + 1 < identifier.length) { var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); if (currentIsUpper && nextIsLower) { @@ -28863,7 +24293,9 @@ var ts; function transitionFromLowerToUpper(identifier, word, index) { var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); - var transition = word ? (currentIsUpper && !lastIsUpper) : currentIsUpper; + var transition = word + ? (currentIsUpper && !lastIsUpper) + : currentIsUpper; return transition; } })(ts || (ts = {})); @@ -28899,7 +24331,8 @@ var ts; function getImmediatelyContainingArgumentInfo(node) { if (node.parent.kind === 155 || node.parent.kind === 156) { var callExpression = node.parent; - if (node.kind === 24 || node.kind === 16) { + if (node.kind === 24 || + node.kind === 16) { var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; ts.Debug.assert(list !== undefined); @@ -28969,9 +24402,7 @@ var ts; } function getArgumentCount(argumentsList) { var listChildren = argumentsList.getChildren(); - var argumentCount = ts.countWhere(listChildren, function (arg) { - return arg.kind !== 23; - }); + var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 23; }); if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 23) { argumentCount++; } @@ -28988,7 +24419,9 @@ var ts; return spanIndex + 1; } function getArgumentListInfoForTemplate(tagExpression, argumentIndex) { - var argumentCount = tagExpression.template.kind === 10 ? 1 : tagExpression.template.templateSpans.length + 1; + var argumentCount = tagExpression.template.kind === 10 + ? 1 + : tagExpression.template.templateSpans.length + 1; ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); return { kind: 2, @@ -29093,10 +24526,7 @@ var ts; isVariadic: candidateSignature.hasRestParameter, prefixDisplayParts: prefixDisplayParts, suffixDisplayParts: suffixDisplayParts, - separatorDisplayParts: [ - ts.punctuationPart(23), - ts.spacePart() - ], + separatorDisplayParts: [ts.punctuationPart(23), ts.spacePart()], parameters: signatureHelpParameters, documentation: candidateSignature.getDocumentationComment() }; @@ -29205,9 +24635,7 @@ var ts; } ts.findListItemInfo = findListItemInfo; function findChildOfKind(n, kind, sourceFile) { - return ts.forEach(n.getChildren(sourceFile), function (c) { - return c.kind === kind && c; - }); + return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; }); } ts.findChildOfKind = findChildOfKind; function findContainingList(node) { @@ -29221,15 +24649,11 @@ var ts; } ts.findContainingList = findContainingList; function getTouchingWord(sourceFile, position) { - return getTouchingToken(sourceFile, position, function (n) { - return isWord(n.kind); - }); + return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }); } ts.getTouchingWord = getTouchingWord; function getTouchingPropertyName(sourceFile, position) { - return getTouchingToken(sourceFile, position, function (n) { - return isPropertyName(n.kind); - }); + return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }); } ts.getTouchingPropertyName = getTouchingPropertyName; function getTouchingToken(sourceFile, position, includeItemAtEndPosition) { @@ -29283,7 +24707,8 @@ var ts; var children = n.getChildren(); for (var _i = 0, _n = children.length; _i < _n; _i++) { var child = children[_i]; - var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); + var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || + (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { return find(child); } @@ -29386,7 +24811,8 @@ var ts; } ts.isPunctuation = isPunctuation; function isInsideTemplateLiteral(node, position) { - return ts.isTemplateLiteralKind(node.kind) && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); + return ts.isTemplateLiteralKind(node.kind) + && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); } ts.isInsideTemplateLiteral = isInsideTemplateLiteral; function compareDataObjects(dst, src) { @@ -29419,38 +24845,19 @@ var ts; var indent; resetWriter(); return { - displayParts: function () { - return displayParts; - }, - writeKeyword: function (text) { - return writeKind(text, 5); - }, - writeOperator: function (text) { - return writeKind(text, 12); - }, - writePunctuation: function (text) { - return writeKind(text, 15); - }, - writeSpace: function (text) { - return writeKind(text, 16); - }, - writeStringLiteral: function (text) { - return writeKind(text, 8); - }, - writeParameter: function (text) { - return writeKind(text, 13); - }, + displayParts: function () { return displayParts; }, + writeKeyword: function (text) { return writeKind(text, 5); }, + writeOperator: function (text) { return writeKind(text, 12); }, + writePunctuation: function (text) { return writeKind(text, 15); }, + writeSpace: function (text) { return writeKind(text, 16); }, + writeStringLiteral: function (text) { return writeKind(text, 8); }, + writeParameter: function (text) { return writeKind(text, 13); }, writeSymbol: writeSymbol, writeLine: writeLine, - increaseIndent: function () { - indent++; - }, - decreaseIndent: function () { - indent--; - }, + increaseIndent: function () { indent++; }, + decreaseIndent: function () { indent--; }, clear: resetWriter, - trackSymbol: function () { - } + trackSymbol: function () { } }; function writeIndent() { if (lineStart) { @@ -29611,9 +25018,7 @@ var ts; advance: advance, readTokenInfo: readTokenInfo, isOnToken: isOnToken, - lastTrailingTriviaWasNewLine: function () { - return wasNewLine; - }, + lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, close: function () { lastTokenInfo = undefined; scanner.setText(undefined); @@ -29674,7 +25079,8 @@ var ts; return container.kind === 9; } function shouldRescanTemplateToken(container) { - return container.kind === 12 || container.kind === 13; + return container.kind === 12 || + container.kind === 13; } function startsWithSlashToken(t) { return t === 36 || t === 56; @@ -29687,7 +25093,13 @@ var ts; token: undefined }; } - var expectedScanAction = shouldRescanGreaterThanToken(n) ? 1 : shouldRescanSlashToken(n) ? 2 : shouldRescanTemplateToken(n) ? 3 : 0; + var expectedScanAction = shouldRescanGreaterThanToken(n) + ? 1 + : shouldRescanSlashToken(n) + ? 2 + : shouldRescanTemplateToken(n) + ? 3 + : 0; if (lastTokenInfo && expectedScanAction === lastScanAction) { return fixTokenKind(lastTokenInfo, n); } @@ -29867,7 +25279,9 @@ var ts; this.Flag = Flag; } Rule.prototype.toString = function () { - return "[desc=" + this.Descriptor + "," + "operation=" + this.Operation + "," + "flag=" + this.Flag + "]"; + return "[desc=" + this.Descriptor + "," + + "operation=" + this.Operation + "," + + "flag=" + this.Flag + "]"; }; return Rule; })(); @@ -29897,7 +25311,8 @@ var ts; this.RightTokenRange = RightTokenRange; } RuleDescriptor.prototype.toString = function () { - return "[leftRange=" + this.LeftTokenRange + "," + "rightRange=" + this.RightTokenRange + "]"; + return "[leftRange=" + this.LeftTokenRange + "," + + "rightRange=" + this.RightTokenRange + "]"; }; RuleDescriptor.create1 = function (left, right) { return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right)); @@ -29937,7 +25352,8 @@ var ts; this.Action = null; } RuleOperation.prototype.toString = function () { - return "[context=" + this.Context + "," + "action=" + this.Action + "]"; + return "[context=" + this.Context + "," + + "action=" + this.Action + "]"; }; RuleOperation.create1 = function (action) { return RuleOperation.create2(formatting.RuleOperationContext.Any, action); @@ -30004,12 +25420,7 @@ var ts; this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(15, 75), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(15, 99), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.FromTokens([ - 17, - 19, - 23, - 22 - ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.FromTokens([17, 19, 23, 22])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); @@ -30018,19 +25429,9 @@ var ts; this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([ - 64, - 3 - ]); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([64, 3]); this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([ - 17, - 3, - 74, - 95, - 80, - 75 - ]); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([17, 3, 74, 95, 80, 75]); this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(14, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); @@ -30049,151 +25450,79 @@ var ts; this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(34, 34), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(34, 39), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ - 97, - 93, - 87, - 73, - 89, - 96 - ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ - 104, - 69 - ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([97, 93, 87, 73, 89, 96]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([104, 69]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(82, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(98, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2)); this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(89, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ - 17, - 74, - 75, - 66 - ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ - 95, - 80 - ]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ - 115, - 119 - ]), 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([17, 74, 75, 66]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([95, 80]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([115, 119]), 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(113, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([ - 116, - 117 - ]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([ - 68, - 114, - 76, - 77, - 78, - 115, - 102, - 84, - 103, - 116, - 106, - 108, - 119, - 109 - ]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([ - 78, - 102 - ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([116, 117]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([68, 114, 76, 77, 78, 115, 102, 84, 103, 116, 106, 108, 119, 109]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([78, 102])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(8, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(32, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(21, 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.FromTokens([ - 17, - 23 - ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.FromTokens([17, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(17, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.TypeNames), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); - this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([ - 16, - 18, - 25, - 23 - ])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([16, 18, 25, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8)); - this.HighPriorityCommonRules = [ - this.IgnoreBeforeComment, - this.IgnoreAfterLineComment, - this.NoSpaceBeforeColon, - this.SpaceAfterColon, - this.NoSpaceBeforeQuestionMark, - this.SpaceAfterQuestionMarkInConditionalOperator, - this.NoSpaceAfterQuestionMark, - this.NoSpaceBeforeDot, - this.NoSpaceAfterDot, - this.NoSpaceAfterUnaryPrefixOperator, - this.NoSpaceAfterUnaryPreincrementOperator, - this.NoSpaceAfterUnaryPredecrementOperator, - this.NoSpaceBeforeUnaryPostincrementOperator, - this.NoSpaceBeforeUnaryPostdecrementOperator, - this.SpaceAfterPostincrementWhenFollowedByAdd, - this.SpaceAfterAddWhenFollowedByUnaryPlus, - this.SpaceAfterAddWhenFollowedByPreincrement, - this.SpaceAfterPostdecrementWhenFollowedBySubtract, - this.SpaceAfterSubtractWhenFollowedByUnaryMinus, - this.SpaceAfterSubtractWhenFollowedByPredecrement, - this.NoSpaceAfterCloseBrace, - this.SpaceAfterOpenBrace, - this.SpaceBeforeCloseBrace, - this.NewLineBeforeCloseBraceInBlockContext, - this.SpaceAfterCloseBrace, - this.SpaceBetweenCloseBraceAndElse, - this.SpaceBetweenCloseBraceAndWhile, - this.NoSpaceBetweenEmptyBraceBrackets, - this.SpaceAfterFunctionInFuncDecl, - this.NewLineAfterOpenBraceInBlockContext, - this.SpaceAfterGetSetInMember, - this.NoSpaceBetweenReturnAndSemicolon, - this.SpaceAfterCertainKeywords, - this.SpaceAfterLetConstInVariableDeclaration, - this.NoSpaceBeforeOpenParenInFuncCall, - this.SpaceBeforeBinaryKeywordOperator, - this.SpaceAfterBinaryKeywordOperator, - this.SpaceAfterVoidOperator, - this.NoSpaceAfterConstructor, - this.NoSpaceAfterModuleImport, - this.SpaceAfterCertainTypeScriptKeywords, - this.SpaceBeforeCertainTypeScriptKeywords, - this.SpaceAfterModuleName, - this.SpaceAfterArrow, - this.NoSpaceAfterEllipsis, - this.NoSpaceAfterOptionalParameters, - this.NoSpaceBetweenEmptyInterfaceBraceBrackets, - this.NoSpaceBeforeOpenAngularBracket, - this.NoSpaceBetweenCloseParenAndAngularBracket, - this.NoSpaceAfterOpenAngularBracket, - this.NoSpaceBeforeCloseAngularBracket, - this.NoSpaceAfterCloseAngularBracket - ]; - this.LowPriorityCommonRules = [ - this.NoSpaceBeforeSemicolon, - this.SpaceBeforeOpenBraceInControl, - this.SpaceBeforeOpenBraceInFunction, - this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, - this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, - this.NoSpaceAfterOpenBracket, - this.NoSpaceBeforeCloseBracket, - this.NoSpaceAfterCloseBracket, - this.SpaceAfterSemicolon, - this.NoSpaceBeforeOpenParenInFuncDecl, - this.SpaceBetweenStatements, - this.SpaceAfterTryFinally - ]; + this.HighPriorityCommonRules = + [ + this.IgnoreBeforeComment, this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQuestionMark, this.SpaceAfterQuestionMarkInConditionalOperator, + this.NoSpaceAfterQuestionMark, + this.NoSpaceBeforeDot, this.NoSpaceAfterDot, + this.NoSpaceAfterUnaryPrefixOperator, + this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, + this.SpaceAfterPostincrementWhenFollowedByAdd, + this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterPostdecrementWhenFollowedBySubtract, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.NoSpaceAfterCloseBrace, + this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, + this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, + this.NoSpaceBetweenReturnAndSemicolon, + this.SpaceAfterCertainKeywords, + this.SpaceAfterLetConstInVariableDeclaration, + this.NoSpaceBeforeOpenParenInFuncCall, + this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, + this.SpaceAfterVoidOperator, + this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, + this.SpaceAfterModuleName, + this.SpaceAfterArrow, + this.NoSpaceAfterEllipsis, + this.NoSpaceAfterOptionalParameters, + this.NoSpaceBetweenEmptyInterfaceBraceBrackets, + this.NoSpaceBeforeOpenAngularBracket, + this.NoSpaceBetweenCloseParenAndAngularBracket, + this.NoSpaceAfterOpenAngularBracket, + this.NoSpaceBeforeCloseAngularBracket, + this.NoSpaceAfterCloseAngularBracket + ]; + this.LowPriorityCommonRules = + [ + this.NoSpaceBeforeSemicolon, + this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.NoSpaceBeforeComma, + this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket, + this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket, + this.SpaceAfterSemicolon, + this.NoSpaceBeforeOpenParenInFuncDecl, + this.SpaceBetweenStatements, this.SpaceAfterTryFinally + ]; this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); @@ -30367,7 +25696,8 @@ var ts; return context.TokensAreOnSameLine(); }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 194 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; + return context.currentTokenParent.kind === 194 && + context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind != 2; @@ -30401,7 +25731,8 @@ var ts; } }; Rules.IsTypeArgumentOrParameterContext = function (context) { - return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); + return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || + Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsVoidOpContext = function (context) { return context.currentTokenSpan.kind === 98 && context.currentTokenParent.kind === 164; @@ -30444,7 +25775,8 @@ var ts; }; RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) { var _this = this; - var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; + var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && + rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) { rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) { var rulesBucketIndex = _this.GetRuleBucketIndex(left, right); @@ -30519,13 +25851,19 @@ var ts; RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) { var position; if (rule.Operation.Action == 1) { - position = specificTokens ? 0 : RulesPosition.IgnoreRulesAny; + position = specificTokens ? + 0 : + RulesPosition.IgnoreRulesAny; } else if (!rule.Operation.Context.IsAny()) { - position = specificTokens ? RulesPosition.ContextRulesSpecific : RulesPosition.ContextRulesAny; + position = specificTokens ? + RulesPosition.ContextRulesSpecific : + RulesPosition.ContextRulesAny; } else { - position = specificTokens ? RulesPosition.NoContextRulesSpecific : RulesPosition.NoContextRulesAny; + position = specificTokens ? + RulesPosition.NoContextRulesSpecific : + RulesPosition.NoContextRulesAny; } var state = constructionState[rulesBucketIndex]; if (state === undefined) { @@ -30582,9 +25920,7 @@ var ts; this.token = token; } TokenSingleValueAccess.prototype.GetTokens = function () { - return [ - this.token - ]; + return [this.token]; }; TokenSingleValueAccess.prototype.Contains = function (tokenValue) { return tokenValue == this.token; @@ -30638,68 +25974,18 @@ var ts; return this.tokenAccess.toString(); }; TokenRange.Any = TokenRange.AllTokens(); - TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([ - 3 - ])); + TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); TokenRange.Keywords = TokenRange.FromRange(65, 124); TokenRange.BinaryOperators = TokenRange.FromRange(24, 63); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([ - 85, - 86, - 124 - ]); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([ - 38, - 39, - 47, - 46 - ]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([ - 7, - 64, - 16, - 18, - 14, - 92, - 87 - ]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([ - 64, - 16, - 92, - 87 - ]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([ - 64, - 17, - 19, - 87 - ]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([ - 64, - 16, - 92, - 87 - ]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([ - 64, - 17, - 19, - 87 - ]); - TokenRange.Comments = TokenRange.FromTokens([ - 2, - 3 - ]); - TokenRange.TypeNames = TokenRange.FromTokens([ - 64, - 118, - 120, - 112, - 121, - 98, - 111 - ]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([85, 86, 124]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([38, 39, 47, 46]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7, 64, 16, 18, 14, 92, 87]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); + TokenRange.Comments = TokenRange.FromTokens([2, 3]); + TokenRange.TypeNames = TokenRange.FromTokens([64, 118, 120, 112, 121, 98, 111]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -30848,11 +26134,16 @@ var ts; } function findOutermostParent(position, expectedTokenKind, sourceFile) { var precedingToken = ts.findPrecedingToken(position, sourceFile); - if (!precedingToken || precedingToken.kind !== expectedTokenKind || position !== precedingToken.getEnd()) { + if (!precedingToken || + precedingToken.kind !== expectedTokenKind || + position !== precedingToken.getEnd()) { return undefined; } var current = precedingToken; - while (current && current.parent && current.parent.end === precedingToken.end && !isListElement(current.parent, current)) { + while (current && + current.parent && + current.parent.end === precedingToken.end && + !isListElement(current.parent, current)) { current = current.parent; } return current; @@ -30877,9 +26168,7 @@ var ts; function findEnclosingNode(range, sourceFile) { return find(sourceFile); function find(n) { - var candidate = ts.forEachChild(n, function (c) { - return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; - }); + var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; }); if (candidate) { var result = find(candidate); if (result) { @@ -30893,11 +26182,9 @@ var ts; if (!errors.length) { return rangeHasNoErrors; } - var sorted = errors.filter(function (d) { - return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); - }).sort(function (e1, e2) { - return e1.start - e2.start; - }); + var sorted = errors + .filter(function (d) { return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); }) + .sort(function (e1, e2) { return e1.start - e2.start; }); if (!sorted.length) { return rangeHasNoErrors; } @@ -30991,7 +26278,10 @@ var ts; var indentation = inheritedIndentation; if (indentation === -1) { if (isSomeBlock(node.kind)) { - if (isSomeBlock(parent.kind) || parent.kind === 221 || parent.kind === 214 || parent.kind === 215) { + if (isSomeBlock(parent.kind) || + parent.kind === 221 || + parent.kind === 214 || + parent.kind === 215) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -31040,12 +26330,8 @@ var ts; return nodeStartLine !== line ? indentation + delta : indentation; } }, - getIndentation: function () { - return indentation; - }, - getDelta: function () { - return delta; - }, + getIndentation: function () { return indentation; }, + getDelta: function () { return delta; }, recomputeIndentation: function (lineAdded) { if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent.kind, node.kind)) { if (lineAdded) { @@ -31239,7 +26525,8 @@ var ts; trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { - lineAdded = processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); + lineAdded = + processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); } } previousRange = range; @@ -31267,7 +26554,9 @@ var ts; dynamicIndentation.recomputeIndentation(true); } } - trimTrailingWhitespaces = (rule.Operation.Action & (4 | 2)) && rule.Flag !== 1; + trimTrailingWhitespaces = + (rule.Operation.Action & (4 | 2)) && + rule.Flag !== 1; } else { trimTrailingWhitespaces = true; @@ -31305,16 +26594,10 @@ var ts; var startPos = commentRange.pos; for (var line = _startLine; line < endLine; ++line) { var endOfLine = ts.getEndLinePosition(line, sourceFile); - parts.push({ - pos: startPos, - end: endOfLine - }); + parts.push({ pos: startPos, end: endOfLine }); startPos = ts.getStartPositionOfLine(line + 1, sourceFile); } - parts.push({ - pos: startPos, - end: commentRange.end - }); + parts.push({ pos: startPos, end: commentRange.end }); } var startLinePos = ts.getStartPositionOfLine(_startLine, sourceFile); var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(startLinePos, parts[0].pos, sourceFile, options); @@ -31329,7 +26612,9 @@ var ts; var _delta = indentation - nonWhitespaceColumnInFirstPart.column; for (var i = startIndex, len = parts.length; i < len; ++i, ++_startLine) { var _startLinePos = ts.getStartPositionOfLine(_startLine, sourceFile); - var nonWhitespaceCharacterAndColumn = i === 0 ? nonWhitespaceColumnInFirstPart : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); + var nonWhitespaceCharacterAndColumn = i === 0 + ? nonWhitespaceColumnInFirstPart + : formatting.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(parts[i].pos, parts[i].end, sourceFile, options); var newIndentation = nonWhitespaceCharacterAndColumn.column + _delta; if (newIndentation > 0) { var indentationString = getIndentationString(newIndentation, options); @@ -31358,10 +26643,7 @@ var ts; } } function newTextChange(start, len, newText) { - return { - span: ts.createTextSpan(start, len), - newText: newText - }; + return { span: ts.createTextSpan(start, len), newText: newText }; } function recordDelete(start, len) { if (len) { @@ -31515,7 +26797,12 @@ var ts; if (!precedingToken) { return 0; } - var precedingTokenIsLiteral = precedingToken.kind === 8 || precedingToken.kind === 9 || precedingToken.kind === 10 || precedingToken.kind === 11 || precedingToken.kind === 12 || precedingToken.kind === 13; + var precedingTokenIsLiteral = precedingToken.kind === 8 || + precedingToken.kind === 9 || + precedingToken.kind === 10 || + precedingToken.kind === 11 || + precedingToken.kind === 12 || + precedingToken.kind === 13; if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } @@ -31575,7 +26862,8 @@ var ts; } } parentStart = getParentStart(_parent, current, sourceFile); - var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(_parent, current, currentStart.line, sourceFile); + var parentAndChildShareLine = parentStart.line === currentStart.line || + childStartsOnTheSameLineWithElseInIfStatement(_parent, current, currentStart.line, sourceFile); if (useActualIndentation) { var _actualIndentation = getActualIndentationForNode(current, _parent, currentStart, parentAndChildShareLine, sourceFile, options); if (_actualIndentation !== -1) { @@ -31608,7 +26896,8 @@ var ts; } } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { - var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && (parent.kind === 221 || !parentAndChildShareLine); + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && + (parent.kind === 221 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -31648,7 +26937,8 @@ var ts; if (node.parent) { switch (node.parent.kind) { case 139: - if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; @@ -31662,29 +26952,30 @@ var ts; case 132: case 131: case 136: - case 137: - { - var start = node.getStart(sourceFile); - if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { - return node.parent.typeParameters; - } - if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { - return node.parent.parameters; - } - break; + case 137: { + var start = node.getStart(sourceFile); + if (node.parent.typeParameters && + ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { + return node.parent.typeParameters; } + if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { + return node.parent.parameters; + } + break; + } case 156: - case 155: - { - var _start = node.getStart(sourceFile); - if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, _start, node.getEnd())) { - return node.parent.typeArguments; - } - if (node.parent.arguments && ts.rangeContainsStartEnd(node.parent.arguments, _start, node.getEnd())) { - return node.parent.arguments; - } - break; + case 155: { + var _start = node.getStart(sourceFile); + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, _start, node.getEnd())) { + return node.parent.typeArguments; } + if (node.parent.arguments && + ts.rangeContainsStartEnd(node.parent.arguments, _start, node.getEnd())) { + return node.parent.arguments; + } + break; + } } } return undefined; @@ -31733,10 +27024,7 @@ var ts; } character++; } - return { - column: column, - character: character - }; + return { column: column, character: character }; } SmartIndenter.findFirstNonWhitespaceCharacterAndColumn = findFirstNonWhitespaceCharacterAndColumn; function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { @@ -32120,7 +27408,10 @@ var ts; return pos; } function isName(pos, end, sourceFile, name) { - return pos + name.length < end && sourceFile.text.substr(pos, name.length) === name && (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); + return pos + name.length < end && + sourceFile.text.substr(pos, name.length) === name && + (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || + ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); } function isParamTag(pos, end, sourceFile) { return isName(pos, end, sourceFile, paramTag); @@ -32336,9 +27627,7 @@ var ts; }; SignatureObject.prototype.getDocumentationComment = function () { if (this.documentationComment === undefined) { - this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([ - this.declaration - ], undefined, false) : []; + this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration], undefined, false) : []; } return this.documentationComment; }; @@ -32372,7 +27661,9 @@ var ts; case 131: var functionDeclaration = node; if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) { - var lastDeclaration = namedDeclarations.length > 0 ? namedDeclarations[namedDeclarations.length - 1] : undefined; + var lastDeclaration = namedDeclarations.length > 0 ? + namedDeclarations[namedDeclarations.length - 1] : + undefined; if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) { if (functionDeclaration.body && !lastDeclaration.body) { namedDeclarations[namedDeclarations.length - 1] = functionDeclaration; @@ -32586,9 +27877,7 @@ var ts; ts.ClassificationTypeNames = ClassificationTypeNames; function displayPartsToString(displayParts) { if (displayParts) { - return ts.map(displayParts, function (displayPart) { - return displayPart.text; - }).join(""); + return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(""); } return ""; } @@ -32766,9 +28055,7 @@ var ts; return bucket; } function reportStats() { - var bucketInfoArray = Object.keys(buckets).filter(function (name) { - return name && name.charAt(0) === '_'; - }).map(function (name) { + var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === '_'; }).map(function (name) { var entries = ts.lookUp(buckets, name); var sourceFiles = []; for (var i in entries) { @@ -32779,9 +28066,7 @@ var ts; references: entry.owners.slice(0) }); } - sourceFiles.sort(function (x, y) { - return y.refCount - x.refCount; - }); + sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); return { bucket: name, sourceFiles: sourceFiles @@ -32970,11 +28255,7 @@ var ts; processImport(); } processTripleSlashDirectives(); - return { - referencedFiles: referencedFiles, - importedFiles: importedFiles, - isLibFile: isNoDefaultLib - }; + return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib }; } ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { @@ -32987,10 +28268,14 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 64 && (node.parent.kind === 185 || node.parent.kind === 184) && node.parent.label === node; + return node.kind === 64 && + (node.parent.kind === 185 || node.parent.kind === 184) && + node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 64 && node.parent.kind === 189 && node.parent.label === node; + return node.kind === 64 && + node.parent.kind === 189 && + node.parent.label === node; } function isLabeledBy(node, labelName) { for (var owner = node.parent; owner.kind === 189; owner = owner.parent) { @@ -33025,10 +28310,12 @@ var ts; return node.parent.kind === 200 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 64 && ts.isFunctionLike(node.parent) && node.parent.name === node; + return node.kind === 64 && + ts.isFunctionLike(node.parent) && node.parent.name === node; } function isNameOfPropertyAssignment(node) { - return (node.kind === 64 || node.kind === 8 || node.kind === 7) && (node.parent.kind === 218 || node.parent.kind === 219) && node.parent.name === node; + return (node.kind === 64 || node.kind === 8 || node.kind === 7) && + (node.parent.kind === 218 || node.parent.kind === 219) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 || node.kind === 7) { @@ -33051,12 +28338,15 @@ var ts; } function isNameOfExternalModuleImportOrDeclaration(node) { if (node.kind === 8) { - return isNameOfModuleDeclaration(node) || (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); + return isNameOfModuleDeclaration(node) || + (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); } return false; } function isInsideComment(sourceFile, token, position) { - return position <= token.getStart(sourceFile) && (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); + return position <= token.getStart(sourceFile) && + (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || + isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); function isInsideCommentRange(comments) { return ts.forEach(comments, function (comment) { if (comment.pos < position && position < comment.end) { @@ -33069,7 +28359,8 @@ var ts; return true; } else { - return !(text.charCodeAt(comment.end - 1) === 47 && text.charCodeAt(comment.end - 2) === 42); + return !(text.charCodeAt(comment.end - 1) === 47 && + text.charCodeAt(comment.end - 2) === 42); } } return false; @@ -33124,44 +28415,33 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 200: - return ScriptElementKind.moduleElement; - case 196: - return ScriptElementKind.classElement; - case 197: - return ScriptElementKind.interfaceElement; - case 198: - return ScriptElementKind.typeElement; - case 199: - return ScriptElementKind.enumElement; + case 200: return ScriptElementKind.moduleElement; + case 196: return ScriptElementKind.classElement; + case 197: return ScriptElementKind.interfaceElement; + case 198: return ScriptElementKind.typeElement; + case 199: return ScriptElementKind.enumElement; case 193: - return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 195: - return ScriptElementKind.functionElement; - case 134: - return ScriptElementKind.memberGetAccessorElement; - case 135: - return ScriptElementKind.memberSetAccessorElement; + return ts.isConst(node) + ? ScriptElementKind.constElement + : ts.isLet(node) + ? ScriptElementKind.letElement + : ScriptElementKind.variableElement; + case 195: return ScriptElementKind.functionElement; + case 134: return ScriptElementKind.memberGetAccessorElement; + case 135: return ScriptElementKind.memberSetAccessorElement; case 132: case 131: return ScriptElementKind.memberFunctionElement; case 130: case 129: return ScriptElementKind.memberVariableElement; - case 138: - return ScriptElementKind.indexSignatureElement; - case 137: - return ScriptElementKind.constructSignatureElement; - case 136: - return ScriptElementKind.callSignatureElement; - case 133: - return ScriptElementKind.constructorImplementationElement; - case 127: - return ScriptElementKind.typeParameterElement; - case 220: - return ScriptElementKind.variableElement; - case 128: - return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 138: return ScriptElementKind.indexSignatureElement; + case 137: return ScriptElementKind.constructSignatureElement; + case 136: return ScriptElementKind.callSignatureElement; + case 133: return ScriptElementKind.constructorImplementationElement; + case 127: return ScriptElementKind.typeParameterElement; + case 220: return ScriptElementKind.variableElement; + case 128: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; case 203: case 208: case 205: @@ -33217,26 +28497,13 @@ var ts; var changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { getSourceFile: getOrCreateSourceFile, - getCancellationToken: function () { - return cancellationToken; - }, - getCanonicalFileName: function (fileName) { - return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); - }, - useCaseSensitiveFileNames: function () { - return useCaseSensitivefileNames; - }, - getNewLine: function () { - return host.getNewLine ? host.getNewLine() : "\r\n"; - }, - getDefaultLibFileName: function (options) { - return host.getDefaultLibFileName(options); - }, - writeFile: function (fileName, data, writeByteOrderMark) { - }, - getCurrentDirectory: function () { - return host.getCurrentDirectory(); - } + getCancellationToken: function () { return cancellationToken; }, + getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); }, + useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, + getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, + getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, + writeFile: function (fileName, data, writeByteOrderMark) { }, + getCurrentDirectory: function () { return host.getCurrentDirectory(); } }); if (program) { var oldSourceFiles = program.getSourceFiles(); @@ -33325,7 +28592,8 @@ var ts; if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { return undefined; } - if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && (firstCharCode === 39 || firstCharCode === 34)) { + if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && + (firstCharCode === 39 || firstCharCode === 34)) { displayName = displayName.substring(1, displayName.length - 1); } var isValid = ts.isIdentifierStart(displayName.charCodeAt(0), target); @@ -33488,7 +28756,9 @@ var ts; } function isCompletionListBlocker(previousToken) { var _start_1 = new Date().getTime(); - var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); + var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || + isIdentifierDefinitionLocation(previousToken) || + isRightOfIllegalDot(previousToken); log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - _start_1)); return result; } @@ -33505,9 +28775,16 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 155 || containingNodeKind === 133 || containingNodeKind === 156 || containingNodeKind === 151 || containingNodeKind === 167; + return containingNodeKind === 155 + || containingNodeKind === 133 + || containingNodeKind === 156 + || containingNodeKind === 151 + || containingNodeKind === 167; case 16: - return containingNodeKind === 155 || containingNodeKind === 133 || containingNodeKind === 156 || containingNodeKind === 159; + return containingNodeKind === 155 + || containingNodeKind === 133 + || containingNodeKind === 156 + || containingNodeKind === 159; case 18: return containingNodeKind === 151; case 116: @@ -33517,7 +28794,8 @@ var ts; case 14: return containingNodeKind === 196; case 52: - return containingNodeKind === 193 || containingNodeKind === 167; + return containingNodeKind === 193 + || containingNodeKind === 167; case 11: return containingNodeKind === 169; case 12: @@ -33537,7 +28815,9 @@ var ts; return false; } function isInStringOrRegularExpressionOrTemplateLiteral(previousToken) { - if (previousToken.kind === 8 || previousToken.kind === 9 || ts.isTemplateLiteralKind(previousToken.kind)) { + if (previousToken.kind === 8 + || previousToken.kind === 9 + || ts.isTemplateLiteralKind(previousToken.kind)) { var _start_1 = previousToken.getStart(); var end = previousToken.getEnd(); if (_start_1 < position && position < end) { @@ -33584,23 +28864,43 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 193 || containingNodeKind === 194 || containingNodeKind === 175 || containingNodeKind === 199 || isFunction(containingNodeKind) || containingNodeKind === 196 || containingNodeKind === 195 || containingNodeKind === 197 || containingNodeKind === 149 || containingNodeKind === 148; + return containingNodeKind === 193 || + containingNodeKind === 194 || + containingNodeKind === 175 || + containingNodeKind === 199 || + isFunction(containingNodeKind) || + containingNodeKind === 196 || + containingNodeKind === 195 || + containingNodeKind === 197 || + containingNodeKind === 149 || + containingNodeKind === 148; case 20: return containingNodeKind === 149; case 18: return containingNodeKind === 149; case 16: - return containingNodeKind === 217 || isFunction(containingNodeKind); + return containingNodeKind === 217 || + isFunction(containingNodeKind); case 14: - return containingNodeKind === 199 || containingNodeKind === 197 || containingNodeKind === 143 || containingNodeKind === 148; + return containingNodeKind === 199 || + containingNodeKind === 197 || + containingNodeKind === 143 || + containingNodeKind === 148; case 22: - return containingNodeKind === 129 && (previousToken.parent.parent.kind === 197 || previousToken.parent.parent.kind === 143); + return containingNodeKind === 129 && + (previousToken.parent.parent.kind === 197 || + previousToken.parent.parent.kind === 143); case 24: - return containingNodeKind === 196 || containingNodeKind === 195 || containingNodeKind === 197 || isFunction(containingNodeKind); + return containingNodeKind === 196 || + containingNodeKind === 195 || + containingNodeKind === 197 || + isFunction(containingNodeKind); case 109: return containingNodeKind === 130; case 21: - return containingNodeKind === 128 || containingNodeKind === 133 || (previousToken.parent.parent.kind === 149); + return containingNodeKind === 128 || + containingNodeKind === 133 || + (previousToken.parent.parent.kind === 149); case 108: case 106: case 107: @@ -33645,7 +28945,8 @@ var ts; if (!importDeclaration.importClause) { return exports; } - if (importDeclaration.importClause.namedBindings && importDeclaration.importClause.namedBindings.kind === 207) { + if (importDeclaration.importClause.namedBindings && + importDeclaration.importClause.namedBindings.kind === 207) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { var _name = el.propertyName || el.name; exisingImports[_name.text] = true; @@ -33654,9 +28955,7 @@ var ts; if (ts.isEmpty(exisingImports)) { return exports; } - return ts.filter(exports, function (e) { - return !ts.lookUp(exisingImports, e.name); - }); + return ts.filter(exports, function (e) { return !ts.lookUp(exisingImports, e.name); }); } function filterContextualMembersList(contextualMemberSymbols, existingMembers) { if (!existingMembers || existingMembers.length === 0) { @@ -33706,9 +29005,7 @@ var ts; name: entryName, kind: ScriptElementKind.keyword, kindModifiers: ScriptElementKindModifier.none, - displayParts: [ - ts.displayPart(entryName, 5) - ], + displayParts: [ts.displayPart(entryName, 5)], documentation: undefined }; } @@ -33806,7 +29103,9 @@ var ts; return ScriptElementKind.unknown; } function getSymbolModifiers(symbol) { - return symbol && symbol.declarations && symbol.declarations.length > 0 ? ts.getNodeModifiers(symbol.declarations[0]) : ScriptElementKindModifier.none; + return symbol && symbol.declarations && symbol.declarations.length > 0 + ? ts.getNodeModifiers(symbol.declarations[0]) + : ScriptElementKindModifier.none; } function getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, enclosingDeclaration, typeResolver, location, semanticMeaning) { if (semanticMeaning === void 0) { semanticMeaning = getMeaningFromLocation(location); } @@ -33891,7 +29190,8 @@ var ts; hasAddedSymbolInfo = true; } } - else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || (location.kind === 113 && location.parent.kind === 133)) { + else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || + (location.kind === 113 && location.parent.kind === 133)) { var functionDeclaration = location.parent; var _allSignatures = functionDeclaration.kind === 133 ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeResolver.isImplementationOfOverload(functionDeclaration)) { @@ -33905,7 +29205,8 @@ var ts; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 136 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 136 && + !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, _allSignatures); hasAddedSymbolInfo = true; @@ -34025,7 +29326,9 @@ var ts; if (symbolKind !== ScriptElementKind.unknown) { if (type) { addPrefixForAnyFunctionOrVar(symbol, symbolKind); - if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 || symbolKind === ScriptElementKind.localVariableElement) { + if (symbolKind === ScriptElementKind.memberVariableElement || + symbolFlags & 3 || + symbolKind === ScriptElementKind.localVariableElement) { displayParts.push(ts.punctuationPart(51)); displayParts.push(ts.spacePart()); if (type.symbol && type.symbol.flags & 262144) { @@ -34038,7 +29341,12 @@ var ts; displayParts.push.apply(displayParts, ts.typeToDisplayParts(typeResolver, type, enclosingDeclaration)); } } - else if (symbolFlags & 16 || symbolFlags & 8192 || symbolFlags & 16384 || symbolFlags & 131072 || symbolFlags & 98304 || symbolKind === ScriptElementKind.memberFunctionElement) { + else if (symbolFlags & 16 || + symbolFlags & 8192 || + symbolFlags & 16384 || + symbolFlags & 131072 || + symbolFlags & 98304 || + symbolKind === ScriptElementKind.memberFunctionElement) { var _allSignatures_1 = type.getCallSignatures(); addSignatureDisplayParts(_allSignatures_1[0], _allSignatures_1); } @@ -34051,11 +29359,7 @@ var ts; if (!documentation) { documentation = symbol.getDocumentationComment(); } - return { - displayParts: displayParts, - documentation: documentation, - symbolKind: symbolKind - }; + return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; function addNewLineIfDisplayPartsExist() { if (displayParts.length) { displayParts.push(ts.lineBreakPart()); @@ -34142,26 +29446,20 @@ var ts; if (isJumpStatementTarget(node)) { var labelName = node.text; var label = getTargetLabel(node.parent, node.text); - return label ? [ - getDefinitionInfo(label, ScriptElementKind.label, labelName, undefined) - ] : undefined; + return label ? [getDefinitionInfo(label, ScriptElementKind.label, labelName, undefined)] : undefined; } - var comment = ts.forEach(sourceFile.referencedFiles, function (r) { - return (r.pos <= position && position < r.end) ? r : undefined; - }); + var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); if (comment) { var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); if (referenceFile) { - return [ - { + return [{ fileName: referenceFile.fileName, textSpan: ts.createTextSpanFromBounds(0, 0), kind: ScriptElementKind.scriptElement, name: comment.fileName, containerName: undefined, containerKind: undefined - } - ]; + }]; } return undefined; } @@ -34192,7 +29490,8 @@ var ts; var symbolKind = getSymbolKind(symbol, typeInfoResolver, node); var containerSymbol = symbol.parent; var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : ""; - if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { + if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && + !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { ts.forEach(declarations, function (declaration) { result.push(getDefinitionInfo(declaration, symbolKind, symbolName, containerName)); }); @@ -34212,7 +29511,8 @@ var ts; var _declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 133) || (!selectConstructors && (d.kind === 195 || d.kind === 132 || d.kind === 131))) { + if ((selectConstructors && d.kind === 133) || + (!selectConstructors && (d.kind === 195 || d.kind === 132 || d.kind === 131))) { _declarations.push(d); if (d.body) definition = d; @@ -34252,10 +29552,9 @@ var ts; if (!node) { return undefined; } - if (node.kind === 64 || node.kind === 92 || node.kind === 90 || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { - return getReferencesForNode(node, [ - sourceFile - ], true, false, false); + if (node.kind === 64 || node.kind === 92 || node.kind === 90 || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + return getReferencesForNode(node, [sourceFile], true, false, false); } switch (node.kind) { case 83: @@ -34303,7 +29602,9 @@ var ts; } break; case 81: - if (hasKind(node.parent, 181) || hasKind(node.parent, 182) || hasKind(node.parent, 183)) { + if (hasKind(node.parent, 181) || + hasKind(node.parent, 182) || + hasKind(node.parent, 183)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -34324,7 +29625,8 @@ var ts; return getGetAndSetOccurrences(node.parent); } default: - if (ts.isModifier(node.kind) && node.parent && (ts.isDeclaration(node.parent) || node.parent.kind === 175)) { + if (ts.isModifier(node.kind) && node.parent && + (ts.isDeclaration(node.parent) || node.parent.kind === 175)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -34569,16 +29871,15 @@ var ts; function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { - return pushKeywordIf(keywords, child, 115, 119); - }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 115, 119); }); } } } function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (declaration.flags & 112) { - if (!(container.kind === 196 || (declaration.kind === 128 && hasKind(container, 133)))) { + if (!(container.kind === 196 || + (declaration.kind === 128 && hasKind(container, 133)))) { return undefined; } } @@ -34622,9 +29923,7 @@ var ts; } ts.forEach(nodes, function (node) { if (node.modifiers && node.flags & modifierFlag) { - ts.forEach(node.modifiers, function (child) { - return pushKeywordIf(keywords, child, modifier); - }); + ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); } }); return ts.map(keywords, getReferenceEntryFromNode); @@ -34678,7 +29977,9 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 64 && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { + if (node.kind !== 64 && + !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && + !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } ts.Debug.assert(node.kind === 64 || node.kind === 7 || node.kind === 8); @@ -34688,9 +29989,7 @@ var ts; if (isLabelName(node)) { if (isJumpStatementTarget(node)) { var labelDefinition = getTargetLabel(node.parent, node.text); - return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [ - getReferenceEntryFromNode(node) - ]; + return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [getReferenceEntryFromNode(node)]; } else { return getLabelReferencesInNode(node.parent, node); @@ -34704,9 +30003,7 @@ var ts; } var symbol = typeInfoResolver.getSymbolAtLocation(node); if (!symbol) { - return [ - getReferenceEntryFromNode(node) - ]; + return [getReferenceEntryFromNode(node)]; } var declarations = symbol.declarations; if (!declarations || !declarations.length) { @@ -34740,7 +30037,9 @@ var ts; } return result; function isImportOrExportSpecifierName(location) { - return location.parent && (location.parent.kind === 208 || location.parent.kind === 212) && location.parent.propertyName === location; + return location.parent && + (location.parent.kind === 208 || location.parent.kind === 212) && + location.parent.propertyName === location; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { @@ -34748,9 +30047,7 @@ var ts; }); } function getDeclaredName(symbol, location) { - var functionExpression = ts.forEach(symbol.declarations, function (d) { - return d.kind === 160 ? d : undefined; - }); + var functionExpression = ts.forEach(symbol.declarations, function (d) { return d.kind === 160 ? d : undefined; }); var _name; if (functionExpression && functionExpression.name) { _name = functionExpression.name.text; @@ -34765,10 +30062,10 @@ var ts; if (isImportOrExportSpecifierName(location)) { return location.getText(); } - var functionExpression = ts.forEach(declarations, function (d) { - return d.kind === 160 ? d : undefined; - }); - var _name = functionExpression && functionExpression.name ? functionExpression.name.text : symbol.name; + var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 160 ? d : undefined; }); + var _name = functionExpression && functionExpression.name + ? functionExpression.name.text + : symbol.name; return stripQuotes(_name); } function stripQuotes(name) { @@ -34781,9 +30078,7 @@ var ts; } function getSymbolScope(symbol) { if (symbol.flags & (4 | 8192)) { - var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { - return (d.flags & 32) ? d : undefined; - }); + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); if (privateDeclaration) { return ts.getAncestor(privateDeclaration, 196); } @@ -34828,7 +30123,8 @@ var ts; if (position > end) break; var endPosition = position + symbolNameLength; - if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && + (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { positions.push(position); } position = text.indexOf(symbolName, position + symbolNameLength + 1); @@ -34846,7 +30142,8 @@ var ts; if (!_node || _node.getWidth() !== labelName.length) { return; } - if (_node === targetLabel || (isJumpStatementTarget(_node) && getTargetLabel(_node, labelName) === targetLabel)) { + if (_node === targetLabel || + (isJumpStatementTarget(_node) && getTargetLabel(_node, labelName) === targetLabel)) { _result.push(getReferenceEntryFromNode(_node)); } }); @@ -34858,7 +30155,8 @@ var ts; case 64: return node.getWidth() === searchSymbolName.length; case 8: - if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + isNameOfExternalModuleImportOrDeclaration(node)) { return node.getWidth() === searchSymbolName.length + 2; } break; @@ -34881,7 +30179,8 @@ var ts; cancellationToken.throwIfCancellationRequested(); var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); if (!isValidReferencePosition(referenceLocation, searchText)) { - if ((findInStrings && isInString(position)) || (findInComments && isInComment(position))) { + if ((findInStrings && isInString(position)) || + (findInComments && isInComment(position))) { result.push({ fileName: sourceFile.fileName, textSpan: ts.createTextSpan(position, searchText.length), @@ -35039,9 +30338,7 @@ var ts; } } function populateSearchSymbolSet(symbol, location) { - var _result = [ - symbol - ]; + var _result = [symbol]; if (isImportOrExportSpecifierImportSymbol(symbol)) { _result.push(typeInfoResolver.getAliasedSymbol(symbol)); } @@ -35094,14 +30391,13 @@ var ts; if (searchSymbols.indexOf(referenceSymbol) >= 0) { return true; } - if (isImportOrExportSpecifierImportSymbol(referenceSymbol) && searchSymbols.indexOf(typeInfoResolver.getAliasedSymbol(referenceSymbol)) >= 0) { + if (isImportOrExportSpecifierImportSymbol(referenceSymbol) && + searchSymbols.indexOf(typeInfoResolver.getAliasedSymbol(referenceSymbol)) >= 0) { return true; } if (isNameOfPropertyAssignment(referenceLocation)) { return ts.forEach(getPropertySymbolsFromContextualType(referenceLocation), function (contextualSymbol) { - return ts.forEach(typeInfoResolver.getRootSymbols(contextualSymbol), function (s) { - return searchSymbols.indexOf(s) >= 0; - }); + return ts.forEach(typeInfoResolver.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0; }); }); } return ts.forEach(typeInfoResolver.getRootSymbols(referenceSymbol), function (rootSymbol) { @@ -35111,9 +30407,7 @@ var ts; if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { var _result = []; getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), _result); - return ts.forEach(_result, function (s) { - return searchSymbols.indexOf(s) >= 0; - }); + return ts.forEach(_result, function (s) { return searchSymbols.indexOf(s) >= 0; }); } return false; }); @@ -35127,9 +30421,7 @@ var ts; if (contextualType.flags & 16384) { var unionProperty = contextualType.getProperty(_name); if (unionProperty) { - return [ - unionProperty - ]; + return [unionProperty]; } else { var _result = []; @@ -35145,9 +30437,7 @@ var ts; else { var _symbol = contextualType.getProperty(_name); if (_symbol) { - return [ - _symbol - ]; + return [_symbol]; } } } @@ -35205,9 +30495,7 @@ var ts; return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); } function containErrors(diagnostics) { - return ts.forEach(diagnostics, function (diagnostic) { - return diagnostic.category === 1; - }); + return ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1; }); } function getEmitOutput(fileName) { synchronizeHostData(); @@ -35301,7 +30589,9 @@ var ts; } function getMeaningFromRightHandSideOfImportEquals(node) { ts.Debug.assert(node.kind === 64); - if (node.parent.kind === 125 && node.parent.right === node && node.parent.parent.kind === 203) { + if (node.parent.kind === 125 && + node.parent.right === node && + node.parent.parent.kind === 203) { return 1 | 2 | 4; } return 4; @@ -35360,7 +30650,8 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 200 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + if (nodeForStartPos.parent.parent.kind === 200 && + nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } else { @@ -35407,7 +30698,8 @@ var ts; } } else if (flags & 1536) { - if (meaningAtPosition & 4 || (meaningAtPosition & 1 && hasValueSideModule(symbol))) { + if (meaningAtPosition & 4 || + (meaningAtPosition & 1 && hasValueSideModule(symbol))) { return ClassificationTypeNames.moduleName; } } @@ -35532,11 +30824,16 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 52) { - if (token.parent.kind === 193 || token.parent.kind === 130 || token.parent.kind === 128) { + if (token.parent.kind === 193 || + token.parent.kind === 130 || + token.parent.kind === 128) { return ClassificationTypeNames.operator; } } - if (token.parent.kind === 167 || token.parent.kind === 165 || token.parent.kind === 166 || token.parent.kind === 168) { + if (token.parent.kind === 167 || + token.parent.kind === 165 || + token.parent.kind === 166 || + token.parent.kind === 168) { return ClassificationTypeNames.operator; } } @@ -35634,22 +30931,14 @@ var ts; return result; function getMatchingTokenKind(token) { switch (token.kind) { - case 14: - return 15; - case 16: - return 17; - case 18: - return 19; - case 24: - return 25; - case 15: - return 14; - case 17: - return 16; - case 19: - return 18; - case 25: - return 24; + case 14: return 15; + case 16: return 17; + case 18: return 19; + case 24: return 25; + case 15: return 14; + case 17: return 16; + case 19: return 18; + case 25: return 24; } return undefined; } @@ -35730,9 +31019,7 @@ var ts; var multiLineCommentStart = /(?:\/\*+\s*)/.source; var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; var _preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; - var literals = "(?:" + ts.map(descriptors, function (d) { - return "(" + escapeRegExp(d.text) + ")"; - }).join("|") + ")"; + var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; var messageRemainder = /(?:.*?)/.source; var messagePortion = "(" + literals + messageRemainder + ")"; @@ -35740,7 +31027,9 @@ var ts; return new RegExp(regExpString, "gim"); } function isLetterOrDigit(char) { - return (char >= 97 && char <= 122) || (char >= 65 && char <= 90) || (char >= 48 && char <= 57); + return (char >= 97 && char <= 122) || + (char >= 65 && char <= 90) || + (char >= 48 && char <= 57); } } function getRenameInfo(fileName, position) { @@ -35842,7 +31131,9 @@ var ts; break; case 8: case 7: - if (ts.isDeclarationName(node) || node.parent.kind === 213 || isArgumentOfElementAccessExpression(node)) { + if (ts.isDeclarationName(node) || + node.parent.kind === 213 || + isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } break; @@ -35852,7 +31143,10 @@ var ts; } } function isArgumentOfElementAccessExpression(node) { - return node && node.parent && node.parent.kind === 154 && node.parent.argumentExpression === node; + return node && + node.parent && + node.parent.kind === 154 && + node.parent.argumentExpression === node; } function createClassifier() { var _scanner = ts.createScanner(2, false); @@ -35881,7 +31175,10 @@ var ts; } function canFollow(keyword1, keyword2) { if (isAccessibilityModifier(keyword1)) { - if (keyword2 === 115 || keyword2 === 119 || keyword2 === 113 || keyword2 === 109) { + if (keyword2 === 115 || + keyword2 === 119 || + keyword2 === 113 || + keyword2 === 109) { return true; } return false; @@ -35939,13 +31236,18 @@ var ts; else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { token = 64; } - else if (lastNonTriviaToken === 64 && token === 24) { + else if (lastNonTriviaToken === 64 && + token === 24) { angleBracketStack++; } else if (token === 25 && angleBracketStack > 0) { angleBracketStack--; } - else if (token === 111 || token === 120 || token === 118 || token === 112 || token === 121) { + else if (token === 111 || + token === 120 || + token === 118 || + token === 112 || + token === 121) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { token = 64; } @@ -35996,7 +31298,9 @@ var ts; } if (numBackslashes & 1) { var quoteChar = tokenText.charCodeAt(0); - result.finalLexState = quoteChar === 34 ? 3 : 2; + result.finalLexState = quoteChar === 34 + ? 3 + : 2; } } } @@ -36028,10 +31332,7 @@ var ts; if (result.entries.length === 0) { length -= offset; } - result.entries.push({ - length: length, - classification: classification - }); + result.entries.push({ length: length, classification: classification }); } } } @@ -36126,9 +31427,7 @@ var ts; return 5; } } - return { - getClassificationsForLine: getClassificationsForLine - }; + return { getClassificationsForLine: getClassificationsForLine }; } ts.createClassifier = createClassifier; function getDefaultLibFilePath(options) { @@ -36152,15 +31451,9 @@ var ts; Node.prototype = proto; return Node; }, - getSymbolConstructor: function () { - return SymbolObject; - }, - getTypeConstructor: function () { - return TypeObject; - }, - getSignatureConstructor: function () { - return SignatureObject; - } + getSymbolConstructor: function () { return SymbolObject; }, + getTypeConstructor: function () { return TypeObject; }, + getSignatureConstructor: function () { return SignatureObject; } }; } initializeServices(); @@ -36334,12 +31627,17 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 182 || variableDeclaration.parent.parent.kind === 183) { + if (variableDeclaration.parent.parent.kind === 182 || + variableDeclaration.parent.parent.kind === 183) { return spanInNode(variableDeclaration.parent.parent); } var isParentVariableStatement = variableDeclaration.parent.parent.kind === 175; var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 181 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); - var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement ? variableDeclaration.parent.parent.initializer.declarations : undefined; + var declarations = isParentVariableStatement + ? variableDeclaration.parent.parent.declarationList.declarations + : isDeclarationOfForStatement + ? variableDeclaration.parent.parent.initializer.declarations + : undefined; if (variableDeclaration.initializer || (variableDeclaration.flags & 1)) { if (declarations && declarations[0] === variableDeclaration) { if (isParentVariableStatement) { @@ -36360,7 +31658,8 @@ var ts; } } function canHaveSpanInParameterDeclaration(parameter) { - return !!parameter.initializer || parameter.dotDotDotToken !== undefined || !!(parameter.flags & 16) || !!(parameter.flags & 32); + return !!parameter.initializer || parameter.dotDotDotToken !== undefined || + !!(parameter.flags & 16) || !!(parameter.flags & 32); } function spanInParameterDeclaration(parameter) { if (canHaveSpanInParameterDeclaration(parameter)) { @@ -36378,7 +31677,8 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 1) || (functionDeclaration.parent.kind === 196 && functionDeclaration.kind !== 133); + return !!(functionDeclaration.flags & 1) || + (functionDeclaration.parent.kind === 196 && functionDeclaration.kind !== 133); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -36630,21 +31930,15 @@ var ts; function forwardJSONCall(logger, actionDescription, action) { try { var result = simpleForwardCall(logger, actionDescription, action); - return JSON.stringify({ - result: result - }); + return JSON.stringify({ result: result }); } catch (err) { if (err instanceof ts.OperationCanceledException) { - return JSON.stringify({ - canceled: true - }); + return JSON.stringify({ canceled: true }); } logInternalError(logger, err); err.description = actionDescription; - return JSON.stringify({ - error: err - }); + return JSON.stringify({ error: err }); } } var ShimBase = (function () { @@ -36694,9 +31988,7 @@ var ts; LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) { var _this = this; var newLine = this.getNewLine(); - return diagnostics.map(function (d) { - return _this.realizeDiagnostic(d, newLine); - }); + return diagnostics.map(function (d) { return _this.realizeDiagnostic(d, newLine); }); }; LanguageServiceShimObject.prototype.realizeDiagnostic = function (diagnostic, newLine) { return { From 84634ac25da26513935d62177aedff1a01fee668 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Mon, 9 Mar 2015 22:51:23 -0400 Subject: [PATCH 088/101] Disallow line terminator after arrow function parameters, before => Closes #2282 --- src/compiler/parser.ts | 327 +++++++++--------- ...sallowLineTerminatorBeforeArrow.errors.txt | 70 ++++ .../disallowLineTerminatorBeforeArrow.js | 60 ++++ .../disallowLineTerminatorBeforeArrow.ts | 22 ++ 4 files changed, 318 insertions(+), 161 deletions(-) create mode 100644 tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt create mode 100644 tests/baselines/reference/disallowLineTerminatorBeforeArrow.js create mode 100644 tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 7f89ff6153b..fc02c3f3eef 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -8,7 +8,7 @@ module ts { export function getNodeConstructor(kind: SyntaxKind): new () => Node { return nodeConstructors[kind] || (nodeConstructors[kind] = objectAllocator.getNodeConstructor(kind)); } - + export function createNode(kind: SyntaxKind): Node { return new (getNodeConstructor(kind))(); } @@ -369,7 +369,7 @@ module ts { function fixupParentReferences(sourceFile: SourceFile) { // normally parent references are set during binding. However, for clients that only need - // a syntax tree, and no semantic features, then the binding process is an unnecessary + // a syntax tree, and no semantic features, then the binding process is an unnecessary // overhead. This functions allows us to set all the parents, without all the expense of // binding. @@ -379,7 +379,7 @@ module ts { function visitNode(n: Node): void { // walk down setting parents that differ from the parent we think it should be. This - // allows us to quickly bail out of setting parents for subtrees during incremental + // allows us to quickly bail out of setting parents for subtrees during incremental // parsing if (n.parent !== parent) { n.parent = parent; @@ -417,7 +417,7 @@ module ts { var text = oldText.substring(node.pos, node.end); } - // Ditch any existing LS children we may have created. This way we can avoid + // Ditch any existing LS children we may have created. This way we can avoid // moving them forward. node._children = undefined; node.pos += delta; @@ -455,9 +455,9 @@ module ts { // We may need to update both the 'pos' and the 'end' of the element. - // If the 'pos' is before the start of the change, then we don't need to touch it. - // If it isn't, then the 'pos' must be inside the change. How we update it will - // depend if delta is positive or negative. If delta is positive then we have + // If the 'pos' is before the start of the change, then we don't need to touch it. + // If it isn't, then the 'pos' must be inside the change. How we update it will + // depend if delta is positive or negative. If delta is positive then we have // something like: // // -------------------AAA----------------- @@ -471,7 +471,7 @@ module ts { // -------------------XXXYYYYYYY----------------- // -------------------ZZZ----------------- // - // In this case, any element that started in the 'X' range will keep its position. + // In this case, any element that started in the 'X' range will keep its position. // However any element htat started after that will have their pos adjusted to be // at the end of the new range. i.e. any node that started in the 'Y' range will // be adjusted to have their start at the end of the 'Z' range. @@ -481,7 +481,7 @@ module ts { element.pos = Math.min(element.pos, changeRangeNewEnd); // If the 'end' is after the change range, then we always adjust it by the delta - // amount. However, if the end is in the change range, then how we adjust it + // amount. However, if the end is in the change range, then how we adjust it // will depend on if delta is positive or negative. If delta is positive then we // have something like: // @@ -496,7 +496,7 @@ module ts { // -------------------XXXYYYYYYY----------------- // -------------------ZZZ----------------- // - // In this case, any element that ended in the 'X' range will keep its position. + // In this case, any element that ended in the 'X' range will keep its position. // However any element htat ended after that will have their pos adjusted to be // at the end of the new range. i.e. any node that ended in the 'Y' range will // be adjusted to have their end at the end of the 'Z' range. @@ -505,7 +505,7 @@ module ts { element.end += delta; } else { - // Element ends in the change range. The element will keep its position if + // Element ends in the change range. The element will keep its position if // possible. Or Move backward to the new-end if it's in the 'Y' range. element.end = Math.min(element.end, changeRangeNewEnd); } @@ -544,7 +544,7 @@ module ts { function visitNode(child: IncrementalNode) { Debug.assert(child.pos <= child.end); if (child.pos > changeRangeOldEnd) { - // Node is entirely past the change range. We need to move both its pos and + // Node is entirely past the change range. We need to move both its pos and // end, forward or backward appropriately. moveElementEntirelyPastChangeRange(child, /*isArray:*/ false, delta, oldText, newText, aggressiveChecks); return; @@ -607,12 +607,12 @@ module ts { // If the text changes with an insertion of / just before the semicolon then we end up with: // void foo() { //; } // - // If we were to just use the changeRange a is, then we would not rescan the { token + // If we were to just use the changeRange a is, then we would not rescan the { token // (as it does not intersect the actual original change range). Because an edit may // change the token touching it, we actually need to look back *at least* one token so - // that the prior token sees that change. + // that the prior token sees that change. let maxLookahead = 1; - + let start = changeRange.span.start; // the first iteration aligns us with the change start. subsequent iteration move us to @@ -676,7 +676,7 @@ module ts { return; } - // If the child intersects this position, then this node is currently the nearest + // If the child intersects this position, then this node is currently the nearest // node that starts before the position. if (child.pos <= position) { if (child.pos >= bestResult.pos) { @@ -687,7 +687,7 @@ module ts { // Now, the node may overlap the position, or it may end entirely before the // position. If it overlaps with the position, then either it, or one of its - // children must be the nearest node before the position. So we can just + // children must be the nearest node before the position. So we can just // recurse into this child to see if we can find something better. if (position < child.end) { // The nearest node is either this child, or one of the children inside @@ -703,15 +703,15 @@ module ts { Debug.assert(child.end <= position); // The child ends entirely before this position. Say you have the following // (where $ is the position) - // - // ? $ : <...> <...> // - // We would want to find the nearest preceding node in "complex expr 2". + // ? $ : <...> <...> + // + // We would want to find the nearest preceding node in "complex expr 2". // To support that, we keep track of this node, and once we're done searching // for a best node, we recurse down this node to see if we can find a good // result in it. // - // This approach allows us to quickly skip over nodes that are entirely + // This approach allows us to quickly skip over nodes that are entirely // before the position, while still allowing us to find any nodes in the // last one that might be what we want. lastNodeEntirelyBeforePosition = child; @@ -744,13 +744,13 @@ module ts { } } - // Produces a new SourceFile for the 'newText' provided. The 'textChangeRange' parameter + // Produces a new SourceFile for the 'newText' provided. The 'textChangeRange' parameter // indicates what changed between the 'text' that this SourceFile has and the 'newText'. - // The SourceFile will be created with the compiler attempting to reuse as many nodes from + // The SourceFile will be created with the compiler attempting to reuse as many nodes from // this file as possible. // // Note: this function mutates nodes from this SourceFile. That means any existing nodes - // from this SourceFile that are being held onto may change as a result (including + // from this SourceFile that are being held onto may change as a result (including // becoming detached from any SourceFile). It is recommended that this SourceFile not // be used once 'update' is called on it. export function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile { @@ -769,7 +769,7 @@ module ts { } // Make sure we're not trying to incrementally update a source file more than once. Once - // we do an update the original source file is considered unusbale from that point onwards. + // we do an update the original source file is considered unusbale from that point onwards. // // This is because we do incremental parsing in-place. i.e. we take nodes from the old // tree and give them new positions and parents. From that point on, trusting the old @@ -781,24 +781,24 @@ module ts { let oldText = sourceFile.text; let syntaxCursor = createSyntaxCursor(sourceFile); - // Make the actual change larger so that we know to reparse anything whose lookahead + // Make the actual change larger so that we know to reparse anything whose lookahead // might have intersected the change. let changeRange = extendToAffectedRange(sourceFile, textChangeRange); checkChangeRange(sourceFile, newText, changeRange, aggressiveChecks); - // Ensure that extending the affected range only moved the start of the change range + // Ensure that extending the affected range only moved the start of the change range // earlier in the file. Debug.assert(changeRange.span.start <= textChangeRange.span.start); Debug.assert(textSpanEnd(changeRange.span) === textSpanEnd(textChangeRange.span)); Debug.assert(textSpanEnd(textChangeRangeNewSpan(changeRange)) === textSpanEnd(textChangeRangeNewSpan(textChangeRange))); - // The is the amount the nodes after the edit range need to be adjusted. It can be + // The is the amount the nodes after the edit range need to be adjusted. It can be // positive (if the edit added characters), negative (if the edit deleted characters) // or zero (if this was a pure overwrite with nothing added/removed). let delta = textChangeRangeNewSpan(changeRange).length - changeRange.span.length; // If we added or removed characters during the edit, then we need to go and adjust all - // the nodes after the edit. Those nodes may move forward (if we inserted chars) or they + // the nodes after the edit. Those nodes may move forward (if we inserted chars) or they // may move backward (if we deleted chars). // // Doing this helps us out in two ways. First, it means that any nodes/tokens we want @@ -811,7 +811,7 @@ module ts { // // We will also adjust the positions of nodes that intersect the change range as well. // By doing this, we ensure that all the positions in the old tree are consistent, not - // just the positions of nodes entirely before/after the change range. By being + // just the positions of nodes entirely before/after the change range. By being // consistent, we can then easily map from positions to nodes in the old tree easily. // // Also, mark any syntax elements that intersect the changed span. We know, up front, @@ -822,15 +822,15 @@ module ts { // Now that we've set up our internal incremental state just proceed and parse the // source file in the normal fashion. When possible the parser will retrieve and // reuse nodes from the old tree. - // + // // Note: passing in 'true' for setNodeParents is very important. When incrementally // parsing, we will be reusing nodes from the old tree, and placing it into new - // parents. If we don't set the parents now, we'll end up with an observably - // inconsistent tree. Setting the parents on the new tree should be very fast. We + // parents. If we don't set the parents now, we'll end up with an observably + // inconsistent tree. Setting the parents on the new tree should be very fast. We // will immediately bail out of walking any subtrees when we can see that their parents // are already correct. - let result = parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /* setParentNode */ true) - + let result = parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /* setParentNode */ true) + return result; } @@ -885,13 +885,13 @@ module ts { return { currentNode(position: number) { - // Only compute the current node if the position is different than the last time - // we were asked. The parser commonly asks for the node at the same position + // Only compute the current node if the position is different than the last time + // we were asked. The parser commonly asks for the node at the same position // twice. Once to know if can read an appropriate list element at a certain point, // and then to actually read and consume the node. if (position !== lastQueriedPosition) { - // Much of the time the parser will need the very next node in the array that - // we just returned a node from.So just simply check for that case and move + // Much of the time the parser will need the very next node in the array that + // we just returned a node from.So just simply check for that case and move // forward in the array instead of searching for the node again. if (current && current.end === position && currentArrayIndex < (currentArray.length - 1)) { currentArrayIndex++; @@ -905,7 +905,7 @@ module ts { } } - // Cache this query so that we don't do any extra work if the parser calls back + // Cache this query so that we don't do any extra work if the parser calls back // into us. Note: this is very common as the parser will make pairs of calls like // 'isListElement -> parseListElement'. If we were unable to find a node when // called with 'isListElement', we don't want to redo the work when parseListElement @@ -917,7 +917,7 @@ module ts { return current; } }; - + // Finds the highest element in the tree we can find that starts at the provided position. // The element must be a direct child of some node list in the tree. This way after we // return it, we can easily return its next sibling in the list. @@ -960,7 +960,7 @@ module ts { } else { if (child.pos < position && position < child.end) { - // Position in somewhere within this child. Search in it and + // Position in somewhere within this child. Search in it and // stop searching in this array. forEachChild(child, visitNode, visitArray); return true; @@ -1007,10 +1007,10 @@ module ts { // Whether or not we are in strict parsing mode. All that changes in strict parsing mode is // that some tokens that would be considered identifiers may be considered keywords. // - // When adding more parser context flags, consider which is the more common case that the + // When adding more parser context flags, consider which is the more common case that the // flag will be in. This should be hte 'false' state for that flag. The reason for this is // that we don't store data in our nodes unless the value is in the *non-default* state. So, - // for example, more often than code 'allows-in' (or doesn't 'disallow-in'). We opt for + // for example, more often than code 'allows-in' (or doesn't 'disallow-in'). We opt for // 'disallow-in' set to 'false'. Otherwise, if we had 'allowsIn' set to 'true', then almost // all nodes would need extra state on them to store this info. // @@ -1030,20 +1030,20 @@ module ts { // EqualityExpression[?In, ?Yield] === RelationalExpression[?In, ?Yield] // EqualityExpression[?In, ?Yield] !== RelationalExpression[?In, ?Yield] // - // Where you have to be careful is then understanding what the points are in the grammar + // Where you have to be careful is then understanding what the points are in the grammar // where the values are *not* passed along. For example: // // SingleNameBinding[Yield,GeneratorParameter] // [+GeneratorParameter]BindingIdentifier[Yield] Initializer[In]opt // [~GeneratorParameter]BindingIdentifier[?Yield]Initializer[In, ?Yield]opt // - // Here this is saying that if the GeneratorParameter context flag is set, that we should + // Here this is saying that if the GeneratorParameter context flag is set, that we should // explicitly set the 'yield' context flag to false before calling into the BindingIdentifier // and we should explicitly unset the 'yield' context flag before calling into the Initializer. - // production. Conversely, if the GeneratorParameter context flag is not set, then we + // production. Conversely, if the GeneratorParameter context flag is not set, then we // should leave the 'yield' context flag alone. // - // Getting this all correct is tricky and requires careful reading of the grammar to + // Getting this all correct is tricky and requires careful reading of the grammar to // understand when these values should be changed versus when they should be inherited. // // Note: it should not be necessary to save/restore these flags during speculative/lookahead @@ -1051,7 +1051,7 @@ module ts { // descent parsing and unwinding. let contextFlags: ParserContextFlags = 0; - // Whether or not we've had a parse error since creating the last AST node. If we have + // Whether or not we've had a parse error since creating the last AST node. If we have // encountered an error, it will be stored on the next AST node we create. Parse errors // can be broken down into three categories: // @@ -1062,7 +1062,7 @@ module ts { // by the 'parseExpected' function. // // 3) A token was present that no parsing function was able to consume. This type of error - // only occurs in the 'abortParsingListOrMoveToNextToken' function when the parser + // only occurs in the 'abortParsingListOrMoveToNextToken' function when the parser // decides to skip the token. // // In all of these cases, we want to mark the next node as having had an error before it. @@ -1071,8 +1071,8 @@ module ts { // node. in that event we would then not produce the same errors as we did before, causing // significant confusion problems. // - // Note: it is necessary that this value be saved/restored during speculative/lookahead - // parsing. During lookahead parsing, we will often create a node. That node will have + // Note: it is necessary that this value be saved/restored during speculative/lookahead + // parsing. During lookahead parsing, we will often create a node. That node will have // this value attached, and then this value will be set back to 'false'. If we decide to // rewind, we must get back to the same value we had prior to the lookahead. // @@ -1135,7 +1135,7 @@ module ts { setDisallowInContext(true); return result; } - + // no need to do anything special if 'in' is already allowed. return func(); } @@ -1206,7 +1206,7 @@ module ts { sourceFile.parseDiagnostics.push(createFileDiagnostic(sourceFile, start, length, message, arg0)); } - // Mark that we've encountered an error. We'll set an appropriate bit on the next + // Mark that we've encountered an error. We'll set an appropriate bit on the next // node we finish so that it can't be reused incrementally. parseErrorBeforeNextFinishedNode = true; } @@ -1245,7 +1245,7 @@ module ts { } function speculationHelper(callback: () => T, isLookAhead: boolean): T { - // Keep track of the state we'll need to rollback to if lookahead fails (or if the + // Keep track of the state we'll need to rollback to if lookahead fails (or if the // caller asked us to always reset our state). let saveToken = token; let saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; @@ -1253,13 +1253,13 @@ module ts { // Note: it is not actually necessary to save/restore the context flags here. That's // because the saving/restorating of these flags happens naturally through the recursive - // descent nature of our parser. However, we still store this here just so we can + // descent nature of our parser. However, we still store this here just so we can // assert that that invariant holds. let saveContextFlags = contextFlags; // If we're only looking ahead, then tell the scanner to only lookahead as well. - // Otherwise, if we're actually speculatively parsing, then tell the scanner to do the - // same. + // Otherwise, if we're actually speculatively parsing, then tell the scanner to do the + // same. let result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); @@ -1277,15 +1277,15 @@ module ts { return result; } - // Invokes the provided callback then unconditionally restores the parser to the state it + // Invokes the provided callback then unconditionally restores the parser to the state it // was in immediately prior to invoking the callback. The result of invoking the callback // is returned from this function. function lookAhead(callback: () => T): T { return speculationHelper(callback, /*isLookAhead:*/ true); } - + // Invokes the provided callback. If the callback returns something falsy, then it restores - // the parser to the state it was in immediately prior to invoking the callback. If the + // the parser to the state it was in immediately prior to invoking the callback. If the // callback returns something truthy, then the parser state is not rolled back. The result // of invoking the callback is returned from this function. function tryParse(callback: () => T): T { @@ -1296,8 +1296,8 @@ module ts { if (token === SyntaxKind.Identifier) { return true; } - - // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is + + // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is // considered a keyword and is not an identifier. if (token === SyntaxKind.YieldKeyword && inYieldContext()) { return false; @@ -1464,7 +1464,7 @@ module ts { // LiteralPropertyName // [+GeneratorParameter] ComputedPropertyName // [~GeneratorParameter] ComputedPropertyName[?Yield] - // + // // ComputedPropertyName[Yield] : // [ AssignmentExpression[In, ?Yield] ] // @@ -1648,13 +1648,13 @@ module ts { } function isVariableDeclaratorListTerminator(): boolean { - // If we can consume a semicolon (either explicitly, or with ASI), then consider us done + // If we can consume a semicolon (either explicitly, or with ASI), then consider us done // with parsing the list of variable declarators. if (canParseSemicolon()) { return true; } - // in the case where we're parsing the variable declarator of a 'for-in' statement, we + // in the case where we're parsing the variable declarator of a 'for-in' statement, we // are done if we see an 'in' keyword in front of us. Same with for-of if (isInOrOfKeyword(token)) { return true; @@ -1730,7 +1730,7 @@ module ts { if (node) { return consumeNode(node); } - + return parseElement(); } @@ -1738,9 +1738,9 @@ module ts { // If there is an outstanding parse error that we've encountered, but not attached to // some node, then we cannot get a node from the old source tree. This is because we // want to mark the next node we encounter as being unusable. - // + // // Note: This may be too conservative. Perhaps we could reuse hte node and set the bit - // on it (or its leftmost child) as having the error. For now though, being conservative + // on it (or its leftmost child) as having the error. For now though, being conservative // is nice and likely won't ever affect perf. if (parseErrorBeforeNextFinishedNode) { return undefined; @@ -1763,18 +1763,18 @@ module ts { return undefined; } - // Can't reuse a node that contains a parse error. This is necessary so that we + // Can't reuse a node that contains a parse error. This is necessary so that we // produce the same set of errors again. if (containsParseError(node)) { return undefined; } - // We can only reuse a node if it was parsed under the same strict mode that we're + // We can only reuse a node if it was parsed under the same strict mode that we're // currently in. i.e. if we originally parsed a node in non-strict mode, but then // the user added 'using strict' at the top of the file, then we can't use that node // again as the presense of strict mode may cause us to parse the tokens in the file // differetly. - // + // // Note: we *can* reuse tokens when the strict mode changes. That's because tokens // are unaffected by strict mode. It's just the parser will decide what to do with it // differently depending on what mode it is in. @@ -1828,32 +1828,32 @@ module ts { case ParsingContext.Parameters: return isReusableParameter(node); - // Any other lists we do not care about reusing nodes in. But feel free to add if + // Any other lists we do not care about reusing nodes in. But feel free to add if // you can do so safely. Danger areas involve nodes that may involve speculative // parsing. If speculative parsing is involved with the node, then the range the // parser reached while looking ahead might be in the edited range (see the example // in canReuseVariableDeclaratorNode for a good case of this). case ParsingContext.HeritageClauses: - // This would probably be safe to reuse. There is no speculative parsing with + // This would probably be safe to reuse. There is no speculative parsing with // heritage clauses. case ParsingContext.TypeReferences: - // This would probably be safe to reuse. There is no speculative parsing with + // This would probably be safe to reuse. There is no speculative parsing with // type names in a heritage clause. There can be generic names in the type - // name list. But because it is a type context, we never use speculative + // name list. But because it is a type context, we never use speculative // parsing on the type argument list. case ParsingContext.TypeParameters: - // This would probably be safe to reuse. There is no speculative parsing with + // This would probably be safe to reuse. There is no speculative parsing with // type parameters. Note that that's because type *parameters* only occur in // unambiguous *type* contexts. While type *arguments* occur in very ambiguous // *expression* contexts. case ParsingContext.TupleElementTypes: - // This would probably be safe to reuse. There is no speculative parsing with + // This would probably be safe to reuse. There is no speculative parsing with // tuple types. - // Technically, type argument list types are probably safe to reuse. While + // Technically, type argument list types are probably safe to reuse. While // speculative parsing is involved with them (since type argument lists are only // produced from speculative parsing a < as a type argument list), we only have // the types because speculative parsing succeeded. Thus, the lookahead never @@ -1861,12 +1861,12 @@ module ts { case ParsingContext.TypeArguments: // Note: these are almost certainly not safe to ever reuse. Expressions commonly - // need a large amount of lookahead, and we should not reuse them as they may + // need a large amount of lookahead, and we should not reuse them as they may // have actually intersected the edit. case ParsingContext.ArgumentExpressions: // This is not safe to reuse for the same reason as the 'AssignmentExpression' - // cases. i.e. a property assignment may end with an expression, and thus might + // cases. i.e. a property assignment may end with an expression, and thus might // have lookahead far beyond it's old node. case ParsingContext.ObjectLiteralMembers: } @@ -1980,12 +1980,12 @@ module ts { // // let v = new List < A, B // - // This is actually legal code. It's a list of variable declarators "v = new List() - // - // then we have a problem. "v = new ListcreateMissingNode(SyntaxKind.Identifier, /*reportAtCurrentToken:*/ true, Diagnostics.Identifier_expected); } @@ -2185,7 +2185,7 @@ module ts { if (scanner.hasExtendedUnicodeEscape()) { node.hasExtendedUnicodeEscape = true; } - + if (scanner.isUnterminated()) { node.isUnterminated = true; } @@ -2193,7 +2193,7 @@ module ts { let tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - + // Octal literals are not allowed in strict mode or ES5 // Note that theoretically the following condition would hold true literals like 009, // which is not octal.But because of how the scanner separates the tokens, we would @@ -2232,7 +2232,7 @@ module ts { let node = createNode(SyntaxKind.TypeParameter); node.name = parseIdentifier(); if (parseOptional(SyntaxKind.ExtendsKeyword)) { - // It's not uncommon for people to write improper constraints to a generic. If the + // It's not uncommon for people to write improper constraints to a generic. If the // user writes a constraint that is an expression and not an actual type, then parse // it out as an expression (so we can recover well), but report that a type is needed // instead. @@ -2294,7 +2294,7 @@ module ts { if (getFullWidth(node.name) === 0 && node.flags === 0 && isModifier(token)) { // in cases like - // 'use strict' + // 'use strict' // function foo(static) // isParameter('static') === true, because of isModifier('static') // however 'static' is not a legal identifier in a strict mode. @@ -2341,7 +2341,7 @@ module ts { } } - // Note: after careful analysis of the grammar, it does not appear to be possible to + // Note: after careful analysis of the grammar, it does not appear to be possible to // have 'Yield' And 'GeneratorParameter' not in sync. i.e. any production calling // this FormalParameters production either always sets both to true, or always sets // both to false. As such we only have a single parameter to represent both. @@ -2388,7 +2388,7 @@ module ts { } function parseTypeMemberSemicolon() { - // We allow type members to be separated by commas or (possibly ASI) semicolons. + // We allow type members to be separated by commas or (possibly ASI) semicolons. // First check if it was a comma. If so, we're done with the member. if (parseOptional(SyntaxKind.CommaToken)) { return; @@ -2561,9 +2561,9 @@ module ts { case SyntaxKind.NumericLiteral: return parsePropertyOrMethodSignature(); default: - // Index declaration as allowed as a type member. But as per the grammar, + // Index declaration as allowed as a type member. But as per the grammar, // they also allow modifiers. So we have to check for an index declaration - // that might be following modifiers. This ensures that things work properly + // that might be following modifiers. This ensures that things work properly // when incrementally parsing as the parser will produce the Index declaration // if it has the same text regardless of whether it is inside a class or an // object type. @@ -2844,7 +2844,7 @@ module ts { function parseExpression(): Expression { // Expression[in]: - // AssignmentExpression[in] + // AssignmentExpression[in] // Expression[in] , AssignmentExpression[in] let expr = parseAssignmentExpressionOrHigher(); @@ -2860,13 +2860,13 @@ module ts { // It's not uncommon during typing for the user to miss writing the '=' token. Check if // there is no newline after the last token and if we're on an expression. If so, parse // this as an equals-value clause with a missing equals. - // NOTE: There are two places where we allow equals-value clauses. The first is in a + // NOTE: There are two places where we allow equals-value clauses. The first is in a // variable declarator. The second is with a parameter. For variable declarators // it's more likely that a { would be a allowed (as an object literal). While this // is also allowed for parameters, the risk is that we consume the { as an object // literal when it really will be for the block following the parameter. if (scanner.hasPrecedingLineBreak() || (inParameter && token === SyntaxKind.OpenBraceToken) || !isStartOfExpression()) { - // preceding line break, open brace in a parameter (likely a function body) or current token is not an expression - + // preceding line break, open brace in a parameter (likely a function body) or current token is not an expression - // do not try to parse initializer return undefined; } @@ -2887,17 +2887,17 @@ module ts { // 4) ArrowFunctionExpression[?in,?yield] // 5) [+Yield] YieldExpression[?In] // - // Note: for ease of implementation we treat productions '2' and '3' as the same thing. + // Note: for ease of implementation we treat productions '2' and '3' as the same thing. // (i.e. they're both BinaryExpressions with an assignment operator in it). // First, do the simple check if we have a YieldExpression (production '5'). if (isYieldExpression()) { return parseYieldExpression(); - } + } // Then, check if we have an arrow function (production '4') that starts with a parenthesized // parameter list. If we do, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is - // not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done + // not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done // with AssignmentExpression if we see one. let arrowExpression = tryParseParenthesizedArrowFunctionExpression(); if (arrowExpression) { @@ -2908,9 +2908,9 @@ module ts { // start with a LogicalOrExpression, while the assignment productions can only start with // LeftHandSideExpressions. // - // So, first, we try to just parse out a BinaryExpression. If we get something that is a - // LeftHandSide or higher, then we can try to parse out the assignment expression part. - // Otherwise, we try to parse out the conditional expression bit. We want to allow any + // So, first, we try to just parse out a BinaryExpression. If we get something that is a + // LeftHandSide or higher, then we can try to parse out the assignment expression part. + // Otherwise, we try to parse out the conditional expression bit. We want to allow any // binary expression here, so we pass in the 'lowest' precedence here so that it matches // and consumes anything. let expr = parseBinaryExpressionOrHigher(/*precedence:*/ 0); @@ -2918,12 +2918,12 @@ module ts { // To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single // identifier and the current token is an arrow. - if (expr.kind === SyntaxKind.Identifier && token === SyntaxKind.EqualsGreaterThanToken) { + if (expr.kind === SyntaxKind.Identifier && token === SyntaxKind.EqualsGreaterThanToken && !scanner.hasPrecedingLineBreak()) { return parseSimpleArrowFunctionExpression(expr); } // Now see if we might be in cases '2' or '3'. - // If the expression was a LHS expression, and we have an assignment operator, then + // If the expression was a LHS expression, and we have an assignment operator, then // we're in '2' or '3'. Consume the assignment and return. // // Note: we call reScanGreaterToken so that we get an appropriately merged token @@ -2938,7 +2938,7 @@ module ts { function isYieldExpression(): boolean { if (token === SyntaxKind.YieldKeyword) { - // If we have a 'yield' keyword, and htis is a context where yield expressions are + // If we have a 'yield' keyword, and htis is a context where yield expressions are // allowed, then definitely parse out a yield expression. if (inYieldContext()) { return true; @@ -2953,12 +2953,12 @@ module ts { // We're in a context where 'yield expr' is not allowed. However, if we can // definitely tell that the user was trying to parse a 'yield expr' and not // just a normal expr that start with a 'yield' identifier, then parse out - // a 'yield expr'. We can then report an error later that they are only + // a 'yield expr'. We can then report an error later that they are only // allowed in generator expressions. - // + // // for example, if we see 'yield(foo)', then we'll have to treat that as an // invocation expression of something called 'yield'. However, if we have - // 'yield foo' then that is not legal as a normal expression, so we can + // 'yield foo' then that is not legal as a normal expression, so we can // definitely recognize this as a yield expression. // // for now we just check if the next token is an identifier. More heuristics @@ -2997,7 +2997,7 @@ module ts { return finishNode(node); } else { - // if the next token is not on the same line as yield. or we don't have an '*' or + // if the next token is not on the same line as yield. or we don't have an '*' or // the start of an expressin, then this is just a simple "yield" expression. return finishNode(node); } @@ -3043,7 +3043,7 @@ module ts { return undefined; } - // If we have an arrow, then try to parse the body. Even if not, try to parse if we + // If we have an arrow, then try to parse the body. Even if not, try to parse if we // have an opening brace, just in case we're in an error state. if (parseExpected(SyntaxKind.EqualsGreaterThanToken) || token === SyntaxKind.OpenBraceToken) { arrowFunction.body = parseArrowFunctionExpressionBody(); @@ -3146,7 +3146,7 @@ module ts { // If we're speculatively parsing a signature for a parenthesized arrow function, then // we have to have a complete parameter list. Otherwise we might see something like // a => (b => c) - // And think that "(b =>" was actually a parenthesized arrow function with a missing + // And think that "(b =>" was actually a parenthesized arrow function with a missing // close paren. fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ !allowAmbiguity, node); @@ -3168,6 +3168,11 @@ module ts { return undefined; } + // Must be no line terminator before token `=>`. + if (scanner.hasPrecedingLineBreak()) { + return undefined; + } + return node; } @@ -3179,7 +3184,7 @@ module ts { if (isStartOfStatement(/*inErrorRecovery:*/ true) && !isStartOfExpressionStatement() && token !== SyntaxKind.FunctionKeyword) { // Check if we got a plain statement (i.e. no expression-statements, no functions expressions/declarations) // - // Here we try to recover from a potential error situation in the case where the + // Here we try to recover from a potential error situation in the case where the // user meant to supply a block. For example, if the user wrote: // // a => @@ -3204,10 +3209,10 @@ module ts { return leftOperand; } - // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and - // we do not that for the 'whenFalse' part. + // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and + // we do not that for the 'whenFalse' part. let node = createNode(SyntaxKind.ConditionalExpression, leftOperand.pos); - node.condition = leftOperand; + node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = allowInAnd(parseAssignmentExpressionOrHigher); node.colonToken = parseExpectedToken(SyntaxKind.ColonToken, /*reportAtCurrentPosition:*/ false, @@ -3227,7 +3232,7 @@ module ts { function parseBinaryExpressionRest(precedence: number, leftOperand: Expression): Expression { while (true) { - // We either have a binary operator here, or we're finished. We call + // We either have a binary operator here, or we're finished. We call // reScanGreaterToken so that we merge token sequences like > and = into >= reScanGreaterToken(); @@ -3374,15 +3379,15 @@ module ts { function parseLeftHandSideExpressionOrHigher(): LeftHandSideExpression { // Original Ecma: - // LeftHandSideExpression: See 11.2 + // LeftHandSideExpression: See 11.2 // NewExpression - // CallExpression + // CallExpression // // Our simplification: // - // LeftHandSideExpression: See 11.2 - // MemberExpression - // CallExpression + // LeftHandSideExpression: See 11.2 + // MemberExpression + // CallExpression // // See comment in parseMemberExpressionOrHigher on how we replaced NewExpression with // MemberExpression to make our lives easier. @@ -3391,14 +3396,14 @@ module ts { // out into its own productions: // // CallExpression: - // MemberExpression Arguments + // MemberExpression Arguments // CallExpression Arguments // CallExpression[Expression] // CallExpression.IdentifierName // super ( ArgumentListopt ) // super.IdentifierName // - // Because of the recursion in these calls, we need to bottom out first. There are two + // Because of the recursion in these calls, we need to bottom out first. There are two // bottom out states we can run into. Either we see 'super' which must start either of // the last two CallExpression productions. Or we have a MemberExpression which either // completes the LeftHandSideExpression, or starts the beginning of the first four @@ -3407,7 +3412,7 @@ module ts { ? parseSuperExpression() : parseMemberExpressionOrHigher(); - // Now, we *may* be complete. However, we might have consumed the start of a + // Now, we *may* be complete. However, we might have consumed the start of a // CallExpression. As such, we need to consume the rest of it here to be complete. return parseCallExpressionRest(expression); } @@ -3417,39 +3422,39 @@ module ts { // place ObjectCreationExpression and FunctionExpression into PrimaryExpression. // like so: // - // PrimaryExpression : See 11.1 + // PrimaryExpression : See 11.1 // this // Identifier // Literal // ArrayLiteral // ObjectLiteral - // (Expression) + // (Expression) // FunctionExpression // new MemberExpression Arguments? // - // MemberExpression : See 11.2 - // PrimaryExpression + // MemberExpression : See 11.2 + // PrimaryExpression // MemberExpression[Expression] // MemberExpression.IdentifierName // - // CallExpression : See 11.2 - // MemberExpression + // CallExpression : See 11.2 + // MemberExpression // CallExpression Arguments // CallExpression[Expression] - // CallExpression.IdentifierName + // CallExpression.IdentifierName // // Technically this is ambiguous. i.e. CallExpression defines: // // CallExpression: // CallExpression Arguments - // + // // If you see: "new Foo()" // - // Then that could be treated as a single ObjectCreationExpression, or it could be + // Then that could be treated as a single ObjectCreationExpression, or it could be // treated as the invocation of "new Foo". We disambiguate that in code (to match // the original grammar) by making sure that if we see an ObjectCreationExpression // we always consume arguments if they are there. So we treat "new Foo()" as an - // object creation only, and not at all as an invocation) Another way to think + // object creation only, and not at all as an invocation) Another way to think // about this is that for every "new" that we see, we will consume an argument list if // it is there as part of the *associated* object creation node. Any additional // argument lists we see, will become invocation expressions. @@ -3539,7 +3544,7 @@ module ts { if (token === SyntaxKind.LessThanToken) { // See if this is the start of a generic invocation. If so, consume it and - // keep checking for postfix expressions. Otherwise, it's just a '<' that's + // keep checking for postfix expressions. Otherwise, it's just a '<' that's // part of an arithmetic expression. Break out so we consume it higher in the // stack. let typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -3593,8 +3598,8 @@ module ts { function canFollowTypeArgumentsInExpression(): boolean { switch (token) { - case SyntaxKind.OpenParenToken: // foo( - // this case are the only case where this token can legally follow a type argument + case SyntaxKind.OpenParenToken: // foo( + // this case are the only case where this token can legally follow a type argument // list. So we definitely want to treat this as a type arg list. case SyntaxKind.DotToken: // foo. @@ -3615,7 +3620,7 @@ module ts { case SyntaxKind.BarToken: // foo | case SyntaxKind.CloseBraceToken: // foo } case SyntaxKind.EndOfFileToken: // foo - // these cases can't legally follow a type arg list. However, they're not legal + // these cases can't legally follow a type arg list. However, they're not legal // expressions either. The user is probably in the middle of a generic type. So // treat it as such. return true; @@ -3836,7 +3841,7 @@ module ts { parseExpected(SyntaxKind.CloseParenToken); // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html - // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in + // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby // do;while(0)x will have a semicolon inserted before x. parseOptional(SyntaxKind.SemicolonToken); @@ -3974,9 +3979,9 @@ module ts { // ThrowStatement[Yield] : // throw [no LineTerminator here]Expression[In, ?Yield]; - // Because of automatic semicolon insertion, we need to report error if this + // Because of automatic semicolon insertion, we need to report error if this // throw could be terminated with a semicolon. Note: we can't call 'parseExpression' - // directly as that might consume an expression on the following line. + // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. let node = createNode(SyntaxKind.ThrowStatement); @@ -4046,9 +4051,9 @@ module ts { function isStartOfStatement(inErrorRecovery: boolean): boolean { // Functions and variable statements are allowed as a statement. But as per the grammar, - // they also allow modifiers. So we have to check for those statements that might be - // following modifiers.This ensures that things work properly when incrementally parsing - // as the parser will produce the same FunctionDeclaraiton or VariableStatement if it has + // they also allow modifiers. So we have to check for those statements that might be + // following modifiers.This ensures that things work properly when incrementally parsing + // as the parser will produce the same FunctionDeclaraiton or VariableStatement if it has // the same text regardless of whether it is inside a block or not. if (isModifier(token)) { let result = lookAhead(parseVariableStatementOrFunctionDeclarationWithModifiers); @@ -4134,7 +4139,7 @@ module ts { return parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode:*/ false); case SyntaxKind.VarKeyword: case SyntaxKind.ConstKeyword: - // const here should always be parsed as const declaration because of check in 'isStatement' + // const here should always be parsed as const declaration because of check in 'isStatement' return parseVariableStatement(scanner.getStartPos(), /*modifiers:*/ undefined); case SyntaxKind.FunctionKeyword: return parseFunctionDeclaration(scanner.getStartPos(), /*modifiers:*/ undefined); @@ -4174,8 +4179,8 @@ module ts { } // Else parse it like identifier - fall through default: - // Functions and variable statements are allowed as a statement. But as per - // the grammar, they also allow modifiers. So we have to check for those + // Functions and variable statements are allowed as a statement. But as per + // the grammar, they also allow modifiers. So we have to check for those // statements that might be following modifiers. This ensures that things // work properly when incrementally parsing as the parser will produce the // same FunctionDeclaraiton or VariableStatement if it has the same text @@ -4336,7 +4341,7 @@ module ts { return finishNode(node); } - + function canFollowContextualOfKeyword(): boolean { return nextTokenIsIdentifier() && nextToken() === SyntaxKind.CloseParenToken; } @@ -4439,7 +4444,7 @@ module ts { if (token === SyntaxKind.OpenBracketToken) { return true; } - + // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. @@ -4718,7 +4723,7 @@ module ts { // import ImportClause from ModuleSpecifier ; // import ModuleSpecifier; if (identifier || // import id - token === SyntaxKind.AsteriskToken || // import * + token === SyntaxKind.AsteriskToken || // import * token === SyntaxKind.OpenBraceToken) { // import { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); parseExpected(SyntaxKind.FromKeyword); @@ -4744,7 +4749,7 @@ module ts { importClause.name = identifier; } - // If there was no default import or if there is comma token after default import + // If there was no default import or if there is comma token after default import // parse namespace or named imports if (!importClause.name || parseOptional(SyntaxKind.CommaToken)) { @@ -4770,12 +4775,12 @@ module ts { } function parseModuleSpecifier(): Expression { - // We allow arbitrary expressions here, even though the grammar only allows string + // We allow arbitrary expressions here, even though the grammar only allows string // literals. We check to ensure that it is only a string literal later in the grammar // walker. let result = parseExpression(); - // Ensure the string being required is in our 'identifier' table. This will ensure - // that features like 'find refs' will look inside this file when search for its name. + // Ensure the string being required is in our 'identifier' table. This will ensure + // that features like 'find refs' will look inside this file when search for its name. if (result.kind === SyntaxKind.StringLiteral) { internIdentifier((result).text); } @@ -5013,8 +5018,8 @@ module ts { let amdDependencies: {path: string; name: string}[] = []; let amdModuleName: string; - // Keep scanning all the leading trivia in the file until we get to something that - // isn't trivia. Any single line comment will be analyzed to see if it is a + // Keep scanning all the leading trivia in the file until we get to something that + // isn't trivia. Any single line comment will be analyzed to see if it is a // reference comment. while (true) { let kind = triviaScanner.scan(); diff --git a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt new file mode 100644 index 00000000000..0450903f717 --- /dev/null +++ b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt @@ -0,0 +1,70 @@ +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(2,5): error TS1109: Expression expected. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(4,7): error TS1109: Expression expected. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(6,5): error TS1109: Expression expected. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(8,7): error TS1109: Expression expected. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(10,5): error TS1109: Expression expected. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(12,7): error TS1109: Expression expected. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(14,5): error TS1109: Expression expected. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(16,7): error TS1109: Expression expected. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(19,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(20,5): error TS1109: Expression expected. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(21,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(22,5): error TS1109: Expression expected. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(22,17): error TS1005: ':' expected. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(22,22): error TS1005: ',' expected. + + +==== tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts (14 errors) ==== + var f1 = () + => { } + ~~ +!!! error TS1109: Expression expected. + var f2 = (x: string, y: string) /* + */ => { } + ~~ +!!! error TS1109: Expression expected. + var f3 = (x: string, y: number, ...rest) + => { } + ~~ +!!! error TS1109: Expression expected. + var f4 = (x: string, y: number, ...rest) /* + */ => { } + ~~ +!!! error TS1109: Expression expected. + var f5 = (...rest) + => { } + ~~ +!!! error TS1109: Expression expected. + var f6 = (...rest) /* + */ => { } + ~~ +!!! error TS1109: Expression expected. + var f7 = (x: string, y: number, z = 10) + => { } + ~~ +!!! error TS1109: Expression expected. + var f8 = (x: string, y: number, z = 10) /* + */ => { } + ~~ +!!! error TS1109: Expression expected. + + function foo(func: () => boolean) { } + foo(() + ~~~~~~ + => true); + ~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~ +!!! error TS1109: Expression expected. + foo(() + ~~~~~~ + => { return false; }); + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + ~~ +!!! error TS1109: Expression expected. + ~~~~~ +!!! error TS1005: ':' expected. + ~ +!!! error TS1005: ',' expected. + \ No newline at end of file diff --git a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.js b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.js new file mode 100644 index 00000000000..c98b6a89d4f --- /dev/null +++ b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.js @@ -0,0 +1,60 @@ +//// [disallowLineTerminatorBeforeArrow.ts] +var f1 = () + => { } +var f2 = (x: string, y: string) /* + */ => { } +var f3 = (x: string, y: number, ...rest) + => { } +var f4 = (x: string, y: number, ...rest) /* + */ => { } +var f5 = (...rest) + => { } +var f6 = (...rest) /* + */ => { } +var f7 = (x: string, y: number, z = 10) + => { } +var f8 = (x: string, y: number, z = 10) /* + */ => { } + +function foo(func: () => boolean) { } +foo(() + => true); +foo(() + => { return false; }); + + +//// [disallowLineTerminatorBeforeArrow.js] +var f1 = ; +{ +} +var f2 = ; /* + */ +{ +} +var f3 = ; +{ +} +var f4 = ; /* + */ +{ +} +var f5 = ; +{ +} +var f6 = ; /* + */ +{ +} +var f7 = ; +{ +} +var f8 = ; /* + */ +{ +} +function foo(func) { +} +foo(, true); +foo(, { + return: false +}); diff --git a/tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts b/tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts new file mode 100644 index 00000000000..316ff92c56c --- /dev/null +++ b/tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts @@ -0,0 +1,22 @@ +var f1 = () + => { } +var f2 = (x: string, y: string) /* + */ => { } +var f3 = (x: string, y: number, ...rest) + => { } +var f4 = (x: string, y: number, ...rest) /* + */ => { } +var f5 = (...rest) + => { } +var f6 = (...rest) /* + */ => { } +var f7 = (x: string, y: number, z = 10) + => { } +var f8 = (x: string, y: number, z = 10) /* + */ => { } + +function foo(func: () => boolean) { } +foo(() + => true); +foo(() + => { return false; }); From dd16fed21e5cf96e87a27ce25c5fe3bdb3ece9f0 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Tue, 10 Mar 2015 17:11:25 -0400 Subject: [PATCH 089/101] Perform error reporting in checker --- src/compiler/checker.ts | 12 ++- .../diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 + src/compiler/parser.ts | 14 ++- src/compiler/types.ts | 44 +++++----- .../baselines/reference/APISample_compile.js | 3 + .../reference/APISample_compile.types | 7 ++ tests/baselines/reference/APISample_linter.js | 3 + .../reference/APISample_linter.types | 7 ++ .../reference/APISample_transform.js | 3 + .../reference/APISample_transform.types | 7 ++ .../baselines/reference/APISample_watcher.js | 3 + .../reference/APISample_watcher.types | 7 ++ ...sallowLineTerminatorBeforeArrow.errors.txt | 86 +++++++++---------- .../disallowLineTerminatorBeforeArrow.js | 70 ++++++++------- 15 files changed, 166 insertions(+), 105 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0dacb20ece4..dae254253ca 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11377,7 +11377,17 @@ module ts { function checkGrammarFunctionLikeDeclaration(node: FunctionLikeDeclaration): boolean { // Prevent cascading error by short-circuit - return checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters) || checkGrammarParameterList(node.parameters); + return checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters) || checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node); + } + + function checkGrammarArrowFunction(node: FunctionLikeDeclaration): boolean { + if (node.kind === SyntaxKind.ArrowFunction) { + if ((node).lineTerminatorBeforeArrow) { + grammarErrorOnNode(node, Diagnostics.Line_terminator_not_permitted_before_arrow); + return true; + } + } + return false; } function checkGrammarIndexSignatureParameters(node: SignatureDeclaration): boolean { diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index d40fcd25ce0..556df1565b0 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -157,6 +157,7 @@ module ts { Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: DiagnosticCategory.Error, key: "Catch clause variable cannot have an initializer." }, An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: DiagnosticCategory.Error, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, Unterminated_Unicode_escape_sequence: { code: 1199, category: DiagnosticCategory.Error, key: "Unterminated Unicode escape sequence." }, + Line_terminator_not_permitted_before_arrow: { code: 1200, category: DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index c4121e92251..0c00d8c974c 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -619,6 +619,10 @@ "category": "Error", "code": 1199 }, + "Line terminator not permitted before arrow.": { + "category": "Error", + "code": 1200 + }, "Duplicate identifier '{0}'.": { "category": "Error", "code": 2300 diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index fc02c3f3eef..06655b1d822 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2918,7 +2918,7 @@ module ts { // To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single // identifier and the current token is an arrow. - if (expr.kind === SyntaxKind.Identifier && token === SyntaxKind.EqualsGreaterThanToken && !scanner.hasPrecedingLineBreak()) { + if (expr.kind === SyntaxKind.Identifier && token === SyntaxKind.EqualsGreaterThanToken) { return parseSimpleArrowFunctionExpression(expr); } @@ -3007,7 +3007,7 @@ module ts { Debug.assert(token === SyntaxKind.EqualsGreaterThanToken, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); let node = createNode(SyntaxKind.ArrowFunction, identifier.pos); - + let parameter = createNode(SyntaxKind.Parameter, identifier.pos); parameter.name = identifier; finishNode(parameter); @@ -3016,6 +3016,7 @@ module ts { node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; + node.lineTerminatorBeforeArrow = scanner.hasPrecedingLineBreak(); parseExpected(SyntaxKind.EqualsGreaterThanToken); node.body = parseArrowFunctionExpressionBody(); @@ -3140,8 +3141,8 @@ module ts { } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity: boolean): FunctionExpression { - let node = createNode(SyntaxKind.ArrowFunction); - // Arrow functions are never generators. + let node = createNode(SyntaxKind.ArrowFunction); + // Arrow functions are never generators. // // If we're speculatively parsing a signature for a parenthesized arrow function, then // we have to have a complete parameter list. Otherwise we might see something like @@ -3168,10 +3169,7 @@ module ts { return undefined; } - // Must be no line terminator before token `=>`. - if (scanner.hasPrecedingLineBreak()) { - return undefined; - } + node.lineTerminatorBeforeArrow = scanner.hasPrecedingLineBreak(); return node; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index c43591911ab..56820a10924 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -329,7 +329,7 @@ module ts { // If the parser encountered an error when parsing the code that created this node. Note // the parser only sets this directly on the node it creates right after encountering the - // error. + // error. ThisNodeHasError = 1 << 4, // Context flags set directly by the parser. @@ -337,7 +337,7 @@ module ts { // Context flags computed by aggregating child flags upwards. - // Used during incremental parsing to determine if this node or any of its children had an + // Used during incremental parsing to determine if this node or any of its children had an // error. Computed only once and then cached. ThisNodeOrAnySubNodesHasError = 1 << 5, @@ -354,7 +354,7 @@ module ts { export interface Node extends TextRange { kind: SyntaxKind; flags: NodeFlags; - // Specific context the parser was in when this node was created. Normally undefined. + // Specific context the parser was in when this node was created. Normally undefined. // Only set when the parser was in some interesting context (like async/yield). parserContextFlags?: ParserContextFlags; modifiers?: ModifiersArray; // Array of modifiers @@ -524,7 +524,7 @@ module ts { body?: Block; } - // See the comment on MethodDeclaration for the intuition behind AccessorDeclaration being a + // See the comment on MethodDeclaration for the intuition behind AccessorDeclaration being a // ClassElement and an ObjectLiteralElement. export interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { _accessorDeclarationBrand: any; @@ -575,12 +575,12 @@ module ts { export interface StringLiteralTypeNode extends LiteralExpression, TypeNode { } - // Note: 'brands' in our syntax nodes serve to give us a small amount of nominal typing. + // Note: 'brands' in our syntax nodes serve to give us a small amount of nominal typing. // Consider 'Expression'. Without the brand, 'Expression' is actually no different // (structurally) than 'Node'. Because of this you can pass any Node to a function that // takes an Expression without any error. By using the 'brands' we ensure that the type - // checker actually thinks you have something of the right type. Note: the brands are - // never actually given values. At runtime they have zero cost. + // checker actually thinks you have something of the right type. Note: the brands are + // never actually given values. At runtime they have zero cost. export interface Expression extends Node { _expressionBrand: any; @@ -653,6 +653,10 @@ module ts { body: Block | Expression; // Required, whereas the member inherited from FunctionDeclaration is optional } + export interface ArrowFunctionExpression extends FunctionExpression { + lineTerminatorBeforeArrow: boolean; + } + // The text property of a LiteralExpression stores the interpreted value of the literal in text form. For a StringLiteral, // or any literal of a template, this means quotes have been removed and escapes have been converted to actual characters. // For a NumericLiteral, the stored value is the toString() representation of the number. For example 1, 1.00, and 1e0 are all stored as just "1". @@ -735,7 +739,7 @@ module ts { } export interface VariableStatement extends Statement { - declarationList: VariableDeclarationList; + declarationList: VariableDeclarationList; } export interface ExpressionStatement extends Statement { @@ -903,7 +907,7 @@ module ts { moduleSpecifier: Expression; } - // In case of: + // In case of: // import d from "mod" => name = d, namedBinding = undefined // import * as ns from "mod" => name = undefined, namedBinding: NamespaceImport = { name: ns } // import d, * as ns from "mod" => name = d, namedBinding: NamespaceImport = { name: ns } @@ -969,7 +973,7 @@ module ts { externalModuleIndicator: Node; languageVersion: ScriptTarget; identifiers: Map; - + /* @internal */ nodeCount: number; /* @internal */ identifierCount: number; /* @internal */ symbolCount: number; @@ -977,10 +981,10 @@ module ts { // File level diagnostics reported by the parser (includes diagnostics about /// references // as well as code diagnostics). /* @internal */ parseDiagnostics: Diagnostic[]; - + // File level diagnostics reported by the binder. /* @internal */ bindDiagnostics: Diagnostic[]; - + // Stores a line map for the file. // This field should never be used directly to obtain line map, use getLineMap function instead. /* @internal */ lineMap: number[]; @@ -1000,10 +1004,10 @@ module ts { getSourceFiles(): SourceFile[]; /** - * Emits the javascript and declaration files. If targetSourceFile is not specified, then + * Emits the javascript and declaration files. If targetSourceFile is not specified, then * the javascript and declaration files will be produced for all the files in this program. * If targetSourceFile is specified, then only the javascript and declaration for that - * specific file will be generated. + * specific file will be generated. * * If writeFile is not specified then the writeFile callback from the compiler host will be * used for writing the javascript and declaration files. Otherwise, the writeFile parameter @@ -1021,7 +1025,7 @@ module ts { getCommonSourceDirectory(): string; - // For testing purposes only. Should not be used by any other consumers (including the + // For testing purposes only. Should not be used by any other consumers (including the // language service). /* @internal */ getDiagnosticsProducingTypeChecker(): TypeChecker; @@ -1058,7 +1062,7 @@ module ts { // when -version or -help was provided, or this was a normal compilation, no diagnostics // were produced, and all outputs were generated successfully. Success = 0, - + // Diagnostics were produced and because of them no code was generated. DiagnosticsPresent_OutputsSkipped = 1, @@ -1168,12 +1172,12 @@ module ts { // Write symbols's type argument if it is instantiated symbol // eg. class C { p: T } <-- Show p as C.p here - // var a: C; + // var a: C; // var p = a.p; <--- Here p is property of C so show it as C.p instead of just C.p - WriteTypeParametersOrArguments = 0x00000001, + WriteTypeParametersOrArguments = 0x00000001, // Use only external alias information to get the symbol name in the given context - // eg. module m { export class c { } } import x = m.c; + // eg. module m { export class c { } } import x = m.c; // When this flag is specified m.c will be used to refer to the class instead of alias symbol x UseOnlyExternalAliasing = 0x00000002, } @@ -1778,7 +1782,7 @@ module ts { // Gets a count of how many times this collection has been modified. This value changes // each time 'add' is called (regardless of whether or not an equivalent diagnostic was // already in the collection). As such, it can be used as a simple way to tell if any - // operation caused diagnostics to be returned by storing and comparing the return value + // operation caused diagnostics to be returned by storing and comparing the return value // of this method before/after the operation is performed. getModificationCount(): number; } diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 98571823181..316649a35c9 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -553,6 +553,9 @@ declare module "typescript" { name?: Identifier; body: Block | Expression; } + interface ArrowFunctionExpression extends FunctionExpression { + lineTerminatorBeforeArrow: boolean; + } interface LiteralExpression extends PrimaryExpression { text: string; isUnterminated?: boolean; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 087c0389d0f..bf51bb946c0 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -1668,6 +1668,13 @@ declare module "typescript" { >body : Expression | Block >Block : Block >Expression : Expression + } + interface ArrowFunctionExpression extends FunctionExpression { +>ArrowFunctionExpression : ArrowFunctionExpression +>FunctionExpression : FunctionExpression + + lineTerminatorBeforeArrow: boolean; +>lineTerminatorBeforeArrow : boolean } interface LiteralExpression extends PrimaryExpression { >LiteralExpression : LiteralExpression diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index d43d6220072..5f7dc308820 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -584,6 +584,9 @@ declare module "typescript" { name?: Identifier; body: Block | Expression; } + interface ArrowFunctionExpression extends FunctionExpression { + lineTerminatorBeforeArrow: boolean; + } interface LiteralExpression extends PrimaryExpression { text: string; isUnterminated?: boolean; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 14eb2936242..ede73749eb0 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -1814,6 +1814,13 @@ declare module "typescript" { >body : Expression | Block >Block : Block >Expression : Expression + } + interface ArrowFunctionExpression extends FunctionExpression { +>ArrowFunctionExpression : ArrowFunctionExpression +>FunctionExpression : FunctionExpression + + lineTerminatorBeforeArrow: boolean; +>lineTerminatorBeforeArrow : boolean } interface LiteralExpression extends PrimaryExpression { >LiteralExpression : LiteralExpression diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index bfe62135a0d..2d39e9a3c0c 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -585,6 +585,9 @@ declare module "typescript" { name?: Identifier; body: Block | Expression; } + interface ArrowFunctionExpression extends FunctionExpression { + lineTerminatorBeforeArrow: boolean; + } interface LiteralExpression extends PrimaryExpression { text: string; isUnterminated?: boolean; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index baa497c95fa..d9d1482fbc8 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -1764,6 +1764,13 @@ declare module "typescript" { >body : Expression | Block >Block : Block >Expression : Expression + } + interface ArrowFunctionExpression extends FunctionExpression { +>ArrowFunctionExpression : ArrowFunctionExpression +>FunctionExpression : FunctionExpression + + lineTerminatorBeforeArrow: boolean; +>lineTerminatorBeforeArrow : boolean } interface LiteralExpression extends PrimaryExpression { >LiteralExpression : LiteralExpression diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index ee1fd062515..7fa2a92afae 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -622,6 +622,9 @@ declare module "typescript" { name?: Identifier; body: Block | Expression; } + interface ArrowFunctionExpression extends FunctionExpression { + lineTerminatorBeforeArrow: boolean; + } interface LiteralExpression extends PrimaryExpression { text: string; isUnterminated?: boolean; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index a8b534439d5..23f7ffb7148 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -1937,6 +1937,13 @@ declare module "typescript" { >body : Expression | Block >Block : Block >Expression : Expression + } + interface ArrowFunctionExpression extends FunctionExpression { +>ArrowFunctionExpression : ArrowFunctionExpression +>FunctionExpression : FunctionExpression + + lineTerminatorBeforeArrow: boolean; +>lineTerminatorBeforeArrow : boolean } interface LiteralExpression extends PrimaryExpression { >LiteralExpression : LiteralExpression diff --git a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt index 0450903f717..c64d42b7fff 100644 --- a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt +++ b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt @@ -1,70 +1,66 @@ -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(2,5): error TS1109: Expression expected. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(4,7): error TS1109: Expression expected. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(6,5): error TS1109: Expression expected. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(8,7): error TS1109: Expression expected. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(10,5): error TS1109: Expression expected. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(12,7): error TS1109: Expression expected. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(14,5): error TS1109: Expression expected. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(16,7): error TS1109: Expression expected. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(19,1): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(20,5): error TS1109: Expression expected. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(21,1): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(22,5): error TS1109: Expression expected. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(22,17): error TS1005: ':' expected. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(22,22): error TS1005: ',' expected. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(1,10): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(3,10): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(5,10): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(7,10): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(9,10): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(11,10): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(13,10): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(15,10): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(19,5): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(21,5): error TS1200: Line terminator not permitted before arrow. -==== tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts (14 errors) ==== +==== tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts (10 errors) ==== var f1 = () + ~~ => { } - ~~ -!!! error TS1109: Expression expected. + ~~~~~~~~~~ +!!! error TS1200: Line terminator not permitted before arrow. var f2 = (x: string, y: string) /* + ~~~~~~~~~~~~~~~~~~~~~~~~~ */ => { } - ~~ -!!! error TS1109: Expression expected. + ~~~~~~~~~~~~ +!!! error TS1200: Line terminator not permitted before arrow. var f3 = (x: string, y: number, ...rest) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => { } - ~~ -!!! error TS1109: Expression expected. + ~~~~~~~~~~ +!!! error TS1200: Line terminator not permitted before arrow. var f4 = (x: string, y: number, ...rest) /* + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ => { } - ~~ -!!! error TS1109: Expression expected. + ~~~~~~~~~~~~ +!!! error TS1200: Line terminator not permitted before arrow. var f5 = (...rest) + ~~~~~~~~~ => { } - ~~ -!!! error TS1109: Expression expected. + ~~~~~~~~~~ +!!! error TS1200: Line terminator not permitted before arrow. var f6 = (...rest) /* + ~~~~~~~~~~~~ */ => { } - ~~ -!!! error TS1109: Expression expected. + ~~~~~~~~~~~~ +!!! error TS1200: Line terminator not permitted before arrow. var f7 = (x: string, y: number, z = 10) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => { } - ~~ -!!! error TS1109: Expression expected. + ~~~~~~~~~~ +!!! error TS1200: Line terminator not permitted before arrow. var f8 = (x: string, y: number, z = 10) /* + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ => { } - ~~ -!!! error TS1109: Expression expected. + ~~~~~~~~~~~~ +!!! error TS1200: Line terminator not permitted before arrow. function foo(func: () => boolean) { } foo(() - ~~~~~~ + ~~ => true); - ~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. - ~~ -!!! error TS1109: Expression expected. + ~~~~~~~~~~~ +!!! error TS1200: Line terminator not permitted before arrow. foo(() - ~~~~~~ - => { return false; }); - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2346: Supplied parameters do not match any signature of call target. ~~ -!!! error TS1109: Expression expected. - ~~~~~ -!!! error TS1005: ':' expected. - ~ -!!! error TS1005: ',' expected. + => { return false; }); + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1200: Line terminator not permitted before arrow. \ No newline at end of file diff --git a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.js b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.js index c98b6a89d4f..2619b41bf38 100644 --- a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.js +++ b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.js @@ -24,37 +24,45 @@ foo(() //// [disallowLineTerminatorBeforeArrow.js] -var f1 = ; -{ -} -var f2 = ; /* - */ -{ -} -var f3 = ; -{ -} -var f4 = ; /* - */ -{ -} -var f5 = ; -{ -} -var f6 = ; /* - */ -{ -} -var f7 = ; -{ -} -var f8 = ; /* - */ -{ -} +var f1 = function () { +}; +var f2 = function (x, y) { +}; +var f3 = function (x, y) { + var rest = []; + for (var _i = 2; _i < arguments.length; _i++) { + rest[_i - 2] = arguments[_i]; + } +}; +var f4 = function (x, y) { + var rest = []; + for (var _i = 2; _i < arguments.length; _i++) { + rest[_i - 2] = arguments[_i]; + } +}; +var f5 = function () { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } +}; +var f6 = function () { + var rest = []; + for (var _i = 0; _i < arguments.length; _i++) { + rest[_i - 0] = arguments[_i]; + } +}; +var f7 = function (x, y, z) { + if (z === void 0) { z = 10; } +}; +var f8 = function (x, y, z) { + if (z === void 0) { z = 10; } +}; function foo(func) { } -foo(, true); -foo(, { - return: false +foo(function () { + return true; +}); +foo(function () { + return false; }); From 231f522d8967dd103246ed4f7aeb2048b7ffff64 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Tue, 10 Mar 2015 17:20:28 -0400 Subject: [PATCH 090/101] Add additional test-cases for arrow function grammar As suggested by @DanielRosenwasser --- ...sallowLineTerminatorBeforeArrow.errors.txt | 37 +++++++++++++++- .../disallowLineTerminatorBeforeArrow.js | 42 +++++++++++++++++++ .../disallowLineTerminatorBeforeArrow.ts | 19 +++++++++ 3 files changed, 97 insertions(+), 1 deletion(-) diff --git a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt index c64d42b7fff..e9f07998504 100644 --- a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt +++ b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt @@ -8,9 +8,13 @@ tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(1 tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(15,10): error TS1200: Line terminator not permitted before arrow. tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(19,5): error TS1200: Line terminator not permitted before arrow. tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(21,5): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(26,40): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(30,20): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(35,17): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(39,20): error TS1200: Line terminator not permitted before arrow. -==== tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts (10 errors) ==== +==== tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts (14 errors) ==== var f1 = () ~~ => { } @@ -63,4 +67,35 @@ tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(2 => { return false; }); ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1200: Line terminator not permitted before arrow. + + module m { + class City { + constructor(x: number, thing = () + ~~ + => 100) { + ~~~~~~~~~~~~~~~~~~ +!!! error TS1200: Line terminator not permitted before arrow. + } + + public m = () + ~~ + => 2 * 2 * 2 + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1200: Line terminator not permitted before arrow. + } + + export enum Enum { + claw = (() + ~~ + => 10)() + ~~~~~~~~~~~~~~~~~ +!!! error TS1200: Line terminator not permitted before arrow. + } + + export var v = x + ~ + => new City(Enum.claw); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1200: Line terminator not permitted before arrow. + } \ No newline at end of file diff --git a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.js b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.js index 2619b41bf38..122c229d7d9 100644 --- a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.js +++ b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.js @@ -21,6 +21,25 @@ foo(() => true); foo(() => { return false; }); + +module m { + class City { + constructor(x: number, thing = () + => 100) { + } + + public m = () + => 2 * 2 * 2 + } + + export enum Enum { + claw = (() + => 10)() + } + + export var v = x + => new City(Enum.claw); +} //// [disallowLineTerminatorBeforeArrow.js] @@ -66,3 +85,26 @@ foo(function () { foo(function () { return false; }); +var m; +(function (m) { + var City = (function () { + function City(x, thing) { + if (thing === void 0) { thing = function () { + return 100; + }; } + this.m = function () { + return 2 * 2 * 2; + }; + } + return City; + })(); + (function (Enum) { + Enum[Enum["claw"] = (function () { + return 10; + })()] = "claw"; + })(m.Enum || (m.Enum = {})); + var Enum = m.Enum; + m.v = function (x) { + return new City(Enum.claw); + }; +})(m || (m = {})); diff --git a/tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts b/tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts index 316ff92c56c..f11fed6b478 100644 --- a/tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts +++ b/tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts @@ -20,3 +20,22 @@ foo(() => true); foo(() => { return false; }); + +module m { + class City { + constructor(x: number, thing = () + => 100) { + } + + public m = () + => 2 * 2 * 2 + } + + export enum Enum { + claw = (() + => 10)() + } + + export var v = x + => new City(Enum.claw); +} From aa3cefb63d75ec91b50717ffb41e994b6dd0b3f6 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Tue, 10 Mar 2015 20:59:16 -0400 Subject: [PATCH 091/101] Check that arrow is on same line as parameters --- src/compiler/checker.ts | 11 +-- src/compiler/parser.ts | 19 ++--- src/compiler/types.ts | 4 +- .../baselines/reference/APISample_compile.js | 4 +- .../reference/APISample_compile.types | 12 ++-- tests/baselines/reference/APISample_linter.js | 4 +- .../reference/APISample_linter.types | 12 ++-- .../reference/APISample_transform.js | 4 +- .../reference/APISample_transform.types | 12 ++-- .../baselines/reference/APISample_watcher.js | 4 +- .../reference/APISample_watcher.types | 12 ++-- ...sallowLineTerminatorBeforeArrow.errors.txt | 70 ++++++++----------- 12 files changed, 82 insertions(+), 86 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index dae254253ca..8322bb7c5d3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11381,11 +11381,12 @@ module ts { } function checkGrammarArrowFunction(node: FunctionLikeDeclaration): boolean { - if (node.kind === SyntaxKind.ArrowFunction) { - if ((node).lineTerminatorBeforeArrow) { - grammarErrorOnNode(node, Diagnostics.Line_terminator_not_permitted_before_arrow); - return true; - } + if (node.kind === SyntaxKind.ArrowFunction && (node).arrow) { + var arrowFunction = node; + var sourceFile = getSourceFileOfNode(node); + if (getLineAndCharacterOfPosition(sourceFile, getTokenPosOfNode(arrowFunction.arrow, sourceFile)).line !== getLineAndCharacterOfPosition(sourceFile, arrowFunction.parameters.end).line) { + return grammarErrorOnNode(arrowFunction.arrow, Diagnostics.Line_terminator_not_permitted_before_arrow); + } } return false; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 06655b1d822..6b010f584a2 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -95,6 +95,7 @@ module ts { visitNodes(cbNodes, (node).typeParameters) || visitNodes(cbNodes, (node).parameters) || visitNode(cbNode, (node).type) || + visitNode(cbNode, (node).arrow) || visitNode(cbNode, (node).body); case SyntaxKind.TypeReference: return visitNode(cbNode, (node).typeName) || @@ -3006,18 +3007,19 @@ module ts { function parseSimpleArrowFunctionExpression(identifier: Identifier): Expression { Debug.assert(token === SyntaxKind.EqualsGreaterThanToken, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - let node = createNode(SyntaxKind.ArrowFunction, identifier.pos); + let node = createNode(SyntaxKind.ArrowFunction, identifier.pos); let parameter = createNode(SyntaxKind.Parameter, identifier.pos); - parameter.name = identifier; + parameter.name = identifier; finishNode(parameter); node.parameters = >[parameter]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; - node.lineTerminatorBeforeArrow = scanner.hasPrecedingLineBreak(); - parseExpected(SyntaxKind.EqualsGreaterThanToken); + if ((node.arrow = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, false, Diagnostics._0_expected, "=>"))) { + node.arrow.parent = node; + } node.body = parseArrowFunctionExpressionBody(); return finishNode(node); @@ -3046,7 +3048,8 @@ module ts { // If we have an arrow, then try to parse the body. Even if not, try to parse if we // have an opening brace, just in case we're in an error state. - if (parseExpected(SyntaxKind.EqualsGreaterThanToken) || token === SyntaxKind.OpenBraceToken) { + if ((arrowFunction.arrow = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, false, Diagnostics._0_expected, "=>")) || token === SyntaxKind.OpenBraceToken) { + arrowFunction.arrow.parent = arrowFunction; arrowFunction.body = parseArrowFunctionExpressionBody(); } else { @@ -3141,9 +3144,9 @@ module ts { } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity: boolean): FunctionExpression { - let node = createNode(SyntaxKind.ArrowFunction); + let node = createNode(SyntaxKind.ArrowFunction); // Arrow functions are never generators. - // + // // If we're speculatively parsing a signature for a parenthesized arrow function, then // we have to have a complete parameter list. Otherwise we might see something like // a => (b => c) @@ -3169,8 +3172,6 @@ module ts { return undefined; } - node.lineTerminatorBeforeArrow = scanner.hasPrecedingLineBreak(); - return node; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 56820a10924..49529bed9c6 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -653,8 +653,8 @@ module ts { body: Block | Expression; // Required, whereas the member inherited from FunctionDeclaration is optional } - export interface ArrowFunctionExpression extends FunctionExpression { - lineTerminatorBeforeArrow: boolean; + export interface ArrowFunction extends Expression, FunctionLikeDeclaration { + arrow: Node; } // The text property of a LiteralExpression stores the interpreted value of the literal in text form. For a StringLiteral, diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 316649a35c9..997bd2bd337 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -553,8 +553,8 @@ declare module "typescript" { name?: Identifier; body: Block | Expression; } - interface ArrowFunctionExpression extends FunctionExpression { - lineTerminatorBeforeArrow: boolean; + interface ArrowFunction extends Expression, FunctionLikeDeclaration { + arrow: Node; } interface LiteralExpression extends PrimaryExpression { text: string; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index bf51bb946c0..d91d860ca8f 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -1669,12 +1669,14 @@ declare module "typescript" { >Block : Block >Expression : Expression } - interface ArrowFunctionExpression extends FunctionExpression { ->ArrowFunctionExpression : ArrowFunctionExpression ->FunctionExpression : FunctionExpression + interface ArrowFunction extends Expression, FunctionLikeDeclaration { +>ArrowFunction : ArrowFunction +>Expression : Expression +>FunctionLikeDeclaration : FunctionLikeDeclaration - lineTerminatorBeforeArrow: boolean; ->lineTerminatorBeforeArrow : boolean + arrow: Node; +>arrow : Node +>Node : Node } interface LiteralExpression extends PrimaryExpression { >LiteralExpression : LiteralExpression diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 5f7dc308820..b941acdbc52 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -584,8 +584,8 @@ declare module "typescript" { name?: Identifier; body: Block | Expression; } - interface ArrowFunctionExpression extends FunctionExpression { - lineTerminatorBeforeArrow: boolean; + interface ArrowFunction extends Expression, FunctionLikeDeclaration { + arrow: Node; } interface LiteralExpression extends PrimaryExpression { text: string; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index ede73749eb0..b8701020e03 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -1815,12 +1815,14 @@ declare module "typescript" { >Block : Block >Expression : Expression } - interface ArrowFunctionExpression extends FunctionExpression { ->ArrowFunctionExpression : ArrowFunctionExpression ->FunctionExpression : FunctionExpression + interface ArrowFunction extends Expression, FunctionLikeDeclaration { +>ArrowFunction : ArrowFunction +>Expression : Expression +>FunctionLikeDeclaration : FunctionLikeDeclaration - lineTerminatorBeforeArrow: boolean; ->lineTerminatorBeforeArrow : boolean + arrow: Node; +>arrow : Node +>Node : Node } interface LiteralExpression extends PrimaryExpression { >LiteralExpression : LiteralExpression diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 2d39e9a3c0c..baf3f9d8503 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -585,8 +585,8 @@ declare module "typescript" { name?: Identifier; body: Block | Expression; } - interface ArrowFunctionExpression extends FunctionExpression { - lineTerminatorBeforeArrow: boolean; + interface ArrowFunction extends Expression, FunctionLikeDeclaration { + arrow: Node; } interface LiteralExpression extends PrimaryExpression { text: string; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index d9d1482fbc8..d214a6fc959 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -1765,12 +1765,14 @@ declare module "typescript" { >Block : Block >Expression : Expression } - interface ArrowFunctionExpression extends FunctionExpression { ->ArrowFunctionExpression : ArrowFunctionExpression ->FunctionExpression : FunctionExpression + interface ArrowFunction extends Expression, FunctionLikeDeclaration { +>ArrowFunction : ArrowFunction +>Expression : Expression +>FunctionLikeDeclaration : FunctionLikeDeclaration - lineTerminatorBeforeArrow: boolean; ->lineTerminatorBeforeArrow : boolean + arrow: Node; +>arrow : Node +>Node : Node } interface LiteralExpression extends PrimaryExpression { >LiteralExpression : LiteralExpression diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 7fa2a92afae..d963aaff481 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -622,8 +622,8 @@ declare module "typescript" { name?: Identifier; body: Block | Expression; } - interface ArrowFunctionExpression extends FunctionExpression { - lineTerminatorBeforeArrow: boolean; + interface ArrowFunction extends Expression, FunctionLikeDeclaration { + arrow: Node; } interface LiteralExpression extends PrimaryExpression { text: string; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 23f7ffb7148..da00b9bf466 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -1938,12 +1938,14 @@ declare module "typescript" { >Block : Block >Expression : Expression } - interface ArrowFunctionExpression extends FunctionExpression { ->ArrowFunctionExpression : ArrowFunctionExpression ->FunctionExpression : FunctionExpression + interface ArrowFunction extends Expression, FunctionLikeDeclaration { +>ArrowFunction : ArrowFunction +>Expression : Expression +>FunctionLikeDeclaration : FunctionLikeDeclaration - lineTerminatorBeforeArrow: boolean; ->lineTerminatorBeforeArrow : boolean + arrow: Node; +>arrow : Node +>Node : Node } interface LiteralExpression extends PrimaryExpression { >LiteralExpression : LiteralExpression diff --git a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt index e9f07998504..e441752338c 100644 --- a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt +++ b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt @@ -1,101 +1,87 @@ -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(1,10): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(3,10): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(5,10): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(7,10): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(9,10): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(11,10): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(13,10): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(15,10): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(19,5): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(21,5): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(26,40): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(30,20): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(35,17): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(39,20): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(2,5): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(4,7): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(6,5): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(8,7): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(10,5): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(12,7): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(14,5): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(16,7): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(20,5): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(22,5): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(27,13): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(31,13): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(36,13): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(40,9): error TS1200: Line terminator not permitted before arrow. ==== tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts (14 errors) ==== var f1 = () - ~~ => { } - ~~~~~~~~~~ + ~~ !!! error TS1200: Line terminator not permitted before arrow. var f2 = (x: string, y: string) /* - ~~~~~~~~~~~~~~~~~~~~~~~~~ */ => { } - ~~~~~~~~~~~~ + ~~ !!! error TS1200: Line terminator not permitted before arrow. var f3 = (x: string, y: number, ...rest) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => { } - ~~~~~~~~~~ + ~~ !!! error TS1200: Line terminator not permitted before arrow. var f4 = (x: string, y: number, ...rest) /* - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ => { } - ~~~~~~~~~~~~ + ~~ !!! error TS1200: Line terminator not permitted before arrow. var f5 = (...rest) - ~~~~~~~~~ => { } - ~~~~~~~~~~ + ~~ !!! error TS1200: Line terminator not permitted before arrow. var f6 = (...rest) /* - ~~~~~~~~~~~~ */ => { } - ~~~~~~~~~~~~ + ~~ !!! error TS1200: Line terminator not permitted before arrow. var f7 = (x: string, y: number, z = 10) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => { } - ~~~~~~~~~~ + ~~ !!! error TS1200: Line terminator not permitted before arrow. var f8 = (x: string, y: number, z = 10) /* - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ => { } - ~~~~~~~~~~~~ + ~~ !!! error TS1200: Line terminator not permitted before arrow. function foo(func: () => boolean) { } foo(() - ~~ => true); - ~~~~~~~~~~~ + ~~ !!! error TS1200: Line terminator not permitted before arrow. foo(() - ~~ => { return false; }); - ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS1200: Line terminator not permitted before arrow. module m { class City { constructor(x: number, thing = () - ~~ => 100) { - ~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS1200: Line terminator not permitted before arrow. } public m = () - ~~ => 2 * 2 * 2 - ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS1200: Line terminator not permitted before arrow. } export enum Enum { claw = (() - ~~ => 10)() - ~~~~~~~~~~~~~~~~~ + ~~ !!! error TS1200: Line terminator not permitted before arrow. } export var v = x - ~ => new City(Enum.claw); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS1200: Line terminator not permitted before arrow. } \ No newline at end of file From fdc673f5eba6d0709a340cd67790e0a670175d89 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Tue, 10 Mar 2015 21:07:05 -0400 Subject: [PATCH 092/101] Fix line wrapping --- src/compiler/checker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8322bb7c5d3..d0c9ff87140 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11384,7 +11384,8 @@ module ts { if (node.kind === SyntaxKind.ArrowFunction && (node).arrow) { var arrowFunction = node; var sourceFile = getSourceFileOfNode(node); - if (getLineAndCharacterOfPosition(sourceFile, getTokenPosOfNode(arrowFunction.arrow, sourceFile)).line !== getLineAndCharacterOfPosition(sourceFile, arrowFunction.parameters.end).line) { + if (getLineAndCharacterOfPosition(sourceFile, getTokenPosOfNode(arrowFunction.arrow, sourceFile)).line !== + getLineAndCharacterOfPosition(sourceFile, arrowFunction.parameters.end).line) { return grammarErrorOnNode(arrowFunction.arrow, Diagnostics.Line_terminator_not_permitted_before_arrow); } } From 5e107e6042cc83bf7071051631fe4b6c0bd61ae0 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Tue, 10 Mar 2015 21:22:41 -0400 Subject: [PATCH 093/101] Address slew of review comments --- src/compiler/checker.ts | 9 +++++---- src/compiler/parser.ts | 9 +++------ src/compiler/types.ts | 2 +- tests/baselines/reference/APISample_compile.js | 2 +- tests/baselines/reference/APISample_compile.types | 4 ++-- tests/baselines/reference/APISample_linter.js | 2 +- tests/baselines/reference/APISample_linter.types | 4 ++-- tests/baselines/reference/APISample_transform.js | 2 +- tests/baselines/reference/APISample_transform.types | 4 ++-- tests/baselines/reference/APISample_watcher.js | 2 +- tests/baselines/reference/APISample_watcher.types | 4 ++-- 11 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d0c9ff87140..df1b70ab6ff 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11381,12 +11381,13 @@ module ts { } function checkGrammarArrowFunction(node: FunctionLikeDeclaration): boolean { - if (node.kind === SyntaxKind.ArrowFunction && (node).arrow) { + if (node.kind === SyntaxKind.ArrowFunction) { var arrowFunction = node; var sourceFile = getSourceFileOfNode(node); - if (getLineAndCharacterOfPosition(sourceFile, getTokenPosOfNode(arrowFunction.arrow, sourceFile)).line !== - getLineAndCharacterOfPosition(sourceFile, arrowFunction.parameters.end).line) { - return grammarErrorOnNode(arrowFunction.arrow, Diagnostics.Line_terminator_not_permitted_before_arrow); + var equalsGreaterThanLine = getLineAndCharacterOfPosition(sourceFile, getTokenPosOfNode(arrowFunction.equalsGreaterThanToken, sourceFile)).line; + var parametersLine = getLineAndCharacterOfPosition(sourceFile, arrowFunction.parameters.end).line; + if (equalsGreaterThanLine !== parametersLine) { + return grammarErrorOnNode(arrowFunction.equalsGreaterThanToken, Diagnostics.Line_terminator_not_permitted_before_arrow); } } return false; diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 6b010f584a2..5756f379685 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -95,7 +95,7 @@ module ts { visitNodes(cbNodes, (node).typeParameters) || visitNodes(cbNodes, (node).parameters) || visitNode(cbNode, (node).type) || - visitNode(cbNode, (node).arrow) || + visitNode(cbNode, (node).equalsGreaterThanToken) || visitNode(cbNode, (node).body); case SyntaxKind.TypeReference: return visitNode(cbNode, (node).typeName) || @@ -3017,9 +3017,7 @@ module ts { node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; - if ((node.arrow = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, false, Diagnostics._0_expected, "=>"))) { - node.arrow.parent = node; - } + node.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, false, Diagnostics._0_expected, "=>"); node.body = parseArrowFunctionExpressionBody(); return finishNode(node); @@ -3048,8 +3046,7 @@ module ts { // If we have an arrow, then try to parse the body. Even if not, try to parse if we // have an opening brace, just in case we're in an error state. - if ((arrowFunction.arrow = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, false, Diagnostics._0_expected, "=>")) || token === SyntaxKind.OpenBraceToken) { - arrowFunction.arrow.parent = arrowFunction; + if ((arrowFunction.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, false, Diagnostics._0_expected, "=>")) || token === SyntaxKind.OpenBraceToken) { arrowFunction.body = parseArrowFunctionExpressionBody(); } else { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 49529bed9c6..25a8ce75245 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -654,7 +654,7 @@ module ts { } export interface ArrowFunction extends Expression, FunctionLikeDeclaration { - arrow: Node; + equalsGreaterThanToken: Node; } // The text property of a LiteralExpression stores the interpreted value of the literal in text form. For a StringLiteral, diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 997bd2bd337..6244dc73951 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -554,7 +554,7 @@ declare module "typescript" { body: Block | Expression; } interface ArrowFunction extends Expression, FunctionLikeDeclaration { - arrow: Node; + equalsGreaterThanToken: Node; } interface LiteralExpression extends PrimaryExpression { text: string; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index d91d860ca8f..43e88c27e41 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -1674,8 +1674,8 @@ declare module "typescript" { >Expression : Expression >FunctionLikeDeclaration : FunctionLikeDeclaration - arrow: Node; ->arrow : Node + equalsGreaterThanToken: Node; +>equalsGreaterThanToken : Node >Node : Node } interface LiteralExpression extends PrimaryExpression { diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index b941acdbc52..fd4649f614d 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -585,7 +585,7 @@ declare module "typescript" { body: Block | Expression; } interface ArrowFunction extends Expression, FunctionLikeDeclaration { - arrow: Node; + equalsGreaterThanToken: Node; } interface LiteralExpression extends PrimaryExpression { text: string; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index b8701020e03..984b59ca7ee 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -1820,8 +1820,8 @@ declare module "typescript" { >Expression : Expression >FunctionLikeDeclaration : FunctionLikeDeclaration - arrow: Node; ->arrow : Node + equalsGreaterThanToken: Node; +>equalsGreaterThanToken : Node >Node : Node } interface LiteralExpression extends PrimaryExpression { diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index baf3f9d8503..4222e1b2d98 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -586,7 +586,7 @@ declare module "typescript" { body: Block | Expression; } interface ArrowFunction extends Expression, FunctionLikeDeclaration { - arrow: Node; + equalsGreaterThanToken: Node; } interface LiteralExpression extends PrimaryExpression { text: string; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index d214a6fc959..bea3f1e7231 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -1770,8 +1770,8 @@ declare module "typescript" { >Expression : Expression >FunctionLikeDeclaration : FunctionLikeDeclaration - arrow: Node; ->arrow : Node + equalsGreaterThanToken: Node; +>equalsGreaterThanToken : Node >Node : Node } interface LiteralExpression extends PrimaryExpression { diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index d963aaff481..0928c2cf139 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -623,7 +623,7 @@ declare module "typescript" { body: Block | Expression; } interface ArrowFunction extends Expression, FunctionLikeDeclaration { - arrow: Node; + equalsGreaterThanToken: Node; } interface LiteralExpression extends PrimaryExpression { text: string; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index da00b9bf466..4498a5538e4 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -1943,8 +1943,8 @@ declare module "typescript" { >Expression : Expression >FunctionLikeDeclaration : FunctionLikeDeclaration - arrow: Node; ->arrow : Node + equalsGreaterThanToken: Node; +>equalsGreaterThanToken : Node >Node : Node } interface LiteralExpression extends PrimaryExpression { From bd828e3024ecd34f60df57ee20514d637b198945 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Tue, 10 Mar 2015 22:14:58 -0400 Subject: [PATCH 094/101] Parse arrow function body as identifier if missing => or { Restores functionality broken in previous commit --- src/compiler/parser.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 5756f379685..eb43f774605 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3046,7 +3046,8 @@ module ts { // If we have an arrow, then try to parse the body. Even if not, try to parse if we // have an opening brace, just in case we're in an error state. - if ((arrowFunction.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, false, Diagnostics._0_expected, "=>")) || token === SyntaxKind.OpenBraceToken) { + arrowFunction.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, false, Diagnostics._0_expected, "=>"); + if (arrowFunction.equalsGreaterThanToken.kind === SyntaxKind.EqualsGreaterThanToken || token === SyntaxKind.OpenBraceToken) { arrowFunction.body = parseArrowFunctionExpressionBody(); } else { From 3dc5faf70779d286405faf05b240feac7687f001 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Wed, 11 Mar 2015 16:40:31 -0400 Subject: [PATCH 095/101] Restore earlier behaviour when parsing non-simple arrow function bodies --- src/compiler/parser.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index eb43f774605..f996af5f5e4 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3046,14 +3046,11 @@ module ts { // If we have an arrow, then try to parse the body. Even if not, try to parse if we // have an opening brace, just in case we're in an error state. - arrowFunction.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, false, Diagnostics._0_expected, "=>"); - if (arrowFunction.equalsGreaterThanToken.kind === SyntaxKind.EqualsGreaterThanToken || token === SyntaxKind.OpenBraceToken) { - arrowFunction.body = parseArrowFunctionExpressionBody(); - } - else { - // If not, we're probably better off bailing out and returning a bogus function expression. - arrowFunction.body = parseIdentifier(); - } + var lastToken = token; + arrowFunction.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, /*reportAtCurrentPosition:*/false, Diagnostics._0_expected, "=>"); + arrowFunction.body = (lastToken === SyntaxKind.EqualsGreaterThanToken || lastToken === SyntaxKind.OpenBraceToken) + ? parseArrowFunctionExpressionBody() + : parseIdentifier(); return finishNode(arrowFunction); } From 10925c1e9ba8cd7d5babc76823c458fb0dbfc886 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Fri, 13 Mar 2015 01:30:07 -0400 Subject: [PATCH 096/101] Make sure arrow function grammar rules can deal with type annotations --- src/compiler/checker.ts | 8 +-- ...sallowLineTerminatorBeforeArrow.errors.txt | 58 ++++++++++++++-- .../disallowLineTerminatorBeforeArrow.js | 68 +++++++++++++++++++ .../disallowLineTerminatorBeforeArrow.ts | 32 +++++++++ 4 files changed, 155 insertions(+), 11 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index df1b70ab6ff..be1b6f943ca 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4412,7 +4412,7 @@ module ts { } /** - * Check if a Type was written as a tuple type literal. + * Check if a Type was written as a tuple type literal. * Prefer using isTupleLikeType() unless the use of `elementTypes` is required. */ function isTupleType(type: Type) : boolean { @@ -11384,9 +11384,9 @@ module ts { if (node.kind === SyntaxKind.ArrowFunction) { var arrowFunction = node; var sourceFile = getSourceFileOfNode(node); - var equalsGreaterThanLine = getLineAndCharacterOfPosition(sourceFile, getTokenPosOfNode(arrowFunction.equalsGreaterThanToken, sourceFile)).line; - var parametersLine = getLineAndCharacterOfPosition(sourceFile, arrowFunction.parameters.end).line; - if (equalsGreaterThanLine !== parametersLine) { + var startLine = getLineAndCharacterOfPosition(sourceFile, arrowFunction.equalsGreaterThanToken.pos).line; + var endLine = getLineAndCharacterOfPosition(sourceFile, arrowFunction.equalsGreaterThanToken.end).line; + if (startLine !== endLine) { return grammarErrorOnNode(arrowFunction.equalsGreaterThanToken, Diagnostics.Line_terminator_not_permitted_before_arrow); } } diff --git a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt index e441752338c..fbd9be772fa 100644 --- a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt +++ b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.errors.txt @@ -6,15 +6,19 @@ tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(1 tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(12,7): error TS1200: Line terminator not permitted before arrow. tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(14,5): error TS1200: Line terminator not permitted before arrow. tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(16,7): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(20,5): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(22,5): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(27,13): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(31,13): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(36,13): error TS1200: Line terminator not permitted before arrow. -tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(40,9): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(18,5): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(21,5): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(23,8): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(26,8): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(52,5): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(54,5): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(59,13): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(63,13): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(68,13): error TS1200: Line terminator not permitted before arrow. +tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(72,9): error TS1200: Line terminator not permitted before arrow. -==== tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts (14 errors) ==== +==== tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts (18 errors) ==== var f1 = () => { } ~~ @@ -47,6 +51,46 @@ tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(4 */ => { } ~~ !!! error TS1200: Line terminator not permitted before arrow. + var f9 = (a: number): number + => a; + ~~ +!!! error TS1200: Line terminator not permitted before arrow. + var f10 = (a: number) : + number + => a + ~~ +!!! error TS1200: Line terminator not permitted before arrow. + var f11 = (a: number): number /* + */ => a; + ~~ +!!! error TS1200: Line terminator not permitted before arrow. + var f12 = (a: number) : + number /* + */ => a + ~~ +!!! error TS1200: Line terminator not permitted before arrow. + + // Should be valid. + var f11 = (a: number + ) => a; + + // Should be valid. + var f12 = (a: number) + : number => a; + + // Should be valid. + var f13 = (a: number): + number => a; + + // Should be valid. + var f14 = () /* */ => {} + + // Should be valid. + var f15 = (a: number): number /* */ => a + + // Should be valid. + var f16 = (a: number, b = 10): + number /* */ => a + b; function foo(func: () => boolean) { } foo(() diff --git a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.js b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.js index 122c229d7d9..610cbe62c1b 100644 --- a/tests/baselines/reference/disallowLineTerminatorBeforeArrow.js +++ b/tests/baselines/reference/disallowLineTerminatorBeforeArrow.js @@ -15,6 +15,38 @@ var f7 = (x: string, y: number, z = 10) => { } var f8 = (x: string, y: number, z = 10) /* */ => { } +var f9 = (a: number): number + => a; +var f10 = (a: number) : + number + => a +var f11 = (a: number): number /* + */ => a; +var f12 = (a: number) : + number /* + */ => a + +// Should be valid. +var f11 = (a: number + ) => a; + +// Should be valid. +var f12 = (a: number) + : number => a; + +// Should be valid. +var f13 = (a: number): + number => a; + +// Should be valid. +var f14 = () /* */ => {} + +// Should be valid. +var f15 = (a: number): number /* */ => a + +// Should be valid. +var f16 = (a: number, b = 10): + number /* */ => a + b; function foo(func: () => boolean) { } foo(() @@ -77,6 +109,42 @@ var f7 = function (x, y, z) { var f8 = function (x, y, z) { if (z === void 0) { z = 10; } }; +var f9 = function (a) { + return a; +}; +var f10 = function (a) { + return a; +}; +var f11 = function (a) { + return a; +}; +var f12 = function (a) { + return a; +}; +// Should be valid. +var f11 = function (a) { + return a; +}; +// Should be valid. +var f12 = function (a) { + return a; +}; +// Should be valid. +var f13 = function (a) { + return a; +}; +// Should be valid. +var f14 = function () { +}; +// Should be valid. +var f15 = function (a) { + return a; +}; +// Should be valid. +var f16 = function (a, b) { + if (b === void 0) { b = 10; } + return a + b; +}; function foo(func) { } foo(function () { diff --git a/tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts b/tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts index f11fed6b478..bd984ba4da0 100644 --- a/tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts +++ b/tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts @@ -14,6 +14,38 @@ var f7 = (x: string, y: number, z = 10) => { } var f8 = (x: string, y: number, z = 10) /* */ => { } +var f9 = (a: number): number + => a; +var f10 = (a: number) : + number + => a +var f11 = (a: number): number /* + */ => a; +var f12 = (a: number) : + number /* + */ => a + +// Should be valid. +var f11 = (a: number + ) => a; + +// Should be valid. +var f12 = (a: number) + : number => a; + +// Should be valid. +var f13 = (a: number): + number => a; + +// Should be valid. +var f14 = () /* */ => {} + +// Should be valid. +var f15 = (a: number): number /* */ => a + +// Should be valid. +var f16 = (a: number, b = 10): + number /* */ => a + b; function foo(func: () => boolean) { } foo(() From 02d356800f36ecd548641d993ab4b70359de2e70 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Sat, 14 Mar 2015 20:12:10 -0400 Subject: [PATCH 097/101] Share SourceFile with other grammar checker that needs it --- src/compiler/checker.ts | 26 +++++++++++++------------- src/compiler/parser.ts | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index be1b6f943ca..03a4ee6d04a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -448,7 +448,7 @@ module ts { let declaration = forEach(result.declarations, d => isBlockOrCatchScoped(d) ? d : undefined); Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); - + // first check if usage is lexically located after the declaration let isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { @@ -465,7 +465,7 @@ module ts { if (variableDeclaration.parent.parent.kind === SyntaxKind.VariableStatement || variableDeclaration.parent.parent.kind === SyntaxKind.ForStatement) { - // variable statement/for statement case, + // variable statement/for statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } @@ -9080,7 +9080,7 @@ module ts { */ function checkElementTypeOfArrayOrString(arrayOrStringType: Type, expressionForError: Expression): Type { Debug.assert(languageVersion < ScriptTarget.ES6); - + // After we remove all types that are StringLike, we will know if there was a string constituent // based on whether the remaining type is the same as the initial type. let arrayType = removeTypesFromUnionType(arrayOrStringType, TypeFlags.StringLike, /*isTypeOfKind*/ true, /*allowEmptyUnionResult*/ true); @@ -11324,16 +11324,15 @@ module ts { } } - function checkGrammarTypeParameterList(node: FunctionLikeDeclaration, typeParameters: NodeArray): boolean { + function checkGrammarTypeParameterList(node: FunctionLikeDeclaration, typeParameters: NodeArray, file: SourceFile): boolean { if (checkGrammarForDisallowedTrailingComma(typeParameters)) { return true; } if (typeParameters && typeParameters.length === 0) { let start = typeParameters.pos - "<".length; - let sourceFile = getSourceFileOfNode(node); - let end = skipTrivia(sourceFile.text, typeParameters.end) + ">".length; - return grammarErrorAtPos(sourceFile, start, end - start, Diagnostics.Type_parameter_list_cannot_be_empty); + let end = skipTrivia(file.text, typeParameters.end) + ">".length; + return grammarErrorAtPos(file, start, end - start, Diagnostics.Type_parameter_list_cannot_be_empty); } } @@ -11377,15 +11376,16 @@ module ts { function checkGrammarFunctionLikeDeclaration(node: FunctionLikeDeclaration): boolean { // Prevent cascading error by short-circuit - return checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters) || checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node); + let file = getSourceFileOfNode(node); + return checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters, file) || + checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } - function checkGrammarArrowFunction(node: FunctionLikeDeclaration): boolean { + function checkGrammarArrowFunction(node: FunctionLikeDeclaration, file: SourceFile): boolean { if (node.kind === SyntaxKind.ArrowFunction) { - var arrowFunction = node; - var sourceFile = getSourceFileOfNode(node); - var startLine = getLineAndCharacterOfPosition(sourceFile, arrowFunction.equalsGreaterThanToken.pos).line; - var endLine = getLineAndCharacterOfPosition(sourceFile, arrowFunction.equalsGreaterThanToken.end).line; + let arrowFunction = node; + let startLine = getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; + let endLine = getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; if (startLine !== endLine) { return grammarErrorOnNode(arrowFunction.equalsGreaterThanToken, Diagnostics.Line_terminator_not_permitted_before_arrow); } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index f996af5f5e4..27f550778c1 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3134,11 +3134,11 @@ module ts { } } - function parsePossibleParenthesizedArrowFunctionExpressionHead() { + function parsePossibleParenthesizedArrowFunctionExpressionHead(): ArrowFunction { return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity:*/ false); } - function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity: boolean): FunctionExpression { + function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity: boolean): ArrowFunction { let node = createNode(SyntaxKind.ArrowFunction); // Arrow functions are never generators. // From fac3cf8b5541216ee7fa01451daffc044986b060 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Sat, 14 Mar 2015 18:50:05 -0700 Subject: [PATCH 098/101] addressed PR feedback --- src/compiler/checker.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1ce946493b0..e59996c0781 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8625,18 +8625,19 @@ module ts { localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & SymbolFlags.BlockScopedVariable) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & NodeFlags.BlockScoped) { - let varDeclList = getAncestor(localDeclarationSymbol.valueDeclaration, SyntaxKind.VariableDeclarationList); let container = - varDeclList.parent.kind === SyntaxKind.VariableStatement && - varDeclList.parent.parent; + varDeclList.parent.kind === SyntaxKind.VariableStatement && varDeclList.parent.parent + ? varDeclList.parent.parent + : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) let namesShareScope = container && (container.kind === SyntaxKind.Block && isFunctionLike(container.parent) || - (container.kind === SyntaxKind.ModuleBlock && container.kind === SyntaxKind.ModuleDeclaration) || + container.kind === SyntaxKind.ModuleBlock || + container.kind === SyntaxKind.ModuleDeclaration || container.kind === SyntaxKind.SourceFile); // here we know that function scoped variable is shadowed by block scoped one From ebcb86b0773320ae00d52b7d534b404943377a3a Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 4 Mar 2015 17:34:07 -0800 Subject: [PATCH 099/101] enable navbar for export defaults Conflicts: src/services/navigationBar.ts --- src/services/navigationBar.ts | 13 ++++------ tests/cases/fourslash/navbar_exportDefault.ts | 24 +++++++++++++++++++ 2 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 tests/cases/fourslash/navbar_exportDefault.ts diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 06eaa481dfb..c6463aba733 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -418,10 +418,10 @@ module ts.NavigationBar { } function createFunctionItem(node: FunctionDeclaration) { - if (node.name && node.body && node.body.kind === SyntaxKind.Block) { + if ((node.name || node.flags & NodeFlags.Default) && node.body && node.body.kind === SyntaxKind.Block) { let childItems = getItemsWorker(sortNodes((node.body).statements), createChildItem); - return getNavigationBarItem(node.name.text, + return getNavigationBarItem((!node.name && node.flags & NodeFlags.Default) ? "default": node.name.text , ts.ScriptElementKind.functionElement, getNodeModifiers(node), [getNodeSpan(node)], @@ -452,11 +452,6 @@ module ts.NavigationBar { } function createClassItem(node: ClassDeclaration): ts.NavigationBarItem { - if (!node.name) { - // An export default class may be nameless - return undefined; - } - let childItems: NavigationBarItem[]; if (node.members) { @@ -475,8 +470,10 @@ module ts.NavigationBar { childItems = getItemsWorker(sortNodes(nodes), createChildItem); } + var nodeName = !node.name && (node.flags & NodeFlags.Default) ? "default" : node.name.text; + return getNavigationBarItem( - node.name.text, + nodeName, ts.ScriptElementKind.classElement, getNodeModifiers(node), [getNodeSpan(node)], diff --git a/tests/cases/fourslash/navbar_exportDefault.ts b/tests/cases/fourslash/navbar_exportDefault.ts new file mode 100644 index 00000000000..a8fe854fa28 --- /dev/null +++ b/tests/cases/fourslash/navbar_exportDefault.ts @@ -0,0 +1,24 @@ +/// + +// @Filename: a.ts +//// {| "itemName": "default", "kind": "class", "parentName": "" |}export default class { } + +// @Filename: b.ts +//// {| "itemName": "C", "kind": "class", "parentName": "" |}export default class C { } + +// @Filename: c.ts +//// {| "itemName": "default", "kind": "function", "parentName": "" |}export default function { } + +// @Filename: d.ts +//// {| "itemName": "Func", "kind": "function", "parentName": "" |}export default function Func { } + +test.markers().forEach(marker => { + goTo.file(marker.fileName); + verify.getScriptLexicalStructureListContains( + marker.data.itemName, + marker.data.kind, + marker.fileName, + marker.data.parentName, + marker.data.isAdditionalRange, + marker.position); +}); \ No newline at end of file From f5a4b0b31aa12ff09b8846d6a41cab3538ff12ec Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 16 Mar 2015 12:37:21 -0700 Subject: [PATCH 100/101] use 'allowGeneratedIdentifiers' to explicitly tell when identifier can be renamed --- src/compiler/checker.ts | 23 +----- src/compiler/emitter.ts | 75 ++++++++++++------- .../initializePropertiesWithRenamedLet.js | 46 ++++++++++++ .../initializePropertiesWithRenamedLet.types | 58 ++++++++++++++ .../shadowingViaLocalValueOrBindingElement.js | 8 +- .../initializePropertiesWithRenamedLet.ts | 17 +++++ 6 files changed, 176 insertions(+), 51 deletions(-) create mode 100644 tests/baselines/reference/initializePropertiesWithRenamedLet.js create mode 100644 tests/baselines/reference/initializePropertiesWithRenamedLet.types create mode 100644 tests/cases/compiler/initializePropertiesWithRenamedLet.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1f27d1e217a..4816bac9fcb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11085,26 +11085,11 @@ module ts { function getBlockScopedVariableId(n: Identifier): number { Debug.assert(!nodeIsSynthesized(n)); - // ignore name parts of property access expressions - if (n.parent.kind === SyntaxKind.PropertyAccessExpression && - (n.parent).name === n) { - return undefined; - } + let isVariableDeclarationOrBindingElement = + n.parent.kind === SyntaxKind.BindingElement || (n.parent.kind === SyntaxKind.VariableDeclaration && (n.parent).name === n); - // ignore property names in object binding patterns - if (n.parent.kind === SyntaxKind.BindingElement && - (n.parent).propertyName === n) { - return undefined; - } - - // for names in variable declarations and binding elements try to short circuit and fetch symbol from the node - let declarationSymbol: Symbol = - (n.parent.kind === SyntaxKind.VariableDeclaration && (n.parent).name === n) || - n.parent.kind === SyntaxKind.BindingElement - ? getSymbolOfNode(n.parent) - : undefined; - - let symbol = declarationSymbol || + let symbol = + (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, SymbolFlags.Value | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 54ec39a5b55..86385ab543a 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2074,19 +2074,19 @@ module ts { sourceMapDir = getDirectoryPath(normalizePath(jsFilePath)); } - function emitNodeWithSourceMap(node: Node) { + function emitNodeWithSourceMap(node: Node, allowGeneratedIdentifiers?: boolean) { if (node) { if (nodeIsSynthesized(node)) { - return emitNodeWithoutSourceMap(node); + return emitNodeWithoutSourceMap(node, /*allowGeneratedIdentifiers*/ false); } if (node.kind != SyntaxKind.SourceFile) { recordEmitNodeStartSpan(node); - emitNodeWithoutSourceMap(node); + emitNodeWithoutSourceMap(node, allowGeneratedIdentifiers); recordEmitNodeEndSpan(node); } else { recordNewSourceFileStart(node); - emitNodeWithoutSourceMap(node); + emitNodeWithoutSourceMap(node, /*allowGeneratedIdentifiers*/ false); } } } @@ -2623,17 +2623,24 @@ module ts { } } - function getBlockScopedVariableId(node: Identifier): number { - // return undefined for synthesized nodes - return !nodeIsSynthesized(node) && resolver.getBlockScopedVariableId(node); + function getGeneratedNameForIdentifier(node: Identifier): string { + if (nodeIsSynthesized(node) || !generatedBlockScopeNames) { + return undefined; + } + + var variableId = resolver.getBlockScopedVariableId(node) + if (variableId === undefined) { + return undefined; + } + + return generatedBlockScopeNames[variableId]; } - function emitIdentifier(node: Identifier) { - let variableId = getBlockScopedVariableId(node); - if (variableId !== undefined && generatedBlockScopeNames) { - let text = generatedBlockScopeNames[variableId]; - if (text) { - write(text); + function emitIdentifier(node: Identifier, allowGeneratedIdentifiers: boolean) { + if (allowGeneratedIdentifiers) { + let generatedName = getGeneratedNameForIdentifier(node); + if (generatedName) { + write(generatedName); return; } } @@ -2686,7 +2693,7 @@ module ts { function emitBindingElement(node: BindingElement) { if (node.propertyName) { - emit(node.propertyName); + emit(node.propertyName, /*allowGeneratedIdentifiers*/ false); write(": "); } if (node.dotDotDotToken) { @@ -3030,7 +3037,7 @@ module ts { } function emitMethod(node: MethodDeclaration) { - emit(node.name); + emit(node.name, /*allowGeneratedIdentifiers*/ false); if (languageVersion < ScriptTarget.ES6) { write(": function "); } @@ -3038,13 +3045,13 @@ module ts { } function emitPropertyAssignment(node: PropertyDeclaration) { - emit(node.name); + emit(node.name, /*allowGeneratedIdentifiers*/ false); write(": "); emit(node.initializer); } function emitShorthandPropertyAssignment(node: ShorthandPropertyAssignment) { - emit(node.name); + emit(node.name, /*allowGeneratedIdentifiers*/ false); // If short-hand property has a prefix, then regardless of the target version, we will emit it as normal property assignment. For example: // module m { // export let y; @@ -3053,7 +3060,20 @@ module ts { // export let obj = { y }; // } // The short-hand property in obj need to emit as such ... = { y : m.y } regardless of the TargetScript version - if (languageVersion < ScriptTarget.ES6 || resolver.getExpressionNameSubstitution(node.name)) { + if (languageVersion < ScriptTarget.ES6) { + // Emit identifier as an identifier + write(": "); + var generatedName = getGeneratedNameForIdentifier(node.name); + if (generatedName) { + write(generatedName); + } + else { + // Even though this is stored as identifier treat it as an expression + // Short-hand, { x }, is equivalent of normal form { x: x } + emitExpressionIdentifier(node.name); + } + } + else if (resolver.getExpressionNameSubstitution(node.name)) { // Emit identifier as an identifier write(": "); // Even though this is stored as identifier treat it as an expression @@ -3106,7 +3126,7 @@ module ts { let indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); write("."); let indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name); - emit(node.name); + emit(node.name, /*allowGeneratedIdentifiers*/ false); decreaseIndentIf(indentedBeforeDot, indentedAfterDot); } @@ -3897,8 +3917,7 @@ module ts { renameNonTopLevelLetAndConst(name); if (name.parent && (name.parent.kind === SyntaxKind.VariableDeclaration || name.parent.kind === SyntaxKind.BindingElement)) { emitModuleMemberName(name.parent); - } - else { + } else { emit(name); } write(" = "); @@ -4294,7 +4313,7 @@ module ts { function emitAccessor(node: AccessorDeclaration) { write(node.kind === SyntaxKind.GetAccessor ? "get " : "set "); - emit(node.name); + emit(node.name, /*allowGeneratedIdentifiers*/ false); emitSignatureAndBody(node); } @@ -5340,7 +5359,7 @@ module ts { emitLeadingComments(node.endOfFileToken); } - function emitNodeWithoutSourceMapWithComments(node: Node): void { + function emitNodeWithoutSourceMapWithComments(node: Node, allowGeneratedIdentifiers?: boolean): void { if (!node) { return; } @@ -5354,14 +5373,14 @@ module ts { emitLeadingComments(node); } - emitJavaScriptWorker(node); + emitJavaScriptWorker(node, (allowGeneratedIdentifiers === undefined) || allowGeneratedIdentifiers); if (emitComments) { emitTrailingComments(node); } } - function emitNodeWithoutSourceMapWithoutComments(node: Node): void { + function emitNodeWithoutSourceMapWithoutComments(node: Node, allowGeneratedIdentifiers?: boolean): void { if (!node) { return; } @@ -5370,7 +5389,7 @@ module ts { return emitPinnedOrTripleSlashComments(node); } - emitJavaScriptWorker(node); + emitJavaScriptWorker(node, (allowGeneratedIdentifiers === undefined) || allowGeneratedIdentifiers); } function shouldEmitLeadingAndTrailingComments(node: Node) { @@ -5400,11 +5419,11 @@ module ts { return true; } - function emitJavaScriptWorker(node: Node) { + function emitJavaScriptWorker(node: Node, allowGeneratedIdentifiers: boolean) { // Check if the node can be emitted regardless of the ScriptTarget switch (node.kind) { case SyntaxKind.Identifier: - return emitIdentifier(node); + return emitIdentifier(node, allowGeneratedIdentifiers); case SyntaxKind.Parameter: return emitParameter(node); case SyntaxKind.MethodDeclaration: diff --git a/tests/baselines/reference/initializePropertiesWithRenamedLet.js b/tests/baselines/reference/initializePropertiesWithRenamedLet.js new file mode 100644 index 00000000000..902a23f5886 --- /dev/null +++ b/tests/baselines/reference/initializePropertiesWithRenamedLet.js @@ -0,0 +1,46 @@ +//// [initializePropertiesWithRenamedLet.ts] + +var x0; +if (true) { + let x0; + var obj1 = { x0: x0 }; + var obj2 = { x0 }; +} + +var x, y, z; +if (true) { + let { x: x } = { x: 0 }; + let { y } = { y: 0 }; + let z; + ({ z: z } = { z: 0 }); + ({ z } = { z: 0 }); +} + +//// [initializePropertiesWithRenamedLet.js] +var x0; +if (true) { + var _x0; + var obj1 = { + x0: _x0 + }; + var obj2 = { + x0: _x0 + }; +} +var x, y, z; +if (true) { + var _x = ({ + x: 0 + }).x; + var _y = ({ + y: 0 + }).y; + var _z; + (_a = { + z: 0 + }, _z = _a.z, _a); + (_b = { + z: 0 + }, _z = _b.z, _b); +} +var _a, _b; diff --git a/tests/baselines/reference/initializePropertiesWithRenamedLet.types b/tests/baselines/reference/initializePropertiesWithRenamedLet.types new file mode 100644 index 00000000000..77f16756fdb --- /dev/null +++ b/tests/baselines/reference/initializePropertiesWithRenamedLet.types @@ -0,0 +1,58 @@ +=== tests/cases/compiler/initializePropertiesWithRenamedLet.ts === + +var x0; +>x0 : any + +if (true) { + let x0; +>x0 : any + + var obj1 = { x0: x0 }; +>obj1 : { x0: any; } +>{ x0: x0 } : { x0: any; } +>x0 : any +>x0 : any + + var obj2 = { x0 }; +>obj2 : { x0: any; } +>{ x0 } : { x0: any; } +>x0 : any +} + +var x, y, z; +>x : any +>y : any +>z : any + +if (true) { + let { x: x } = { x: 0 }; +>x : unknown +>x : number +>{ x: 0 } : { x: number; } +>x : number + + let { y } = { y: 0 }; +>y : number +>{ y: 0 } : { y: number; } +>y : number + + let z; +>z : any + + ({ z: z } = { z: 0 }); +>({ z: z } = { z: 0 }) : { z: number; } +>{ z: z } = { z: 0 } : { z: number; } +>{ z: z } : { z: any; } +>z : any +>z : any +>{ z: 0 } : { z: number; } +>z : number + + ({ z } = { z: 0 }); +>({ z } = { z: 0 }) : { z: number; } +>{ z } = { z: 0 } : { z: number; } +>{ z } : { z: any; } +>z : any +>{ z: 0 } : { z: number; } +>z : number +} diff --git a/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.js b/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.js index 76c4a7ac3a6..594ec1ca18e 100644 --- a/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.js +++ b/tests/baselines/reference/shadowingViaLocalValueOrBindingElement.js @@ -16,16 +16,16 @@ if (true) { if (true) { var x = 0; // Error var _a = ({ - _x: 0 + x: 0 }).x, x = _a === void 0 ? 0 : _a; // Error var _b = ({ - _x: 0 + x: 0 }).x, x = _b === void 0 ? 0 : _b; // Error var x = ({ - _x: 0 + x: 0 }).x; // Error var x = ({ - _x: 0 + x: 0 }).x; // Error } } diff --git a/tests/cases/compiler/initializePropertiesWithRenamedLet.ts b/tests/cases/compiler/initializePropertiesWithRenamedLet.ts new file mode 100644 index 00000000000..b30ce609775 --- /dev/null +++ b/tests/cases/compiler/initializePropertiesWithRenamedLet.ts @@ -0,0 +1,17 @@ +// @target: es5 + +var x0; +if (true) { + let x0; + var obj1 = { x0: x0 }; + var obj2 = { x0 }; +} + +var x, y, z; +if (true) { + let { x: x } = { x: 0 }; + let { y } = { y: 0 }; + let z; + ({ z: z } = { z: 0 }); + ({ z } = { z: 0 }); +} \ No newline at end of file From 7f8ef3881ba3c0322c47d1ba20f98dd4428b86dd Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 16 Mar 2015 13:36:34 -0700 Subject: [PATCH 101/101] addressed PR feedback --- src/compiler/emitter.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 86385ab543a..5bf678f5436 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3917,7 +3917,8 @@ module ts { renameNonTopLevelLetAndConst(name); if (name.parent && (name.parent.kind === SyntaxKind.VariableDeclaration || name.parent.kind === SyntaxKind.BindingElement)) { emitModuleMemberName(name.parent); - } else { + } + else { emit(name); } write(" = "); @@ -5373,7 +5374,7 @@ module ts { emitLeadingComments(node); } - emitJavaScriptWorker(node, (allowGeneratedIdentifiers === undefined) || allowGeneratedIdentifiers); + emitJavaScriptWorker(node, allowGeneratedIdentifiers); if (emitComments) { emitTrailingComments(node); @@ -5389,7 +5390,7 @@ module ts { return emitPinnedOrTripleSlashComments(node); } - emitJavaScriptWorker(node, (allowGeneratedIdentifiers === undefined) || allowGeneratedIdentifiers); + emitJavaScriptWorker(node, allowGeneratedIdentifiers); } function shouldEmitLeadingAndTrailingComments(node: Node) { @@ -5419,7 +5420,7 @@ module ts { return true; } - function emitJavaScriptWorker(node: Node, allowGeneratedIdentifiers: boolean) { + function emitJavaScriptWorker(node: Node, allowGeneratedIdentifiers: boolean = true) { // Check if the node can be emitted regardless of the ScriptTarget switch (node.kind) { case SyntaxKind.Identifier: